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

This commit is contained in:
Peter Dias 2021-09-21 16:17:17 +08:00
parent ab40bc5962
commit 8a510c31d1
6 changed files with 17 additions and 20 deletions

View File

@ -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 = "<b>".format_string($entry->concept)."</b><p>$strareyousuredelete</p>";
$linkyes = 'deleteentry.php';

View File

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

View File

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

View File

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

View File

@ -40,6 +40,7 @@ if ($eid) {
}
$PAGE->set_pagelayout('incourse');
$PAGE->activityheader->disable();
if ($entries) {
foreach ($entries as $key => $entry) {

View File

@ -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('&nbsp;', '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");