mirror of
https://github.com/moodle/moodle.git
synced 2025-04-23 09:23:09 +02:00
MDL-72413 page: Use the common module for setting the header
This commit is contained in:
parent
a6779348f4
commit
468204450c
@ -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 "<value>"
|
||||
And I set the field "<feature>" to "<value>"
|
||||
And I press "Save and display"
|
||||
Then I <shouldornot> see "PageName1" in the "region-main" "region"
|
||||
Then I <shouldornot> see "<lookfor>" in the "region-main" "region"
|
||||
|
||||
Examples:
|
||||
| feature | lookfor | value | shouldornot |
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user