Skip to content

Commit

Permalink
MDL-22309 report_singleview: Fixing wrong uses of get_role_users()
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Nov 24, 2014
1 parent a8e60d9 commit 34f1842
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
10 changes: 7 additions & 3 deletions grade/report/singleview/classes/local/screen/grade.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,13 @@ public function original_definition() {
public function init($selfitemisempty = false) {
$roleids = explode(',', get_config('moodle', 'gradebookroles'));

$this->items = get_role_users(
$roleids, $this->context, false, '',
'u.lastname, u.firstname', null, $this->groupid);
$this->items = array();
foreach ($roleids as $roleid) {
// Keeping the first user appearance.
$this->items = $this->items + get_role_users(
$roleid, $this->context, false, '',
'u.lastname, u.firstname', null, $this->groupid);
}

$this->totalitemcount = count_role_users($roleids, $this->context);

Expand Down
14 changes: 9 additions & 5 deletions grade/report/singleview/classes/local/screen/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ public function init($selfitemisempty = false) {

$roleids = explode(',', get_config('moodle', 'gradebookroles'));

$this->items = get_role_users(
$roleids, $this->context, false, '',
'u.id, u.lastname, u.firstname', null, $this->groupid,
$this->perpage * $this->page, $this->perpage
);
$this->items = array();
foreach ($roleids as $roleid) {
// Keeping the first user appearance.
$this->items = $this->items + get_role_users(
$roleid, $this->context, false, '',
'u.id, u.lastname, u.firstname', null, $this->groupid,
$this->perpage * $this->page, $this->perpage
);
}
$this->item = $DB->get_record('course', array('id' => $this->courseid));
}

Expand Down

0 comments on commit 34f1842

Please sign in to comment.