Added helper function to issue certificates
This commit is contained in:
parent
f0b8292779
commit
3c6a8b97f3
4 changed files with 24 additions and 25 deletions
|
@ -130,15 +130,7 @@ class email_certificate_task extends \core\task\scheduled_task {
|
|||
array('userid' => $enroluser->id, 'customcertid' => $customcert->id));
|
||||
if (empty($issueid)) {
|
||||
// Ok, issue them the certificate.
|
||||
$customcertissue = new \stdClass();
|
||||
$customcertissue->customcertid = $customcert->id;
|
||||
$customcertissue->userid = $enroluser->id;
|
||||
$customcertissue->code = \mod_customcert\certificate::generate_code();
|
||||
$customcertissue->emailed = 0;
|
||||
$customcertissue->timecreated = time();
|
||||
|
||||
// Insert the record into the database.
|
||||
$issueid = $DB->insert_record('customcert_issues', $customcertissue);
|
||||
$issueid = \mod_customcert\certificate::issue_certificate($customcert->id, $enroluser->id);
|
||||
}
|
||||
|
||||
// Add them to the array so we email them.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue