Skip to content
Permalink
Browse files
Merge branch 'MDL-63571-35' of git://github.com/peterRd/moodle into M…
…OODLE_35_STABLE
  • Loading branch information
David Monllao committed Nov 20, 2018
2 parents 56d8e41 + 810bb4b commit dfecd50ac376319845c1381c7be3fbb29038a21b
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 dfecd50

Please sign in to comment.