0) { $extra_params['cidReq'] = $_GET['cidReq']; $course_url = '&cidReq='.$_GET['cidReq']; } foreach($user_list as $user) { $uid=$user[0]; $user_info = api_get_user_info($uid); $table_row = array(); $url = '?id='.$uid.$course_url; if(strlen($user_info['picture_uri']) > 0) { $table_row[] = '1'.htmlentities($user_info['firstName'],ENT_QUOTES,$charset).''; } else { $table_row[] = '0'; } $table_row[] = ''.$user_info['firstName'].''; $table_row[] = ''.$user_info['lastName'].''; if (api_get_setting("show_email_addresses") == "true") { $table_row[] = Display::encrypted_mailto_link($user_info['mail']); } if ( api_is_plugin_installed($_plugins, 'messages') && isset($_SESSION['_user']) ) { $table_row[] = ''.get_lang('; } $table_data[] = $table_row; } $table_header[] = array(get_lang('UserPicture'),true,'width="50"'); $table_header[] = array(get_lang('FirstName'),true); $table_header[] = array(get_lang('LastName'),true); if (api_get_setting("show_email_addresses") == "true") { $table_header[] = array(get_lang('Email'),true); } if ( api_is_plugin_installed($_plugins, 'messages') && isset($_SESSION['_user'])) { $table_header[] = array(get_lang('SendMessage'),true); } $sorting_options['column'] = (isset ($_GET['column']) ? $_GET['column'] : 2); Display::display_sortable_table($table_header,$table_data,$sorting_options,array('per_page_default'=>count($table_data)),$extra_params); } } /** * Displays the information of an individual user * @param int $user_id */ function display_individual_user($user_id) { global $interbreadcrumb; // to prevent a hacking attempt: http://www.dokeos.com/forum/viewtopic.php?t=5363 $user_table=Database::get_main_table(TABLE_MAIN_USER); $sql = "SELECT * FROM $user_table WHERE user_id='".mysql_real_escape_string($user_id)."'"; $result=api_sql_query($sql,__FILE__,__LINE__); if (mysql_num_rows($result)==1) { $user_object = mysql_fetch_object($result); $name = GetFullUserName($user_id).($_SESSION['_uid'] == $user_id ? ' ('.get_lang('Me').')' : '' ); $alt = GetFullUserName($user_id).($_SESSION['_uid'] == $user_id ? ' ('.get_lang('Me').')' : ''); $status = ($user_object->status == COURSEMANAGER ? get_lang('Teacher') : get_lang('Student')); $interbreadcrumb[]=array("url" => "whoisonline.php","name" => get_lang('UsersOnLineList')); Display::display_header($alt); api_display_tool_title($alt); echo '
'; if (strlen(trim($user_object->picture_uri)) > 0) { $fullurl=api_get_path(WEB_CODE_PATH).'upload/users/'.$user_object->picture_uri; $system_image_path=api_get_path(SYS_CODE_PATH).'upload/users/'.$user_object->picture_uri; list($width, $height, $type, $attr) = getimagesize($system_image_path); $resizing = (($height > 200) ? 'height="200"' : ''); $height += 30; $width += 30; $window_name = 'window'.uniqid(''); $onclick = $window_name."=window.open('".$fullurl."','".$window_name."','alwaysRaised=yes, alwaysLowered=no,alwaysOnTop=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=".$width.",height=".$height.",left=200,top=20'); return false;"; echo ''.$alt.'
'; } if (api_get_setting("show_email_addresses") == "true") { echo Display::encrypted_mailto_link($user_object->email,$user_object->email).'
'; } echo $status.'
'; echo '
'; if ($user_object->competences) { echo '
'.get_lang('Competences').'
'; echo '
'.$user_object->competences.'
'; } if ($user_object->diplomas) { echo '
'.get_lang('Diplomas').'
'; echo '
'.$user_object->diplomas.'
'; } if ($user_object->teach) { echo '
'.get_lang('Teach').'
'; echo '
'.$user_object->teach.'
';; } display_productions($user_object->user_id); if ($user_object->openarea) { echo '
'.get_lang('Openarea').'
'; echo '
'.$user_object->openarea.'
'; } } } /** * Display productions in whoisonline * @param int $user_id User id * @todo use the correct api_get_path instead of $clarolineRepositoryWeb */ function display_productions($user_id) { global $clarolineRepositoryWeb, $disabled_output; $sysdir=api_get_path(SYS_CODE_PATH).'upload/users/'.$user_id; $webdir=$clarolineRepositoryWeb.'upload/users/'.$user_id; if( !is_dir($sysdir)) { mkpath($sysdir); } $handle = opendir($sysdir); $productions = array(); while ($file = readdir($handle)) { if ($file == '.' || $file == '..' || $file == '.htaccess') { continue; // Skip current and parent directories } $productions[] = $file; } if(count($productions) > 0) { echo '
'.get_lang('Productions').'
'; echo '
'; } } // This if statement prevents users accessing the who's online feature when it has been disabled. if ((get_setting('showonline','world') == 'true' AND !$_user['user_id']) OR (get_setting('showonline','users') == 'true' AND $_user['user_id'])) { if(isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) { $user_list = Who_is_online_in_this_course($_user['user_id'],api_get_setting('time_limit_whosonline'),$_GET['cidReq']); } else { $user_list = WhoIsOnline($_user['user_id'],$_configuration['statistics_database'],api_get_setting('time_limit_whosonline')); } $total=count($user_list); if (!isset($_GET['id'])) { Display::display_header(get_lang('UsersOnLineList')); api_display_tool_title(get_lang('UsersOnLineList')); echo ''.get_lang('TotalOnLine').' : '.$total.''; if ($_GET['id']=='') { echo '

'.get_lang('Refresh').'

'; } else { if(0) // if ($_user['user_id'] && $_GET["id"] != $_user['user_id']) { echo ''.get_lang('SendChatRequest').''; } } } if ($user_list!=false) { if (!isset($_GET['id'])) { display_user_list($user_list, $_plugins); } else //individual user information { display_individual_user($_GET['id']); } } } else { Display::display_header(get_lang('UsersOnLineList')); Display::display_error_message(get_lang('AccessNotAllowed')); } $referer = empty($_GET['referer'])?'index.php':htmlentities(strip_tags($_GET['referer']),ENT_QUOTES,$charset); echo '< '.get_lang('Back').''; /* ============================================================================== FOOTER ============================================================================== */ Display::display_footer(); ?>