]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17837 - mimic from 19_STABLE - apply some limits to the dropdown of users in...
authorstronk7 <stronk7>
Wed, 14 Jan 2009 18:23:30 +0000 (18:23 +0000)
committerstronk7 <stronk7>
Wed, 14 Jan 2009 18:23:30 +0000 (18:23 +0000)
course/report/log/lib.php

index d595f750d99a996265f454e1589049eac702c6b7..2fc2acd9c5dc654ae4847e248da84f79ab40b453 100644 (file)
@@ -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) {