From: toyomoyo Date: Thu, 22 Nov 2007 05:17:26 +0000 (+0000) Subject: MDL-12309, gradebook can not sort by names while in group mode X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d2b8b98732e608bd5bf1324ba0ec7e6f399ec020;p=moodle.git MDL-12309, gradebook can not sort by names while in group mode --- diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 924ed9ec67..ccb1b3f797 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -291,12 +291,9 @@ class grade_report_grader extends grade_report { } elseif ($this->sortitemid == 'firstname') { $sort2 = ', u.lastname ' . $this->sortorder; } - $this->users = get_role_users($this->gradebookroles, $this->context, false, - 'u.id, u.firstname, u.lastname', 'u.'.$this->sortitemid .' '. $this->sortorder . $sort2, - false, $this->page * $this->get_pref('studentsperpage'), $this->get_pref('studentsperpage'), - $this->currentgroup); - // need to cut users down by groups + 'u.id, u.firstname, u.lastname', 'u.'.$this->sortitemid .' '. $this->sortorder . $sort2, + false, $this->currentgroup, $this->page * $this->get_pref('studentsperpage'), $this->get_pref('studentsperpage')); } diff --git a/lib/accesslib.php b/lib/accesslib.php index 05b59ac377..14bc6b4ff4 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -4348,7 +4348,7 @@ function get_users_by_capability($context, $capability, $fields='', $sort='', * @param bool gethidden - whether to fetch hidden enrolments too * @return array() */ -function get_role_users($roleid, $context, $parent=false, $fields='', $sort='u.lastname ASC', $gethidden=true, $group='') { +function get_role_users($roleid, $context, $parent=false, $fields='', $sort='u.lastname ASC', $gethidden=true, $group='', $limitfrom='', $limitnum='') { global $CFG; if (empty($fields)) { @@ -4400,7 +4400,8 @@ function get_role_users($roleid, $context, $parent=false, $fields='', $sort='u.l $hiddensql ORDER BY $sort "; // join now so that we can just use fullname() later - return get_records_sql($SQL); + + return get_records_sql($SQL, $limitfrom, $limitnum); } /**