|
|
@ -1,6 +1,6 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* This script allows platform admins to add users to urls. |
|
|
|
* This script allows platform admins to add users to urls. |
|
|
|
* It displays a list of users and a list of courses; |
|
|
|
* It displays a list of users and a list of courses; |
|
|
|
* you can select multiple users and courses and then click on |
|
|
|
* you can select multiple users and courses and then click on |
|
|
@ -17,14 +17,10 @@ $this_section=SECTION_PLATFORM_ADMIN; |
|
|
|
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php'; |
|
|
|
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php'; |
|
|
|
api_protect_global_admin_script(); |
|
|
|
api_protect_global_admin_script(); |
|
|
|
if (!api_get_multiple_access_url()) { |
|
|
|
if (!api_get_multiple_access_url()) { |
|
|
|
header('Location: index.php'); |
|
|
|
header('Location: index.php'); |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
Global constants and variables |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form_sent = 0; |
|
|
|
$form_sent = 0; |
|
|
|
$first_letter_user = ''; |
|
|
|
$first_letter_user = ''; |
|
|
|
$first_letter_course = ''; |
|
|
|
$first_letter_course = ''; |
|
|
@ -41,12 +37,12 @@ $tool_name = get_lang('AddUsersToURL'); |
|
|
|
$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
|
|
$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
|
|
$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
|
|
|
$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
|
|
|
|
|
|
|
|
|
|
|
/* MAIN CODE */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Display :: display_header($tool_name); |
|
|
|
Display :: display_header($tool_name); |
|
|
|
|
|
|
|
|
|
|
|
echo '<div class="actions">'; |
|
|
|
echo '<div class="actions">'; |
|
|
|
echo Display::url(Display::return_icon('edit.gif',get_lang('EditUsersToURL'),''), api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php">'); |
|
|
|
echo Display::url( |
|
|
|
|
|
|
|
Display::return_icon('edit.png', get_lang('EditUsersToURL'),''), |
|
|
|
|
|
|
|
api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php'); |
|
|
|
echo '</div>'; |
|
|
|
echo '</div>'; |
|
|
|
|
|
|
|
|
|
|
|
api_display_tool_title($tool_name); |
|
|
|
api_display_tool_title($tool_name); |
|
|
@ -61,33 +57,26 @@ if ($_POST['form_sent']) { |
|
|
|
$users[$key] = intval($value); |
|
|
|
$users[$key] = intval($value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($form_sent == 1) |
|
|
|
if ($form_sent == 1) { |
|
|
|
{ |
|
|
|
|
|
|
|
if ( count($users) == 0 || count($url_list) == 0) { |
|
|
|
if ( count($users) == 0 || count($url_list) == 0) { |
|
|
|
Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL')); |
|
|
|
Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL')); |
|
|
|
//header('Location: access_urls.php?action=show_message&message='.get_lang('AtLeastOneUserAndOneURL')); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
UrlManager::add_users_to_urls($users,$url_list); |
|
|
|
UrlManager::add_users_to_urls($users,$url_list); |
|
|
|
Display :: display_confirmation_message(get_lang('UsersBelongURL')); |
|
|
|
Display :: display_confirmation_message(get_lang('UsersBelongURL')); |
|
|
|
//header('Location: access_urls.php?action=show_message&message='.get_lang('UsersBelongURL')); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Display GUI */ |
|
|
|
/* Display GUI */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($first_letter_user)) { |
|
|
|
if (empty($first_letter_user)) { |
|
|
|
$sql = "SELECT count(*) as nb_users FROM $tbl_user"; |
|
|
|
$sql = "SELECT count(*) as nb_users FROM $tbl_user"; |
|
|
|
$result = Database::query($sql); |
|
|
|
$result = Database::query($sql); |
|
|
|
$num_row = Database::fetch_array($result); |
|
|
|
$num_row = Database::fetch_array($result); |
|
|
|
if($num_row['nb_users']>1000) { |
|
|
|
if ($num_row['nb_users']>1000) { |
|
|
|
//if there are too much users to gracefully handle with the HTML select list, |
|
|
|
//if there are too much users to gracefully handle with the HTML select list, |
|
|
|
// assign a default filter on users names |
|
|
|
// assign a default filter on users names |
|
|
|
$first_letter_user = 'A'; |
|
|
|
$first_letter_user = 'A'; |
|
|
|
} |
|
|
|
} |
|
|
|
unset($result); |
|
|
|
unset($result); |
|
|
|
} |
|
|
|
} |
|
|
|
$first_letter_user = Database::escape_string($first_letter_user); |
|
|
|
$first_letter_user = Database::escape_string($first_letter_user); |
|
|
@ -114,7 +103,7 @@ unset($result); |
|
|
|
<td width="40%" align="center"> |
|
|
|
<td width="40%" align="center"> |
|
|
|
<b><?php echo get_lang('UserList'); ?></b>
|
|
|
|
<b><?php echo get_lang('UserList'); ?></b>
|
|
|
|
<br/><br/> |
|
|
|
<br/><br/> |
|
|
|
<?php echo get_lang('Select').' ' ; echo $target_name == 'firstname'? get_lang('FirstName') : get_lang('LastName'); ?>
|
|
|
|
<?php echo get_lang('Select').' ' ; echo $target_name == 'firstname'? get_lang('FirstName') : get_lang('LastName'); ?> |
|
|
|
<select name="first_letter_user" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();"> |
|
|
|
<select name="first_letter_user" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();"> |
|
|
|
<option value="">--</option> |
|
|
|
<option value="">--</option> |
|
|
|
<?php |
|
|
|
<?php |
|
|
@ -161,5 +150,5 @@ unset($result); |
|
|
|
</table> |
|
|
|
</table> |
|
|
|
</form> |
|
|
|
</form> |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
/* FOOTER */ |
|
|
|
|
|
|
|
Display :: display_footer(); |
|
|
|
Display :: display_footer(); |
|
|
|