MDL-22309 report_singleview: Fixing wrong uses of get_role_users()

This commit is contained in:
David Monllao
2014-11-24 10:59:02 +08:00
parent de64c655e2
commit 3aeec06364
2 changed files with 16 additions and 8 deletions
@@ -123,9 +123,13 @@ class grade extends tablelike implements selectable_items, filterable_items {
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);
@@ -48,11 +48,15 @@ class select extends screen {
$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));
}