From 2224f2c5989104defbc6e8ccb1109b14e5fe98d4 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Mon, 20 Apr 2015 12:24:04 +0100 Subject: [PATCH] MDL-49933 mod_assign: Sort marker select lists alphabetically by name --- mod/assign/gradingtable.php | 3 ++- mod/assign/locallib.php | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mod/assign/gradingtable.php b/mod/assign/gradingtable.php index 0b9904086bfcd..f1d65dc7b4b69 100644 --- a/mod/assign/gradingtable.php +++ b/mod/assign/gradingtable.php @@ -541,7 +541,8 @@ public function col_allocatedmarker(stdClass $row) { static $markers = null; static $markerlist = array(); if ($markers === null) { - $markers = get_users_by_capability($this->assignment->get_context(), 'mod/assign:grade'); + list($sort, $params) = users_order_by_sql(); + $markers = get_users_by_capability($this->assignment->get_context(), 'mod/assign:grade', '', $sort); $markerlist[0] = get_string('choosemarker', 'assign'); foreach ($markers as $marker) { $markerlist[$marker->id] = fullname($marker); diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 48ca39252e151..4b670280705c5 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -3251,7 +3251,8 @@ protected function view_grading_table() { // Get markers to use in drop lists. $markingallocationoptions = array(); if ($markingallocation) { - $markers = get_users_by_capability($this->context, 'mod/assign:grade'); + list($sort, $params) = users_order_by_sql(); + $markers = get_users_by_capability($this->context, 'mod/assign:grade', '', $sort); $markingallocationoptions[''] = get_string('filternone', 'assign'); $markingallocationoptions[ASSIGN_MARKER_FILTER_NO_MARKER] = get_string('markerfilternomarker', 'assign'); foreach ($markers as $marker) { @@ -3792,7 +3793,8 @@ public function view_batch_markingallocation($mform) { 'usershtml' => $usershtml, ); - $markers = get_users_by_capability($this->get_context(), 'mod/assign:grade'); + list($sort, $params) = users_order_by_sql(); + $markers = get_users_by_capability($this->get_context(), 'mod/assign:grade', '', $sort); $markerlist = array(); foreach ($markers as $marker) { $markerlist[$marker->id] = fullname($marker); @@ -5555,7 +5557,8 @@ protected function process_save_grading_options() { if ($markingallocation) { $markingallocationoptions[''] = get_string('filternone', 'assign'); $markingallocationoptions[ASSIGN_MARKER_FILTER_NO_MARKER] = get_string('markerfilternomarker', 'assign'); - $markers = get_users_by_capability($this->context, 'mod/assign:grade'); + list($sort, $params) = users_order_by_sql(); + $markers = get_users_by_capability($this->context, 'mod/assign:grade', '', $sort); foreach ($markers as $marker) { $markingallocationoptions[$marker->id] = fullname($marker); } @@ -6132,7 +6135,8 @@ public function add_grade_form_elements(MoodleQuickForm $mform, stdClass $data, $this->get_instance()->markingallocation && has_capability('mod/assign:manageallocations', $this->context)) { - $markers = get_users_by_capability($this->context, 'mod/assign:grade'); + list($sort, $params) = users_order_by_sql(); + $markers = get_users_by_capability($this->context, 'mod/assign:grade', '', $sort); $markerlist = array('' => get_string('choosemarker', 'assign')); foreach ($markers as $marker) { $markerlist[$marker->id] = fullname($marker); @@ -6536,7 +6540,8 @@ protected function process_set_batch_marking_allocation() { 'usershtml' => '' // initialise these parameters with real information. ); - $markers = get_users_by_capability($this->get_context(), 'mod/assign:grade'); + list($sort, $params) = users_order_by_sql(); + $markers = get_users_by_capability($this->get_context(), 'mod/assign:grade', '', $sort); $markerlist = array(); foreach ($markers as $marker) { $markerlist[$marker->id] = fullname($marker);