From 72e9984a79d9a21ee73188d1ee1a412fbcd5ed8b Mon Sep 17 00:00:00 2001 From: Sesostris Vieira Date: Mon, 10 Mar 2014 17:23:21 -0300 Subject: [PATCH] =?UTF-8?q?Permitir=20emiss=C3=A3o=20de=20certificado=20ap?= =?UTF-8?q?enas=20ap=C3=B3s=20conclus=C3=A3o=20do=20curso?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lang/en/certificate.php | 4 +++- view.php | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lang/en/certificate.php b/lang/en/certificate.php index 88e9d34..d90abf9 100644 --- a/lang/en/certificate.php +++ b/lang/en/certificate.php @@ -201,4 +201,6 @@ $string['verifycertificate'] = 'Verify Certificate'; $string['viewcertificateviews'] = 'View {$a} issued certificates'; $string['viewed'] = 'You received this certificate on:'; $string['viewtranscript'] = 'View Certificates'; -$string['watermark'] = 'Watermark'; \ No newline at end of file +$string['watermark'] = 'Watermark'; +$string['completionrequired'] = "

You have not completed the course.


+

While the criteria for course completion are not met, the certificate can not be issued.

"; diff --git a/view.php b/view.php index e251af1..283d71c 100644 --- a/view.php +++ b/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 $certrecord = certificate_get_issue($course, $USER, $certificate, $cm);