Merge branch 'MDL-76467-master' of https://github.com/davewoloszyn/moodle

This commit is contained in:
Víctor Déniz 2022-11-24 15:08:13 +00:00
commit 4e95640030
4 changed files with 20 additions and 8 deletions

View File

@ -121,13 +121,18 @@ class gradereport_singleview_renderer extends plugin_renderer_base {
$i = array_search($itemid, $reloptionssorting);
$navparams = ['item' => $itemtype, 'id' => $courseid, 'group' => $groupid];
// Determine directionality so that icons can be modified to suit language.
$previousarrow = right_to_left() ? 'right' : 'left';
$nextarrow = right_to_left() ? 'left' : 'right';
if ($i > 0) {
$navparams['itemid'] = $reloptionssorting[$i - 1];
$link = (new moodle_url('/grade/report/singleview/index.php', $navparams))
->out(false);
$navigationdata['previoususer'] = [
'name' => $reloptions[$navparams['itemid']],
'url' => $link
'url' => $link,
'previousarrow' => $previousarrow
];
}
if ($i < count($reloptionssorting) - 1) {
@ -136,7 +141,8 @@ class gradereport_singleview_renderer extends plugin_renderer_base {
->out(false);
$navigationdata['nextuser'] = [
'name' => $reloptions[$navparams['itemid']],
'url' => $link
'url' => $link,
'nextarrow' => $nextarrow
];
}

View File

@ -45,7 +45,7 @@
{{#previoususer}}
<div class="previous d-flex">
<a href="{{url}}" aria-label="{{#str}} gotopreviousreport, gradereport_singleview {{/str}}">
<i class="fa fa-caret-left fa-lg pr-1"></i>
<i class="fa fa-caret-{{previousarrow}} fa-lg pr-1"></i>
{{name}}
</a>
</div>
@ -56,7 +56,7 @@
<div class="next d-flex ml-auto">
<a href="{{url}}" aria-label="{{#str}} gotonextreport, gradereport_singleview {{/str}}">
{{name}}
<i class="fa fa-caret-right fa-lg pl-1"></i>
<i class="fa fa-caret-{{nextarrow}} fa-lg pl-1"></i>
</a>
</div>
{{/nextuser}}

View File

@ -150,13 +150,18 @@ class gradereport_user_renderer extends plugin_renderer_base {
$arraykeys = array_keys($users);
$keynumber = array_search($userid, $arraykeys);
// Determine directionality so that icons can be modified to suit language.
$previousarrow = right_to_left() ? 'right' : 'left';
$nextarrow = right_to_left() ? 'left' : 'right';
// If the current user is not the first one in the list, find and render the previous user.
if ($keynumber !== 0) {
$previoususer = $users[$arraykeys[$keynumber - 1]];
$navigationdata['previoususer'] = [
'name' => fullname($previoususer),
'url' => (new moodle_url('/grade/report/user/index.php', ['id' => $courseid, 'userid' => $previoususer->id]))
->out(false)
->out(false),
'previousarrow' => $previousarrow
];
}
// If the current user is not the last one in the list, find and render the last user.
@ -165,7 +170,8 @@ class gradereport_user_renderer extends plugin_renderer_base {
$navigationdata['nextuser'] = [
'name' => fullname($nextuser),
'url' => (new moodle_url('/grade/report/user/index.php', ['id' => $courseid, 'userid' => $nextuser->id]))
->out(false)
->out(false),
'nextarrow' => $nextarrow
];
}

View File

@ -44,7 +44,7 @@
{{#previoususer}}
<div class="previous d-flex">
<a href="{{url}}" aria-label="{{#str}} gotopreviousreport, gradereport_user {{/str}}">
<i class="fa fa-caret-left fa-lg pr-1"></i>
<i class="fa fa-caret-{{previousarrow}} fa-lg pr-1"></i>
{{name}}
</a>
</div>
@ -53,7 +53,7 @@
<div class="next d-flex ml-auto">
<a href="{{url}}" aria-label="{{#str}} gotonextreport, gradereport_user {{/str}}">
{{name}}
<i class="fa fa-caret-right fa-lg pl-1"></i>
<i class="fa fa-caret-{{nextarrow}} fa-lg pl-1"></i>
</a>
</div>
{{/nextuser}}