diff --git a/element/date/classes/element.php b/element/date/classes/element.php index e03e655..c91662e 100644 --- a/element/date/classes/element.php +++ b/element/date/classes/element.php @@ -68,12 +68,15 @@ class element extends \mod_customcert\element { * @param \mod_customcert\edit_element_form $mform the edit_form instance */ public function render_form_elements($mform) { - global $COURSE; + global $CFG, $COURSE; // Get the possible date options. $dateoptions = array(); $dateoptions[CUSTOMCERT_DATE_ISSUE] = get_string('issueddate', 'customcertelement_date'); - $dateoptions[CUSTOMCERT_DATE_COMPLETION] = get_string('completiondate', 'customcertelement_date'); + $completionenabled = $CFG->enablecompletion && $COURSE->enablecompletion; + if ($completionenabled) { + $dateoptions[CUSTOMCERT_DATE_COMPLETION] = get_string('completiondate', 'customcertelement_date'); + } $dateoptions[CUSTOMCERT_DATE_COURSE_START] = get_string('coursestartdate', 'customcertelement_date'); $dateoptions[CUSTOMCERT_DATE_COURSE_END] = get_string('courseenddate', 'customcertelement_date'); $dateoptions[CUSTOMCERT_DATE_COURSE_GRADE] = get_string('coursegradedate', 'customcertelement_date');