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-11-23 22:44:14 +08:00
parent 816fadfcd7
commit fe3ff7dd69
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
3 changed files with 10 additions and 4 deletions

View File

@ -301,7 +301,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());
}
/**

View File

@ -302,7 +302,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));
}
/**

View File

@ -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.';