ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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

 $templateRepository
 
 $setting
 
 $objectHelper
 
 $statusHelper
 
 $trackingHelper
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

46 {
47 $this->templateRepository = $templateRepository;
48
49 if (null === $setting) {
50 $setting = new ilSetting('crs');
51 }
52 $this->setting = $setting;
53
54 if (null === $objectHelper) {
56 }
57 $this->objectHelper = $objectHelper;
58
59 if (null === $statusHelper) {
61 }
62 $this->statusHelper = $statusHelper;
63 if (null === $trackingHelper) {
65 }
66 $this->trackingHelper = $trackingHelper;
67 }
ILIAS Setting Class.

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

Member Function Documentation

◆ evaluate()

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

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

74 : array
75 {
76 $courseTemplates = $this->templateRepository->fetchActiveTemplatesByType('crs');
77
78 $enabledGlobalLearningProgress = $this->trackingHelper->enabledLearningProgress();
79
80 $templatesOfCompletedCourses = array();
81 foreach ($courseTemplates as $courseTemplate) {
82 $courseObjectId = $courseTemplate->getObjId();
83
84 if ($enabledGlobalLearningProgress) {
85 $objectLearningProgressSettings = new ilLPObjSettings($courseObjectId);
86 $mode = $objectLearningProgressSettings->getMode();
87
89 continue;
90 }
91 }
92
93 $subItems = $this->setting->get('cert_subitems_' . $courseObjectId, false);
94
95 if (false === $subItems || $subItems === null) {
96 continue;
97 }
98
99 $subItems = json_decode($subItems);
100
101 if (!is_array($subItems)) {
102 continue;
103 }
104
105 $subitem_obj_ids = array();
106 foreach ($subItems as $subItemRefId) {
107 $subitem_obj_ids[$subItemRefId] = $this->objectHelper->lookupObjId((int) $subItemRefId);
108 }
109
110 if (in_array($refId, $subItems)) {
111 $completed = true;
112
113 // check if all subitems are completed now
114 foreach ($subitem_obj_ids as $subitem_ref_id => $subitem_id) {
115 $status = $this->statusHelper->lookUpStatus($subitem_id, $userId);
116
118 $completed = false;
119 break;
120 }
121 }
122
123 if (true === $completed) {
124 $templatesOfCompletedCourses[] = $courseTemplate;
125 }
126 }
127 }
128
129 return $templatesOfCompletedCourses;
130 }
const LP_STATUS_COMPLETED_NUM
$refId
Definition: xapitoken.php:42

References $refId, ilLPObjSettings\LP_MODE_DEACTIVATED, and ilLPStatus\LP_STATUS_COMPLETED_NUM.

Field Documentation

◆ $objectHelper

ilCertificateCourseLearningProgressEvaluation::$objectHelper
private

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

Referenced by __construct().

◆ $setting

ilCertificateCourseLearningProgressEvaluation::$setting
private

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

Referenced by __construct().

◆ $statusHelper

ilCertificateCourseLearningProgressEvaluation::$statusHelper
private

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

Referenced by __construct().

◆ $templateRepository

ilCertificateCourseLearningProgressEvaluation::$templateRepository
private

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

Referenced by __construct().

◆ $trackingHelper

ilCertificateCourseLearningProgressEvaluation::$trackingHelper
private

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

Referenced by __construct().


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