19 declare(strict_types=1);
41 if (null === $setting) {
46 if (null === $objectHelper) {
51 if (null === $statusHelper) {
55 if (null === $trackingHelper) {
68 $courseTemplates = $this->templateRepository
69 ->fetchActiveCertificateTemplatesForCoursesWithDisabledLearningProgress(
70 $this->trackingHelper->enabledLearningProgress(),
74 $templatesOfCompletedCourses = [];
75 foreach ($courseTemplates as $courseTemplate) {
76 $courseObjectId = $courseTemplate->getObjId();
78 $subItems = $this->setting->get(
'cert_subitems_' . $courseObjectId);
79 if ($subItems === null) {
82 $subItems = json_decode($subItems,
true, 512, JSON_THROW_ON_ERROR);
83 if (!is_array($subItems)) {
87 $subitem_obj_ids = [];
88 foreach ($subItems as $subItemRefId) {
89 $subitem_obj_ids[$subItemRefId] = $this->objectHelper->lookupObjId((
int) $subItemRefId);
92 if (in_array($refId, $subItems)) {
96 foreach ($subitem_obj_ids as $subitem_ref_id => $subitem_id) {
97 $status = $this->statusHelper->lookUpStatus($subitem_id, $userId);
105 if (
true === $completed) {
106 $templatesOfCompletedCourses[] = $courseTemplate;
111 return $templatesOfCompletedCourses;
const LP_STATUS_COMPLETED_NUM
evaluate(int $refId, int $userId)
ilCertificateObjUserTrackingHelper $trackingHelper
__construct(ilCertificateTemplateRepository $templateRepository, ?ilSetting $setting=null, ?ilCertificateObjectHelper $objectHelper=null, ?ilCertificateLPStatusHelper $statusHelper=null, ?ilCertificateObjUserTrackingHelper $trackingHelper=null)
ilCertificateObjectHelper $objectHelper
ilCertificateLPStatusHelper $statusHelper
ilCertificateTemplateRepository $templateRepository