Check that a certificate issue exists (#269)
This commit is contained in:
parent
01e427cf57
commit
4f583679d0
1 changed files with 5 additions and 0 deletions
|
@ -30,6 +30,11 @@ $downloadcert = optional_param('downloadcert', '', PARAM_BOOL);
|
||||||
if ($downloadcert) {
|
if ($downloadcert) {
|
||||||
$certificateid = required_param('certificateid', PARAM_INT);
|
$certificateid = required_param('certificateid', PARAM_INT);
|
||||||
$customcert = $DB->get_record('customcert', array('id' => $certificateid), '*', MUST_EXIST);
|
$customcert = $DB->get_record('customcert', array('id' => $certificateid), '*', MUST_EXIST);
|
||||||
|
|
||||||
|
// Check there exists an issued certificate for this user.
|
||||||
|
if (!$issue = $DB->get_record('customcert_issues', ['userid' => $userid, 'customcertid' => $customcert->id])) {
|
||||||
|
throw new moodle_exception('You have not been issued a certificate');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$page = optional_param('page', 0, PARAM_INT);
|
$page = optional_param('page', 0, PARAM_INT);
|
||||||
$perpage = optional_param('perpage', \mod_customcert\certificate::CUSTOMCERT_PER_PAGE, PARAM_INT);
|
$perpage = optional_param('perpage', \mod_customcert\certificate::CUSTOMCERT_PER_PAGE, PARAM_INT);
|
||||||
|
|
Loading…
Reference in a new issue