From 002cebd47c03fb7fc8ea299a841e346e0f2e3605 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Tue, 26 Jun 2018 20:11:01 +0800 Subject: [PATCH] #203 Added missing consistency changes for headings/titles --- load_template.php | 17 ++++++++++++++++- rearrange.php | 12 +++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/load_template.php b/load_template.php index e962e33..2daa771 100644 --- a/load_template.php +++ b/load_template.php @@ -41,6 +41,15 @@ if ($cm = $template->get_cm()) { } $template->require_manage(); +if ($template->get_context()->contextlevel == CONTEXT_MODULE) { + $customcert = $DB->get_record('customcert', ['id' => $cm->instance], '*', MUST_EXIST); + $title = $customcert->name; + $heading = format_string($title); +} else { + $title = $SITE->fullname; + $heading = $title; +} + // Check that they have confirmed they wish to load the template. if ($confirm && confirm_sesskey()) { // First, remove all the existing elements and pages. @@ -77,9 +86,15 @@ $yesurl = new moodle_url('/mod/customcert/load_template.php', array('tid' => $ti 'sesskey' => sesskey())); $pageurl = new moodle_url('/mod/customcert/load_template.php', array('tid' => $tid, 'ltid' => $ltid)); -\mod_customcert\page_helper::page_setup($pageurl, $template->get_context(), get_string('loadtemplate', 'customcert')); +\mod_customcert\page_helper::page_setup($pageurl, $template->get_context(), $title); + +$str = get_string('editcustomcert', 'customcert'); +$link = new moodle_url('/mod/customcert/edit.php', array('tid' => $template->get_id())); +$PAGE->navbar->add($str, new \action_link($link, $str)); +$PAGE->navbar->add(get_string('loadtemplate', 'customcert')); // Show a confirmation page. echo $OUTPUT->header(); +echo $OUTPUT->heading($heading); echo $OUTPUT->confirm(get_string('loadtemplatemsg', 'customcert'), $yesurl, $nourl); echo $OUTPUT->footer(); \ No newline at end of file diff --git a/rearrange.php b/rearrange.php index 5505422..78f40ad 100644 --- a/rearrange.php +++ b/rearrange.php @@ -42,9 +42,18 @@ if ($cm = $template->get_cm()) { // Make sure the user has the required capabilities. $template->require_manage(); +if ($template->get_context()->contextlevel == CONTEXT_MODULE) { + $customcert = $DB->get_record('customcert', ['id' => $cm->instance], '*', MUST_EXIST); + $title = $customcert->name; + $heading = format_string($title); +} else { + $title = $SITE->fullname; + $heading = $title; +} + // Set the $PAGE settings. $pageurl = new moodle_url('/mod/customcert/rearrange.php', array('pid' => $pid)); -\mod_customcert\page_helper::page_setup($pageurl, $template->get_context(), get_string('rearrangeelements', 'customcert')); +\mod_customcert\page_helper::page_setup($pageurl, $template->get_context(), $title); // Add more links to the navigation. if (!$cm = $template->get_cm()) { @@ -115,6 +124,7 @@ if ($page->rightmargin) { $html .= html_writer::end_tag('div'); echo $OUTPUT->header(); +echo $OUTPUT->heading($heading); echo $OUTPUT->heading(get_string('rearrangeelementsheading', 'customcert'), 4); echo $html; $PAGE->requires->js_call_amd('mod_customcert/rearrange-area', 'init', array('#pdf'));