MDL-72413 forum: Use the common module for setting the header

This commit is contained in:
Peter Dias
2021-12-13 09:49:34 +08:00
parent 93782ecdb9
commit ab40bc5962
7 changed files with 22 additions and 25 deletions
+4 -4
View File
@@ -43,7 +43,10 @@ $PAGE->set_title($course->shortname.': '.$folder->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($folder);
$PAGE->set_secondary_active_tab('modulepage');
$PAGE->activityheader->set_attrs([
'hidecompletion' => true,
'description' => ''
]);
$data = new stdClass();
$data->id = $cm->id;
$maxbytes = get_user_max_upload_file_size($context, $CFG->maxbytes);
@@ -79,9 +82,6 @@ if ($mform->is_cancelled()) {
}
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($folder->name));
}
echo $OUTPUT->box_start('generalbox foldertree');
$mform->display();
echo $OUTPUT->box_end();
+1
View File
@@ -310,6 +310,7 @@ if ($node && $post->get_id() != $discussion->get_first_post_id()) {
$isnestedv2displaymode = $displaymode == FORUM_MODE_NESTED_V2;
$PAGE->set_title("$course->shortname: " . format_string($discussion->get_name()));
$PAGE->set_heading($course->fullname);
$PAGE->activityheader->disable();
if ($isnestedv2displaymode) {
$PAGE->add_body_class('nested-v2-display-mode reset-style');
$settingstrigger = $OUTPUT->render_from_template('mod_forum/settings_drawer_trigger', null);
+1
View File
@@ -182,6 +182,7 @@ $PAGE->set_url($url);
$PAGE->set_title($pagetitle);
$PAGE->set_pagelayout('admin');
$PAGE->set_heading($pagetitle);
$PAGE->activityheader->disable();
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
+5 -8
View File
@@ -1094,11 +1094,12 @@ if ($edit) {
$PAGE->set_title("{$course->shortname}: {$strdiscussionname}{$titlesubject}");
$PAGE->set_heading($course->fullname);
$PAGE->set_secondary_active_tab("modulepage");
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($forum->name), 2);
$activityheaderconfig['hidecompletion'] = true;
if (!empty($parententity)) {
$activityheaderconfig['description'] = '';
}
$PAGE->activityheader->set_attrs($activityheaderconfig);
echo $OUTPUT->header();
// Checkup.
if (!empty($parententity) && !$capabilitymanager->can_view_post($USER, $discussionentity, $parententity)) {
@@ -1141,10 +1142,6 @@ if (!empty($parententity)) {
$rendererfactory = mod_forum\local\container::get_renderer_factory();
$postsrenderer = $rendererfactory->get_single_discussion_posts_renderer(FORUM_MODE_THREADED, true);
echo $postsrenderer->render($USER, [$forumentity], [$discussionentity], $postentities);
} else {
if (!empty($forum->intro)) {
echo $OUTPUT->box(format_module_intro('forum', $forum, $cm->id), 'generalbox', 'intro');
}
}
// Call print disclosure for enabled plagiarism plugins.
+1
View File
@@ -107,6 +107,7 @@ $PAGE->set_url($pageurl);
$PAGE->set_pagelayout('report');
$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);
$PAGE->activityheader->disable();
$PAGE->navbar->add(get_string('nodetitle', 'forumreport_summary'));
// Activate the secondary nav tab.
+1 -1
View File
@@ -109,13 +109,13 @@ $PAGE->set_secondary_active_tab("forumsubscriptions");
// Output starts from here.
$actionbar = new \mod_forum\output\subscription_actionbar($id, $url, $forum);
$PAGE->activityheader->disable();
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(get_string('forum', 'forum') . ' ' . $strsubscribers);
}
echo $forumoutput->subscription_actionbar($actionbar);
if ($edit === 0) {
$subscribers = \mod_forum\subscriptions::fetch_subscribed_users($forum, $currentgroup, $context);
if (\mod_forum\subscriptions::is_forcesubscribed($forum)) {
+9 -12
View File
@@ -157,24 +157,21 @@ if (!empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forum
]) . ': ' . format_string($forum->get_name());
rss_add_http_header($forum->get_context(), 'mod_forum', $forumrecord, $rsstitle);
}
// Output starts from here.
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($forum->get_name()), 2);
$activityheader = $PAGE->activityheader;
$pageheader = [];
if ($activityheader->is_title_allowed()) {
$pageheader['title'] = format_string($forum->get_name());
}
// Render the activity information.
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
// Fetch the current groupid.
$groupid = groups_get_activity_group($cm, true) ?: null;
if (!$istypesingle && !empty($forum->get_intro())) {
echo $OUTPUT->box(format_module_intro('forum', $forumrecord, $cm->id), 'generalbox', 'intro');
if ($istypesingle || empty($forum->get_intro())) {
$pageheader['description'] = '';
}
$activityheader->set_attrs($pageheader);
echo $OUTPUT->header();
$rendererfactory = mod_forum\local\container::get_renderer_factory();
// The elements for view action are rendered and added to the page.