Fix the issue with displaying PDF when debugging is ON (#420)
This commit is contained in:
parent
47061f8737
commit
1859ffa651
2 changed files with 11 additions and 11 deletions
|
@ -272,15 +272,15 @@ class template {
|
||||||
$customcert = $DB->get_record('customcert', ['templateid' => $this->id]);
|
$customcert = $DB->get_record('customcert', ['templateid' => $this->id]);
|
||||||
|
|
||||||
// If the template belongs to a certificate then we need to check what permissions we set for it.
|
// If the template belongs to a certificate then we need to check what permissions we set for it.
|
||||||
$protection = $customcert->protection;
|
if (!empty($customcert->protection)) {
|
||||||
if (!empty($protection)) {
|
$protection = explode(', ', $customcert->protection);
|
||||||
$protection = explode(', ', $protection);
|
|
||||||
$pdf->SetProtection($protection);
|
$pdf->SetProtection($protection);
|
||||||
}
|
}
|
||||||
|
|
||||||
$deliveryoption = $customcert->deliveryoption;
|
if (empty($customcert->deliveryoption)) {
|
||||||
if (empty($deliveryoption)) {
|
|
||||||
$deliveryoption = certificate::DELIVERY_OPTION_INLINE;
|
$deliveryoption = certificate::DELIVERY_OPTION_INLINE;
|
||||||
|
} else {
|
||||||
|
$deliveryoption = $customcert->deliveryoption;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->setPrintHeader(false);
|
$pdf->setPrintHeader(false);
|
||||||
|
|
|
@ -52,6 +52,12 @@ if (($userid != $USER->id) && !has_capability('mod/customcert:viewallcertificate
|
||||||
print_error('You are not allowed to view these certificates');
|
print_error('You are not allowed to view these certificates');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$PAGE->set_url($pageurl);
|
||||||
|
$PAGE->set_context(context_user::instance($userid));
|
||||||
|
$PAGE->set_title(get_string('mycertificates', 'customcert'));
|
||||||
|
$PAGE->set_pagelayout('standard');
|
||||||
|
$PAGE->navigation->extend_for_user($user);
|
||||||
|
|
||||||
// Check if we requested to download a certificate.
|
// Check if we requested to download a certificate.
|
||||||
if ($downloadcert) {
|
if ($downloadcert) {
|
||||||
$template = $DB->get_record('customcert_templates', array('id' => $customcert->templateid), '*', MUST_EXIST);
|
$template = $DB->get_record('customcert_templates', array('id' => $customcert->templateid), '*', MUST_EXIST);
|
||||||
|
@ -68,12 +74,6 @@ if ($table->is_downloading()) {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$PAGE->set_url($pageurl);
|
|
||||||
$PAGE->set_context(context_user::instance($userid));
|
|
||||||
$PAGE->set_title(get_string('mycertificates', 'customcert'));
|
|
||||||
$PAGE->set_pagelayout('standard');
|
|
||||||
$PAGE->navigation->extend_for_user($user);
|
|
||||||
|
|
||||||
// Additional page setup.
|
// Additional page setup.
|
||||||
$PAGE->navbar->add(get_string('profile'), new moodle_url('/user/profile.php', array('id' => $userid)));
|
$PAGE->navbar->add(get_string('profile'), new moodle_url('/user/profile.php', array('id' => $userid)));
|
||||||
$PAGE->navbar->add(get_string('mycertificates', 'customcert'));
|
$PAGE->navbar->add(get_string('mycertificates', 'customcert'));
|
||||||
|
|
Loading…
Reference in a new issue