#203 Added missing consistency changes for headings/titles

This commit is contained in:
Mark Nelson 2018-06-26 20:11:01 +08:00
parent 5d6e1e4250
commit 002cebd47c
2 changed files with 27 additions and 2 deletions

View file

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

View file

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