Merge branch 'MDL-68312-master-2' of git://github.com/rezaies/moodle

This commit is contained in:
Andrew Nicols 2020-06-03 08:00:57 +08:00
commit 9777b0fa19
4 changed files with 51 additions and 24 deletions

View File

@ -725,13 +725,15 @@ class grade_report_grader extends grade_report {
$usercell->scope = 'row';
if ($showuserimage) {
$usercell->text = $OUTPUT->user_picture($user, array('visibletoscreenreaders' => false));
$usercell->text = $OUTPUT->user_picture($user, ['link' => false, 'visibletoscreenreaders' => false]);
}
$fullname = fullname($user, $viewfullnames);
$usercell->text .= html_writer::link(new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), $fullname, array(
'class' => 'username',
));
$usercell->text = html_writer::link(
new moodle_url('/user/view.php', ['id' => $user->id, 'course' => $this->course->id]),
$usercell->text . $fullname,
['class' => 'username']
);
if (!empty($user->suspendedenrolment)) {
$usercell->attributes['class'] .= ' usersuspended';
@ -753,13 +755,18 @@ class grade_report_grader extends grade_report {
$a = new stdClass();
$a->user = $fullname;
$strgradesforuser = get_string('gradesforuser', 'grades', $a);
$url = new moodle_url('/grade/report/'.$CFG->grade_profilereport.'/index.php', array('userid' => $user->id, 'id' => $this->course->id));
$userreportcell->text .= $OUTPUT->action_icon($url, new pix_icon('t/grades', $strgradesforuser));
$url = new moodle_url('/grade/report/'.$CFG->grade_profilereport.'/index.php',
['userid' => $user->id, 'id' => $this->course->id]);
$userreportcell->text .= $OUTPUT->action_icon($url, new pix_icon('t/grades', ''), null,
['title' => $strgradesforuser, 'aria-label' => $strgradesforuser]);
}
if ($canseesingleview) {
$url = new moodle_url('/grade/report/singleview/index.php', array('id' => $this->course->id, 'itemid' => $user->id, 'item' => 'user'));
$singleview = $OUTPUT->action_icon($url, new pix_icon('t/editstring', get_string('singleview', 'grades', $fullname)));
$strsingleview = get_string('singleview', 'grades', $fullname);
$url = new moodle_url('/grade/report/singleview/index.php',
['id' => $this->course->id, 'itemid' => $user->id, 'item' => 'user']);
$singleview = $OUTPUT->action_icon($url, new pix_icon('t/editstring', ''), null,
['title' => $strsingleview, 'aria-label' => $strsingleview]);
$userreportcell->text .= $singleview;
}
@ -913,13 +920,16 @@ class grade_report_grader extends grade_report {
if (has_all_capabilities(array('gradereport/singleview:view', 'moodle/grade:viewall',
'moodle/grade:edit'), $this->context)) {
$strsingleview = get_string('singleview', 'grades', $element['object']->get_name());
$url = new moodle_url('/grade/report/singleview/index.php', array(
'id' => $this->course->id,
'item' => 'grade',
'itemid' => $element['object']->id));
$singleview = $OUTPUT->action_icon(
$url,
new pix_icon('t/editstring', get_string('singleview', 'grades', $element['object']->get_name()))
$url,
new pix_icon('t/editstring', ''),
null,
['title' => $strsingleview, 'aria-label' => $strsingleview]
);
}
}
@ -1269,7 +1279,8 @@ class grade_report_grader extends grade_report {
$fulltable = new html_table();
$fulltable->attributes['class'] = 'gradereport-grader-table';
$fulltable->id = 'user-grades';
$fulltable->summary = get_string('summarygrader', 'gradereport_grader');
$fulltable->caption = get_string('summarygrader', 'gradereport_grader');
$fulltable->captionhide = true;
// Extract rows from each side (left and right) and collate them into one row each
foreach ($leftrows as $key => $row) {
@ -1637,24 +1648,32 @@ class grade_report_grader extends grade_report {
if (in_array($element['object']->id, $this->collapsed['aggregatesonly'])) {
$url->param('action', 'switch_plus');
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_plus', $strswitchplus), null, null);
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_plus', ''), null,
['title' => $strswitchplus, 'aria-label' => $strswitchplus]);
$showing = get_string('showingaggregatesonly', 'grades');
} else if (in_array($element['object']->id, $this->collapsed['gradesonly'])) {
$url->param('action', 'switch_whole');
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_whole', $strswitchwhole), null, null);
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_whole', ''), null,
['title' => $strswitchwhole, 'aria-label' => $strswitchwhole]);
$showing = get_string('showinggradesonly', 'grades');
} else {
$url->param('action', 'switch_minus');
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_minus', $strswitchminus), null, null);
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_minus', ''), null,
['title' => $strswitchminus, 'aria-label' => $strswitchminus]);
$showing = get_string('showingfullmode', 'grades');
}
}
$name = $element['object']->get_name();
$courseheaderid = 'courseheader_' . clean_param($name, PARAM_ALPHANUMEXT);
$courseheader = html_writer::tag('span', $name, array('id' => $courseheaderid,
'title' => $name, 'class' => 'gradeitemheader'));
$courseheader .= html_writer::label($showing, $courseheaderid, false, array('class' => 'accesshide'));
$describedbyid = uniqid();
$courseheader = html_writer::tag('span', $name, [
'title' => $name,
'class' => 'gradeitemheader',
'aria-describedby' => $describedbyid
]);
$courseheader .= html_writer::div($showing, 'sr-only', [
'id' => $describedbyid
]);
$courseheader .= $icon;
return $courseheader;

View File

@ -417,8 +417,8 @@ abstract class grade_report {
$matrix = array('up' => 'desc', 'down' => 'asc', 'move' => 'desc');
$strsort = $this->get_lang_string('sort' . $matrix[$direction]);
$arrow = $OUTPUT->pix_icon($pix[$direction], $strsort, '', array('class' => 'sorticon'));
return html_writer::link($sortlink, $arrow, array('title'=>$strsort));
$arrow = $OUTPUT->pix_icon($pix[$direction], '', '', ['class' => 'sorticon']);
return html_writer::link($sortlink, $arrow, ['title' => $strsort, 'aria-label' => $strsort]);
}
/**

View File

@ -2765,6 +2765,12 @@ class html_table {
/**
* @var string Description of the contents for screen readers.
*
* The "summary" attribute on the "table" element is not supported in HTML5.
* Consider describing the structure of the table in a "caption" element or in a "figure" element containing the table;
* or, simplify the structure of the table so that no description is needed.
*
* @deprecated since Moodle 3.9.
*/
public $summary;

View File

@ -57,13 +57,15 @@
href="#"
title="{{#str}} markallread {{/str}}"
data-action="mark-all-read"
role="button">
<span class="normal-icon">{{#pix}} t/markasread, core, {{#str}} markallread {{/str}} {{/pix}}</span>
role="button"
aria-label="{{#str}} markallread {{/str}}">
<span class="normal-icon">{{#pix}} t/markasread, core {{/pix}}</span>
{{> core/loading }}
</a>
<a href="{{{urls.preferences}}}"
title="{{#str}} notificationpreferences, message {{/str}}">
{{#pix}} i/settings, core, {{#str}} notificationpreferences, message {{/str}} {{/pix}}
title="{{#str}} notificationpreferences, message {{/str}}"
aria-label="{{#str}} notificationpreferences, message {{/str}}">
{{#pix}} i/settings, core {{/pix}}
</a>
{{/headeractions}}