Browse Source

Permitir emissão de certificado apenas após conclusão do curso

temp
Sesostris Vieira 11 years ago
parent
commit
72e9984a79
  1. 4
      lang/en/certificate.php
  2. 6
      view.php

4
lang/en/certificate.php

@ -201,4 +201,6 @@ $string['verifycertificate'] = 'Verify Certificate';
$string['viewcertificateviews'] = 'View {$a} issued certificates'; $string['viewcertificateviews'] = 'View {$a} issued certificates';
$string['viewed'] = 'You received this certificate on:'; $string['viewed'] = 'You received this certificate on:';
$string['viewtranscript'] = 'View Certificates'; $string['viewtranscript'] = 'View Certificates';
$string['watermark'] = 'Watermark'; $string['watermark'] = 'Watermark';
$string['completionrequired'] = "<p><strong>You have not completed the course.</strong></p><br/>
<p>While the criteria for course completion are not met, the certificate can not be issued.</p>";

6
view.php

@ -84,6 +84,12 @@ if ($certificate->requiredtime && !has_capability('mod/certificate:manage', $con
} }
} }
// Check if the user has completed the course
if (!$completion->is_course_complete($USER->id) && !has_capability('mod/certificate:manage', $context)) {
notice(get_string('completionrequired','certificate'), "$CFG->wwwroot/course/view.php?id=$course->id");
die;
}
// Create new certificate record, or return existing record // Create new certificate record, or return existing record
$certrecord = certificate_get_issue($course, $USER, $certificate, $cm); $certrecord = certificate_get_issue($course, $USER, $certificate, $cm);

Loading…
Cancel
Save