From 3f9dd2f2105dc09a756efc1de6f04103eb4472bf Mon Sep 17 00:00:00 2001 From: Kevin Percy Date: Fri, 25 Aug 2023 14:03:06 +0800 Subject: [PATCH] MDL-78106 gradereport_grader: Force direction when clicking sort arrow --- grade/report/lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/grade/report/lib.php b/grade/report/lib.php index 59c462b6000..063cda31fa2 100644 --- a/grade/report/lib.php +++ b/grade/report/lib.php @@ -598,6 +598,11 @@ abstract class grade_report { $matrix = ['up' => 'desc', 'down' => 'asc']; $strsort = get_string($matrix[$direction], 'moodle'); $arrow = $OUTPUT->pix_icon($pix[$direction], '', '', ['class' => 'sorticon']); + + if (!empty($sortlink)) { + $sortlink->param('sort', ($direction == 'up' ? 'asc' : 'desc')); + } + return html_writer::link($sortlink, $arrow, ['title' => $strsort, 'aria-label' => $strsort, 'data-collapse' => 'sort', 'class' => 'arrow_link py-1']); }