MDL-77144 core_grades: deprecated showtitle in print_grade_page_head

This commit is contained in:
David Woloszyn
2023-05-11 09:55:17 +10:00
parent 5d320dd7d1
commit d81da7aba1
2 changed files with 15 additions and 23 deletions
+11 -23
View File
@@ -842,7 +842,7 @@ class grade_plugin_info {
* @param string $active_type The type of the current page (report, settings,
* import, export, scales, outcomes, letters)
* @param string|null $active_plugin The plugin of the current page (grader, fullview etc...)
* @param string|bool $heading The heading of the page. Tries to guess if none is given
* @param string|bool $heading The heading of the page.
* @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
* @param string|bool $buttons Additional buttons to display on the page
* @param boolean $shownavigation should the gradebook navigation be shown?
@@ -852,14 +852,18 @@ class grade_plugin_info {
* @param actionbar|null $actionbar The actions bar which will be displayed on the page if $shownavigation is set
* to true. If $actionbar is not explicitly defined, the general action bar
* (\core_grades\output\general_action_bar) will be used by default.
* @param boolean $showtitle If set to false just show course full name as a title.
* @param null $unused This parameter has been deprecated since 4.3 and should not be used anymore.
* @return string HTML code or nothing if $return == false
*/
function print_grade_page_head(int $courseid, string $active_type, ?string $active_plugin = null, $heading = false,
function print_grade_page_head(int $courseid, string $active_type, ?string $active_plugin = null, string|bool $heading = false,
bool $return = false, $buttons = false, bool $shownavigation = true, ?string $headerhelpidentifier = null,
?string $headerhelpcomponent = null, ?stdClass $user = null, ?action_bar $actionbar = null, $showtitle = true) {
?string $headerhelpcomponent = null, ?stdClass $user = null, ?action_bar $actionbar = null, $unused = null) {
global $CFG, $OUTPUT, $PAGE;
if ($unused !== null) {
debugging('Deprecated argument passed to ' . __FUNCTION__, DEBUG_DEVELOPER);
}
// Put a warning on all gradebook pages if the course has modules currently scheduled for background deletion.
require_once($CFG->dirroot . '/course/lib.php');
if (course_modules_pending_deletion($courseid, true)) {
@@ -875,24 +879,15 @@ function print_grade_page_head(int $courseid, string $active_type, ?string $acti
$plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
// Determine the string of the active plugin
$stractive_plugin = ($active_plugin) ? $plugin_info['strings']['active_plugin_str'] : $heading;
$stractive_type = $plugin_info['strings'][$active_type];
if (!$showtitle) {
$title = $PAGE->course->fullname;
} else if (empty($plugin_info[$active_type]->id) || !empty($plugin_info[$active_type]->parent)) {
$title = $PAGE->course->fullname.': ' . $stractive_type . ': ' . $stractive_plugin;
} else {
$title = $PAGE->course->fullname.': ' . $stractive_plugin;
}
if ($active_type == 'report') {
$PAGE->set_pagelayout('report');
} else {
$PAGE->set_pagelayout('admin');
}
$PAGE->set_title(get_string('grades') . ': ' . $stractive_type);
$PAGE->set_heading($title);
$PAGE->set_heading($PAGE->course->fullname);
$PAGE->set_secondary_active_tab('grades');
if ($buttons instanceof single_button) {
@@ -914,15 +909,6 @@ function print_grade_page_head(int $courseid, string $active_type, ?string $acti
echo $returnval;
}
// Guess heading if not given explicitly
if (!$heading) {
$heading = $stractive_plugin;
}
if (!$showtitle) {
$heading = '';
}
if ($shownavigation) {
$renderer = $PAGE->get_renderer('core_grades');
// If the navigation action bar is not explicitly defined, use the general (default) action bar.
@@ -937,6 +923,8 @@ function print_grade_page_head(int $courseid, string $active_type, ?string $acti
}
}
$heading = !empty($heading) ? $heading : '';
$output = '';
// Add a help dialogue box if provided.
if (isset($headerhelpidentifier)) {
+4
View File
@@ -1,6 +1,10 @@
This file describes API changes in /grade/* ;
Information provided here is intended especially for developers.
=== 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.
=== 4.1 ===
* The $importactiveurl parameter in the constructor of the core_grades\output\import_action_bar class has been deprecated and is not used anymore.
* The $exportactiveurl parameter in the constructor of the core_grades\output\export_action_bar class has been deprecated and is not used anymore.