diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php
index c5494c345b..c5f0ea85d3 100644
--- a/main/inc/lib/display.lib.php
+++ b/main/inc/lib/display.lib.php
@@ -1384,7 +1384,7 @@ class Display {
return '';
}
- function label($content, $type = 'default') {
+ function label($content, $type = null) {
$class = '';
switch ($type) {
case 'success':
diff --git a/main/user/user.php b/main/user/user.php
index 0d54c17852..3615d0a18c 100644
--- a/main/user/user.php
+++ b/main/user/user.php
@@ -29,11 +29,9 @@ require_once '../inc/global.inc.php';
$current_course_tool = TOOL_USER;
$this_section = SECTION_COURSES;
-
// notice for unauthorized people.
api_protect_course_script(true);
-
/* Libraries */
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
@@ -303,82 +301,6 @@ function display_user_search_form() {
echo '';
echo '';
}
-/**
-* This function displays a list if users for each virtual course linked to the current
-* real course.
-*
-* defines globals
-*
-* @version 1.0
-* @author Roan Embrechts
-* @todo users from virtual courses always show "-" for the group related output. Edit and statistics columns are disabled * for these users, for now.
-*/
-/*
-function show_users_in_virtual_courses() {
- global $_course, $_user, $origin;
- $real_course_code = $_course['sysCode'];
- $real_course_info = Database::get_course_info($real_course_code);
- $user_subscribed_virtual_course_list = CourseManager::get_list_of_virtual_courses_for_specific_user_and_real_course($_user['user_id'], $real_course_code);
-
- $number_of_virtual_courses = count($user_subscribed_virtual_course_list);
- $row = 0;
- $column_header[$row++] = "ID";
- $column_header[$row++] = get_lang("FullUserName");
- $column_header[$row++] = get_lang("Role");
- $column_header[$row++] = get_lang("Group");
- if (api_is_allowed_to_edit()) {
- $column_header[$row++] = get_lang("Tutor");
- }
- if (api_is_allowed_to_edit()) {
- $column_header[$row++] = get_lang("CourseManager");
- }
-
- if (!is_array($user_subscribed_virtual_course_list)) {
- return;
- }
-
- foreach ($user_subscribed_virtual_course_list as $virtual_course) {
- $virtual_course_code = $virtual_course["code"];
- $virtual_course_user_list = CourseManager::get_user_list_from_course_code($virtual_course_code);
- $message = get_lang("RegisteredInVirtualCourse")." ".$virtual_course["title"]." (".$virtual_course["code"].")";
- echo "
";
- echo "
';
- // the action links
- if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or api_is_platform_admin()) {
- $actions .= '
'.Display::return_icon('user_subscribe_course.png',get_lang("SubscribeUserToCourse"),'',ICON_SIZE_MEDIUM).' ';
- $actions .= "
".Display::return_icon('teacher_subscribe_course.png', get_lang("SubscribeUserToCourseAsTeacher"),'',ICON_SIZE_MEDIUM)." ";
- }
- $actions .= '
'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).' ';
- $actions .= '
'.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).' ';
-
- if (!api_get_session_id()) {
- $actions .= '
'.Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'),'',ICON_SIZE_MEDIUM).' ';
- }
-
- $actions .= '
'.Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).' ';
-
- $actions .= "
".Display::return_icon('group.png', get_lang("GroupUserManagement"),'',ICON_SIZE_MEDIUM)."";
+ // the action links
+ if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or api_is_platform_admin()) {
+ $actions .= '
'.Display::return_icon('user_subscribe_course.png',get_lang("SubscribeUserToCourse"),'',ICON_SIZE_MEDIUM).' ';
+ $actions .= "
".Display::return_icon('teacher_subscribe_course.png', get_lang("SubscribeUserToCourseAsTeacher"),'',ICON_SIZE_MEDIUM)." ";
+ }
+ $actions .= '
'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).' ';
+ $actions .= '
'.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).' ';
+
+ if (!api_get_session_id()) {
+ $actions .= '
'.Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'),'',ICON_SIZE_MEDIUM).' ';
+ }
+
+ $actions .= '
'.Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).' ';
+
+ $actions .= "
".Display::return_icon('group.png', get_lang("GroupUserManagement"),'',ICON_SIZE_MEDIUM)."";
if (api_get_setting('use_session_mode') == 'false') {
$actions .= '
'.get_lang('Classes').'';
@@ -455,28 +376,7 @@ if (1) // platform setting api_get_setting('subscribe_user_by_coach') {
}
}*/
-
-/*
- 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)
-*/
-/*
- * @todo seems not to affect anything in the code
-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
-*/
+/* DISPLAY LIST OF USERS */
/**
* * Get the users to display on the current page.
*/
@@ -564,7 +464,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
}
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'])) {
+ 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);
$temp = array();
@@ -590,21 +490,23 @@ function get_user_data($from, $number_of_items, $column, $direction) {
$temp[] = $o_course_user['firstname'];
}
- $temp[] = $o_course_user['username'];
- $temp[] = isset($o_course_user['role']) ? $o_course_user['role'] : null;
- $temp[] = implode(', ', $groups_name); //Group
-
+ $temp[] = $o_course_user['username'];
+ $temp[] = isset($o_course_user['role']) ? $o_course_user['role'] : null; //Description
+ $temp[] = implode(', ', $groups_name); //Group
- // deprecated feature
+ // Status
+ $default_status = '-';
if ((isset($o_course_user['status_rel']) && $o_course_user['status_rel'] == 1) || (isset($o_course_user['status_session']) && $o_course_user['status_session'] == 2)) {
- $temp[] = get_lang('CourseManager');
+ $default_status = get_lang('CourseManager');
} elseif (isset($o_course_user['tutor_id']) && $o_course_user['tutor_id'] == 1) {
- $temp[] = get_lang('Tutor');
- } else {
- $temp[] = '-';
+ $default_status = get_lang('Tutor');
}
-
+ $temp[] = $default_status;
+
+ //Active
$temp[] = $o_course_user['active'];
+
+ //User id
$temp[] = $user_id;
} else {
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
@@ -635,8 +537,6 @@ function get_user_data($from, $number_of_items, $column, $direction) {
}
}
return $a_users;
-
-
}
@@ -683,21 +583,22 @@ function modify_filter($user_id) {
if (api_is_allowed_to_edit(null, true)) {
// edit
- $result .= '
'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).' ';
- if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or api_is_platform_admin()) {
- // unregister
- if ($user_id != $_user['user_id']) {
- $result .= '
'.Display::return_icon('unsubscribe_course.png', get_lang('Unreg'),'',ICON_SIZE_SMALL).' ';
- } else {
- $result .= Display::return_icon('unsubscribe_course_na.png', get_lang('Unreg'),'',ICON_SIZE_SMALL).' ';
- }
+ $result .= '
'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).' ';
+ if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or api_is_platform_admin()) {
+ // unregister
+ if ($user_id != $_user['user_id']) {
+ $result .= '
'.Display::return_icon('unsubscribe_course.png', get_lang('Unreg'),'',ICON_SIZE_SMALL).' ';
+ } else {
+ $result .= Display::return_icon('unsubscribe_course_na.png', get_lang('Unreg'),'',ICON_SIZE_SMALL).' ';
}
- }
- //if platform admin, show the login_as icon (this drastically shortens
- // time taken by support to test things out)
- if (api_is_platform_admin()) {
- $result .= '
'.Display::return_icon('login_as.gif', get_lang('LoginAs')).' ';
}
+ }
+
+ //if platform admin, show the login_as icon (this drastically shortens
+ // time taken by support to test things out)
+ if (api_is_platform_admin()) {
+ $result .= '
'.Display::return_icon('login_as.gif', get_lang('LoginAs')).' ';
+ }
$result .= "
";
return $result;
}