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

This commit is contained in:
Peter Dias 2021-09-22 10:58:17 +08:00
parent 7fa1354496
commit a6779348f4
5 changed files with 18 additions and 20 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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: