Permalink
Browse files

Merge branch 'MDL-63571-master' of git://github.com/peterRd/moodle

  • Loading branch information...
dmonllao committed Nov 20, 2018
2 parents 0225ad4 + 727d3d7 commit a78a8766292f6a7fed568ea6f079f20e8e4d8be9
Showing with 23 additions and 20 deletions.
  1. +23 −20 grade/report/grader/lib.php
@@ -1901,37 +1901,40 @@ public static function do_process_action($target, $action, $courseid = null) {
* @return array An associative array of HTML sorting links+arrows
*/
public function get_sort_arrows(array $extrafields = array()) {
global $OUTPUT;
global $OUTPUT, $CFG;
$arrows = array();
$strsortasc = $this->get_lang_string('sortasc', 'grades');
$strsortdesc = $this->get_lang_string('sortdesc', 'grades');
$strfirstname = $this->get_lang_string('firstname');
$strlastname = $this->get_lang_string('lastname');
$iconasc = $OUTPUT->pix_icon('t/sort_asc', $strsortasc, '', array('class' => 'iconsmall sorticon'));
$icondesc = $OUTPUT->pix_icon('t/sort_desc', $strsortdesc, '', array('class' => 'iconsmall sorticon'));
$firstlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'firstname')), $strfirstname);
$lastlink = html_writer::link(new moodle_url($this->baseurl, array('sortitemid'=>'lastname')), $strlastname);
$arrows['studentname'] = $lastlink;
if ($this->sortitemid === 'lastname') {
if ($this->sortorder == 'ASC') {
$arrows['studentname'] .= $iconasc;
} else {
$arrows['studentname'] .= $icondesc;
}
// Sourced from tablelib.php
// Check the full name display for sortable fields.
if (has_capability('moodle/site:viewfullnames', context_system::instance())) {
$nameformat = $CFG->alternativefullnameformat;
} else {
$nameformat = $CFG->fullnamedisplay;
}
$arrows['studentname'] .= ' ' . $firstlink;
if ($nameformat == 'language') {
$nameformat = get_string('fullnamedisplay');
}
if ($this->sortitemid === 'firstname') {
if ($this->sortorder == 'ASC') {
$arrows['studentname'] .= $iconasc;
} else {
$arrows['studentname'] .= $icondesc;
$arrows['studentname'] = '';
$requirednames = order_in_string(get_all_user_name_fields(), $nameformat);
if (!empty($requirednames)) {
foreach ($requirednames as $name) {
$arrows['studentname'] .= html_writer::link(
new moodle_url($this->baseurl, array('sortitemid' => $name)), $this->get_lang_string($name)
);
if ($this->sortitemid == $name) {
$arrows['studentname'] .= $this->sortorder == 'ASC' ? $iconasc : $icondesc;
}
$arrows['studentname'] .= ' / ';
}
$arrows['studentname'] = substr($arrows['studentname'], 0, -3);
}
foreach ($extrafields as $field) {

0 comments on commit a78a876

Please sign in to comment.