diff --git a/admin/roles/assign.php b/admin/roles/assign.php index c542943da30..82e07a5f72d 100644 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -61,6 +61,7 @@ if ($returnurl) { } $PAGE->set_url($pageurl); $PAGE->set_context($context); +$PAGE->activityheader->disable(); $contextname = $context->get_context_name(); $courseid = $course->id; diff --git a/admin/roles/check.php b/admin/roles/check.php index 631085ab7a7..daa2ccca6d8 100644 --- a/admin/roles/check.php +++ b/admin/roles/check.php @@ -87,6 +87,7 @@ if ($context->contextlevel == CONTEXT_BLOCK) { $PAGE->blocks->show_only_fake_blocks(true); } $PAGE->set_title($title); +$PAGE->activityheader->disable(); switch ($context->contextlevel) { case CONTEXT_SYSTEM: diff --git a/admin/roles/permissions.php b/admin/roles/permissions.php index dfd6547a00b..773c3fc397e 100644 --- a/admin/roles/permissions.php +++ b/admin/roles/permissions.php @@ -97,6 +97,7 @@ if ($context->contextlevel == CONTEXT_BLOCK) { } $PAGE->set_title($title); +$PAGE->activityheader->disable(); switch ($context->contextlevel) { case CONTEXT_SYSTEM: print_error('cannotoverridebaserole', 'error'); diff --git a/backup/backup.php b/backup/backup.php index c68bbfa9882..80968967d5c 100644 --- a/backup/backup.php +++ b/backup/backup.php @@ -107,6 +107,7 @@ switch ($type) { $PAGE->set_title($heading); $PAGE->set_heading($heading); +$PAGE->activityheader->disable(); if (empty($cancel)) { // Do not print the header if user cancelled the process, as we are going to redirect the user. diff --git a/backup/restorefile.php b/backup/restorefile.php index eef560bf06c..6351918868d 100644 --- a/backup/restorefile.php +++ b/backup/restorefile.php @@ -114,6 +114,7 @@ $PAGE->set_context($context); $PAGE->set_title(get_string('course') . ': ' . $coursefullname); $PAGE->set_heading($heading); $PAGE->set_pagelayout('admin'); +$PAGE->activityheader->disable(); $PAGE->requires->js_call_amd('core_backup/async_backup', 'asyncBackupAllStatus', array($context->id)); $form = new course_restore_form(null, array('contextid'=>$contextid)); diff --git a/course/modedit.php b/course/modedit.php index 71cc3102df1..c4de83c75a9 100644 --- a/course/modedit.php +++ b/course/modedit.php @@ -200,6 +200,7 @@ if ($mform->is_cancelled()) { if (isset($navbaraddition)) { $PAGE->navbar->add($navbaraddition); } + $PAGE->activityheader->disable(); echo $OUTPUT->header(); diff --git a/filter/manage.php b/filter/manage.php index bff72f847a0..0b6b6752818 100644 --- a/filter/manage.php +++ b/filter/manage.php @@ -123,6 +123,7 @@ $straction = get_string('filters', 'admin'); // Used by tabs.php $PAGE->set_cacheable(false); $PAGE->set_title($title); $PAGE->set_pagelayout('admin'); +$PAGE->activityheader->disable(); echo $OUTPUT->header(); /// Print heading. diff --git a/grade/grading/manage.php b/grade/grading/manage.php index 0491d89195b..d38c96721dc 100644 --- a/grade/grading/manage.php +++ b/grade/grading/manage.php @@ -82,6 +82,8 @@ $PAGE->set_url($manager->get_management_url($returnurl)); navigation_node::override_active_url($manager->get_management_url()); $PAGE->set_title(get_string('gradingmanagement', 'core_grading')); $PAGE->set_heading(get_string('gradingmanagement', 'core_grading')); +// We don't need to show the default header on a management page. +$PAGE->activityheader->disable(); $output = $PAGE->get_renderer('core_grading'); // process the eventual change of the active grading method diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 4ca3c691cc4..10e37273878 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -60,6 +60,7 @@ $string['addedtogroupnot'] = 'Not added to group "{$a}"'; $string['addedtogroupnotenrolled'] = 'Not added to group "{$a}", because not enrolled in course'; $string['addfilehere'] = 'Add file(s) here'; $string['addinganew'] = 'Adding a new {$a}'; +$string['additionalcustomnav'] = 'Additional custom navigation'; $string['addnew'] = 'Add a new {$a}'; $string['addinganewto'] = 'Adding a new {$a->what} to {$a->to}'; $string['addingdatatoexisting'] = 'Adding data to existing'; diff --git a/lib/classes/output/activity_header.php b/lib/classes/output/activity_header.php new file mode 100644 index 00000000000..af1bd2bf904 --- /dev/null +++ b/lib/classes/output/activity_header.php @@ -0,0 +1,184 @@ +. + +namespace core\output; + +use moodle_page; +use renderer_base; +use url_select; + +/** + * Data structure representing standard components displayed on the activity header. + * + * Consists of title, header, description. In addition, additional_items can be provided which is a url_select + * + * @copyright 2021 Peter + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since Moodle 4.0 + * @package core + * @category output + */ +class activity_header implements \renderable, \templatable { + /** @var moodle_page $page The current page we are looking at */ + protected $page; + /** @var string $title The title to be displayed in the header. Defaults to activityrecord name. */ + protected $title; + /** @var string $description The description to be displayed. Defaults to activityrecord intro. */ + protected $description; + /** @var \stdClass $user The user we are dealing with */ + protected $user; + /** @var url_select $additionalnavitems Any additional custom navigation elements to be injected into template. */ + protected $additionalnavitems; + /** @var bool $hidecompletion Whether to show completion criteria, if available, or not */ + protected $hidecompletion; + /** @var bool $hideoverflow Whether to show the overflow data or not */ + protected $hideoverflow; + /** @var bool $hideheader Whether or not to show the header */ + protected $hideheader; + + /** + * Constructor for activity_header + * + * @param moodle_page $page + * @param \stdClass $user + */ + public function __construct(moodle_page $page, \stdClass $user) { + $this->page = $page; + $this->user = $user; + $pageoptions = $this->page->theme->activityheaderconfig ?? []; + $layoutoptions = $this->page->layout_options['activityheader'] ?? []; + // Do a basic setup for the header based on theme/page options. + if ($page->activityrecord) { + if (empty($pageoptions['notitle']) && empty($layoutoptions['notitle'])) { + $this->title = format_string($page->activityrecord->name); + } + + if (empty($layoutoptions['nodescription']) && $page->activityrecord->intro && trim($page->activityrecord->intro)) { + $this->description = format_module_intro($this->page->activityname, $page->activityrecord, $page->cm->id); + } + } + $this->hidecompletion = !empty($layoutoptions['nocompletion']); + $this->hideoverflow = false; + $this->hideheader = false; + } + + /** + * Checks if the theme has specified titles to be displayed. + * + * @return bool + */ + public function is_title_allowed(): bool { + return empty($this->page->theme->activityheaderconfig['notitle']); + } + + /** + * Bulk set class member variables. Only updates variables which have corresponding setters + * + * @param array $config + */ + public function set_attrs(array $config): void { + foreach ($config as $key => $value) { + if (method_exists($this, "set_$key")) { + $this->{"set_$key"}($value); + } + } + } + + /** + * Sets the hidecompletion class member variable + * + * @param bool $value + */ + public function set_hidecompletion(bool $value): void { + $this->hidecompletion = $value; + } + + /** + * Sets the additionalnavitems class member variable + * + * @param url_select $value + */ + public function set_additionalnavitems(url_select $value): void { + $this->additionalnavitems = $value; + } + + /** + * Sets the hideoverflow class member variable + * + * @param bool $value + */ + public function set_hideoverflow(bool $value): void { + $this->hideoverflow = $value; + } + + /** + * Sets the title class member variable. + * + * @param string $value + */ + public function set_title(string $value): void { + $this->title = preg_replace('/]*>([.\s\S]*)<\/h2>/', '$1', $value); + } + + /** + * Sets the description class member variable + * + * @param string $value + */ + public function set_description(string $value): void { + $this->description = $value; + } + + /** + * Disable the activity header completely. Use this if the page has some custom content, headings to be displayed. + */ + public function disable(): void { + $this->hideheader = true; + } + + /** + * Export items to be rendered with a template. + * + * @param renderer_base $output + * @return array + */ + public function export_for_template(renderer_base $output): array { + // Don't need to show anything if not displaying within an activity context. + if (!$this->page->activityrecord) { + return []; + } + + // If within an activity context but requesting to hide the header, + // then just trigger the render for maincontent div. + if ($this->hideheader) { + return ['title' => '']; + } + + $completion = null; + if (!$this->hidecompletion) { + $completiondetails = \core_completion\cm_completion_details::get_instance($this->page->cm, $this->user->id); + $activitydates = \core\activity_dates::get_dates_for_module($this->page->cm, $this->user->id); + $completion = $output->activity_information($this->page->cm, $completiondetails, $activitydates); + } + + return [ + 'title' => $this->title, + 'description' => $this->description, + 'completion' => $completion, + 'additional_items' => $this->hideoverflow ? '' : $this->additionalnavitems, + ]; + } +} diff --git a/lib/outputlib.php b/lib/outputlib.php index aecd3f47db6..a99c7cdca6a 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -760,7 +760,7 @@ class theme_config { 'rendererfactory', 'csspostprocess', 'editor_sheets', 'editor_scss', 'rarrow', 'larrow', 'uarrow', 'darrow', 'hidefromselector', 'doctype', 'yuicssmodules', 'blockrtlmanipulations', 'blockrendermethod', 'scss', 'extrascsscallback', 'prescsscallback', 'csstreepostprocessor', 'addblockposition', - 'iconsystem', 'precompiledcsscallback', 'haseditswitch', 'usescourseindex'); + 'iconsystem', 'precompiledcsscallback', 'haseditswitch', 'usescourseindex', 'activityheaderconfig'); foreach ($config as $key=>$value) { if (in_array($key, $configurable)) { diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 534bbfcf969..b478e9566b3 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -1402,7 +1402,11 @@ class core_renderer extends renderer_base { $this->opencontainers->push('header/footer', $footer); $this->page->set_state(moodle_page::STATE_IN_BODY); - return $header . $this->skip_link_target('maincontent'); + // If an activity record has been set, activity_header will handle this. + if (!$this->page->activityrecord || !empty($this->page->layout_options['noactivityheader'])) { + $header .= $this->skip_link_target('maincontent'); + } + return $header; } /** @@ -2903,6 +2907,8 @@ EOD; //$this->page->set_pagelayout('base'); //TODO: MDL-20676 blocks on error pages are weird, unfortunately it somehow detect the pagelayout from URL :-( $this->page->set_title(get_string('error')); $this->page->set_heading($this->page->course->fullname); + // No need to display the activity header when encountering an error. + $this->page->activityheader->disable(); $output .= $this->header(); } diff --git a/lib/pagelib.php b/lib/pagelib.php index 189ece5d763..eb7a00117f0 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -403,6 +403,11 @@ class moodle_page { */ protected $_activenodeprimary = null; + /** + * @var \core\output\activity_header The default activity header for standardised. + */ + protected $_activityheader; + /** * Force the settings menu to be displayed on this page. This will only force the * settings menu on an activity / resource page that is being displayed on a theme that @@ -823,6 +828,24 @@ class moodle_page { return $this->_flatnav; } + /** + * Returns the activity header object + * @return secondary + */ + protected function magic_get_activityheader() { + global $USER; + if ($this->_activityheader === null) { + $class = 'core\output\activity_header'; + // Try and load a custom class first. + if (class_exists("mod_{$this->activityname}\\output\\activity_header")) { + $class = "mod_{$this->activityname}\\output\\activity_header"; + } + + $this->_activityheader = new $class($this, $USER); + } + return $this->_activityheader; + } + /** * Returns the secondary navigation object * @return secondary diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index 33cdbe54223..e2201d06e32 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -1117,7 +1117,10 @@ function portfolio_export_pagesetup($PAGE, $caller) { // and now we know the course for sure and maybe the cm, call require_login with it require_login($PAGE->course, false, $cm); - + $PAGE->activityheader->set_attrs([ + 'description' => '', + 'hidecompletion' => true + ]); foreach ($extranav as $navitem) { $PAGE->navbar->add($navitem['name']); } diff --git a/lib/templates/activity_header.mustache b/lib/templates/activity_header.mustache new file mode 100644 index 00000000000..f26224b9508 --- /dev/null +++ b/lib/templates/activity_header.mustache @@ -0,0 +1,86 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template core/activity_header + + Activity header template. + + Context variables required for this template: + * title - The title of the activity module + * description - The intro for the module + * completion - The completion info if available for the the module as acquired via the activity_information method + * additional_items - Any additional URL select navigation that needs to show up in the header + + Example context (json): + { + "title": "Assignment 1", + "description": "The assignment does something", + "completion": "
Some activity completion criteria
", + "additional_items": { + "id": "url_select_test", + "action": "https://example.com/post", + "formid": "url_select_form", + "sesskey": "sesskey", + "label": "core/url_select", + "helpicon": { + "title": "Help with something", + "text": "Help with something", + "url": "http://example.org/help", + "linktext": "", + "icon":{ + "extraclasses": "iconhelp", + "attributes": [ + {"name": "src", "value": "../../../pix/help.svg"}, + {"name": "alt", "value": "Help icon"} + ] + } + }, + "showbutton": "Go", + "options": [{ + "name": "Group 1", "isgroup": true, "options": + [ + {"name": "Item 1", "isgroup": false, "value": "1"}, + {"name": "Item 2", "isgroup": false, "value": "2"} + ]}, + {"name": "Group 2", "isgroup": true, "options": + [ + {"name": "Item 3", "isgroup": false, "value": "3"}, + {"name": "Item 4", "isgroup": false, "value": "4"} + ]}], + "disabled": false, + "title": "Some cool title" + } + } +}} + +{{#title}} +

{{{title}}}

+{{/title}} +{{#completion}} + {{#str}} overallaggregation, completion {{/str}} + {{{completion}}} +{{/completion}} +{{#description}} +
+ {{{description}}} +
+{{/description}} +{{#additional_items}} + +{{/additional_items}} diff --git a/lib/tests/output/activity_header_test.php b/lib/tests/output/activity_header_test.php new file mode 100644 index 00000000000..c0dbe4e1356 --- /dev/null +++ b/lib/tests/output/activity_header_test.php @@ -0,0 +1,73 @@ +. + +namespace core\output; + +/** + * Unit tests for activity header + * + * @package core + * @category test + * @copyright 2021 Peter + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class activity_header_test extends \advanced_testcase { + /** + * Test the title setter + * + * @dataProvider test_set_title_provider + * @param string $value + * @param string $expected + */ + public function test_set_title(string $value, string $expected): void { + global $PAGE, $DB; + $this->resetAfterTest(); + $course = $this->getDataGenerator()->create_course(['enablecompletion' => true]); + $assign = $this->getDataGenerator()->create_module('assign', [ + 'course' => $course->id, + 'completion' => COMPLETION_TRACKING_AUTOMATIC, + 'completionview' => 1 + ]); + $this->setAdminUser(); + + $cm = $DB->get_record('course_modules', ['id' => $assign->cmid]); + $PAGE->set_cm($cm); + $PAGE->set_activity_record($assign); + + $header = $PAGE->activityheader; + $header->set_title($value); + $data = $header->export_for_template($PAGE->get_renderer('core')); + $this->assertEquals($expected, $data['title']); + } + + /** + * Provider for the test_set_title unit test. + * @return array + */ + public function test_set_title_provider(): array { + return [ + "Set the title with a plain text" => [ + "Activity title", "Activity title" + ], + "Set the title with a string with standard header tags" => [ + "

Activity title

", "Activity title" + ], + "Set the title with a string with multiple header content" => [ + "

Activity title

Header 2

", "Activity title

Header 2" + ], + ]; + } +} diff --git a/mod/assign/classes/output/renderer.php b/mod/assign/classes/output/renderer.php index ed28cb1d55c..216e21e7156 100644 --- a/mod/assign/classes/output/renderer.php +++ b/mod/assign/classes/output/renderer.php @@ -230,10 +230,6 @@ class renderer extends \plugin_renderer_base { * @return string */ public function render_assign_header(assign_header $header) { - global $USER; - - $o = ''; - if ($header->subpage) { $this->page->navbar->add($header->subpage, $header->subpageurl); $args = ['contextname' => $header->context->get_context_name(false, true), 'subpage' => $header->subpage]; @@ -248,33 +244,24 @@ class renderer extends \plugin_renderer_base { $this->page->set_title($title); $this->page->set_heading($this->page->course->fullname); - $o .= $this->output->header(); - if (!$this->page->has_secondary_navigation()) { - $o .= $this->output->heading($heading); - } - - // Show the activity information output component. - $modinfo = get_fast_modinfo($header->assign->course); - $cm = $modinfo->get_cm($header->coursemoduleid); - $cmcompletion = \core_completion\cm_completion_details::get_instance($cm, $USER->id); - $activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id); - $o .= $this->output->activity_information($cm, $cmcompletion, $activitydates); - - if ($header->preface) { - $o .= $header->preface; - } - + $description = $header->preface; if ($header->showintro) { - $o .= $this->output->box_start('generalbox boxaligncenter', 'intro'); - $o .= format_module_intro('assign', $header->assign, $header->coursemoduleid); + $description = $this->output->box_start('generalbox boxaligncenter', 'intro'); + $description .= format_module_intro('assign', $header->assign, $header->coursemoduleid); if ($header->activity) { - $o .= $this->format_activity_text($header->assign, $header->coursemoduleid); + $description .= $this->format_activity_text($header->assign, $header->coursemoduleid); } - $o .= $header->postfix; - $o .= $this->output->box_end(); + $description .= $header->postfix; + $description .= $this->output->box_end(); } - return $o; + $activityheader = $this->page->activityheader; + $activityheader->set_attrs([ + 'title' => $activityheader->is_title_allowed() ? $heading : '', + 'description' => $description + ]); + + return $this->output->header(); } /** diff --git a/mod/assign/overridedelete.php b/mod/assign/overridedelete.php index 1003219e67c..611f458bb83 100644 --- a/mod/assign/overridedelete.php +++ b/mod/assign/overridedelete.php @@ -82,9 +82,13 @@ $PAGE->set_pagelayout('admin'); $PAGE->navbar->add($title); $PAGE->set_title($title); $PAGE->set_heading($course->fullname); +$PAGE->activityheader->set_attrs([ + "title" => format_string($assign->get_instance()->name, true, ['context' => $context]), + "description" => "", + "hidecompletion" => true +]); echo $OUTPUT->header(); -echo $OUTPUT->heading(format_string($assign->get_instance()->name, true, array('context' => $context))); if ($override->groupid) { $group = $DB->get_record('groups', array('id' => $override->groupid), 'id, name'); diff --git a/mod/assign/overrideedit.php b/mod/assign/overrideedit.php index 34716ac2bca..87cc0442580 100644 --- a/mod/assign/overrideedit.php +++ b/mod/assign/overrideedit.php @@ -257,8 +257,13 @@ $PAGE->navbar->add($pagetitle); $PAGE->set_pagelayout('admin'); $PAGE->set_title($pagetitle); $PAGE->set_heading($course->fullname); +$activityheader = $PAGE->activityheader; +$activityheader->set_attrs([ + 'description' => '', + 'hidecompletion' => true, + 'title' => $activityheader->is_title_allowed() ? format_string($assigninstance->name, true, ['context' => $context]) : "" +]); echo $OUTPUT->header(); -echo $OUTPUT->heading(format_string($assigninstance->name, true, array('context' => $context))); $mform->display(); diff --git a/mod/assign/overrides.php b/mod/assign/overrides.php index 6e8df8fd2fc..806c716c1c6 100644 --- a/mod/assign/overrides.php +++ b/mod/assign/overrides.php @@ -82,10 +82,13 @@ if ($action == 'movegroupoverride') { $PAGE->set_pagelayout('admin'); $PAGE->set_title(get_string('overrides', 'assign')); $PAGE->set_heading($course->fullname); +$activityheader = $PAGE->activityheader; +$activityheader->set_attrs([ + 'description' => '', + 'hidecompletion' => true, + 'title' => $activityheader->is_title_allowed() ? format_string($assign->name, true, ['context' => $context]) : "" +]); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($assign->name, true, array('context' => $context))); -} $overridemenu = new \mod_assign\output\override_actionmenu($url, $cm); $renderer = $PAGE->get_renderer('mod_assign'); echo $renderer->render($overridemenu); diff --git a/mod/assign/tests/locallib_test.php b/mod/assign/tests/locallib_test.php index 84273aaaf7f..b0efb1e3271 100644 --- a/mod/assign/tests/locallib_test.php +++ b/mod/assign/tests/locallib_test.php @@ -4225,106 +4225,6 @@ Anchor link 2:Link text ]; } - /** - * Data provider for test_view_group_override - * - * @return array Provider data - */ - public function view_group_override_provider() { - return [ - 'Other users should see their duedate' => [ - 'student', - ['group2'], - 'group1', - '7 June 2019, 5:37 PM', - ], - 'Teacher should be able to see all group override duedate' => [ - 'teacher', - ['group1'], - 'group1', - '20 September 2019, 10:37 PM', - ], - 'Teacher should be able to see all group override duedate even if they are not member' => [ - 'editingteacher', - ['group1'], - 'group2', - '7 June 2019, 5:37 PM', - ] - ]; - } - - /** - * Test showing group override duedate for admin - * - * @dataProvider view_group_override_provider - * @param string $role the role of the user (teacher, student, etc) - * @param string[] $groups the groups the user are member of - * @param string $activegroup The selected group - * @param string $expecteddate The expected due date - */ - public function test_view_group_override(string $role, array $groups, string $activegroup, string $expecteddate) { - global $DB, $PAGE, $SESSION; - - $this->resetAfterTest(); - $course = $this->getDataGenerator()->create_course(); - - $group1 = $this->getDataGenerator()->create_group(['courseid' => $course->id]); - $group2 = $this->getDataGenerator()->create_group(['courseid' => $course->id]); - - $user = $this->getDataGenerator()->create_and_enrol($course, $role); - if (in_array('group1', $groups)) { - groups_add_member($group1, $user); - } - if (in_array('group2', $groups)) { - groups_add_member($group2, $user); - } - $activegroup = $$activegroup; - - $assign = $this->create_instance($course, [ - 'groupmode' => SEPARATEGROUPS, - 'duedate' => 1558999899, // 28 May 2019, 7:31 AM. - ]); - $instance = $assign->get_instance(); - - // Overrides for two groups. - $overrides = [ - (object) [ - 'assignid' => $instance->id, - 'groupid' => $group1->id, - 'userid' => null, - 'sortorder' => 1, - 'duedate' => 1568990258, // 20 September 2019, 10:37 PM. - ], - (object) [ - 'assignid' => $instance->id, - 'groupid' => $group2->id, - 'userid' => null, - 'sortorder' => 2, - 'duedate' => 1559900258, // 7 June 2019, 5:37 PM. - ], - ]; - - foreach ($overrides as &$override) { - $override->id = $DB->insert_record('assign_overrides', $override); - } - - $currenturl = new moodle_url('/mod/assign/view.php', ['id' => $assign->get_course_module()->id]); - $PAGE->set_url($currenturl); - - $this->setUser($user); - $_GET['group'] = $activegroup->id; - - /** @var assign $assign */ - $header = new \mod_assign\output\assign_header( - $assign->get_instance(), - $assign->get_context(), - false, - $assign->get_course_module()->id - ); - $output = $assign->get_renderer()->render($header); - $this->assertStringContainsStringIgnoringCase($expecteddate, $output); - } - /** * Test that cron task uses task API to get its last run time. */ diff --git a/mod/book/edit.php b/mod/book/edit.php index 367bbe7966d..20d6255c378 100644 --- a/mod/book/edit.php +++ b/mod/book/edit.php @@ -135,9 +135,12 @@ $PAGE->set_heading($course->fullname); if ($chapters = book_preload_chapters($book)) { book_add_fake_block($chapters, $chapter, $book, $cm); } +$PAGE->activityheader->set_attrs([ + "description" => '', + "hidecompletion" => true +]); echo $OUTPUT->header(); -echo $OUTPUT->heading(format_string($book->name)); $mform->display(); diff --git a/mod/book/tool/importhtml/index.php b/mod/book/tool/importhtml/index.php index deac0d123e4..4a1eef49254 100644 --- a/mod/book/tool/importhtml/index.php +++ b/mod/book/tool/importhtml/index.php @@ -50,7 +50,10 @@ if ($chapterid) { $PAGE->set_title($book->name); $PAGE->set_heading($course->fullname); - +$PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' +]); // Prepare the page header. $strbook = get_string('modulename', 'mod_book'); $strbooks = get_string('modulenameplural', 'mod_book'); @@ -67,7 +70,6 @@ if ($mform->is_cancelled()) { } else if ($data = $mform->get_data()) { echo $OUTPUT->header(); - echo $OUTPUT->heading(format_string($book->name)); echo $OUTPUT->heading(get_string('importingchapters', 'booktool_importhtml'), 3); // this is a bloody hack - children do not try this at home! @@ -85,7 +87,6 @@ if ($mform->is_cancelled()) { } echo $OUTPUT->header(); -echo $OUTPUT->heading(format_string($book->name)); $mform->display(); diff --git a/mod/book/view.php b/mod/book/view.php index 9991938ec63..f9ac36977f8 100644 --- a/mod/book/view.php +++ b/mod/book/view.php @@ -137,20 +137,6 @@ book_view($book, $chapter, $islastchapter, $course, $cm, $context); // ===================================================== echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($book->name)); -} - -// Render the activity information. -$cminfo = cm_info::create($cm); -$cmcompletion = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id); -$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id); -echo $OUTPUT->activity_information($cminfo, $cmcompletion, $activitydates); - -// Info box. -if ($book->intro) { - echo $OUTPUT->box(format_module_intro('book', $book, $cm->id), 'generalbox', 'intro'); -} echo $renderedmenu; diff --git a/mod/chat/report.php b/mod/chat/report.php index 939cd75e0b3..a36008f1e61 100644 --- a/mod/chat/report.php +++ b/mod/chat/report.php @@ -84,6 +84,12 @@ $navlinks = array(); $canexportsess = has_capability('mod/chat:exportsession', $context); $canviewfullnames = has_capability('moodle/site:viewfullnames', $context); +$PAGE->activityheader->set_attrs([ + 'title' => '', + 'description' => '', + 'hidecompletion' => true, + 'hideoverflow' => true, +]); // Print a session if one has been specified. if ($start and $end and !$confirmdelete) { // Show a full transcript. diff --git a/mod/chat/view.php b/mod/chat/view.php index 7170e040814..dc5e9acd240 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -84,9 +84,6 @@ $PAGE->set_url('/mod/chat/view.php', array('id' => $cm->id)); $PAGE->set_title($title); $PAGE->set_heading($course->fullname); -// Print the page header. -echo $OUTPUT->header(); - // Check to see if groups are being used here. $groupmode = groups_get_activity_groupmode($cm); $currentgroup = groups_get_activity_group($cm, true); @@ -102,19 +99,8 @@ if ($currentgroup) { $groupparam = ""; } -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($chat->name), 2); -} - -// Render the activity information. -$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); -echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - -if ($chat->intro) { - echo $OUTPUT->box(format_module_intro('chat', $chat, $cm->id), 'generalbox', 'intro'); -} +// Print the page header. +echo $OUTPUT->header(); groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/chat/view.php?id=$cm->id"); diff --git a/mod/choice/report.php b/mod/choice/report.php index 4cb1d18550a..14a08e83e42 100644 --- a/mod/choice/report.php +++ b/mod/choice/report.php @@ -67,10 +67,12 @@ $PAGE->navbar->add($strresponses); $PAGE->set_title(format_string($choice->name).": $strresponses"); $PAGE->set_heading($course->fullname); + $PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' + ]); echo $OUTPUT->header(); - if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($choice->name), 2, null); - } + /// Check to see if groups are being used in this choice $groupmode = groups_get_activity_groupmode($cm); if ($groupmode) { diff --git a/mod/choice/view.php b/mod/choice/view.php index 7a5a9f25d0b..075644731a2 100644 --- a/mod/choice/view.php +++ b/mod/choice/view.php @@ -98,14 +98,6 @@ if (data_submitted() && !empty($action) && confirm_sesskey()) { choice_view($choice, $course, $cm, $context); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($choice->name), 2, null); -} - -// 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); if ($notify and confirm_sesskey()) { if ($notify === 'choicesaved') { @@ -140,10 +132,6 @@ if (has_capability('mod/choice:readresponses', $context) && !$PAGE->has_secondar echo '
'; -if ($choice->intro) { - echo $OUTPUT->box(format_module_intro('choice', $choice, $cm->id), 'generalbox', 'intro'); -} - $timenow = time(); $current = choice_get_my_response($choice); //if user has already made a selection, and they are not allowed to update it or if choice is not open, show their selected answer. diff --git a/mod/data/edit.php b/mod/data/edit.php index d22b2062ffc..95604e3ad28 100644 --- a/mod/data/edit.php +++ b/mod/data/edit.php @@ -227,17 +227,6 @@ if ($datarecord = data_submitted() and confirm_sesskey()) { echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($data->name), 2); -} - -// Render the activity information. -$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); -echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - -echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro'); groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/data/edit.php?d='.$data->id); /// Print the browsing interface diff --git a/mod/data/export.php b/mod/data/export.php index 259ae0a7c0d..2112015185f 100644 --- a/mod/data/export.php +++ b/mod/data/export.php @@ -77,7 +77,6 @@ foreach ($fieldrecords as $fieldrecord) { $fields[]= data_get_field($fieldrecord, $data); } - $mform = new mod_data_export_form(new moodle_url('/mod/data/export.php', ['d' => $data->id, 'backto' => $redirectbackto]), $fields, $cm, $data); @@ -118,17 +117,6 @@ $PAGE->set_heading($course->fullname); $PAGE->force_settings_menu(true); $PAGE->set_secondary_active_tab('modulepage'); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($data->name), 2); -} - -// Render the activity information. -$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); -echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - -echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro'); groups_print_activity_menu($cm, $url); diff --git a/mod/data/import.php b/mod/data/import.php index e35facf7ca8..4f651dde8e2 100644 --- a/mod/data/import.php +++ b/mod/data/import.php @@ -80,6 +80,7 @@ $PAGE->navbar->add(get_string('add', 'data')); $PAGE->set_title($data->name); $PAGE->set_heading($course->fullname); $PAGE->set_secondary_active_tab('modulepage'); +$PAGE->activityheader->disable(); echo $OUTPUT->header(); echo $OUTPUT->heading_with_help(get_string('uploadrecords', 'mod_data'), 'uploadrecords', 'mod_data'); diff --git a/mod/data/lib.php b/mod/data/lib.php index 3ab1be0e744..d7506510aa6 100644 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -2321,18 +2321,6 @@ function data_print_header($course, $cm, $data, $currenttab='', string $actionba $PAGE->set_title($data->name); echo $OUTPUT->header(); - if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($data->name), 2); - } - - // Render the activity information. - $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); - echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - - echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro'); - echo $actionbar; // Print any notices diff --git a/mod/data/preset.php b/mod/data/preset.php index 6b77d6a0d15..08e5d277d3f 100644 --- a/mod/data/preset.php +++ b/mod/data/preset.php @@ -102,9 +102,6 @@ if ($formimportzip->is_cancelled()) { } echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($data->name), 2); -} if ($formdata = $formimportzip->get_data()) { $file = new stdClass; @@ -184,14 +181,6 @@ if (in_array($action, ['confirmdelete', 'delete', 'finishimport'])) { exit(0); } -// Render the activity information. -$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); -echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - -echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro'); - if ($action === 'import') { echo $formimportzip->display(); } else { diff --git a/mod/data/templates.php b/mod/data/templates.php index 39d38a91341..926f99ae7b7 100644 --- a/mod/data/templates.php +++ b/mod/data/templates.php @@ -104,17 +104,6 @@ $PAGE->set_pagelayout('admin'); $PAGE->force_settings_menu(true); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($data->name), 2); -} - -// Render the activity information. -$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); - -echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); -echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro'); $actionbar = new \mod_data\output\action_bar($data->id, $url); echo $actionbar->get_templates_action_bar(); diff --git a/mod/data/view.php b/mod/data/view.php index 87ba7852a57..4c0f60937b3 100644 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -261,21 +261,11 @@ $groupmode = groups_get_activity_groupmode($cm); $canmanageentries = has_capability('mod/data:manageentries', $context); echo $OUTPUT->header(); - // Detect entries not approved yet and show hint instead of not found error. if ($record and !data_can_view_record($data, $record, $currentgroup, $canmanageentries)) { print_error('notapproved', 'data'); } -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($data->name), 2); -} - -// 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); - // Do we need to show a link to the RSS feed for the records? //this links has been Settings (database activity administration) block /*if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) { @@ -289,7 +279,6 @@ if ($data->intro and empty($page) and empty($record) and $mode != 'single') { $options = new stdClass(); $options->noclean = true; } -echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro'); $returnurl = $CFG->wwwroot . '/mod/data/view.php?d='.$data->id.'&search='.s($search).'&sort='.s($sort).'&order='.s($order).'&'; groups_print_activity_menu($cm, $returnurl); diff --git a/mod/feedback/analysis.php b/mod/feedback/analysis.php index e44ea6d920c..4977fa73495 100644 --- a/mod/feedback/analysis.php +++ b/mod/feedback/analysis.php @@ -48,10 +48,11 @@ if (!$feedbackstructure->can_view_analysis()) { $PAGE->set_heading($course->fullname); $PAGE->set_title($feedback->name); +$PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' +]); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($feedback->name)); -} //get the groupid $mygroupid = groups_get_activity_group($cm, true); diff --git a/mod/feedback/edit.php b/mod/feedback/edit.php index f182bdd7211..b5170600bd4 100644 --- a/mod/feedback/edit.php +++ b/mod/feedback/edit.php @@ -85,6 +85,10 @@ $PAGE->set_url($url); $PAGE->set_heading($course->fullname); $PAGE->set_title($feedback->name); $actionbar = new \mod_feedback\output\edit_action_bar($cm->id, $url, $lastposition); +$PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' +]); //Adding the javascript module for the items dragdrop. if (count($feedbackitems) > 1) { diff --git a/mod/feedback/edit_item.php b/mod/feedback/edit_item.php index 5f2be63beb9..1b5c74bad38 100644 --- a/mod/feedback/edit_item.php +++ b/mod/feedback/edit_item.php @@ -99,13 +99,12 @@ if ($item->id) { } $PAGE->set_heading($course->fullname); $PAGE->set_title($feedback->name); +$PAGE->activityheader->set_attrs([ + "hidecompletion" => true, + "description" => '' +]); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { -// Print the main part of the page. - echo $OUTPUT->heading(format_string($feedback->name)); -} - /// print the tabs $current_tab = 'edit'; $id = $cm->id; diff --git a/mod/feedback/import.php b/mod/feedback/import.php index 0558d98315f..c14c30bc599 100644 --- a/mod/feedback/import.php +++ b/mod/feedback/import.php @@ -95,13 +95,14 @@ $strfeedback = get_string("modulename", "feedback"); $PAGE->set_heading($course->fullname); $PAGE->set_title($feedback->name); +$PAGE->activityheader->set_attrs([ + "hidecompletion" => true, + "description" => '' +]); echo $OUTPUT->header(); /** @var \mod_feedback\output\renderer $renderer */ $renderer = $PAGE->get_renderer('mod_feedback'); echo $renderer->main_action_bar($actionbar); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($feedback->name)); -} /// Print the main part of the page /////////////////////////////////////////////////////////////////////////// diff --git a/mod/feedback/manage_templates.php b/mod/feedback/manage_templates.php index f170dbe07b9..ea7987c4f08 100644 --- a/mod/feedback/manage_templates.php +++ b/mod/feedback/manage_templates.php @@ -71,7 +71,10 @@ if ($templateid) { $successurl = new moodle_url('/mod/feedback/manage_templates.php', ['id' => $id]); redirect($url, get_string('template_deleted', 'feedback'), null, \core\output\notification::NOTIFY_SUCCESS); } - +$PAGE->activityheader->set_attrs([ + "hidecompletion" => true, + "description" => '' +]); echo $OUTPUT->header(); /** @var \mod_feedback\output\renderer $renderer */ $renderer = $PAGE->get_renderer('mod_feedback'); diff --git a/mod/feedback/mapcourse.php b/mod/feedback/mapcourse.php index 975c801f163..7c045226efa 100644 --- a/mod/feedback/mapcourse.php +++ b/mod/feedback/mapcourse.php @@ -58,9 +58,7 @@ $strfeedback = get_string("modulename", "feedback"); $PAGE->set_heading($course->fullname); $PAGE->set_title($feedback->name); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($feedback->name)); -} + echo $OUTPUT->box(get_string('mapcourseinfo', 'feedback')); $form->display(); diff --git a/mod/feedback/print.php b/mod/feedback/print.php index d9448fd335f..e365377eeb9 100644 --- a/mod/feedback/print.php +++ b/mod/feedback/print.php @@ -48,11 +48,9 @@ $PAGE->navbar->add(format_string($feedback->name)); $PAGE->set_title($feedback->name); $PAGE->set_heading($course->fullname); +$PAGE->activityheader->set_title(format_string($feedback->name)); echo $OUTPUT->header(); -// Print the main part of the page. -echo $OUTPUT->heading(format_string($feedback->name)); - $continueurl = new moodle_url('/mod/feedback/view.php', array('id' => $id)); if ($courseid) { $continueurl->param('courseid', $courseid); diff --git a/mod/feedback/show_entries.php b/mod/feedback/show_entries.php index 54ce08f72d5..fe4a91248bb 100644 --- a/mod/feedback/show_entries.php +++ b/mod/feedback/show_entries.php @@ -86,6 +86,10 @@ if ($data = $courseselectform->get_data()) { navigation_node::override_active_url($baseurl); $PAGE->set_heading($course->fullname); $PAGE->set_title($feedback->name); +$PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' +]); echo $OUTPUT->header(); /** @var \mod_feedback\output\renderer $renderer */ diff --git a/mod/feedback/show_nonrespondents.php b/mod/feedback/show_nonrespondents.php index adb2c7b770c..a81e30d3426 100644 --- a/mod/feedback/show_nonrespondents.php +++ b/mod/feedback/show_nonrespondents.php @@ -137,6 +137,10 @@ if ($action == 'sendmessage' AND $canbulkmessaging) { /// Print the page header $PAGE->set_heading($course->fullname); $PAGE->set_title($feedback->name); +$PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' +]); echo $OUTPUT->header(); /** @var \mod_feedback\output\renderer $renderer */ diff --git a/mod/feedback/use_templ.php b/mod/feedback/use_templ.php index 72a3621f6e8..02eedbe6107 100644 --- a/mod/feedback/use_templ.php +++ b/mod/feedback/use_templ.php @@ -63,6 +63,10 @@ if ($mode == 'manage') { $PAGE->set_heading($course->fullname); $PAGE->set_title($feedback->name); +$PAGE->activityheader->set_attrs([ + "hidecompletion" => true, + "description" => '' +]); $actionbar = new \mod_feedback\output\edit_template_action_bar($cm->id, $templateid, $mode); /** @var \mod_feedback\output\renderer $renderer */ $renderer = $PAGE->get_renderer('mod_feedback'); diff --git a/mod/feedback/view.php b/mod/feedback/view.php index 5ddd7efa987..b72bf9ddc4b 100644 --- a/mod/feedback/view.php +++ b/mod/feedback/view.php @@ -72,9 +72,6 @@ $renderer = $PAGE->get_renderer('mod_feedback'); // Trigger module viewed event. $feedbackcompletion->trigger_module_viewed(); -/// Print the page header -echo $OUTPUT->header(); - /// Print the main part of the page /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// @@ -87,10 +84,10 @@ if ($courseid) { } $preview = html_writer::link($previewlnk, $previewimg); -// 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); +$PAGE->activityheader->set_description(""); + +// Print the page header. +echo $OUTPUT->header(); // Show description. echo $OUTPUT->box_start('generalbox feedback_description'); diff --git a/mod/folder/edit.php b/mod/folder/edit.php index 221186d297a..6ad010a8dcc 100644 --- a/mod/folder/edit.php +++ b/mod/folder/edit.php @@ -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(); diff --git a/mod/folder/renderer.php b/mod/folder/renderer.php index ed166ea0b1d..eec62c710ae 100644 --- a/mod/folder/renderer.php +++ b/mod/folder/renderer.php @@ -47,10 +47,7 @@ class mod_folder_renderer extends plugin_renderer_base { } if (trim($folder->intro)) { - if ($folder->display != FOLDER_DISPLAY_INLINE) { - $output .= $this->output->box(format_module_intro('folder', $folder, $cm->id), - 'generalbox', 'intro'); - } else if ($cm->showdescription) { + if ($folder->display == FOLDER_DISPLAY_INLINE && $cm->showdescription) { // for "display inline" do not filter, filters run at display time. $output .= format_module_intro('folder', $folder, $cm->id, false); } diff --git a/mod/folder/view.php b/mod/folder/view.php index 90f6587ddaa..fd18474eeca 100644 --- a/mod/folder/view.php +++ b/mod/folder/view.php @@ -69,21 +69,10 @@ $PAGE->set_title($course->shortname.': '.$folder->name); $PAGE->set_heading($course->fullname); $PAGE->set_activity_record($folder); - $output = $PAGE->get_renderer('mod_folder'); echo $output->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $output->heading(format_string($folder->name), 2); -} - -// Render the activity information. -$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); -echo $output->activity_information($cminfo, $completiondetails, $activitydates); - echo $output->display_folder($folder); echo $output->footer(); diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php index b645ba32fe2..7730542cd40 100644 --- a/mod/forum/discuss.php +++ b/mod/forum/discuss.php @@ -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); diff --git a/mod/forum/export.php b/mod/forum/export.php index 0caf7ff45c0..1d31ec393f8 100644 --- a/mod/forum/export.php +++ b/mod/forum/export.php @@ -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()) { diff --git a/mod/forum/post.php b/mod/forum/post.php index 5b0c81cd2f6..d9c79339d51 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -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. diff --git a/mod/forum/report/summary/index.php b/mod/forum/report/summary/index.php index 37d037ec36f..a82d65cfa74 100644 --- a/mod/forum/report/summary/index.php +++ b/mod/forum/report/summary/index.php @@ -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. diff --git a/mod/forum/subscribers.php b/mod/forum/subscribers.php index 4ed7dc26c87..3e9174572bd 100644 --- a/mod/forum/subscribers.php +++ b/mod/forum/subscribers.php @@ -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)) { diff --git a/mod/forum/view.php b/mod/forum/view.php index d856562b832..94a36c51e9b 100644 --- a/mod/forum/view.php +++ b/mod/forum/view.php @@ -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. diff --git a/mod/glossary/deleteentry.php b/mod/glossary/deleteentry.php index ea174b72920..c3f676d48ea 100644 --- a/mod/glossary/deleteentry.php +++ b/mod/glossary/deleteentry.php @@ -66,6 +66,7 @@ if ($confirm and confirm_sesskey()) { // the operation was confirmed. $PAGE->navbar->add(get_string('delete')); $PAGE->set_title($glossary->name); $PAGE->set_heading($course->fullname); + $PAGE->activityheader->disable(); echo $OUTPUT->header(); $areyousure = "".format_string($entry->concept)."

$strareyousuredelete

"; $linkyes = 'deleteentry.php'; diff --git a/mod/glossary/edit.php b/mod/glossary/edit.php index 830288b7a97..7a3841604cd 100644 --- a/mod/glossary/edit.php +++ b/mod/glossary/edit.php @@ -83,11 +83,8 @@ if (!empty($id)) { $PAGE->set_title($glossary->name); $PAGE->set_heading($course->fullname); $PAGE->set_secondary_active_tab('modulepage'); +$PAGE->activityheader->set_hidecompletion(true); echo $OUTPUT->header(); -echo $OUTPUT->heading(format_string($glossary->name), 2); -if ($glossary->intro) { - echo $OUTPUT->box(format_module_intro('glossary', $glossary, $cm->id), 'generalbox', 'intro'); -} $data = new StdClass(); $data->tags = core_tag_tag::get_item_tags_array('mod_glossary', 'glossary_entries', $id); diff --git a/mod/glossary/export.php b/mod/glossary/export.php index c8e8078930b..cd91134951e 100644 --- a/mod/glossary/export.php +++ b/mod/glossary/export.php @@ -51,6 +51,7 @@ $PAGE->navbar->add($strexportentries); $PAGE->set_title($glossary->name); $PAGE->set_heading($course->fullname); $PAGE->set_secondary_active_tab('modulepage'); +$PAGE->activityheader->disable(); echo $OUTPUT->header(); echo $OUTPUT->heading($strexportentries); diff --git a/mod/glossary/import.php b/mod/glossary/import.php index d73158b8008..b2e90c0ee1d 100644 --- a/mod/glossary/import.php +++ b/mod/glossary/import.php @@ -50,6 +50,7 @@ $PAGE->navbar->add($strimportentries); $PAGE->set_title($glossary->name); $PAGE->set_heading($course->fullname); $PAGE->set_secondary_active_tab('modulepage'); +$PAGE->activityheader->disable(); echo $OUTPUT->header(); echo $OUTPUT->heading($strimportentries); diff --git a/mod/glossary/showentry.php b/mod/glossary/showentry.php index 1bbc6aa9f1c..8a85f48ee81 100644 --- a/mod/glossary/showentry.php +++ b/mod/glossary/showentry.php @@ -40,6 +40,7 @@ if ($eid) { } $PAGE->set_pagelayout('incourse'); +$PAGE->activityheader->disable(); if ($entries) { foreach ($entries as $key => $entry) { diff --git a/mod/glossary/view.php b/mod/glossary/view.php index 4e7f2357f1d..e22ef571cac 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -297,23 +297,24 @@ if ($tab == GLOSSARY_APPROVAL_VIEW) { require_capability('mod/glossary:approve', $context); $PAGE->navbar->add($strwaitingapproval); } -echo $OUTPUT->header(); -$hassecondary = $PAGE->has_secondary_navigation(); -if (!$hassecondary) { - if ($tab == GLOSSARY_APPROVAL_VIEW) { - echo $OUTPUT->heading($strwaitingapproval); - } - echo $OUTPUT->heading(format_string($glossary->name), 2); +$hassecondary = $PAGE->has_secondary_navigation(); +if ($tab == GLOSSARY_APPROVAL_VIEW && !$hassecondary && $PAGE->activityheader->is_title_allowed()) { + $PAGE->activityheader->set_title( + $OUTPUT->heading($strwaitingapproval) . + $OUTPUT->heading(format_string($glossary->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); +if ($tab == GLOSSARY_APPROVAL_VIEW || !($glossary->intro && $showcommonelements)) { + $PAGE->activityheader->set_description(''); +} + +echo $OUTPUT->header(); if ($showcommonelements) { echo $renderer->main_action_bar($actionbar); } + /// All this depends if whe have $showcommonelements if ($showcommonelements) { /// To calculate available options @@ -368,11 +369,6 @@ if ($showcommonelements) { // print_box(' ', 'clearer'); } -/// Info box -if ($glossary->intro && $showcommonelements) { - echo $OUTPUT->box(format_module_intro('glossary', $glossary, $cm->id), 'generalbox', 'intro'); -} - require("tabs.php"); require("sql.php"); diff --git a/mod/h5pactivity/report.php b/mod/h5pactivity/report.php index cfc7a655af9..90837f8846a 100644 --- a/mod/h5pactivity/report.php +++ b/mod/h5pactivity/report.php @@ -84,6 +84,7 @@ $event->trigger(); $shortname = format_string($course->shortname, true, ['context' => $context]); $pagetitle = strip_tags($shortname.': '.format_string($moduleinstance->name)); $PAGE->set_title(format_string($pagetitle)); +$PAGE->activityheader->disable(); $navbar = []; if ($manager->can_view_all_attempts()) { diff --git a/mod/h5pactivity/view.php b/mod/h5pactivity/view.php index c66cba75bd1..012fedb6616 100644 --- a/mod/h5pactivity/view.php +++ b/mod/h5pactivity/view.php @@ -68,19 +68,8 @@ $PAGE->set_heading(format_string($course->fullname)); $PAGE->set_context($context); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($moduleinstance->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); $instance = $manager->get_instance(); -if (!empty($instance->intro)) { - echo $OUTPUT->box(format_module_intro('h5pactivity', $instance, $cm->id), 'generalbox', 'intro'); -} if (!$manager->is_tracking_enabled()) { $message = get_string('previewmode', 'mod_h5pactivity'); diff --git a/mod/imscp/view.php b/mod/imscp/view.php index fbffca914ad..15c7c595f1a 100644 --- a/mod/imscp/view.php +++ b/mod/imscp/view.php @@ -69,18 +69,6 @@ if (!$imscp->structure) { } echo $OUTPUT->header(); -echo $OUTPUT->heading(format_string($imscp->name)); - -// Render the activity information. -$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); -echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - -// Info box. -if ($imscp->intro) { - echo $OUTPUT->box(format_module_intro('imscp', $imscp, $cm->id), 'generalbox', 'intro'); -} imscp_print_content($imscp, $cm, $course); diff --git a/mod/lesson/import.php b/mod/lesson/import.php index 38d5c0f73be..c4cf6ddefd1 100644 --- a/mod/lesson/import.php +++ b/mod/lesson/import.php @@ -57,8 +57,11 @@ $mform->set_data($data); $PAGE->navbar->add($strimportquestions); $PAGE->set_title($strimportquestions); $PAGE->set_heading($course->fullname); + $PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' + ]); echo $OUTPUT->header(); - echo $OUTPUT->heading(format_string($lesson->name), 2); echo $OUTPUT->heading_with_help($strimportquestions, 'importquestions', 'lesson', '', '', 3); if ($data = $mform->get_data()) { diff --git a/mod/lesson/renderer.php b/mod/lesson/renderer.php index c105f32a657..6971b549668 100644 --- a/mod/lesson/renderer.php +++ b/mod/lesson/renderer.php @@ -53,42 +53,30 @@ class mod_lesson_renderer extends plugin_renderer_base { $this->page->set_title($title); $this->page->set_heading($this->page->course->fullname); lesson_add_header_buttons($cm, $context, $extraeditbuttons, $lessonpageid); + + $canmanage = has_capability('mod/lesson:manage', $context); + $activityheader = $this->page->activityheader; + $activitypage = new moodle_url('/mod/' . $this->page->activityname . '/view.php'); + $setactive = $activitypage->compare($this->page->url, URL_MATCH_BASE); + if ($activityheader->is_title_allowed()) { + $title = $canmanage && $setactive ? + $this->output->heading_with_help($activityname, 'overview', 'lesson') : + $activityname; + $activityheader->set_title($title); + } + + // If we have the capability to manage the lesson but not within the view page, + // there's no reason to show activity/completion information. + if ($canmanage && !$setactive) { + $activityheader->set_hidecompletion(true); + } + $output = $this->output->header(); - - $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); - if (has_capability('mod/lesson:manage', $context)) { - $activitypage = new moodle_url('/mod/' . $this->page->activityname . '/view.php'); - $setactive = $activitypage->compare($this->page->url, URL_MATCH_BASE); - if ($setactive) { - if (!$this->page->has_secondary_navigation()) { - $output .= $this->output->heading_with_help($activityname, 'overview', 'lesson'); - } - $output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates); - } - - // Info box. - if ($lesson->intro) { - $output .= $this->output->box(format_module_intro('lesson', $lesson, $cm->id), 'generalbox', 'intro'); - } - - if (!empty($currenttab) && !$this->page->has_secondary_navigation()) { - ob_start(); - include($CFG->dirroot.'/mod/lesson/tabs.php'); - $output .= ob_get_contents(); - ob_end_clean(); - } - } else { - if (!$this->page->has_secondary_navigation()) { - $output .= $this->output->heading($activityname); - } - $output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates); - - // Info box. - if ($lesson->intro) { - $output .= $this->output->box(format_module_intro('lesson', $lesson, $cm->id), 'generalbox', 'intro'); - } + if ($canmanage && !empty($currenttab) && !$this->page->has_secondary_navigation()) { + ob_start(); + include($CFG->dirroot.'/mod/lesson/tabs.php'); + $output .= ob_get_contents(); + ob_end_clean(); } foreach ($lesson->messages as $message) { diff --git a/mod/lti/view.php b/mod/lti/view.php index 6ad1258aa22..40759b6c4fe 100644 --- a/mod/lti/view.php +++ b/mod/lti/view.php @@ -106,26 +106,18 @@ $pagetitle = strip_tags($course->shortname.': '.format_string($lti->name)); $PAGE->set_title($pagetitle); $PAGE->set_heading($course->fullname); +$activityheader = $PAGE->activityheader; +if (!$lti->showtitlelaunch) { + $header['title'] = ''; +} +if (!$lti->showdescriptionlaunch) { + $header['description'] = ''; +} +$activityheader->set_attrs($header ?? []); + // Print the page header. echo $OUTPUT->header(); -if ($lti->showtitlelaunch) { - // Print the main part of the page. - if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($lti->name, true, array('context' => $context))); - } -} - -// Display 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); -echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - -if ($lti->showdescriptionlaunch && $lti->intro) { - echo $OUTPUT->box(format_module_intro('lti', $lti, $cm->id), 'generalbox description', 'intro'); -} - if ($typeid) { $config = lti_get_type_type_config($typeid); } else { diff --git a/mod/page/tests/behat/page_appearance.feature b/mod/page/tests/behat/page_appearance.feature index c7c2fe80bba..25ac48f38bb 100644 --- a/mod/page/tests/behat/page_appearance.feature +++ b/mod/page/tests/behat/page_appearance.feature @@ -16,9 +16,9 @@ Feature: Configure page appearance Scenario Outline: Hide and display page features Given I am on the "PageName1" "page activity editing" page logged in as admin And I expand all fieldsets - And I set the field "Display page name" to "" + And I set the field "" to "" And I press "Save and display" - Then I see "PageName1" in the "region-main" "region" + Then I see "" in the "region-main" "region" Examples: | feature | lookfor | value | shouldornot | diff --git a/mod/page/view.php b/mod/page/view.php index 9251056c158..3f34f956065 100644 --- a/mod/page/view.php +++ b/mod/page/view.php @@ -58,6 +58,15 @@ $PAGE->set_url('/mod/page/view.php', array('id' => $cm->id)); $options = empty($page->displayoptions) ? [] : (array) unserialize_array($page->displayoptions); +$activityheader = ['hidecompletion' => false]; +if (empty($options['printheading'])) { + $activityheader['title'] = ''; +} + +if (empty($options['printintro']) || !trim(strip_tags($page->intro))) { + $activityheader['description'] = ''; +} + if ($inpopup and $page->display == RESOURCELIB_DISPLAY_POPUP) { $PAGE->set_pagelayout('popup'); $PAGE->set_title($course->shortname.': '.$page->name); @@ -66,26 +75,12 @@ if ($inpopup and $page->display == RESOURCELIB_DISPLAY_POPUP) { $PAGE->set_title($course->shortname.': '.$page->name); $PAGE->set_heading($course->fullname); $PAGE->set_activity_record($page); -} -echo $OUTPUT->header(); -if (!isset($options['printheading']) || !empty($options['printheading'])) { - echo $OUTPUT->heading(format_string($page->name), 2); -} - -// Display 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); -echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - -if (!empty($options['printintro'])) { - if (trim(strip_tags($page->intro))) { - echo $OUTPUT->box_start('mod_introbox', 'pageintro'); - echo format_module_intro('page', $page, $cm->id); - echo $OUTPUT->box_end(); + if (!$PAGE->activityheader->is_title_allowed()) { + $activityheader['title'] = ""; } } - +$PAGE->activityheader->set_attrs($activityheader); +echo $OUTPUT->header(); $content = file_rewrite_pluginfile_urls($page->content, 'pluginfile.php', $context->id, 'mod_page', 'content', $page->revision); $formatoptions = new stdClass; $formatoptions->noclean = true; diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index e1fca018b2b..2bdf03287bf 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -128,7 +128,7 @@ $PAGE->blocks->add_fake_block($navbc, reset($regions)); $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 { diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php index 485dca0a3bb..9753b8d7597 100644 --- a/mod/quiz/edit.php +++ b/mod/quiz/edit.php @@ -182,6 +182,7 @@ $output = $PAGE->get_renderer('mod_quiz', 'edit'); $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(); diff --git a/mod/quiz/overridedelete.php b/mod/quiz/overridedelete.php index c163046b947..5f8004642f8 100644 --- a/mod/quiz/overridedelete.php +++ b/mod/quiz/overridedelete.php @@ -87,11 +87,12 @@ $PAGE->set_pagelayout('admin'); $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'); diff --git a/mod/quiz/overrideedit.php b/mod/quiz/overrideedit.php index 693f71c8b9d..2b6a5f8d997 100644 --- a/mod/quiz/overrideedit.php +++ b/mod/quiz/overrideedit.php @@ -241,10 +241,12 @@ $PAGE->navbar->add($pagetitle); $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(); diff --git a/mod/quiz/overrides.php b/mod/quiz/overrides.php index 0ac24319826..55e677863d8 100644 --- a/mod/quiz/overrides.php +++ b/mod/quiz/overrides.php @@ -68,6 +68,7 @@ $PAGE->set_url($url); $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"); diff --git a/mod/quiz/renderer.php b/mod/quiz/renderer.php index ce0e2136bb1..dcf2126abb7 100644 --- a/mod/quiz/renderer.php +++ b/mod/quiz/renderer.php @@ -972,24 +972,8 @@ class mod_quiz_renderer extends plugin_renderer_base { * @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); diff --git a/mod/quiz/report.php b/mod/quiz/report.php index 5ddc63cd579..d3e788c8b9c 100644 --- a/mod/quiz/report.php +++ b/mod/quiz/report.php @@ -65,7 +65,7 @@ $PAGE->set_url($url); 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'); diff --git a/mod/quiz/review.php b/mod/quiz/review.php index 16cf84dd360..40f746e661b 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -108,6 +108,7 @@ if ($attemptobj->is_own_preview()) { $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. ============================================================================ diff --git a/mod/quiz/summary.php b/mod/quiz/summary.php index 01461dccbf0..64186e64288 100644 --- a/mod/quiz/summary.php +++ b/mod/quiz/summary.php @@ -94,7 +94,7 @@ $PAGE->blocks->add_fake_block($navbc, reset($regions)); $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); diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 59f6d191122..5d343236662 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -143,6 +143,9 @@ if (!empty($grading_info->items)) { $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')) { diff --git a/mod/resource/deprecatedlib.php b/mod/resource/deprecatedlib.php new file mode 100644 index 00000000000..ae65ef718cd --- /dev/null +++ b/mod/resource/deprecatedlib.php @@ -0,0 +1,59 @@ +. + +/** + * List of deprecated mod_resource functions. + * + * @package mod_resource + * @copyright 2021 Peter D + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Print resource heading. + * + * @deprecated since Moodle 4.0 + * @param object $resource + * @param object $cm + * @param object $course + * @param bool $notused This variable is no longer used + * @return void + */ +function resource_print_heading($resource, $cm, $course, $notused = false) { + global $OUTPUT; + debugging('resource_print_heading is deprecated. Handled by activity_header now.', DEBUG_DEVELOPER); + echo $OUTPUT->heading(format_string($resource->name), 2); +} + +/** + * Print resource introduction. + * + * @deprecated since Moodle 4.0 + * @param object $resource + * @param object $cm + * @param object $course + * @param bool $ignoresettings print even if not specified in modedit + * @return void + */ +function resource_print_intro($resource, $cm, $course, $ignoresettings=false) { + global $OUTPUT; + debugging('resource_print_intro is deprecated. Handled by activity_header now.', DEBUG_DEVELOPER); + if ($intro = resource_get_intro($resource, $cm, $ignoresettings)) { + echo $OUTPUT->box_start('mod_introbox', 'resourceintro'); + echo $intro; + echo $OUTPUT->box_end(); + } +} diff --git a/mod/resource/locallib.php b/mod/resource/locallib.php index 1b7439d2232..4b6c3386c0a 100644 --- a/mod/resource/locallib.php +++ b/mod/resource/locallib.php @@ -61,7 +61,7 @@ function resource_redirect_if_migrated($oldid, $cmid) { * @return does not return */ function resource_display_embed($resource, $cm, $course, $file) { - global $PAGE, $OUTPUT, $USER; + global $PAGE, $OUTPUT; $clicktoopen = resource_get_clicktoopen($file, $resource->revision); @@ -99,19 +99,13 @@ function resource_display_embed($resource, $cm, $course, $file) { $code = resourcelib_embed_general($moodleurl, $title, $clicktoopen, $mimetype); } - resource_print_header($resource, $cm, $course); - resource_print_heading($resource, $cm, $course); + // Let the module handle the display. + $PAGE->activityheader->set_description(resource_get_intro($resource, $cm)); - // Display 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); - echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); + resource_print_header($resource, $cm, $course); echo format_text($code, FORMAT_HTML, ['noclean' => true]); - resource_print_intro($resource, $cm, $course); - echo $OUTPUT->footer(); die; } @@ -131,9 +125,8 @@ function resource_display_frame($resource, $cm, $course, $file) { if ($frame === 'top') { $PAGE->set_pagelayout('frametop'); + $PAGE->activityheader->set_description(resource_get_intro($resource, $cm, true)); resource_print_header($resource, $cm, $course); - resource_print_heading($resource, $cm, $course); - resource_print_intro($resource, $cm, $course); echo $OUTPUT->footer(); die; @@ -208,17 +201,12 @@ function resource_get_clicktodownload($file, $revision) { * @return does not return */ function resource_print_workaround($resource, $cm, $course, $file) { - global $CFG, $OUTPUT, $USER; + global $CFG, $OUTPUT, $PAGE; + + // Let the module handle the display. + $PAGE->activityheader->set_description(resource_get_intro($resource, $cm, true)); + resource_print_header($resource, $cm, $course); - resource_print_heading($resource, $cm, $course, true); - - // Display 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); - echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - - resource_print_intro($resource, $cm, $course, true); $resource->mainfile = $file->get_filename(); echo '
'; @@ -270,23 +258,6 @@ function resource_print_header($resource, $cm, $course) { echo $OUTPUT->header(); } -/** - * Print resource heading. - * @param object $resource - * @param object $cm - * @param object $course - * @param bool $notused This variable is no longer used - * @return void - */ -function resource_print_heading($resource, $cm, $course, $notused = false) { - global $OUTPUT, $PAGE; - - if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($resource->name), 2); - } -} - - /** * Gets details of the file to cache in course cache to be displayed using {@link resource_get_optional_details()} * @@ -415,16 +386,14 @@ function resource_get_optional_details($resource, $cm) { } /** - * Print resource introduction. + * Get resource introduction. + * * @param object $resource * @param object $cm - * @param object $course * @param bool $ignoresettings print even if not specified in modedit - * @return void + * @return string */ -function resource_print_intro($resource, $cm, $course, $ignoresettings=false) { - global $OUTPUT; - +function resource_get_intro(object $resource, object $cm, bool $ignoresettings = false): string { $options = empty($resource->displayoptions) ? [] : (array) unserialize_array($resource->displayoptions); $extraintro = resource_get_optional_details($resource, $cm); @@ -433,17 +402,18 @@ function resource_print_intro($resource, $cm, $course, $ignoresettings=false) { $extraintro = html_writer::tag('p', $extraintro, array('class' => 'resourcedetails')); } + $content = ""; if ($ignoresettings || !empty($options['printintro']) || $extraintro) { $gotintro = trim(strip_tags($resource->intro)); if ($gotintro || $extraintro) { - echo $OUTPUT->box_start('mod_introbox', 'resourceintro'); if ($gotintro) { - echo format_module_intro('resource', $resource, $cm->id); + $content = format_module_intro('resource', $resource, $cm->id); } - echo $extraintro; - echo $OUTPUT->box_end(); + $content .= $extraintro; } } + + return $content; } /** @@ -454,12 +424,10 @@ function resource_print_intro($resource, $cm, $course, $ignoresettings=false) { * @return void, does not return */ function resource_print_tobemigrated($resource, $cm, $course) { - global $DB, $OUTPUT; - + global $DB, $OUTPUT, $PAGE; + $PAGE->activityheader->set_description(resource_get_intro($resource, $cm)); $resource_old = $DB->get_record('resource_old', array('oldid'=>$resource->id)); resource_print_header($resource, $cm, $course); - resource_print_heading($resource, $cm, $course); - resource_print_intro($resource, $cm, $course); echo $OUTPUT->notification(get_string('notmigrated', 'resource', $resource_old->type)); echo $OUTPUT->footer(); die; @@ -473,12 +441,11 @@ function resource_print_tobemigrated($resource, $cm, $course) { * @return void, does not return */ function resource_print_filenotfound($resource, $cm, $course) { - global $DB, $OUTPUT; + global $DB, $OUTPUT, $PAGE; $resource_old = $DB->get_record('resource_old', array('oldid'=>$resource->id)); + $PAGE->activityheader->set_description(resource_get_intro($resource, $cm)); resource_print_header($resource, $cm, $course); - resource_print_heading($resource, $cm, $course); - resource_print_intro($resource, $cm, $course); if ($resource_old) { echo $OUTPUT->notification(get_string('notmigrated', 'resource', $resource_old->type)); } else { diff --git a/mod/resource/upgrade.txt b/mod/resource/upgrade.txt new file mode 100644 index 00000000000..288c2d39cc7 --- /dev/null +++ b/mod/resource/upgrade.txt @@ -0,0 +1,5 @@ +This files describes API changes in the quiz code. + +=== 4.0 === + +* Functions resource_print_heading and resource_print_intro have been deprecated in favour for the activity header. \ No newline at end of file diff --git a/mod/scorm/report.php b/mod/scorm/report.php index 8e4aeab26c7..a883fd0b6ad 100644 --- a/mod/scorm/report.php +++ b/mod/scorm/report.php @@ -86,12 +86,13 @@ if (empty($noheader)) { $PAGE->set_title("$course->shortname: ".format_string($scorm->name)); $PAGE->set_heading($course->fullname); + $PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' + ]); $PAGE->navbar->add($strreport, new moodle_url('/mod/scorm/report.php', array('id' => $cm->id))); echo $OUTPUT->header(); - if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($scorm->name)); - } } // Open the selected Scorm report and display it. diff --git a/mod/scorm/view.php b/mod/scorm/view.php index f83ccef99f4..6728929ec93 100644 --- a/mod/scorm/view.php +++ b/mod/scorm/view.php @@ -136,17 +136,9 @@ if (empty($preventskip) && empty($launch) && (has_capability('mod/scorm:skipview $PAGE->set_title($pagetitle); $PAGE->set_heading($course->fullname); +// Let the module handle the display. +$PAGE->activityheader->set_description(''); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($scorm->name)); -} - -// Display 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); -echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - if (!empty($action) && confirm_sesskey() && has_capability('mod/scorm:deleteownresponses', $contextmodule)) { if ($action == 'delete') { $confirmurl = new moodle_url($PAGE->url, array('action' => 'deleteconfirm')); diff --git a/mod/survey/report.php b/mod/survey/report.php index c289363e523..6fd60686891 100644 --- a/mod/survey/report.php +++ b/mod/survey/report.php @@ -94,15 +94,16 @@ $PAGE->set_title("$course->shortname: ".format_string($survey->name)); $PAGE->set_heading($course->fullname); + $PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' + ]); // Activate the secondary nav tab. navigation_node::override_active_url(new moodle_url('/mod/survey/report.php', ['id' => $id, 'action' => 'summary'])); $actionbar = new \mod_survey\output\actionbar($id, $action, $url); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($survey->name)); -} $renderer = $PAGE->get_renderer('mod_survey'); echo $renderer->response_actionbar($actionbar); diff --git a/mod/survey/view.php b/mod/survey/view.php index 2ddfe863ca0..5ccfc3d7005 100644 --- a/mod/survey/view.php +++ b/mod/survey/view.php @@ -70,15 +70,12 @@ if ($surveyalreadydone) { $strsurvey = get_string("modulename", "survey"); $PAGE->set_title($survey->name); $PAGE->set_heading($course->fullname); -echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($survey->name)); +// No need to show the description if the survey is done and a graph page is to be shown. +if ($surveyalreadydone && $showscales) { + $PAGE->activityheader->set_description(''); } -// 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); +echo $OUTPUT->header(); // Check to see if groups are being used in this survey. if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used. @@ -119,7 +116,6 @@ if ($surveyalreadydone) { } else { - echo $OUTPUT->box(format_module_intro('survey', $survey, $cm->id), 'generalbox', 'intro'); echo $OUTPUT->spacer(array('height' => 30, 'width' => 1), true); // Should be done with CSS instead. $questions = survey_get_questions($survey); @@ -147,7 +143,6 @@ echo '
'; echo ""; echo ""; -echo $OUTPUT->box(format_module_intro('survey', $survey, $cm->id), 'generalbox boxaligncenter bowidthnormal', 'intro'); echo '
'. get_string('allquestionrequireanswer', 'survey'). '
'; // Get all the major questions in order. diff --git a/mod/url/deprecatedlib.php b/mod/url/deprecatedlib.php new file mode 100644 index 00000000000..87530d7f9fd --- /dev/null +++ b/mod/url/deprecatedlib.php @@ -0,0 +1,59 @@ +. + +/** + * List of deprecated mod_url functions. + * + * @package mod_url + * @copyright 2021 Peter D + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Print url heading. + * + * @deprecated since 4.0 + * @param object $url + * @param object $cm + * @param object $course + * @param bool $notused This variable is no longer used. + * @return void + */ +function url_print_heading($url, $cm, $course, $notused = false) { + global $OUTPUT; + debugging('url_print_heading is deprecated. Handled by activity_header now.', DEBUG_DEVELOPER); + echo $OUTPUT->heading(format_string($url->name), 2); +} + +/** + * Print url introduction. + * + * @deprecated since 4.0 + * @param object $url + * @param object $cm + * @param object $course + * @param bool $ignoresettings print even if not specified in modedit + * @return void + */ +function url_print_intro($url, $cm, $course, $ignoresettings=false) { + global $OUTPUT; + debugging('url_print_intro is deprecated. Handled by activity_header now.', DEBUG_DEVELOPER); + if ($intro = url_get_intro($url, $cm, $ignoresettings)) { + echo $OUTPUT->box_start('mod_introbox', 'urlintro'); + echo $intro; + echo $OUTPUT->box_end(); + } +} diff --git a/mod/url/locallib.php b/mod/url/locallib.php index 7aca2eb4c59..1144202faa9 100644 --- a/mod/url/locallib.php +++ b/mod/url/locallib.php @@ -172,37 +172,22 @@ function url_print_header($url, $cm, $course) { } /** - * Print url heading. + * Get url introduction. + * * @param object $url * @param object $cm - * @param object $course - * @param bool $notused This variable is no longer used. - * @return void - */ -function url_print_heading($url, $cm, $course, $notused = false) { - global $OUTPUT; - echo $OUTPUT->heading(format_string($url->name), 2); -} - -/** - * Print url introduction. - * @param object $url - * @param object $cm - * @param object $course * @param bool $ignoresettings print even if not specified in modedit - * @return void + * @return string */ -function url_print_intro($url, $cm, $course, $ignoresettings=false) { - global $OUTPUT; - +function url_get_intro(object $url, object $cm, bool $ignoresettings = false): string { $options = empty($url->displayoptions) ? [] : (array) unserialize_array($url->displayoptions); if ($ignoresettings or !empty($options['printintro'])) { if (trim(strip_tags($url->intro))) { - echo $OUTPUT->box_start('mod_introbox', 'urlintro'); - echo format_module_intro('url', $url, $cm->id); - echo $OUTPUT->box_end(); + return format_module_intro('url', $url, $cm->id); } } + + return ''; } /** @@ -219,9 +204,11 @@ function url_display_frame($url, $cm, $course) { if ($frame === 'top') { $PAGE->set_pagelayout('frametop'); + $PAGE->activityheader->set_attrs([ + 'description' => url_get_intro($url, $cm), + 'title' => format_string($url->name) + ]); url_print_header($url, $cm, $course); - url_print_heading($url, $cm, $course); - url_print_intro($url, $cm, $course); echo $OUTPUT->footer(); die; @@ -268,20 +255,9 @@ EOF; function url_print_workaround($url, $cm, $course) { global $OUTPUT, $PAGE, $USER; + $PAGE->activityheader->set_description(url_get_intro($url, $cm, true)); url_print_header($url, $cm, $course); - if (!$PAGE->has_secondary_navigation()) { - url_print_heading($url, $cm, $course, true); - } - - // Display 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); - echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); - - url_print_intro($url, $cm, $course, true); - $fullurl = url_get_full_url($url, $cm, $course); $display = url_get_final_display_type($url); @@ -316,7 +292,7 @@ function url_print_workaround($url, $cm, $course) { * @return does not return */ function url_display_embed($url, $cm, $course) { - global $PAGE, $OUTPUT, $USER; + global $PAGE, $OUTPUT; $mimetype = resourcelib_guess_url_mimetype($url->externalurl); $fullurl = url_get_full_url($url, $cm, $course); @@ -346,21 +322,11 @@ function url_display_embed($url, $cm, $course) { $code = resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype); } + $PAGE->activityheader->set_description(url_get_intro($url, $cm)); url_print_header($url, $cm, $course); - if (!$PAGE->has_secondary_navigation()) { - url_print_heading($url, $cm, $course); - } - - // Display 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); - echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); echo $code; - url_print_intro($url, $cm, $course); - echo $OUTPUT->footer(); die; } diff --git a/mod/url/upgrade.txt b/mod/url/upgrade.txt new file mode 100644 index 00000000000..cbc598a736d --- /dev/null +++ b/mod/url/upgrade.txt @@ -0,0 +1,5 @@ +This files describes API changes in the quiz code. + +=== 4.0 === + +* Functions url_print_heading and url_print_intro have been deprecated in favour for the activity header. \ No newline at end of file diff --git a/mod/url/view.php b/mod/url/view.php index 1068a6e5545..00119759a57 100644 --- a/mod/url/view.php +++ b/mod/url/view.php @@ -57,11 +57,8 @@ $PAGE->set_url('/mod/url/view.php', array('id' => $cm->id)); // Do not use PARAM_URL here, it is too strict and does not support general URIs! $exturl = trim($url->externalurl); if (empty($exturl) or $exturl === 'http://') { + $PAGE->activityheader->set_description(url_get_intro($url, $cm)); url_print_header($url, $cm, $course); - if (!$PAGE->has_secondary_navigation()) { - url_print_heading($url, $cm, $course); - } - url_print_intro($url, $cm, $course); notice(get_string('invalidstoredurl', 'url'), new moodle_url('/course/view.php', array('id'=>$cm->course))); die; } diff --git a/mod/wiki/files.php b/mod/wiki/files.php index 16f3f732e89..06e62d079d5 100644 --- a/mod/wiki/files.php +++ b/mod/wiki/files.php @@ -89,20 +89,9 @@ $PAGE->navbar->add(format_string(get_string('wikifiles', 'wiki'))); $PAGE->set_secondary_active_tab('modulepage'); echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($wiki->name)); -} - -// Render the activity information. -$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); -echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates); $renderer = $PAGE->get_renderer('mod_wiki'); -echo $OUTPUT->box(format_module_intro('wiki', $wiki, $PAGE->cm->id), 'generalbox', 'intro'); - $actionbar = new \mod_wiki\output\action_bar($pageid, $PAGE->url); echo $renderer->render_action_bar($actionbar); diff --git a/mod/wiki/filesedit.php b/mod/wiki/filesedit.php index 41d363ebd32..e292abf1cfd 100644 --- a/mod/wiki/filesedit.php +++ b/mod/wiki/filesedit.php @@ -79,6 +79,9 @@ $PAGE->set_heading($course->fullname); $PAGE->navbar->add(format_string(get_string('wikifiles', 'wiki')), $CFG->wwwroot . '/mod/wiki/files.php?pageid=' . $pageid); $PAGE->navbar->add(format_string($title)); $PAGE->set_secondary_active_tab('modulepage'); +$PAGE->activityheader->set_attrs([ + 'hidecompletion' => true +]); $data = new stdClass(); $data->returnurl = $returnurl; @@ -98,8 +101,6 @@ if ($mform->is_cancelled()) { } echo $OUTPUT->header(); -echo $OUTPUT->heading(format_string($wiki->name)); -echo $OUTPUT->box(format_module_intro('wiki', $wiki, $PAGE->cm->id), 'generalbox', 'intro'); echo $OUTPUT->box_start('generalbox'); $mform->display(); echo $OUTPUT->box_end(); diff --git a/mod/wiki/pagelib.php b/mod/wiki/pagelib.php index 97e4e2709f7..8496d3978cf 100644 --- a/mod/wiki/pagelib.php +++ b/mod/wiki/pagelib.php @@ -125,7 +125,7 @@ abstract class page_wiki { * This method prints the top of the page. */ function print_header() { - global $OUTPUT, $PAGE, $CFG, $USER, $SESSION; + global $OUTPUT, $PAGE, $SESSION; $PAGE->set_heading($PAGE->course->fullname); @@ -138,12 +138,6 @@ abstract class page_wiki { $this->create_navbar(); echo $OUTPUT->header(); - $wiki = $PAGE->activityrecord; - if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($wiki->name)); - } - - echo $this->wikioutput->wiki_info(); if (!empty($this->page)) { echo $this->action_bar($this->page->id, $PAGE->url); diff --git a/mod/wiki/renderer.php b/mod/wiki/renderer.php index 78214a19bbc..dcd68384dbf 100644 --- a/mod/wiki/renderer.php +++ b/mod/wiki/renderer.php @@ -234,9 +234,21 @@ class mod_wiki_renderer extends plugin_renderer_base { return $output; } + + /** + * Print the wiki activity information and intro + * + * @return string + * @deprecated since 4.0. Now handled in PAGE's activity header + */ public function wiki_info() { global $USER; + debugging( + 'wiki_info() is deprecated. Output is handled within the $PAGE->activityheader instead.', + DEBUG_DEVELOPER + ); + // Display any activity information (eg completion requirements / dates). $cminfo = cm_info::create($this->page->cm); $completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id); diff --git a/mod/wiki/upgrade.txt b/mod/wiki/upgrade.txt index 6f643bf87b8..00c7cf67bcd 100644 --- a/mod/wiki/upgrade.txt +++ b/mod/wiki/upgrade.txt @@ -1,5 +1,7 @@ This files describes API changes in /mod/wiki/*, information provided here is intended especially for developers. +=== 4.0 === +* wiki_info has been deprecated. Output will be handled within the $PAGE->activityheader instead. === 3.8 === * The following functions have been finally deprecated and can not be used anymore: diff --git a/mod/workshop/allocation.php b/mod/workshop/allocation.php index b6e727bc6a8..eb5166d2646 100644 --- a/mod/workshop/allocation.php +++ b/mod/workshop/allocation.php @@ -48,6 +48,10 @@ require_capability('mod/workshop:allocate', $context); $PAGE->set_title($workshop->name); $PAGE->set_heading($course->fullname); $PAGE->navbar->add(get_string('allocation', 'workshop'), $workshop->allocation_url($method)); +$PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' +]); $allocator = $workshop->allocator_instance($method); $initresult = $allocator->init(); @@ -59,10 +63,6 @@ $actionbar = new \mod_workshop\output\actionbar($url, $workshop); $output = $PAGE->get_renderer('mod_workshop'); echo $output->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($workshop->name)); -} - echo $actionbar->get_allocation_menu(); if (is_null($initresult->get_status()) or $initresult->get_status() == workshop_allocation_result::STATUS_VOID) { diff --git a/mod/workshop/assessment.php b/mod/workshop/assessment.php index dbe56ed4d7b..7ba78456600 100644 --- a/mod/workshop/assessment.php +++ b/mod/workshop/assessment.php @@ -53,6 +53,11 @@ $workshop = new workshop($workshop, $cm, $course); $PAGE->set_url($workshop->assess_url($assessment->id)); $PAGE->set_title($workshop->name); $PAGE->set_heading($course->fullname); +$PAGE->activityheader->set_attrs([ + "hidecompletion" => true, + "description" => "" +]); + $PAGE->navbar->add(get_string('assessingsubmission', 'workshop')); $PAGE->set_secondary_active_tab('modulepage'); @@ -75,9 +80,6 @@ if ($assessmenteditable) { list($assessed, $notice) = $workshop->check_examples_assessed_before_assessment($assessment->reviewerid); if (!$assessed) { echo $output->header(); - if (!$PAGE->has_secondary_navigation()) { - echo $output->heading(format_string($workshop->name)); - } notice(get_string($notice, 'workshop'), new moodle_url('/mod/workshop/view.php', array('id' => $cm->id))); echo $output->footer(); exit; @@ -158,9 +160,6 @@ if ($canoverridegrades or $cansetassessmentweight) { // output starts here $output = $PAGE->get_renderer('mod_workshop'); // workshop renderer echo $output->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $output->heading(format_string($workshop->name)); -} echo $output->heading(get_string('assessedsubmission', 'workshop'), 3); $submission = $workshop->get_submission_by_id($submission->id); // reload so can be passed to the renderer diff --git a/mod/workshop/editform.php b/mod/workshop/editform.php index b799b9adb68..8da5fcb09ea 100644 --- a/mod/workshop/editform.php +++ b/mod/workshop/editform.php @@ -43,6 +43,10 @@ $workshop = new workshop($workshop, $cm, $course); $PAGE->set_url($workshop->editform_url()); $PAGE->set_title($workshop->name); $PAGE->set_heading($course->fullname); +$PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' +]); $PAGE->navbar->add(get_string('editingassessmentform', 'workshop')); // load the grading strategy logic @@ -73,9 +77,6 @@ if ($mform->is_cancelled()) { // Output starts here echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($workshop->name)); -} echo $OUTPUT->heading(get_string('pluginname', 'workshopform_' . $workshop->strategy), 3); $mform->display(); diff --git a/mod/workshop/editformpreview.php b/mod/workshop/editformpreview.php index 77c50ed3a0b..bb5c42e671b 100644 --- a/mod/workshop/editformpreview.php +++ b/mod/workshop/editformpreview.php @@ -44,6 +44,10 @@ $PAGE->set_heading($course->fullname); $PAGE->navbar->add(get_string('editingassessmentform', 'workshop'), $workshop->editform_url(), navigation_node::TYPE_CUSTOM); $PAGE->navbar->add(get_string('previewassessmentform', 'workshop')); $PAGE->set_secondary_active_tab('workshopassessement'); +$PAGE->activityheader->set_attrs([ + "hidecompletion" => true, + "description" => '' +]); $currenttab = 'editform'; // load the grading strategy logic @@ -54,9 +58,6 @@ $mform = $strategy->get_assessment_form($workshop->editform_url(), 'preview'); // output starts here echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($workshop->name)); -} echo $OUTPUT->heading(get_string('assessmentform', 'workshop'), 3); $mform->display(); echo $OUTPUT->footer(); diff --git a/mod/workshop/submission.php b/mod/workshop/submission.php index a179a01cc31..0b92ee326f5 100644 --- a/mod/workshop/submission.php +++ b/mod/workshop/submission.php @@ -175,6 +175,10 @@ if (!$edit and ($canoverride or $canpublish)) { $PAGE->set_title($workshop->name); $PAGE->set_heading($course->fullname); +$PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' +]); if ($edit) { $PAGE->navbar->add(get_string('mysubmission', 'workshop'), $workshop->submission_url(), navigation_node::TYPE_CUSTOM); $PAGE->navbar->add(get_string('editingsubmission', 'workshop')); @@ -187,9 +191,6 @@ if ($edit) { // Output starts here $output = $PAGE->get_renderer('mod_workshop'); echo $output->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $output->heading(format_string($workshop->name), 2); -} echo $output->heading(get_string('mysubmission', 'workshop'), 3); // show instructions for submitting as thay may contain some list of questions and we need to know them diff --git a/mod/workshop/switchphase.php b/mod/workshop/switchphase.php index d30d46cf572..60bcef9f781 100644 --- a/mod/workshop/switchphase.php +++ b/mod/workshop/switchphase.php @@ -52,6 +52,10 @@ if ($confirm) { $PAGE->set_title($workshop->name); $PAGE->set_heading($course->fullname); +$PAGE->activityheader->set_attrs([ + 'hidecompletion' => true, + 'description' => '' +]); $PAGE->navbar->add(get_string('switchingphase', 'workshop')); $PAGE->set_secondary_active_tab("modulepage"); @@ -60,10 +64,6 @@ $PAGE->set_secondary_active_tab("modulepage"); // Output starts here // echo $OUTPUT->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(format_string($workshop->name)); -} - $continuebtn = new single_button( new moodle_url($PAGE->url, array('confirm' => 1)), get_string('continue'), 'post', true); $continuebtn->class .= ' mr-3'; diff --git a/mod/workshop/view.php b/mod/workshop/view.php index 638581b0e85..149ce97ed6e 100644 --- a/mod/workshop/view.php +++ b/mod/workshop/view.php @@ -97,20 +97,18 @@ if ($eval) { redirect($PAGE->url); } +$heading = $OUTPUT->heading_with_help(format_string($workshop->name), 'userplan', 'workshop'); +$heading = preg_replace('/]*>([.\s\S]*)<\/h2>/', '$1', $heading); +$PAGE->activityheader->set_attrs([ + 'title' => $PAGE->activityheader->is_title_allowed() ? $heading : "", + 'description' => '' +]); + $output = $PAGE->get_renderer('mod_workshop'); /// Output starts here echo $output->header(); -if (!$PAGE->has_secondary_navigation()) { - echo $output->heading_with_help(format_string($workshop->name), 'userplan', 'workshop'); -} - -// Display 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); -echo $output->activity_information($cminfo, $completiondetails, $activitydates); // Output action buttons here. switch ($workshop->phase) { diff --git a/question/bank/editquestion/question.php b/question/bank/editquestion/question.php index aa1b68380b7..0403cf344af 100644 --- a/question/bank/editquestion/question.php +++ b/question/bank/editquestion/question.php @@ -337,6 +337,7 @@ if ($mform->is_cancelled()) { $streditingquestion = $qtypeobj->get_heading(); $PAGE->set_title($streditingquestion); $PAGE->set_heading($COURSE->fullname); +$PAGE->activityheader->disable(); $PAGE->navbar->add($streditingquestion); // Display a heading, question editing form and possibly some extra content needed for diff --git a/question/bank/exportquestions/export.php b/question/bank/exportquestions/export.php index 7bc3ae2b7f7..c5a3a1e20b4 100644 --- a/question/bank/exportquestions/export.php +++ b/question/bank/exportquestions/export.php @@ -46,6 +46,7 @@ $category = $DB->get_record('question_categories', ["id" => $catid, 'contextid' $PAGE->set_url($thispageurl); $PAGE->set_title($strexportquestions); $PAGE->set_heading($COURSE->fullname); +$PAGE->activityheader->disable(); // Print horizontal nav if needed. $renderer = $PAGE->get_renderer('core_question', 'bank'); diff --git a/question/bank/importquestions/import.php b/question/bank/importquestions/import.php index 62e3c8a1865..a1957ab7740 100644 --- a/question/bank/importquestions/import.php +++ b/question/bank/importquestions/import.php @@ -73,6 +73,7 @@ if ($importform->is_cancelled()) { // Page header. $PAGE->set_title($txt->importquestions); $PAGE->set_heading($COURSE->fullname); +$PAGE->activityheader->disable(); // Print horizontal nav if needed. $renderer = $PAGE->get_renderer('core_question', 'bank'); diff --git a/question/bank/managecategories/category.php b/question/bank/managecategories/category.php index 96b55591d6b..a76021258bd 100644 --- a/question/bank/managecategories/category.php +++ b/question/bank/managecategories/category.php @@ -147,6 +147,7 @@ if ($param->edit) { $PAGE->set_title(get_string('editcategories', 'question')); $PAGE->set_heading($COURSE->fullname); +$PAGE->activityheader->disable(); // Print horizontal nav if needed. $renderer = $PAGE->get_renderer('core_question', 'bank'); diff --git a/question/edit.php b/question/edit.php index 2c7138a6340..aaa3a948945 100644 --- a/question/edit.php +++ b/question/edit.php @@ -42,6 +42,7 @@ $context = $contexts->lowest(); $streditingquestions = get_string('editquestions', 'question'); $PAGE->set_title($streditingquestions); $PAGE->set_heading($COURSE->fullname); +$PAGE->activityheader->disable(); // Print horizontal nav if needed. $renderer = $PAGE->get_renderer('core_question', 'bank'); diff --git a/theme/boost/config.php b/theme/boost/config.php index ac1c0edbb33..bb67a323795 100644 --- a/theme/boost/config.php +++ b/theme/boost/config.php @@ -102,17 +102,31 @@ $THEME->layouts = [ 'options' => array('langmenu' => true), ), - // Pages that appear in pop-up windows - no navigation, no blocks, no header. + // Pages that appear in pop-up windows - no navigation, no blocks, no header and bare activity header. 'popup' => array( 'file' => 'columns1.php', 'regions' => array(), - 'options' => array('nofooter' => true, 'nonavbar' => true), + 'options' => array( + 'nofooter' => true, + 'nonavbar' => true, + 'activityheader' => [ + 'notitle' => true, + 'nocompletion' => true, + 'nodescription' => true + ] + ) ), // No blocks and minimal footer - used for legacy frame layouts only! 'frametop' => array( 'file' => 'columns1.php', 'regions' => array(), - 'options' => array('nofooter' => true, 'nocoursefooter' => true), + 'options' => array( + 'nofooter' => true, + 'nocoursefooter' => true, + 'activityheader' => [ + 'nocompletion' => true + ] + ), ), // Embeded pages, like iframe/object embeded in moodleform - it needs as much space as possible. 'embedded' => array( @@ -131,7 +145,7 @@ $THEME->layouts = [ 'print' => array( 'file' => 'columns1.php', 'regions' => array(), - 'options' => array('nofooter' => true, 'nonavbar' => false), + 'options' => array('nofooter' => true, 'nonavbar' => false, 'noactivityheader' => true), ), // The pagelayout used when a redirection is occuring. 'redirect' => array( @@ -164,3 +178,7 @@ $THEME->addblockposition = BLOCK_ADDBLOCK_POSITION_FLATNAV; $THEME->iconsystem = \core\output\icon_system::FONTAWESOME; $THEME->haseditswitch = true; $THEME->usescourseindex = true; +// By default, all boost theme do not need their titles displayed. +$THEME->activityheaderconfig = [ + 'notitle' => true +]; diff --git a/theme/boost/layout/columns1.php b/theme/boost/layout/columns1.php index d5b041211d7..44d07b53d01 100644 --- a/theme/boost/layout/columns1.php +++ b/theme/boost/layout/columns1.php @@ -25,12 +25,17 @@ defined('MOODLE_INTERNAL') || die(); $bodyattributes = $OUTPUT->body_attributes([]); - $templatecontext = [ 'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]), 'output' => $OUTPUT, - 'bodyattributes' => $bodyattributes + 'bodyattributes' => $bodyattributes, ]; +if (empty($PAGE->layout_options['noactivityheader'])) { + $header = $PAGE->activityheader; + $renderer = $PAGE->get_renderer('core'); + $templatecontext['headercontent'] = $header->export_for_template($renderer); +} + echo $OUTPUT->render_from_template('theme_boost/columns1', $templatecontext); diff --git a/theme/boost/layout/columns2.php b/theme/boost/layout/columns2.php index 9c34f59575f..57eee18e079 100644 --- a/theme/boost/layout/columns2.php +++ b/theme/boost/layout/columns2.php @@ -71,6 +71,9 @@ $buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_action // If the settings menu will be included in the header then don't add it here. $regionmainsettingsmenu = $buildregionmainsettings ? $OUTPUT->region_main_settings_menu() : false; +$header = $PAGE->activityheader; +$headercontent = $header->export_for_template($renderer); + $templatecontext = [ 'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]), 'output' => $OUTPUT, @@ -84,7 +87,8 @@ $templatecontext = [ 'langmenu' => $primarymenu['lang'], 'regionmainsettingsmenu' => $regionmainsettingsmenu, 'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu), - 'overflow' => $overflow + 'headercontent' => $headercontent, + 'overflow' => $overflow, ]; $nav = $PAGE->flatnav; $templatecontext['firstcollectionlabel'] = $nav->get_collectionlabel(); diff --git a/theme/boost/layout/drawers.php b/theme/boost/layout/drawers.php index aa74077bbff..17e2e124902 100644 --- a/theme/boost/layout/drawers.php +++ b/theme/boost/layout/drawers.php @@ -96,6 +96,9 @@ $buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_action // If the settings menu will be included in the header then don't add it here. $regionmainsettingsmenu = $buildregionmainsettings ? $OUTPUT->region_main_settings_menu() : false; +$header = $PAGE->activityheader; +$headercontent = $header->export_for_template($renderer); + $templatecontext = [ 'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]), 'output' => $OUTPUT, @@ -113,7 +116,8 @@ $templatecontext = [ 'forceblockdraweropen' => $forceblockdraweropen, 'regionmainsettingsmenu' => $regionmainsettingsmenu, 'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu), - 'overflow' => $overflow + 'overflow' => $overflow, + 'headercontent' => $headercontent, ]; $nav = $PAGE->flatnav; diff --git a/theme/boost/templates/columns1.mustache b/theme/boost/templates/columns1.mustache index 51fb23efedb..d2965a73b71 100644 --- a/theme/boost/templates/columns1.mustache +++ b/theme/boost/templates/columns1.mustache @@ -50,6 +50,9 @@
{{{ output.course_content_header }}} + {{#headercontent}} + {{> core/activity_header }} + {{/headercontent}} {{{ output.main_content }}} {{{ output.activity_navigation }}} {{{ output.course_content_footer }}} diff --git a/theme/boost/templates/columns2.mustache b/theme/boost/templates/columns2.mustache index 8aa1c386b3d..64ce7ba797a 100644 --- a/theme/boost/templates/columns2.mustache +++ b/theme/boost/templates/columns2.mustache @@ -79,6 +79,9 @@
{{/hasregionmainsettingsmenu}} {{{ output.course_content_header }}} + {{#headercontent}} + {{> core/activity_header }} + {{/headercontent}} {{#overflow}} {{> core/url_select}} {{/overflow}} diff --git a/theme/boost/templates/drawers.mustache b/theme/boost/templates/drawers.mustache index c6a4c3f20fd..4b92080a340 100644 --- a/theme/boost/templates/drawers.mustache +++ b/theme/boost/templates/drawers.mustache @@ -140,6 +140,9 @@
{{/hasregionmainsettingsmenu}} {{{ output.course_content_header }}} + {{#headercontent}} + {{> core/activity_header }} + {{/headercontent}} {{#overflow}} {{> core/url_select}} {{/overflow}} diff --git a/theme/boost/tests/behat/blacklist.json b/theme/boost/tests/behat/blacklist.json index ec554c22e0b..88e88a26eb5 100644 --- a/theme/boost/tests/behat/blacklist.json +++ b/theme/boost/tests/behat/blacklist.json @@ -6,6 +6,7 @@ "course/tests/behat/activity_navigation.feature", "course/tests/behat/activity_navigation_with_restrictions.feature", "course/tests/behat/paged_course_navigation.feature", - "course/tests/behat/section_visibility.feature" + "course/tests/behat/section_visibility.feature", + "mod/page/tests/behat/page_appearance.feature" ] } diff --git a/theme/classic/config.php b/theme/classic/config.php index da07493f375..0f6aff0fd3b 100644 --- a/theme/classic/config.php +++ b/theme/classic/config.php @@ -101,13 +101,26 @@ $THEME->layouts = [ 'popup' => array( 'file' => 'contentonly.php', 'regions' => array(), - 'options' => array('nofooter' => true, 'nonavbar' => true), + 'options' => array( + 'nofooter' => true, + 'nonavbar' => true, + 'activityheader' => [ + 'notitle' => true, + 'nocompletion' => true, + 'nodescription' => true + ] + ), ), // No blocks and minimal footer - used for legacy frame layouts only! 'frametop' => array( 'file' => 'contentonly.php', 'regions' => array(), - 'options' => array('nofooter' => true, 'nocoursefooter' => true), + 'options' => array( + 'nofooter' => true, + 'nocoursefooter' => true, + 'activityheader' => [ + 'nocompletion' => true + ]), ), // Embeded pages, like iframe/object embeded in moodleform - it needs as much space as possible. 'embedded' => array( @@ -127,7 +140,7 @@ $THEME->layouts = [ 'print' => array( 'file' => 'contentonly.php', 'regions' => array(), - 'options' => array('nofooter' => true, 'nonavbar' => false), + 'options' => array('nofooter' => true, 'nonavbar' => false, 'noactivityheader' => true), ), // The pagelayout used when a redirection is occuring. 'redirect' => array( diff --git a/theme/classic/layout/columns.php b/theme/classic/layout/columns.php index 61269028113..2d66771e795 100644 --- a/theme/classic/layout/columns.php +++ b/theme/classic/layout/columns.php @@ -31,6 +31,9 @@ $blockspost = $OUTPUT->blocks('side-post'); $hassidepre = $PAGE->blocks->region_has_content('side-pre', $OUTPUT); $hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT); $PAGE->has_secondary_navigation_setter(false); +$renderer = $PAGE->get_renderer('core'); +$header = $PAGE->activityheader; +$headercontent = $header->export_for_template($renderer); $templatecontext = [ 'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]), @@ -39,7 +42,8 @@ $templatecontext = [ 'sidepostblocks' => $blockspost, 'haspreblocks' => $hassidepre, 'haspostblocks' => $hassidepost, - 'bodyattributes' => $bodyattributes + 'bodyattributes' => $bodyattributes, + 'headercontent' => $headercontent, ]; echo $OUTPUT->render_from_template('theme_classic/columns', $templatecontext); diff --git a/theme/classic/layout/contentonly.php b/theme/classic/layout/contentonly.php index 253b3da76f8..de7f8f0bd2b 100644 --- a/theme/classic/layout/contentonly.php +++ b/theme/classic/layout/contentonly.php @@ -31,6 +31,11 @@ $templatecontext = [ 'output' => $OUTPUT, 'bodyattributes' => $bodyattributes ]; +if (empty($PAGE->layout_options['noactivityheader'])) { + $header = $PAGE->activityheader; + $renderer = $PAGE->get_renderer('core'); + $templatecontext['headercontent'] = $header->export_for_template($renderer); +} echo $OUTPUT->render_from_template('theme_classic/contentonly', $templatecontext); diff --git a/theme/classic/templates/columns.mustache b/theme/classic/templates/columns.mustache index 87dd7774cf3..36b54558b05 100644 --- a/theme/classic/templates/columns.mustache +++ b/theme/classic/templates/columns.mustache @@ -71,6 +71,9 @@
{{/hasregionmainsettingsmenu}} {{{ output.course_content_header }}} + {{#headercontent}} + {{> core/activity_header }} + {{/headercontent}} {{{ output.main_content }}} {{{ output.activity_navigation }}} {{{ output.course_content_footer }}} diff --git a/theme/classic/templates/contentonly.mustache b/theme/classic/templates/contentonly.mustache index 2e4e1f7bb38..b4045d64225 100644 --- a/theme/classic/templates/contentonly.mustache +++ b/theme/classic/templates/contentonly.mustache @@ -56,6 +56,9 @@
{{{ output.course_content_header }}} + {{#headercontent}} + {{> core/activity_header }} + {{/headercontent}} {{{ output.main_content }}} {{{ output.activity_navigation }}} {{{ output.course_content_footer }}} diff --git a/version.php b/version.php index 9bf293d2fbb..42c73d2078d 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2021121000.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2021121000.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.0dev+ (Build: 20211210)'; // Human-friendly version name