Skip to content

Commit

Permalink
Fixing up a bug in the log selector to do with optionally showing all…
Browse files Browse the repository at this point in the history
… users in the dropdown when over COURSE_MAX_USERS_PER_DROPDOWN
  • Loading branch information
mjollnir_ committed Sep 4, 2005
1 parent 9e525f5 commit c11d468
Showing 1 changed file with 12 additions and 27 deletions.
39 changes: 12 additions & 27 deletions course/lib.php
Expand Up @@ -243,25 +243,6 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
$showcourses = 1;
}


if ($course->category) {
if ($selectedgroup) { // If using a group, only get users in that group.
$courseusers = get_group_users($selectedgroup, 'u.lastname ASC', '', 'u.id');
} else {
$courseusers = get_course_users($course->id, '', '', 'u.id');
}
} else {
$courseusers = get_site_users('u.lastaccess DESC', 'u.id');
}

$numusers = count((array)$courseusers);


if ($numusers < COURSE_MAX_USERS_PER_DROPDOWN && !$showusers) {
$showusers = 1;
}


/// Setup for group handling.
$isteacher = isteacher($course->id);
$isteacheredit = isteacheredit($course->id);
Expand All @@ -281,17 +262,21 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
// Get all the possible users
$users = array();

if ($showusers) {
if ($course->category) {
if ($selectedgroup) { // If using a group, only get users in that group.
$courseusers = get_group_users($selectedgroup, 'u.lastname ASC', '', 'u.id, u.firstname, u.lastname');
} else {
$courseusers = get_course_users($course->id, '', '', 'u.id, u.firstname, u.lastname');
}
if ($course->category) {
if ($selectedgroup) { // If using a group, only get users in that group.
$courseusers = get_group_users($selectedgroup, 'u.lastname ASC', '', 'u.id, u.firstname, u.lastname, u.nickname, u.idnumber');
} else {
$courseusers = get_site_users("u.lastaccess DESC", "u.id, u.firstname, u.lastname");
$courseusers = get_course_users($course->id, '', '', 'u.id, u.firstname, u.lastname, u.nickname, u.idnumber');
}
} else {
$courseusers = get_site_users("u.lastaccess DESC", "u.id, u.firstname, u.lastname, u.nickname, u.idnumber");
}

if (count($courseusers) < COURSE_MAX_USERS_PER_DROPDOWN && !$showusers) {
$showusers = 1;
}

if ($showusers) {
if ($courseusers) {
foreach ($courseusers as $courseuser) {
$users[$courseuser->id] = fullname($courseuser, $isteacher);
Expand Down

0 comments on commit c11d468

Please sign in to comment.