";
}
}*/
/*
--------------------------------------
DISPLAY USERS LIST
--------------------------------------
Also shows a "next page" button if there are
more than 50 users.
There's a bug in here somewhere - some users count as more than one if they are in more than one group
--> code for > 50 users should take this into account
(Roan, Feb 2004)
*/
if ( CourseManager::has_virtual_courses_from_code($course_id, $user_id)) {
$real_course_code = $_course['sysCode'];
$real_course_info = Database::get_course_info($real_course_code);
$message = get_lang("RegisteredInRealCourse")." ".$real_course_info["title"]." (".$real_course_info["official_code"].")";
echo "
".$message."
";
}
/*
==============================================================================
DISPLAY LIST OF USERS
==============================================================================
*/
/**
* * Get the users to display on the current page.
*/
function get_number_of_users() {
$counter=0;
if (!empty($_SESSION["id_session"])) {
$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], true, $_SESSION['id_session']);
} else {
$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], true);
}
foreach ($a_course_users as $user_id=>$o_course_user) {
if ( (isset ($_GET['keyword']) && search_keyword($o_course_user['firstname'],$o_course_user['lastname'],$o_course_user['username'],$o_course_user['official_code'],$_GET['keyword'])) || !isset($_GET['keyword']) || empty($_GET['keyword'])) {
$counter++;
}
}
return $counter;
}
function search_keyword($firstname,$lastname,$username,$official_code,$keyword) {
if (strripos($firstname,$keyword)!==false || strripos($lastname,$keyword)!==false || strripos($username,$keyword)!==false || strripos($official_code,$keyword)!==false) {
return true;
} else {
return false;
}
}
/**
* Get the users to display on the current page.
*/
function get_user_data($from, $number_of_items, $column, $direction) {
global $origin;
$a_users=array();
// limit
if (!isset($_GET['keyword']) || empty($_GET['keyword']))
$limit = 'LIMIT '.intval($from).','.intval($number_of_items);
// order by
switch ($column) {
case 1 : $order_by = 'ORDER BY user.firstname';break;
case 2 : $order_by = 'ORDER BY user.lastname';break;
case 5 : $order_by = 'ORDER BY user.official_code';break;
default: $order_by = 'ORDER BY user.lastname';break;
}
if(!in_array($direction, array('ASC','DESC'))){
$direction = 'ASC';
}
$order_by .= ' '.$direction;
if (!empty($_SESSION["id_session"])) {
$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], true, $_SESSION['id_session'], $limit, $order_by);
} else {
$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], false, 0, $limit, $order_by);
}
foreach ($a_course_users as $user_id=>$o_course_user) {
if ( (isset ($_GET['keyword']) && search_keyword($o_course_user['firstname'],$o_course_user['lastname'],$o_course_user['username'],$o_course_user['official_code'],$_GET['keyword'])) || !isset($_GET['keyword']) || empty($_GET['keyword'])) {
$groups_name=GroupManager :: get_user_group_name($user_id);
if (api_is_allowed_to_edit()) {
$temp=array();
$temp[] = $user_id;
$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, 'small_', ' width="22" height="22" ');
if (!api_is_anonymous()) {
$photo= '
';
}
$temp[] = $photo;
$temp[] = $o_course_user['firstname'];
$temp[] = $o_course_user['lastname'];
$temp[] = $o_course_user['role'];
$temp[] = implode(', ',$groups_name);//Group
$temp[] = $o_course_user['official_code'];
$temp[] = $user_id;
}
$a_users[$user_id] = $temp;
}
}
return $a_users;
}
/**
* Build the active-column of the table to lock or unlock a certain user
* lock = the user can no longer use this account
* @author Patrick Cool , Ghent University
* @param int $active the current state of the account
* @param int $user_id The user id
* @param string $url_params
* @return string Some HTML-code with the lock/unlock button
*/
function active_filter($active, $url_params, $row) {
global $_user;
if ($active=='1') {
$action='AccountActive';
$image='right';
}
if ($active=='0') {
$action='AccountInactive';
$image='wrong';
}
if ($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 = '
';
}
return $result;
}
/**
* Build the modify-column of the table
* @param int $user_id The user id
* @return string Some HTML-code
*/
function modify_filter($user_id) {
global $origin,$_user, $_course, $is_allowed_to_track,$charset;
$result="
\n";
}
//User list of the virtual courses linked to this course.
//show_users_in_virtual_courses($is_allowed_to_track);
/*
==============================================================================
FOOTER
==============================================================================
*/
if ( $origin != 'learnpath') {
Display::display_footer();
}