193 $status = $this->parameters[
'status'] ?? \ilLpStatus::LP_STATUS_NOT_ATTEMPTED_NUM;
195 $settings =
new ilSetting(
'certificate');
198 $objectId = $this->parameters[
'obj_id'] ?? 0;
199 $userId = $this->parameters[
'usr_id'] ?? 0;
201 $type = $this->objectDataCache->lookupType($objectId);
203 $this->logger->info(sprintf(
204 "Certificate evaluation triggered, received 'completed' learning progress for: usr_id: %s/obj_id: %s/type: %s",
210 if ($this->certificateClassMap->typeExistsInMap(
$type)) {
212 $template = $this->templateRepository->fetchCurrentlyActiveCertificate($objectId);
214 if (
true ===
$template->isCurrentlyActive()) {
215 $this->logger->info(sprintf(
216 "Trigger persisting certificate achievement for: usr_id: %s/obj_id: %s/type: %s/template_id: %s",
224 $this->logger->info(sprintf(
225 "Did not trigger certificate achievement for inactive template: usr_id: %s/obj_id: %s/type: %s/template_id: %s",
233 $this->logger->info(sprintf(
234 "Did not find an active certificate template for case: usr_id: %s/obj_id: %s/type: %s",
241 $this->logger->info(sprintf(
242 "Object type is not of interest, skipping certificate evaluation for this object" 246 if (
$type ===
'crs') {
248 'Skipping handling for course, because courses cannot be certificate trigger ' .
249 '(with globally disabled learning progress) for other certificate enabled objects' 255 'Triggering certificate evaluation of possible depending course objects ...' 260 $progressEvaluation = new \ilCertificateCourseLearningProgressEvaluation(
$templateRepository);
262 $templatesOfCompletedCourses = $progressEvaluation->evaluate($refId, $userId);
263 if (0 === count($templatesOfCompletedCourses)) {
264 $this->logger->info(sprintf(
265 "No dependent course certificate template configuration found for child object: usr_id: %s/obj_id: %s/ref_id: %s/type: %s",
274 foreach ($templatesOfCompletedCourses as $courseTemplate) {
277 $courseObjectId = $courseTemplate->getObjId();
279 if (
true === $courseTemplate->isCurrentlyActive()) {
280 $type = $this->objectDataCache->lookupType($courseObjectId);
282 $this->logger->info(sprintf(
283 "Trigger persisting certificate achievement for: usr_id: %s/obj_id: %s/type: %s/template_id: %s",
287 $courseTemplate->getId()
289 $this->
processEntry(
$type, $courseObjectId, $userId, $courseTemplate, $settings);
291 $this->logger->info(sprintf(
292 "Did not trigger certificate achievement for inactive template: usr_id: %s/obj_id: %s/type: %s/template_id: %s",
296 $courseTemplate->getId()
300 $this->logger->warning($exception->getMessage());
307 'Finished certificate evaluation' const LP_STATUS_COMPLETED_NUM
static _getAllReferences($a_id)
get all reference ids of object
processEntry($type, $objectId, int $userId, ilCertificateTemplate $template, ilSetting $settings)