MDL-80043 gradereport_singleview: Improve heading wordings

* Make the headings for the single view easier to read and understand
* When on editing mode, update the heading for the grade and user
screens to convey to the user that the page is currently on editing
mode. This is helpful for screen reader users as they can immediately
know the current display mode of the single view report page when this
gets read via the page title.
This commit is contained in:
Jun Pataleta
2023-12-01 09:07:30 +08:00
parent 7c0eece4c6
commit 3f75abcb8d
3 changed files with 10 additions and 4 deletions
@@ -320,7 +320,9 @@ class grade extends tablelike implements selectable_items, filterable_items {
* @return string
*/
public function heading(): string {
return get_string('gradeitem', 'gradereport_singleview', $this->item->get_name());
global $PAGE;
$headinglangstring = $PAGE->user_is_editing() ? 'gradeitemedit' : 'gradeitem';
return get_string($headinglangstring, 'gradereport_singleview', $this->item->get_name());
}
/**
@@ -313,7 +313,9 @@ class user extends tablelike implements selectable_items {
* @return string
*/
public function heading(): string {
return get_string('gradeuser', 'gradereport_singleview', fullname($this->item));
global $PAGE;
$headinglangstring = $PAGE->user_is_editing() ? 'gradeuseredit' : 'gradeuser';
return get_string($headinglangstring, 'gradereport_singleview', fullname($this->item));
}
/**
@@ -44,8 +44,10 @@ $string['excludenonegrades'] = 'Exclude none';
$string['eventgradereportviewed'] = 'Grade single view report viewed.';
$string['feedbackfor'] = 'Feedback for {$a}';
$string['gradefor'] = 'Grade for {$a}';
$string['gradeitem'] = 'Grade item: {$a}';
$string['gradeuser'] = 'Grade user: {$a}';
$string['gradeitem'] = 'Viewing grades for {$a}';
$string['gradeitemedit'] = 'Editing grades for {$a}';
$string['gradeuser'] = 'Viewing {$a}\'s grades';
$string['gradeuseredit'] = 'Editing {$a}\'s grades';
$string['gotonextreport'] = 'Go to next user report';
$string['gotopreviousreport'] = 'Go to previous user report';
$string['noscreens'] = 'Could not find a suitable single view screen.';