Skip to content

Commit

Permalink
MDL-72413 wiki: Use the common module for setting the header
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Dias committed Dec 13, 2021
1 parent 7fa1354 commit a677934
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
11 changes: 0 additions & 11 deletions mod/wiki/files.php
Expand Up @@ -89,20 +89,9 @@
$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);

Expand Down
5 changes: 3 additions & 2 deletions mod/wiki/filesedit.php
Expand Up @@ -79,6 +79,9 @@
$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;
Expand All @@ -98,8 +101,6 @@
}

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();
Expand Down
8 changes: 1 addition & 7 deletions mod/wiki/pagelib.php
Expand Up @@ -125,7 +125,7 @@ public function __construct($wiki, $subwiki, $cm, ?string $activesecondarytab =
* 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);

Expand All @@ -138,12 +138,6 @@ function print_header() {
$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);
Expand Down
12 changes: 12 additions & 0 deletions mod/wiki/renderer.php
Expand Up @@ -234,9 +234,21 @@ public function diff_paging_bar($minpage, $maxpage, $page, $baseurl, $pagevar =

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);
Expand Down
2 changes: 2 additions & 0 deletions 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:
Expand Down

0 comments on commit a677934

Please sign in to comment.