Skip to content

Commit

Permalink
MDL-72413 quiz: Use the common module for setting the header
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Dias committed Dec 13, 2021
1 parent 65ae3c1 commit 7d3927a
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion mod/quiz/attempt.php
Expand Up @@ -128,7 +128,7 @@
$headtags = $attemptobj->get_html_head_contributions($page);
$PAGE->set_title($attemptobj->attempt_page_title($page));
$PAGE->set_heading($attemptobj->get_course()->fullname);

$PAGE->activityheader->disable();
if ($attemptobj->is_last_page($page)) {
$nextpage = -1;
} else {
Expand Down
1 change: 1 addition & 0 deletions mod/quiz/edit.php
Expand Up @@ -182,6 +182,7 @@

$PAGE->set_title(get_string('editingquizx', 'quiz', format_string($quiz->name)));
$PAGE->set_heading($course->fullname);
$PAGE->activityheader->disable();
$node = $PAGE->settingsnav->find('mod_quiz_edit', navigation_node::TYPE_SETTING);
if ($node) {
$node->make_active();
Expand Down
9 changes: 5 additions & 4 deletions mod/quiz/overridedelete.php
Expand Up @@ -87,11 +87,12 @@
$PAGE->navbar->add($title);
$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);

$PAGE->activityheader->set_attrs([
"title" => format_string($quiz->name, true, ['context' => $context]),
"description" => "",
"hidecompletion" => true
]);
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context)));
}

if ($override->groupid) {
$group = $DB->get_record('groups', ['id' => $override->groupid], 'id, name');
Expand Down
8 changes: 5 additions & 3 deletions mod/quiz/overrideedit.php
Expand Up @@ -241,10 +241,12 @@
$PAGE->set_pagelayout('admin');
$PAGE->set_title($pagetitle);
$PAGE->set_heading($course->fullname);
$PAGE->activityheader->set_attrs([
"title" => format_string($quiz->name, true, array('context' => $context)),
"description" => "",
"hidecompletion" => true
]);
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context)));
}

$mform->display();

Expand Down
1 change: 1 addition & 0 deletions mod/quiz/overrides.php
Expand Up @@ -68,6 +68,7 @@
$PAGE->set_pagelayout('admin');
$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);
$PAGE->activityheader->disable();

// Activate the secondary nav tab.
$PAGE->set_secondary_active_tab("mod_quiz_useroverrides");
Expand Down
16 changes: 0 additions & 16 deletions mod/quiz/renderer.php
Expand Up @@ -972,24 +972,8 @@ public function view_page_notenrolled($course, $quiz, $cm, $context, $messages,
* @return string HTML to output.
*/
public function view_information($quiz, $cm, $context, $messages, bool $quizhasquestions = false) {
global $USER;

$output = '';

// Print quiz name.
if (!$this->page->has_secondary_navigation()) {
$output .= $this->heading(format_string($quiz->name));
}

// Print any activity information (eg completion requirements / dates).
$cminfo = cm_info::create($cm);
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
$output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates);

// Print quiz description.
$output .= $this->quiz_intro($quiz, $cm);

// Print the preview, quiz buttons for tertiary nav.
$canedit = has_capability('mod/quiz:manage', $context);
$canpreview = has_capability('mod/quiz:preview', $context);
Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/report.php
Expand Up @@ -65,7 +65,7 @@
require_login($course, false, $cm);
$context = context_module::instance($cm->id);
$PAGE->set_pagelayout('report');

$PAGE->activityheader->disable();
$reportlist = quiz_report_list($context);
if (empty($reportlist)) {
print_error('erroraccessingreport', 'quiz');
Expand Down
1 change: 1 addition & 0 deletions mod/quiz/review.php
Expand Up @@ -108,6 +108,7 @@
$headtags = $attemptobj->get_html_head_contributions($page, $showall);
$PAGE->set_title($attemptobj->review_page_title($page, $showall));
$PAGE->set_heading($attemptobj->get_course()->fullname);
$PAGE->activityheader->disable();

// Summary table start. ============================================================================

Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/summary.php
Expand Up @@ -94,7 +94,7 @@
$PAGE->navbar->add(get_string('summaryofattempt', 'quiz'));
$PAGE->set_title($attemptobj->summary_page_title());
$PAGE->set_heading($attemptobj->get_course()->fullname);

$PAGE->activityheader->disable();
// Display the page.
echo $output->summary_page($attemptobj, $displayoptions);

Expand Down
3 changes: 3 additions & 0 deletions mod/quiz/view.php
Expand Up @@ -143,6 +143,9 @@
$title = $course->shortname . ': ' . format_string($quiz->name);
$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);
if (html_is_blank($quiz->intro)) {
$PAGE->activityheader->set_description('');
}
$output = $PAGE->get_renderer('mod_quiz');
// MDL-71915 Will remove this place holder.
if (defined('BEHAT_SITE_RUNNING')) {
Expand Down

0 comments on commit 7d3927a

Please sign in to comment.