ILIAS  release_8 Revision v8.24
ilCertificateCourseLearningProgressEvaluation Class Reference
+ Collaboration diagram for ilCertificateCourseLearningProgressEvaluation:

Public Member Functions

 __construct (ilCertificateTemplateRepository $templateRepository, ?ilSetting $setting=null, ?ilCertificateObjectHelper $objectHelper=null, ?ilCertificateLPStatusHelper $statusHelper=null, ?ilCertificateObjUserTrackingHelper $trackingHelper=null)
 
 evaluate (int $refId, int $userId)
 

Private Attributes

ilCertificateTemplateRepository $templateRepository
 
ilSetting $setting
 
ilCertificateObjectHelper $objectHelper
 
ilCertificateLPStatusHelper $statusHelper
 
ilCertificateObjUserTrackingHelper $trackingHelper
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCertificateCourseLearningProgressEvaluation::__construct ( ilCertificateTemplateRepository  $templateRepository,
?ilSetting  $setting = null,
?ilCertificateObjectHelper  $objectHelper = null,
?ilCertificateLPStatusHelper  $statusHelper = null,
?ilCertificateObjUserTrackingHelper  $trackingHelper = null 
)

Definition at line 32 of file class.ilCertificateCourseLearningProgressEvaluation.php.

38 {
39 $this->templateRepository = $templateRepository;
40
41 if (null === $setting) {
42 $setting = new ilSetting('crs');
43 }
44 $this->setting = $setting;
45
46 if (null === $objectHelper) {
48 }
49 $this->objectHelper = $objectHelper;
50
51 if (null === $statusHelper) {
53 }
54 $this->statusHelper = $statusHelper;
55 if (null === $trackingHelper) {
57 }
58 $this->trackingHelper = $trackingHelper;
59 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $objectHelper, $setting, $statusHelper, $templateRepository, and $trackingHelper.

Member Function Documentation

◆ evaluate()

ilCertificateCourseLearningProgressEvaluation::evaluate ( int  $refId,
int  $userId 
)
Parameters
int$refId
int$userId
Returns
ilCertificateTemplate[]

Definition at line 66 of file class.ilCertificateCourseLearningProgressEvaluation.php.

66 : array
67 {
68 $courseTemplates = $this->templateRepository
69 ->fetchActiveCertificateTemplatesForCoursesWithDisabledLearningProgress(
70 $this->trackingHelper->enabledLearningProgress(),
71 $refId
72 );
73
74 $templatesOfCompletedCourses = [];
75 foreach ($courseTemplates as $courseTemplate) {
76 $courseObjectId = $courseTemplate->getObjId();
77
78 $subItems = $this->setting->get('cert_subitems_' . $courseObjectId);
79 if ($subItems === null) {
80 continue;
81 }
82 $subItems = json_decode($subItems, true, 512, JSON_THROW_ON_ERROR);
83 if (!is_array($subItems)) {
84 continue;
85 }
86
87 $subitem_obj_ids = [];
88 foreach ($subItems as $subItemRefId) {
89 $subitem_obj_ids[$subItemRefId] = $this->objectHelper->lookupObjId((int) $subItemRefId);
90 }
91
92 if (in_array($refId, $subItems)) {
93 $completed = true;
94
95 // check if all subitems are completed now
96 foreach ($subitem_obj_ids as $subitem_ref_id => $subitem_id) {
97 $status = $this->statusHelper->lookUpStatus($subitem_id, $userId);
98
100 $completed = false;
101 break;
102 }
103 }
104
105 if (true === $completed) {
106 $templatesOfCompletedCourses[] = $courseTemplate;
107 }
108 }
109 }
110
111 return $templatesOfCompletedCourses;
112 }
const LP_STATUS_COMPLETED_NUM
$refId
Definition: xapitoken.php:58

References $refId, and ilLPStatus\LP_STATUS_COMPLETED_NUM.

Field Documentation

◆ $objectHelper

ilCertificateObjectHelper ilCertificateCourseLearningProgressEvaluation::$objectHelper
private

Definition at line 28 of file class.ilCertificateCourseLearningProgressEvaluation.php.

Referenced by __construct().

◆ $setting

ilSetting ilCertificateCourseLearningProgressEvaluation::$setting
private

Definition at line 27 of file class.ilCertificateCourseLearningProgressEvaluation.php.

Referenced by __construct().

◆ $statusHelper

ilCertificateLPStatusHelper ilCertificateCourseLearningProgressEvaluation::$statusHelper
private

Definition at line 29 of file class.ilCertificateCourseLearningProgressEvaluation.php.

Referenced by __construct().

◆ $templateRepository

ilCertificateTemplateRepository ilCertificateCourseLearningProgressEvaluation::$templateRepository
private

Definition at line 26 of file class.ilCertificateCourseLearningProgressEvaluation.php.

Referenced by __construct().

◆ $trackingHelper

ilCertificateObjUserTrackingHelper ilCertificateCourseLearningProgressEvaluation::$trackingHelper
private

Definition at line 30 of file class.ilCertificateCourseLearningProgressEvaluation.php.

Referenced by __construct().


The documentation for this class was generated from the following file: