#203 Consistency among headings/titles on all pages
This commit is contained in:
parent
9d27015a5f
commit
c1a70c763e
8 changed files with 86 additions and 47 deletions
24
edit.php
24
edit.php
|
@ -51,19 +51,31 @@ $context = context::instance_by_id($contextid);
|
|||
if ($context->contextlevel == CONTEXT_MODULE) {
|
||||
$cm = get_coursemodule_from_id('customcert', $context->instanceid, 0, false, MUST_EXIST);
|
||||
require_login($cm->course, false, $cm);
|
||||
|
||||
$customcert = $DB->get_record('customcert', ['id' => $cm->instance], '*', MUST_EXIST);
|
||||
$title = $customcert->name;
|
||||
$heading = format_string($title);
|
||||
} else {
|
||||
require_login();
|
||||
$title = $SITE->fullname;
|
||||
$heading = $title;
|
||||
}
|
||||
|
||||
require_capability('mod/customcert:manage', $context);
|
||||
|
||||
// Set up the page.
|
||||
\mod_customcert\page_helper::page_setup($pageurl, $context, get_string('editcustomcert', 'customcert'));
|
||||
\mod_customcert\page_helper::page_setup($pageurl, $context, $title);
|
||||
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM) {
|
||||
// We are managing a template - add some navigation.
|
||||
$PAGE->navbar->add(get_string('managetemplates', 'customcert'),
|
||||
new moodle_url('/mod/customcert/manage_templates.php'));
|
||||
$PAGE->navbar->add(get_string('editcustomcert', 'customcert'));
|
||||
if (!$tid) {
|
||||
$PAGE->navbar->add(get_string('editcustomcert', 'customcert'));
|
||||
} else {
|
||||
$PAGE->navbar->add(get_string('editcustomcert', 'customcert'),
|
||||
new moodle_url('/mod/customcert/edit.php', ['tid' => $tid]));
|
||||
}
|
||||
}
|
||||
|
||||
// Flag to determine if we are deleting anything.
|
||||
|
@ -140,11 +152,9 @@ if ($tid) {
|
|||
// Check if we are deleting either a page or an element.
|
||||
if ($deleting) {
|
||||
// Show a confirmation page.
|
||||
$strheading = get_string('deleteconfirm', 'customcert');
|
||||
$PAGE->navbar->add($strheading);
|
||||
$PAGE->set_title($strheading);
|
||||
$PAGE->navbar->add(get_string('deleteconfirm', 'customcert'));
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strheading);
|
||||
echo $OUTPUT->heading($heading);
|
||||
echo $OUTPUT->confirm($message, $yesurl, $nourl);
|
||||
echo $OUTPUT->footer();
|
||||
exit();
|
||||
|
@ -230,7 +240,7 @@ if ($data = $mform->get_data()) {
|
|||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('editcustomcert', 'customcert'));
|
||||
echo $OUTPUT->heading($heading);
|
||||
$mform->display();
|
||||
if ($tid && $context->contextlevel == CONTEXT_MODULE) {
|
||||
$loadtemplateurl = new moodle_url('/mod/customcert/load_template.php', array('tid' => $tid));
|
||||
|
|
|
@ -41,6 +41,15 @@ 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;
|
||||
}
|
||||
|
||||
if ($action == 'edit') {
|
||||
// The id of the element must be supplied if we are currently editing one.
|
||||
$id = required_param('id', PARAM_INT);
|
||||
|
@ -56,7 +65,6 @@ if ($action == 'edit') {
|
|||
}
|
||||
|
||||
// Set up the page.
|
||||
$title = get_string('editelement', 'customcert');
|
||||
\mod_customcert\page_helper::page_setup($pageurl, $template->get_context(), $title);
|
||||
|
||||
// Additional page setup.
|
||||
|
@ -66,7 +74,7 @@ if ($template->get_context()->contextlevel == CONTEXT_SYSTEM) {
|
|||
}
|
||||
$PAGE->navbar->add(get_string('editcustomcert', 'customcert'), new moodle_url('/mod/customcert/edit.php',
|
||||
array('tid' => $tid)));
|
||||
$PAGE->navbar->add($title);
|
||||
$PAGE->navbar->add(get_string('editelement', 'customcert'));
|
||||
|
||||
$mform = new \mod_customcert\edit_element_form($pageurl, array('element' => $element));
|
||||
|
||||
|
@ -95,6 +103,6 @@ if ($data = $mform->get_data()) {
|
|||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('editelement', 'customcert'));
|
||||
echo $OUTPUT->heading($heading);
|
||||
$mform->display();
|
||||
echo $OUTPUT->footer();
|
||||
|
|
|
@ -170,6 +170,7 @@ $string['verifyallcertificates_desc'] = 'When this setting is enabled any person
|
|||
|
||||
Note - this only applies to certificates where \'Allow anyone to verify a certificate\' has been set to \'Yes\' in the certificate settings.';
|
||||
$string['verifycertificate'] = 'Verify certificate';
|
||||
$string['verifycertificatedesc'] = 'This link will take you to a new screen where you will be able to verify certificates on the site';
|
||||
$string['verifycertificateanyone'] = 'Allow anyone to verify a certificate';
|
||||
$string['verifycertificateanyone_help'] = 'This setting enables anyone with the certificate verification link (including users not logged in) to verify a certificate.';
|
||||
$string['viewcustomcertissues'] = 'View {$a} issued certificates';
|
||||
|
|
|
@ -46,12 +46,20 @@ $context = context::instance_by_id($contextid);
|
|||
require_login();
|
||||
require_capability('mod/customcert:manage', $context);
|
||||
|
||||
$title = $SITE->fullname;
|
||||
$heading = $title;
|
||||
|
||||
// Set up the page.
|
||||
$pageurl = new moodle_url('/mod/customcert/manage_templates.php');
|
||||
\mod_customcert\page_helper::page_setup($pageurl, $context, get_string('managetemplates', 'customcert'));
|
||||
\mod_customcert\page_helper::page_setup($pageurl, $context, $title);
|
||||
|
||||
// Additional page setup.
|
||||
$PAGE->navbar->add(get_string('managetemplates', 'customcert'));
|
||||
if ($tid && $action && confirm_sesskey()) {
|
||||
$PAGE->navbar->add(get_string('managetemplates', 'customcert'),
|
||||
new moodle_url('/mod/customcert/manage_templates.php'));
|
||||
} else {
|
||||
$PAGE->navbar->add(get_string('managetemplates', 'customcert'));
|
||||
}
|
||||
|
||||
if ($tid) {
|
||||
if ($action && confirm_sesskey()) {
|
||||
|
@ -69,12 +77,10 @@ if ($tid) {
|
|||
if ($action == 'delete') {
|
||||
if (!$confirm) {
|
||||
// Show a confirmation page.
|
||||
$strheading = get_string('deleteconfirm', 'customcert');
|
||||
$PAGE->navbar->add($strheading);
|
||||
$PAGE->set_title($strheading);
|
||||
$PAGE->navbar->add(get_string('deleteconfirm', 'customcert'));
|
||||
$message = get_string('deletetemplateconfirm', 'customcert');
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strheading);
|
||||
echo $OUTPUT->heading($heading);
|
||||
echo $OUTPUT->confirm($message, $yesurl, $nourl);
|
||||
echo $OUTPUT->footer();
|
||||
exit();
|
||||
|
@ -88,12 +94,10 @@ if ($tid) {
|
|||
} else if ($action == 'duplicate') {
|
||||
if (!$confirm) {
|
||||
// Show a confirmation page.
|
||||
$strheading = get_string('duplicateconfirm', 'customcert');
|
||||
$PAGE->navbar->add($strheading);
|
||||
$PAGE->set_title($strheading);
|
||||
$PAGE->navbar->add(get_string('duplicateconfirm', 'customcert'));
|
||||
$message = get_string('duplicatetemplateconfirm', 'customcert');
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strheading);
|
||||
echo $OUTPUT->heading($heading);
|
||||
echo $OUTPUT->confirm($message, $yesurl, $nourl);
|
||||
echo $OUTPUT->footer();
|
||||
exit();
|
||||
|
@ -120,6 +124,7 @@ $table = new \mod_customcert\manage_templates_table($context);
|
|||
$table->define_baseurl($pageurl);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($heading);
|
||||
$table->out($perpage, false);
|
||||
$url = new moodle_url('/mod/customcert/edit.php?contextid=' . $contextid);
|
||||
echo $OUTPUT->single_button($url, get_string('createtemplate', 'customcert'), 'get');
|
||||
|
|
24
report.php
24
report.php
|
@ -48,6 +48,19 @@ require_login($course, false, $cm);
|
|||
$context = context_module::instance($cm->id);
|
||||
require_capability('mod/customcert:viewreport', $context);
|
||||
|
||||
// Set up the page.
|
||||
$title = $customcert->name;
|
||||
$heading = format_string($title);
|
||||
\mod_customcert\page_helper::page_setup($pageurl, $context, $title);
|
||||
|
||||
// Additional page setup.
|
||||
if ($deleteissue && confirm_sesskey()) {
|
||||
$PAGE->navbar->add(get_string('listofissues', 'customcert'),
|
||||
new moodle_url('/mod/customcert/report.php', ['id' => $id]));
|
||||
} else {
|
||||
$PAGE->navbar->add(get_string('listofissues', 'customcert'));
|
||||
}
|
||||
|
||||
if ($deleteissue && confirm_sesskey()) {
|
||||
require_capability('mod/customcert:manage', $context);
|
||||
|
||||
|
@ -63,13 +76,10 @@ if ($deleteissue && confirm_sesskey()) {
|
|||
);
|
||||
|
||||
// Show a confirmation page.
|
||||
$strheading = get_string('deleteconfirm', 'customcert');
|
||||
$PAGE->navbar->add($strheading);
|
||||
$PAGE->set_title($strheading);
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->navbar->add(get_string('deleteconfirm', 'customcert'));
|
||||
$message = get_string('deleteissueconfirm', 'customcert');
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strheading);
|
||||
echo $OUTPUT->heading($heading);
|
||||
echo $OUTPUT->confirm($message, $yesurl, $nourl);
|
||||
echo $OUTPUT->footer();
|
||||
exit();
|
||||
|
@ -103,11 +113,7 @@ if ($table->is_downloading()) {
|
|||
exit();
|
||||
}
|
||||
|
||||
// Set up the page.
|
||||
\mod_customcert\page_helper::page_setup($pageurl, $context, $customcert->name);
|
||||
|
||||
// Additional page setup.
|
||||
$PAGE->navbar->add(get_string('listofissues', 'customcert'));
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($customcert->name), 2);
|
||||
|
|
|
@ -35,6 +35,10 @@ $settings->add(new admin_setting_configcheckbox('customcert/showposxy',
|
|||
get_string('showposxy_desc', 'customcert'),
|
||||
0));
|
||||
|
||||
$settings->add(new \mod_customcert\admin_setting_link('customcert/verifycertificate',
|
||||
get_string('verifycertificate', 'customcert'), get_string('verifycertificatedesc', 'customcert'),
|
||||
get_string('verifycertificate', 'customcert'), new moodle_url('/mod/customcert/verify_certificate.php'), ''));
|
||||
|
||||
$settings->add(new \mod_customcert\admin_setting_link('customcert/managetemplates',
|
||||
get_string('managetemplates', 'customcert'), get_string('managetemplatesdesc', 'customcert'),
|
||||
get_string('managetemplates', 'customcert'), new moodle_url('/mod/customcert/manage_templates.php'), ''));
|
||||
|
|
|
@ -33,7 +33,7 @@ $struploadimage = get_string('uploadimage', 'customcert');
|
|||
|
||||
// Set the page variables.
|
||||
$pageurl = new moodle_url('/mod/customcert/upload_image.php');
|
||||
\mod_customcert\page_helper::page_setup($pageurl, $context, $struploadimage, $SITE->fullname);
|
||||
\mod_customcert\page_helper::page_setup($pageurl, $context, $SITE->fullname);
|
||||
|
||||
// Additional page setup.
|
||||
$PAGE->navbar->add($struploadimage);
|
||||
|
@ -50,5 +50,6 @@ if ($uploadform->is_cancelled()) {
|
|||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($SITE->fullname);
|
||||
$uploadform->display();
|
||||
echo $OUTPUT->footer();
|
||||
|
|
|
@ -33,6 +33,10 @@ $context = context::instance_by_id($contextid);
|
|||
// Set up the page.
|
||||
$pageurl = new moodle_url('/mod/customcert/verify_certificate.php', array('contextid' => $contextid));
|
||||
|
||||
if ($code) {
|
||||
$pageurl->param('code', $code);
|
||||
}
|
||||
|
||||
// Ok, a certificate was specified.
|
||||
if ($context->contextlevel != CONTEXT_SYSTEM) {
|
||||
$cm = get_coursemodule_from_id('customcert', $context->instanceid, 0, false, MUST_EXIST);
|
||||
|
@ -49,36 +53,36 @@ if ($context->contextlevel != CONTEXT_SYSTEM) {
|
|||
$PAGE->set_cm($cm, $course);
|
||||
}
|
||||
|
||||
$title = $customcert->name;
|
||||
$heading = format_string($title);
|
||||
$checkallofsite = false;
|
||||
} else {
|
||||
$title = $SITE->fullname;
|
||||
$heading = $title;
|
||||
$checkallofsite = true;
|
||||
}
|
||||
|
||||
\mod_customcert\page_helper::page_setup($pageurl, $context, $title);
|
||||
|
||||
// Additional page setup.
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM) {
|
||||
$PAGE->navbar->add(get_string('verifycertificate', 'customcert'));
|
||||
}
|
||||
|
||||
if ($checkallofsite) {
|
||||
// If the 'verifyallcertificates' is not set and the user does not have the capability 'mod/customcert:verifyallcertificates'
|
||||
// then show them a message letting them know they can not proceed.
|
||||
$verifyallcertificates = get_config('customcert', 'verifyallcertificates');
|
||||
$canverifyallcertificates = has_capability('mod/customcert:verifyallcertificates', $context);
|
||||
if (!$verifyallcertificates && !$canverifyallcertificates) {
|
||||
$strheading = get_string('verifycertificate', 'customcert');
|
||||
$PAGE->navbar->add($strheading);
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_title($strheading);
|
||||
$PAGE->set_url($pageurl);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strheading);
|
||||
echo $OUTPUT->heading($heading);
|
||||
echo $OUTPUT->notification(get_string('cannotverifyallcertificates', 'customcert'));
|
||||
echo $OUTPUT->footer();
|
||||
exit();
|
||||
}
|
||||
|
||||
$checkallofsite = true;
|
||||
}
|
||||
|
||||
if ($code) {
|
||||
$pageurl->param('code', $code);
|
||||
}
|
||||
|
||||
$PAGE->set_url($pageurl);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_title(get_string('verifycertificate', 'customcert'));
|
||||
|
||||
// The form we are using to verify these codes.
|
||||
$form = new \mod_customcert\verify_certificate_form($pageurl);
|
||||
|
||||
|
@ -124,7 +128,7 @@ if ($form->get_data()) {
|
|||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('verifycertificate', 'customcert'));
|
||||
echo $OUTPUT->heading($heading);
|
||||
echo $form->display();
|
||||
if (isset($result)) {
|
||||
$renderer = $PAGE->get_renderer('mod_customcert');
|
||||
|
|
Loading…
Reference in a new issue