Skip to content

Commit

Permalink
MDL-11233 Corrected typo in grader report lib, and added a second sor…
Browse files Browse the repository at this point in the history
…t parameter for lastname and firstname sorts, to add consistency to result sets. Non-students no longer appear in the list
  • Loading branch information
nicolasconnault committed Sep 13, 2007
1 parent d9935f2 commit c421ad4
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 142 deletions.
13 changes: 11 additions & 2 deletions grade/report/grader/lib.php
Expand Up @@ -254,8 +254,17 @@ function load_users() {
} else {
// default sort
// get users sorted by lastname
$this->users = get_role_users(@implode(',', $CFG->gradebookroles), $this->context, false,
'u.id, u.firstname, u.lastname', 'u.'.$this->sortitemid .' '. $this->sortorder,

// If lastname or firstname is given as sortitemid, add the other name (firstname or lastname respectively) as second sort param
$sort2 = '';
if ($this->sortitemid == 'lastname') {
$sort2 = ', u.firstname ' . $this->sortorder;
} 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
Expand Down

0 comments on commit c421ad4

Please sign in to comment.