@ -119,14 +119,14 @@ $htmlHeadXtra[] = '<style type="text/css" media="screen, projection">
.blackboard_hide {
display: none;
}
';
< / style > ';
// xajax
$xajax = new xajax();
$xajax->registerFunction('courses_of_user');
//$xajax->registerFunction('empty_courses_of_user');
$xajax->processRequests();
/**
* Get a formatted list of courses for given user
* @param int User ID
@ -317,14 +317,12 @@ function login_user($user_id) {
* Get the total number of users on the platform
* @see SortableTable#get_total_number_of_items()
*/
function get_number_of_users()
{
function get_number_of_users() {
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT COUNT(u.user_id) AS total_number_of_items FROM $user_table u";
// adding the filter to see the user's only of the current access_url
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) & & $_configuration['multiple_access_urls'] & & api_get_current_access_url_id()!=-1) {
if ((api_is_platform_admin() || api_is_session_admin()) & & api_get_multiple_access_url()) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}
@ -384,7 +382,7 @@ function get_number_of_users()
}
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) & & $_configuration['multiple_access_urls'] & & api_get_current_access_url_id()!=-1 ) {
if ((api_is_platform_admin() || api_is_session_admin()) & & api_get_multiple_access_url() ) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}
@ -402,7 +400,7 @@ function get_number_of_users()
*/
function get_user_data($from, $number_of_items, $column, $direction)
{
global $_configuration,$ origin;
global $origin;
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$admin_table = Database :: get_main_table(TABLE_MAIN_ADMIN);
@ -423,7 +421,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
" FROM $user_table u ";
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) & & $_configuration['multiple_access_urls'] & & api_get_current_access_url_id()!=-1 ) {
if ((api_is_platform_admin() || api_is_session_admin()) & & api_get_multiple_access_url() ) {
$access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.user_id=url_rel_user.user_id)";
}
@ -484,7 +482,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
}
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) & & $_configuration['multiple_access_urls'] & & api_get_current_access_url_id()!=-1 ) {
if ((api_is_platform_admin() || api_is_session_admin()) & & api_get_multiple_access_url() ) {
$sql.= " AND url_rel_user.access_url_id=".api_get_current_access_url_id();
}
@ -560,6 +558,7 @@ function modify_filter($user_id,$url_params,$row) {
if ($row['7'] == $statusname[ANONYMOUS]) {
$user_is_anonymous =true;
}
$result = '';
if (!$user_is_anonymous) {
$result .= '< a href = "javascript:void(0)" onclick = "load_course_list(\'div_'.$user_id.'\','.$user_id.')" >
< img onclick = "load_course_list(\'div_'.$user_id.'\','.$user_id.')" onmouseout = "clear_course_list (\'div_'.$user_id.'\')" src = "../img/course.gif" title = "'.get_lang('Courses').'" alt = "'.get_lang('Courses').'" / >
@ -662,14 +661,14 @@ function active_filter($active, $url_params, $row) {
$image='wrong';
}
$result = '';
if ($action=='edit') {
$result = Display::return_icon($image.'.gif', get_lang('AccountExpired'));
} elseif ($row['0']< >$_user['user_id']) {
// you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
//$result = '< a href = "user_list.php?action='.$action.'&user_id='.$row['0'].'&'.$url_params.'&sec_token='.$_SESSION['sec_token'].'" > '.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).'< / a > ';
//$result = '< a href = "'.api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?action=active_user&user_id='.$row['0'].'&'.$url_params.'&sec_token='.$_SESSION['sec_token'].'" > ';
$result . =Display::return_icon($image.'.gif', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0'])).'< / a > ';
$result = Display::return_icon($image.'.gif', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0'])).'< / a > ';
//$result .= '< div > ';
}
return $result;
@ -734,10 +733,6 @@ if ($_GET['action'] == "login_as" && isset ($login_as_user_id)) {
login_user($login_as_user_id);
}
//if (isset ($_GET['search']) & & $_GET['search'] == 'advanced')
//{}
//else
//{
if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('UserList'));
@ -793,13 +788,11 @@ if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
Security::clear_token();
}
}
if (isset ($_POST['action']))
{
if (isset ($_POST['action'])) {
$check = Security::check_token('get');
if($check)
{
switch ($_POST['action'])
{
if ($check) {
switch ($_POST['action']) {
case 'delete' :
if (api_is_platform_admin()) {
$number_of_selected_users = count($_POST['id']);
@ -830,6 +823,7 @@ if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
Security::clear_token();
}
}
// Create a search-box
$form = new FormValidator('search_simple','get','','',null,false);
$renderer =& $form->defaultRenderer();
@ -871,15 +865,6 @@ if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
$_admins_list[] = $row_admin[0];
}
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
$user_profile = UserManager::get_picture_user($user_id, $image_path['file'], 22, USER_IMAGE_SIZE_SMALL, ' width="22" height="22" ');
if (!api_is_anonymous()) {
$photo = '< center > < a href = "userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&uInfo='.$user_id.'" title = "'.get_lang('Info').'" > < img src = "'.$user_profile['file'].'" ' . $ user_profile [ ' style ' ] . ' alt = "'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title = "'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" / > < / a > < / center > ';
} else {
$photo = '< center > < img src = "'.$user_profile['file'].'" ' . $ user_profile [ ' style ' ] . ' alt = "'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" title = "'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" / > < / center > ';
}
// display advaced search form
$form = new FormValidator('advanced_search','get');
@ -926,7 +911,11 @@ if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
$form->addGroup($active_group,'',get_lang('ActiveAccount'),'< br / > ',false);
$form->addElement('html', '< / td > < td > ');
$extra_data = UserManager::get_extra_user_data($user_id, false, true, false, 1);
/*
* @todo fix this code
$extra_data = UserManager::get_extra_fields( 0,10,5, 'ASC', true, 1);
var_dump($extra_data);
$extra_options = array();
if (!empty($extra_data)) {
$extra_options[0] = get_lang('All');
@ -942,7 +931,7 @@ if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
$form->addElement('html', '< / div > ');
} else {
$form->addElement('html', '< div id = "extra_data_text" style = "display:none;" > ');
}
}*/
$form->addElement('html', '< / td > < / tr > ');
@ -957,7 +946,6 @@ if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
$form->setDefaults($defaults);
$form->addElement('html','< / div > ');
$form->display();
$table = new SortableTable('users', 'get_number_of_users', 'get_user_data', (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2);
@ -985,8 +973,9 @@ if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
$table->set_column_filter(7, 'status_filter');
$table->set_column_filter(8, 'active_filter');
$table->set_column_filter(9, 'modify_filter');
if (api_is_platform_admin())
$table->set_form_actions(array ('delete' => get_lang('DeleteFromPlatform')));
$table->display();
//}
Display :: display_footer();