diff --git a/grade/lib.php b/grade/lib.php index b692b76c861..8e0cf929990 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -930,14 +930,24 @@ function print_grade_page_head(int $courseid, string $active_type, ?string $acti } $coursecontext = context_course::instance($courseid); // Title will be constituted by information starting from the unique identifying information for the page. - if (in_array($active_type, ['report', 'settings'])) { + if ($heading) { + // If heading is supplied, use this for the page title. + $uniquetitle = $heading; + } else if (in_array($active_type, ['report', 'settings'])) { + // For grade reports or settings pages of grade plugins, use the plugin name for the unique title. $uniquetitle = $stractive_plugin; + // But if editing mode is turned on, check if the report plugin has an editing mode title string and use it if present. + if ($PAGE->user_is_editing() && $active_type === 'report') { + $strcomponent = "gradereport_{$active_plugin}"; + if (get_string_manager()->string_exists('editingmode_title', $strcomponent)) { + $uniquetitle = get_string('editingmode_title', $strcomponent); + } + } } else { $uniquetitle = $stractive_type . ': ' . $stractive_plugin; } $titlecomponents = [ $uniquetitle, - get_string('grades'), $coursecontext->get_context_name(false), ]; $PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titlecomponents)); diff --git a/grade/report/grader/lang/en/gradereport_grader.php b/grade/report/grader/lang/en/gradereport_grader.php index da0f659288e..aae697d69e8 100644 --- a/grade/report/grader/lang/en/gradereport_grader.php +++ b/grade/report/grader/lang/en/gradereport_grader.php @@ -28,6 +28,7 @@ $string['ajaxerror'] = 'Error'; $string['ajaxfailedupdate'] = 'Unable to update [1] for [2]'; $string['ajaxfieldchanged'] = 'The field you are currently editing has changed, would you like to use the updated value?'; $string['ajaxchoosescale'] = 'Choose'; +$string['editingmode_title'] = 'Editing the grader report'; $string['eventgradereportviewed'] = 'Grader report viewed'; $string['grader:manage'] = 'Manage the grader report'; $string['grader:view'] = 'View grader report'; diff --git a/grade/report/singleview/classes/local/screen/grade.php b/grade/report/singleview/classes/local/screen/grade.php index 567d202e7d6..9984d647aec 100644 --- a/grade/report/singleview/classes/local/screen/grade.php +++ b/grade/report/singleview/classes/local/screen/grade.php @@ -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()); } /** diff --git a/grade/report/singleview/classes/local/screen/user.php b/grade/report/singleview/classes/local/screen/user.php index 1688f18bead..76a7a4c2aa6 100644 --- a/grade/report/singleview/classes/local/screen/user.php +++ b/grade/report/singleview/classes/local/screen/user.php @@ -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)); } /** diff --git a/grade/report/singleview/lang/en/gradereport_singleview.php b/grade/report/singleview/lang/en/gradereport_singleview.php index 8abc112d353..8bed4520065 100644 --- a/grade/report/singleview/lang/en/gradereport_singleview.php +++ b/grade/report/singleview/lang/en/gradereport_singleview.php @@ -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.'; diff --git a/grade/upgrade.txt b/grade/upgrade.txt index 49e4603f227..4211979a030 100644 --- a/grade/upgrade.txt +++ b/grade/upgrade.txt @@ -1,6 +1,12 @@ This file describes API changes in /grade/* ; Information provided here is intended especially for developers. +=== 4.1.7 === +* Some changes to how print_grade_page_head() sets the page title: + * If a non-empty `$heading` parameter is passed, it will be used as the page title's unique identifying information. + * Add support for grade report plugins that define an `editingmode_title` lang string. If the grade report plugin defines this + language string, it will be used for the page title's unique identifying information when editing mode is turned on. + === 4.1.6 === * The grade `itemname` property contained in the return structure of the following external methods is now PARAM_CLEANHTML: - `gradereport_user_get_grade_items`