From: stronk7 Date: Wed, 14 Jan 2009 18:23:30 +0000 (+0000) Subject: MDL-17837 - mimic from 19_STABLE - apply some limits to the dropdown of users in... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ae1467bbff52845bd6e4ba2272b61d946658d414;p=moodle.git MDL-17837 - mimic from 19_STABLE - apply some limits to the dropdown of users in first instance. --- diff --git a/course/report/log/lib.php b/course/report/log/lib.php index d595f750d9..2fc2acd9c5 100644 --- a/course/report/log/lib.php +++ b/course/report/log/lib.php @@ -47,12 +47,17 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select // Get all the possible users $users = array(); + // Define limitfrom and limitnum for queries below + // If $showusers is enabled... don't apply limitfrom and limitnum + $limitfrom = empty($showusers) ? 0 : ''; + $limitnum = empty($showusers) ? COURSE_MAX_USERS_PER_DROPDOWN + 1 : ''; + // If looking at a different host, we're interested in all our site users if ($hostid == $CFG->mnet_localhost_id && $course->id != SITEID) { - $courseusers = get_users_by_capability($context, 'moodle/course:view', 'u.id, u.firstname, u.lastname, u.idnumber', 'lastname ASC, firstname ASC', '','', $selectedgroup,'', false); + $courseusers = get_users_by_capability($context, 'moodle/course:view', 'u.id, u.firstname, u.lastname, u.idnumber', 'lastname ASC, firstname ASC', $limitfrom, $limitnum, $selectedgroup,'', false); } else { // this may be a lot of users :-( - $courseusers = $DB->get_records('user', array('deleted'=>0), 'lastaccess DESC', 'id, firstname, lastname, idnumber'); + $courseusers = $DB->get_records('user', array('deleted'=>0), 'lastaccess DESC', 'id, firstname, lastname, idnumber', $limitfrom, $limitnum); } if (count($courseusers) < COURSE_MAX_USERS_PER_DROPDOWN && !$showusers) {