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

Public Member Functions

 determineStatus (int $a_obj_id, int $a_usr_id, object $a_obj=null)
 
 determinePercentage (int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
 
 refreshStatus (int $a_obj_id, ?array $a_users=null)
 Refresh status. More...
 
- Public Member Functions inherited from ilLPStatus
 __construct (int $a_obj_id)
 
 _updateStatus (int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
 New status handling (st: status, nr: accesses, p: percentage, t: time spent, m: mark) Learning progress: More...
 
 determinePercentage (int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
 
 determineStatus (int $a_obj_id, int $a_usr_id, object $a_obj=null)
 
 refreshStatus (int $a_obj_id, ?array $a_users=null)
 Refresh status. More...
 

Static Public Member Functions

static _getInProgress (int $a_obj_id)
 
static _getCompleted (int $a_obj_id)
 
static _getFailed (int $a_obj_id)
 
static _getNotAttempted (int $a_obj_id)
 
static _getStatusInfo (int $a_obj_id)
 
- Static Public Member Functions inherited from ilLPStatus
static _getCountNotAttempted (int $a_obj_id)
 
static _getNotAttempted (int $a_obj_id)
 
static _getCountInProgress (int $a_obj_id)
 
static _getInProgress (int $a_obj_id)
 
static _getCountCompleted (int $a_obj_id)
 
static _getCompleted (int $a_obj_id)
 
static _getFailed (int $a_obj_id)
 
static _getCountFailed (int $a_obj_id)
 
static _getStatusInfo (int $a_obj_id)
 
static _getTypicalLearningTime (int $a_obj_id)
 
static checkStatusForObject (int $a_obj_id, ?array $a_users=null)
 This function checks whether the status for a given number of users is dirty and must be recalculated. More...
 
static writeStatus (int $a_obj_id, int $a_user_id, int $a_status, int $a_percentage=0, bool $a_force_per=false, ?int &$a_old_status=self::LP_STATUS_NOT_ATTEMPTED_NUM)
 Write status for user and object. More...
 
static setInProgressIfNotAttempted (int $a_obj_id, int $a_user_id)
 This function shoudl be clalled for normal "read events". More...
 
static setAllDirty ()
 Sets all status to dirty. More...
 
static setDirty (int $a_obj_id)
 Sets status of an object to dirty. More...
 
static _lookupStatus (int $a_obj_id, int $a_user_id, bool $a_create=true)
 Lookup status. More...
 
static _lookupPercentage (int $a_obj_id, int $a_user_id)
 Lookup percentage. More...
 
static _hasUserCompleted (int $a_obj_id, int $a_user_id)
 Lookup user object completion. More...
 
static _lookupStatusChanged (int $a_obj_id, int $a_user_id)
 Lookup status changed. More...
 
static _lookupCompletedForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get in progress users for object. More...
 
static preloadListGUIData (array $a_obj_ids)
 
static getListGUIStatus (int $a_obj_id, bool $a_image_only=true)
 
static hasListGUIStatus (int $a_obj_id)
 

Additional Inherited Members

- Data Fields inherited from ilLPStatus
const LP_STATUS_NOT_ATTEMPTED = 'trac_no_attempted'
 
const LP_STATUS_IN_PROGRESS = 'trac_in_progress'
 
const LP_STATUS_COMPLETED = 'trac_completed'
 
const LP_STATUS_FAILED = 'trac_failed'
 
const LP_STATUS_NOT_ATTEMPTED_NUM = 0
 
const LP_STATUS_IN_PROGRESS_NUM = 1
 
const LP_STATUS_COMPLETED_NUM = 2
 
const LP_STATUS_FAILED_NUM = 3
 
const LP_STATUS_REGISTERED = 'trac_registered'
 
const LP_STATUS_NOT_REGISTERED = 'trac_not_registered'
 
const LP_STATUS_PARTICIPATED = 'trac_participated'
 
const LP_STATUS_NOT_PARTICIPATED = 'trac_not_participated'
 
- Static Public Attributes inherited from ilLPStatus
static $list_gui_cache
 
- Static Protected Member Functions inherited from ilLPStatus
static raiseEvent (int $a_obj_id, int $a_usr_id, int $a_status, int $a_old_status, int $a_percentage)
 
static _lookupStatusForObject (int $a_obj_id, int $a_status, ?array $a_user_ids=null)
 Get users with given status for object. More...
 
static validateLPForObjects (int $a_user_id, array $a_obj_ids, int $a_parent_ref_id)
 Process given objects for lp-relevance. More...
 
static checkLPModesForObjects (array $a_obj_ids, array &$a_coll_obj_ids)
 Process lp modes for given objects. More...
 
static getLPStatusForObjects (int $a_user_id, array $a_obj_ids)
 Get LP status for given objects (and user) More...
 
- Protected Attributes inherited from ilLPStatus
int $obj_id
 
ilDBInterface $db
 
ilObjectDataCache $ilObjDataCache
 

Detailed Description

Definition at line 11 of file class.ilLPStatusSCORM.php.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusSCORM::_getCompleted ( int  $a_obj_id)
static
Parameters
int$a_obj_id
Returns
int[]

Reimplemented from ilLPStatus.

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

30 : array
31 {
32 global $DIC;
33
34 $ilDB = $DIC['ilDB'];
35
36 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
37 $items = $status_info['scos'];
38 $counter = 0;
39 $users = array();
40 foreach ($items as $sco_id) {
41 $tmp_users = $status_info['completed'][$sco_id];
42
43 if (!$counter++) {
44 $users = $tmp_users;
45 } else {
46 $users = array_intersect($users, $tmp_users);
47 }
48 }
49
50 $users = array_diff($users, ilLPStatusWrapper::_getFailed($a_obj_id));
51 return $users;
52 }
static _getFailed(int $a_obj_id)
Static function to read the users who have the status 'completed'.
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
global $DIC
Definition: feed.php:28

References $DIC, $ilDB, ilLPStatusWrapper\_getFailed(), and ilLPStatusWrapper\_getStatusInfo().

+ Here is the call graph for this function:

◆ _getFailed()

static ilLPStatusSCORM::_getFailed ( int  $a_obj_id)
static
Parameters
int$a_obj_id
Returns
int[]

Reimplemented from ilLPStatus.

Definition at line 54 of file class.ilLPStatusSCORM.php.

54 : array
55 {
56 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
57
58 if (!count($status_info['scos'])) {
59 return array();
60 }
61 $users = array();
62 foreach ($status_info['scos'] as $sco_id) {
63 $users = array_merge(
64 $users,
65 (array) $status_info['failed'][$sco_id]
66 );
67 }
68 return array_unique($users);
69 }

References ilLPStatusWrapper\_getStatusInfo().

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusSCORM::_getInProgress ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

Definition at line 13 of file class.ilLPStatusSCORM.php.

13 : array
14 {
15 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
16 $users = array();
17 foreach ($status_info['in_progress'] as $in_progress) {
18 $users = array_merge($users, $in_progress);
19 }
20 $users = array_unique($users);
21 $users = array_diff(
22 $users,
24 );
25 $users = array_diff($users, ilLPStatusWrapper::_getFailed($a_obj_id));
26
27 return $users;
28 }
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.

References ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), and ilLPStatusWrapper\_getStatusInfo().

+ Here is the call graph for this function:

◆ _getNotAttempted()

static ilLPStatusSCORM::_getNotAttempted ( int  $a_obj_id)
static
Parameters
int$a_obj_id
Returns
int[]

Reimplemented from ilLPStatus.

Definition at line 71 of file class.ilLPStatusSCORM.php.

71 : array
72 {
73 $users = array();
74
75 $members = ilObjectLP::getInstance($a_obj_id)->getMembers();
76 if ($members) {
77 // diff in progress and completed (use stored result in LPStatusWrapper)
78 $users = array_diff(
79 (array) $members,
81 );
82 $users = array_diff(
83 $users,
85 );
86 $users = array_diff(
87 $users,
89 );
90 }
91
92 return $users;
93 }
static _getInProgress(int $a_obj_id)
Static function to read users who have the status 'in_progress'.
static getInstance(int $obj_id)

References ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), and ilObjectLP\getInstance().

+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusSCORM::_getStatusInfo ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

Definition at line 95 of file class.ilLPStatusSCORM.php.

95 : array
96 {
97 // Which sco's determine the status
98 $olp = ilObjectLP::getInstance($a_obj_id);
99 $collection = $olp->getCollectionInstance();
100 if ($collection) {
101 $status_info['scos'] = $collection->getItems();
102 } else {
103 $status_info['scos'] = array();
104 }
105 $status_info['num_scos'] = count($status_info['scos']);
106
107 // Get subtype
108 $status_info['subtype'] = ilObjSAHSLearningModule::_lookupSubType(
109 $a_obj_id
110 );
111 $info = [];
112 switch ($status_info['subtype']) {
113 case 'hacp':
114 case 'aicc':
115 $status_info['num_completed'] = ilObjSCORMTracking::_getCountCompletedPerUser(
116 $status_info['scos'],
117 $a_obj_id
118 );
119
120 foreach (ilObjAICCLearningModule::_getTrackingItems(
121 $a_obj_id
122 ) as $item) {
123 if (in_array($item['obj_id'], $status_info['scos'])) {
124 $status_info['scos_title']["$item[obj_id]"] = $item['title'];
125 }
126 }
128 $status_info['scos'],
129 $a_obj_id
130 );
131 break;
132
133 case 'scorm':
134 $status_info['num_completed'] = ilObjSCORMTracking::_getCountCompletedPerUser(
135 $status_info['scos'],
136 $a_obj_id
137 );
138
139 foreach ($status_info['scos'] as $sco_id) {
140 $status_info['scos_title'][$sco_id] = ilSCORMItem::_lookupTitle(
141 $sco_id
142 );
143 }
145 $status_info['scos'],
146 $a_obj_id
147 );
148 break;
149
150 case "scorm2004":
151 $status_info['num_completed'] = ilSCORM2004Tracking::_getCountCompletedPerUser(
152 $status_info['scos'],
153 $a_obj_id,
154 true
155 );
156 foreach ($status_info['scos'] as $sco_id) {
157 $status_info['scos_title'][$sco_id] = ilObjSCORM2004LearningModule::_lookupItemTitle(
158 $sco_id
159 );
160 }
161
163 $status_info['scos'],
164 $a_obj_id,
165 true
166 );
167 break;
168 }
169
170 $status_info['completed'] = array();
171 $status_info['failed'] = array();
172 $status_info['in_progress'] = array();
173 foreach ($status_info['scos'] as $sco_id) {
174 $status_info['completed'][$sco_id] = $info['completed'][$sco_id] ?? array();
175 $status_info['failed'][$sco_id] = $info['failed'][$sco_id] ?? array();
176 $status_info['in_progress'][$sco_id] = $info['in_progress'][$sco_id] ?? array();
177 }
178 //var_dump($status_info["completed"]);
179 return $status_info;
180 }
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
static _getProgressInfo(array $sco_item_ids, int $a_obj_id)
Get info about.
static _getCountCompletedPerUser(array $a_scorm_item_ids, int $a_obj_id)
Get users who have status completed or passed.
static _getCountCompletedPerUser(array $a_scorm_item_ids, int $a_obj_id, bool $a_omit_failed=false)
Get progress of selected scos.
static _getItemProgressInfo(array $a_scorm_item_ids, int $a_obj_id, bool $a_omit_failed)
static _lookupTitle(int $a_obj_id)

References ilObjSCORMTracking\_getCountCompletedPerUser(), ilSCORM2004Tracking\_getCountCompletedPerUser(), ilSCORM2004Tracking\_getItemProgressInfo(), ilObjSCORMTracking\_getProgressInfo(), ilObjSCORM2004LearningModule\_lookupItemTitle(), ilObjSAHSLearningModule\_lookupSubType(), ilSCORMItem\_lookupTitle(), and ilObjectLP\getInstance().

+ Here is the call graph for this function:

◆ determinePercentage()

ilLPStatusSCORM::determinePercentage ( int  $a_obj_id,
int  $a_usr_id,
?object  $a_obj = null 
)

Reimplemented from ilLPStatus.

Definition at line 244 of file class.ilLPStatusSCORM.php.

248 : int {
249 // Which sco's determine the status
250 $olp = ilObjectLP::getInstance($a_obj_id);
251 $collection = $olp->getCollectionInstance();
252 $reqscos = 0;
253 $compl = 0;
254 if ($collection) {
255 $scos = $collection->getItems();
256 $reqscos = count($scos);
257
258 $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
259 if ($subtype != "scorm2004") {
261 $scos,
262 $a_obj_id,
263 $a_usr_id
264 );
265 } else {
267 $scos,
268 $a_obj_id,
269 $a_usr_id,
270 true
271 );
272 }
273 }
274
275 if ($reqscos > 0) {
276 $per = min(100, 100 / $reqscos * $compl);
277 } else {
278 $per = 100;
279 }
280
281 return $per;
282 }
static _countCompleted(?array $a_scos, int $a_obj_id, int $a_user_id)
static _countCompleted(array $a_scos, int $a_obj_id, int $a_user_id, bool $a_omit_failed)

References ilObjSCORMTracking\_countCompleted(), ilSCORM2004Tracking\_countCompleted(), and ilObjSAHSLearningModule\_lookupSubType().

+ Here is the call graph for this function:

◆ determineStatus()

ilLPStatusSCORM::determineStatus ( int  $a_obj_id,
int  $a_usr_id,
object  $a_obj = null 
)

Reimplemented from ilLPStatus.

Definition at line 182 of file class.ilLPStatusSCORM.php.

186 : int {
187 global $DIC;
188
190
191 // if the user has accessed the scorm object
192 // the status is at least "in progress"
193 if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
195 }
196 // Which sco's determine the status
197 $olp = ilObjectLP::getInstance($a_obj_id);
198 $collection = $olp->getCollectionInstance();
199 if ($collection) {
200 $scos = $collection->getItems();
201 if (sizeof(
202 $scos
203 )) { // #15462 (#11513 - empty collections cannot be completed)
204 $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
205 $scorm_status = '';
206 switch ($subtype) {
207 case 'hacp':
208 case 'aicc':
209 case 'scorm':
211 $scos,
212 $a_obj_id,
213 $a_usr_id
214 );
215 break;
216
217 case 'scorm2004':
219 $scos,
220 $a_obj_id,
221 $a_usr_id
222 );
223 break;
224 }
225
226 switch ($scorm_status) {
227 case "in_progress":
229 break;
230 case "completed":
232 break;
233 case "failed":
235 break;
236 }
237 }
238 }
239
240 //$ilLog->write("-".$status."-");
241 return $status;
242 }
static hasAccessed(int $a_obj_id, int $a_usr_id)
Has accessed.
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
static _getCollectionStatus(?array $a_scos, int $a_obj_id, int $a_user_id)
static _getCollectionStatus(array $a_scos, int $a_obj_id, int $a_user_id)

References ilLPStatus\LP_STATUS_IN_PROGRESS_NUM.

◆ refreshStatus()

ilLPStatusSCORM::refreshStatus ( int  $a_obj_id,
?array  $a_users = null 
)

Refresh status.

Reimplemented from ilLPStatus.

Definition at line 284 of file class.ilLPStatusSCORM.php.

284 : void
285 {
286 parent::refreshStatus($a_obj_id, $a_users);
287
288 // this is restricted to SCOs in the current collection
289 $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
290 $completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
291 $failed = ilLPStatusWrapper::_getFailed($a_obj_id);
292 $all_active_users = array_unique(
293 array_merge($in_progress, $completed, $failed)
294 );
295
296 // get all tracked users regardless of SCOs
297 $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
298 if ($subtype != "scorm2004") {
299 $all_tracked_users = ilObjSCORMTracking::_getTrackedUsers(
300 $a_obj_id
301 );
302 } else {
303 $all_tracked_users = ilSCORM2004Tracking::_getTrackedUsers(
304 $a_obj_id
305 );
306 }
307
308 $not_attempted_users = array_diff(
309 $all_tracked_users,
310 $all_active_users
311 );
312 unset($all_tracked_users);
313 unset($all_active_users);
314
315 // reset all users which have no data for the current SCOs
316 if ($not_attempted_users) {
317 foreach ($not_attempted_users as $usr_id) {
318 // this will update any (parent) collections if necessary
320 $a_obj_id,
321 $usr_id,
322 self::LP_STATUS_NOT_ATTEMPTED_NUM
323 );
324 }
325 }
326 }
static writeStatus(int $a_obj_id, int $a_user_id, int $a_status, int $a_percentage=0, bool $a_force_per=false, ?int &$a_old_status=self::LP_STATUS_NOT_ATTEMPTED_NUM)
Write status for user and object.
static _getTrackedUsers(int $a_obj_id)
Get all tracked users.
static _getTrackedUsers(int $a_obj_id)
Get all tracked users.

References ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), ilSCORM2004Tracking\_getTrackedUsers(), ilObjSCORMTracking\_getTrackedUsers(), ilObjSAHSLearningModule\_lookupSubType(), and ilLPStatus\writeStatus().

+ Here is the call graph for this function:

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