MDL-77144 core_grades: fix headings in grade area

Previous to this, heading logic was performed in print_grade_page_head.
With the deprecation of the showtitle param, it makes sense now to
explicitly set the heading when the function is called. This prevents
duplicated text between the heading and teriary dropdown. This patch
also fixes unnecessary text that was concatenated onto headings.
This commit is contained in:
David Woloszyn 2023-05-09 10:36:00 +10:00
parent d81da7aba1
commit f3f816ced9
10 changed files with 13 additions and 15 deletions

View File

@ -92,7 +92,7 @@ if (!$edit) {
echo $renderer->render_action_bar($actionbar);
echo $OUTPUT->heading($heading);
} else {
print_grade_page_head($course->id, 'letter', 'view', $heading, false, false,
print_grade_page_head($course->id, 'letter', 'view', false, false, false,
true, null, null, null, $actionbar);
}

View File

@ -172,7 +172,7 @@ if ($scales = grade_scale::fetch_all_global()) {
$actionbar = new \core_grades\output\scales_action_bar($context);
if ($courseid) {
print_grade_page_head($courseid, 'scale', 'scale', get_string('coursescales', 'grades'),
print_grade_page_head($courseid, 'scale', 'scale', false,
false, false, true, null, null, null, $actionbar);
} else {
$renderer = $PAGE->get_renderer('core_grades');

View File

@ -73,7 +73,7 @@ if ($data = $mform->get_data()) {
}
}
print_grade_page_head($courseid, 'settings', 'coursesettings', get_string('coursegradesettings', 'grades'));
print_grade_page_head($courseid, 'settings', 'coursesettings');
// The settings could have been changed due to a notice shown in print_grade_page_head, we need to refresh them.
$settings = grade_get_settings($course->id);

View File

@ -246,8 +246,8 @@ if (grade_regrade_final_grades_if_required($course, $grade_edit_tree_index_check
}
$actionbar = new \core_grades\output\gradebook_setup_action_bar($context);
print_grade_page_head($courseid, 'settings', 'setup', get_string('gradebooksetup', 'grades'),
false, false, true, null, null, null, $actionbar, false);
print_grade_page_head($courseid, 'settings', 'setup', false,
false, false, true, null, null, null, $actionbar);
// Print Table of categories and items
echo $OUTPUT->box_start('gradetreebox generalbox');

View File

@ -138,8 +138,8 @@ $PAGE->requires->js_call_amd('gradereport_grader/collapse', 'init', [
$numusers = $report->get_numusers(true, true);
$actionbar = new \gradereport_grader\output\action_bar($context, $report, $numusers);
print_grade_page_head($COURSE->id, 'report', 'grader', $reportname, false, $buttons, true,
null, null, null, $actionbar, false);
print_grade_page_head($COURSE->id, 'report', 'grader', false, false, $buttons, true,
null, null, null, $actionbar);
// make sure separate group does not prevent view
if ($report->currentgroup == -2) {

View File

@ -62,7 +62,7 @@ if ($data = $mform->get_data()) {
}
}
print_grade_page_head($courseid, 'settings', 'grader', get_string('preferences', 'gradereport_grader'));
print_grade_page_head($courseid, 'settings', 'grader');
// If USER has admin capability, print a link to the site config page for this report
if (has_capability('moodle/site:config', $systemcontext)) {

View File

@ -110,8 +110,7 @@ if ($table->is_downloading()) {
// Print header.
$actionbar = new \core_grades\output\general_action_bar($context,
new moodle_url('/grade/report/history/index.php', ['id' => $courseid]), 'report', 'history');
print_grade_page_head($COURSE->id, 'report', 'history', get_string('pluginname',
'gradereport_history'), false, false, true, null, null,
print_grade_page_head($COURSE->id, 'report', 'history', false, false, false, true, null, null,
null, $actionbar);
$mform->display();

View File

@ -47,7 +47,7 @@ require_capability('moodle/grade:viewall', $context);
print_grade_page_head($courseid, 'report', 'summary', false,
false, false, true, null, null,
null, null, false);
null, null);
$report = system_report_factory::create(summary::class, context_course::instance($courseid));

View File

@ -130,13 +130,13 @@ if (has_capability('moodle/grade:viewall', $context)) {
$actionbar = new \gradereport_user\output\action_bar($context, $userview, null, $currentgroup);
// Print header.
print_grade_page_head($courseid, 'report', 'user', ' ', false, null, true,
print_grade_page_head($courseid, 'report', 'user', false, false, null, true,
null, null, null, $actionbar);
echo $report->output_report_zerostate();
} else if ($userid == 0) { // Show all reports.
$actionbar = new \gradereport_user\output\action_bar($context, $userview, 0, $currentgroup);
print_grade_page_head($courseid, 'report', 'user', ' ', false, null, true,
print_grade_page_head($courseid, 'report', 'user', false, false, null, true,
null, null, null, $actionbar);
while ($userdata = $gui->next_user()) {
@ -177,7 +177,7 @@ if (has_capability('moodle/grade:viewall', $context)) {
$userheading = $gradesrenderer->user_heading($report->user, $courseid, false);
// Print the page.
print_grade_page_head($courseid, 'report', 'user', ' ');
print_grade_page_head($courseid, 'report', 'user');
echo $OUTPUT->heading($userheading);

View File

@ -44,7 +44,6 @@ Feature: link to gradebook on the end of lesson page
Then I should see "Congratulations - end of lesson reached"
And I should see "View grades"
And I follow "View grades"
And I should see "User report" in the "page-header" "region"
And I should see "Student 1" in the "region-main" "region"
And I should see "Test lesson"