This commit is contained in:
Ilya Tregubov
2023-12-05 09:10:37 +08:00
6 changed files with 27 additions and 6 deletions
+12 -2
View File
@@ -926,14 +926,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 = $stractiveplugin;
// 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 . ': ' . $stractiveplugin;
}
$titlecomponents = [
$uniquetitle,
get_string('grades'),
$coursecontext->get_context_name(false),
];
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titlecomponents));
@@ -27,6 +27,7 @@ $string['aria:dropdowncolumns'] = 'Collapsed columns found';
$string['clearall'] = 'Clear all';
$string['clearsearch'] = 'Clear searched users';
$string['collapsedcolumns'] = 'Collapsed columns <span class="badge badge-pill badge-primary ml-1" data-collapse="count">{$a}</span>';
$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';
@@ -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.';
+4
View File
@@ -6,6 +6,10 @@ Information provided here is intended especially for developers.
* The grade_structure::get_element_type_string() function has been deprecated. Please use grade_helper::get_element_type_string() instead.
* The grade_structure::get_element_header() function has been deprecated. Please use grade_helper::get_element_header() instead.
* The grade_structure::get_activity_link() functions has been deprecated. Please use grade_helper::get_activity_link() instead.
* 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.3 ===
* The $showtitle parameter in the print_grade_page_head function located inside grade/lib.php has been deprecated and is not used anymore.