ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilLPStatusSCORM Class Reference
+ Inheritance diagram for ilLPStatusSCORM:
+ Collaboration diagram for ilLPStatusSCORM:

Public Member Functions

 ilLPStatusSCORM ($a_obj_id)
 
 _getInProgress ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 _getFailed ($a_obj_id)
 
 _getStatusInfo ($a_obj_id)
 
 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 Determine status. More...
 
 determinePercentage ($a_obj_id, $a_user_id, $a_obj=null)
 Determine percentage. More...
 
 refreshStatus ($a_obj_id)
 
- Public Member Functions inherited from ilLPStatus
 ilLPStatus ($a_obj_id)
 
 _getCountNotAttempted ($a_obj_id)
 
 _getNotAttempted ($a_obj_id)
 
 _getCountInProgress ($a_obj_id)
 
 _getInProgress ($a_obj_id)
 
 _getCountCompleted ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 _getFailed ($a_obj_id)
 
 _getCountFailed ()
 
 _getStatusInfo ($a_obj_id)
 
 _getTypicalLearningTime ($a_obj_id)
 
 _updateStatus ($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=false, $a_force_raise=false)
 New status handling (st: status, nr: accesses, p: percentage, t: time spent, m: mark) More...
 
 determinePercentage ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine percentage. More...
 
 determineStatus ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine status. More...
 
 refreshStatus ($a_obj_id, $a_users=null)
 Refresh status. More...
 
 _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilLPStatus
static checkStatusForObject ($a_obj_id, $a_users=false)
 This function checks whether the status for a given number of users is dirty and must be recalculated. More...
 
static writeStatus ($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
 Write status for user and object. More...
 
static setInProgressIfNotAttempted ($a_obj_id, $a_user_id)
 This function shoudl be clalled for normal "read events". More...
 
static setAllDirty ()
 Sets all status to dirty. More...
 
static setDirty ($a_obj_id)
 Sets status of an object to dirty. More...
 
static _lookupStatus ($a_obj_id, $a_user_id, $a_create=true)
 Lookup status. More...
 
static _lookupPercentage ($a_obj_id, $a_user_id)
 Lookup percentage. More...
 
static _hasUserCompleted ($a_obj_id, $a_user_id)
 Lookup user object completion. More...
 
static _lookupCompletedForObject ($a_obj_id, $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject ($a_obj_id, $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject ($a_obj_id, $a_user_ids=null)
 Get in progress users for object. More...
 
static preloadListGUIData ($a_obj_ids)
 
static getListGUIStatus ($a_obj_id)
 
- Data Fields inherited from ilLPStatus
 $obj_id = null
 
 $db = null
 
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
 
- Protected Member Functions inherited from ilLPStatus
 raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)
 
- Static Protected Member Functions inherited from ilLPStatus
static _lookupStatusForObject ($a_obj_id, $a_status, $a_user_ids=null)
 Get users with given status for object. More...
 

Detailed Description

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

Member Function Documentation

◆ _getCompleted()

ilLPStatusSCORM::_getCompleted (   $a_obj_id)

Reimplemented from ilLPStatus.

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

43 {
44 global $ilDB;
45
46 include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
47
48 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
49
50 $items = $status_info['scos'];
51
52 $counter = 0;
53 $users = array();
54 foreach($items as $sco_id)
55 {
56 $tmp_users = $status_info['completed'][$sco_id];
57
58 if(!$counter++)
59 {
60 $users = $tmp_users;
61 }
62 else
63 {
64 $users = array_intersect($users,$tmp_users);
65 }
66 }
67
68 $users = array_diff($users,ilLPStatusWrapper::_getFailed($a_obj_id));
69 return $users;
70 }
_getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
_getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
global $ilDB

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

+ Here is the call graph for this function:

◆ _getFailed()

ilLPStatusSCORM::_getFailed (   $a_obj_id)

Reimplemented from ilLPStatus.

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

73 {
74 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
75
76 if(!count($status_info['scos']))
77 {
78 return array();
79 }
80 $users = array();
81 foreach($status_info['scos'] as $sco_id)
82 {
83 // max attempts vs. failed
84 if(sizeof($status_info['in_progress'][$sco_id]))
85 {
86 foreach($status_info['in_progress'][$sco_id] as $user_id)
87 {
88 if(!in_array($user_id, $status_info['failed'][$sco_id]))
89 {
90 switch($status_info["subtype"])
91 {
92 case 'hacp':
93 case 'aicc':
94 case 'scorm':
95 include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
96 $has_max_attempts = ilObjSCORMTracking::_hasMaxAttempts($a_obj_id, $user_id);
97 break;
98
99 case 'scorm2004':
100 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
101 $has_max_attempts = ilSCORM2004Tracking::_hasMaxAttempts($a_obj_id, $user_id);
102 break;
103 }
104
105 if($has_max_attempts)
106 {
107 $status_info['failed'][$sco_id][] = $user_id;
108 }
109 }
110 }
111 }
112
113 $users = array_merge($users,(array) $status_info['failed'][$sco_id]);
114 }
115 return array_unique($users);
116 }
static _hasMaxAttempts($a_obj_id, $a_user_id)
static _hasMaxAttempts($a_obj_id, $a_user_id)

References ilLPStatusWrapper\_getStatusInfo(), ilSCORM2004Tracking\_hasMaxAttempts(), and ilObjSCORMTracking\_hasMaxAttempts().

+ Here is the call graph for this function:

◆ _getInProgress()

ilLPStatusSCORM::_getInProgress (   $a_obj_id)

Reimplemented from ilLPStatus.

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

28 {
29 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
30 $users = array();
31 foreach($status_info['in_progress'] as $in_progress)
32 {
33 $users = array_merge($users,$in_progress);
34 }
35 $users = array_unique($users);
36 $users = array_diff($users,ilLPStatusWrapper::_getCompleted($a_obj_id));
37 $users = array_diff($users,ilLPStatusWrapper::_getFailed($a_obj_id));
38
39 return $users;
40 }
_getCompleted($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:

◆ _getStatusInfo()

ilLPStatusSCORM::_getStatusInfo (   $a_obj_id)

Reimplemented from ilLPStatus.

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

120 {
121 // Which sco's determine the status
122 include_once './Services/Object/classes/class.ilObjectLP.php';
123 $olp = ilObjectLP::getInstance($a_obj_id);
124 $collection = $olp->getCollectionInstance();
125 if($collection)
126 {
127 $status_info['scos'] = $collection->getItems();
128 }
129 else
130 {
131 $status_info['scos'] = array();
132 }
133 $status_info['num_scos'] = count($status_info['scos']);
134
135 // Get subtype
136 include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
137 $status_info['subtype'] = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
138
139 switch($status_info['subtype'])
140 {
141 case 'hacp':
142 case 'aicc':
143 include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
144 $status_info['num_completed'] = ilObjSCORMTracking::_getCountCompletedPerUser($status_info['scos'],$a_obj_id);
145
146 include_once './Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php';
147 foreach(ilObjAICCLearningModule::_getTrackingItems($a_obj_id) as $item)
148 {
149 if(in_array($item['obj_id'],$status_info['scos']))
150 {
151 $status_info['scos_title']["$item[obj_id]"] = $item['title'];
152 }
153 }
154 $info = ilObjSCORMTracking::_getProgressInfo($status_info['scos'],$a_obj_id);
155 break;
156
157 case 'scorm':
158 include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
159 $status_info['num_completed'] = ilObjSCORMTracking::_getCountCompletedPerUser($status_info['scos'],$a_obj_id);
160
161 include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
162 foreach($status_info['scos'] as $sco_id)
163 {
164 $status_info['scos_title'][$sco_id] = ilSCORMItem::_lookupTitle($sco_id);
165 }
166 $info = ilObjSCORMTracking::_getProgressInfo($status_info['scos'],$a_obj_id);
167 break;
168
169 case "scorm2004":
170 include_once './Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php';
171 $status_info['num_completed'] = ilSCORM2004Tracking::_getCountCompletedPerUser($status_info['scos'],$a_obj_id,true);
172 include_once './Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
173 foreach($status_info['scos'] as $sco_id)
174 {
175 $status_info['scos_title'][$sco_id] = ilObjSCORM2004LearningModule::_lookupItemTitle($sco_id);
176 }
177
178 $info = ilSCORM2004Tracking::_getItemProgressInfo($status_info['scos'],$a_obj_id,true);
179 break;
180 }
181
182 $status_info['completed'] = array();
183 $status_info['failed'] = array();
184 $status_info['in_progress'] = array();
185 foreach($status_info['scos'] as $sco_id)
186 {
187 $status_info['completed'][$sco_id] = $info['completed'][$sco_id] ? $info['completed'][$sco_id] : array();
188 $status_info['failed'][$sco_id] = $info['failed'][$sco_id] ? $info['failed'][$sco_id] : array();
189 $status_info['in_progress'][$sco_id] = $info['in_progress'][$sco_id] ? $info['in_progress'][$sco_id] : array();
190 }
191//var_dump($status_info["completed"]);
192 return $status_info;
193 }
_getTrackingItems($a_obj_id)
get all tracking items of scorm object
_lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
static _getProgressInfo($sco_item_ids, $a_obj_id)
Get info about.
static _getCountCompletedPerUser($a_scorm_item_ids, $a_obj_id)
Get users who have status completed or passed.
static getInstance($a_obj_id)
_getCountCompletedPerUser($a_scorm_item_ids, $a_obj_id, $a_omit_failed=false)
Get progress of selected scos.
_getItemProgressInfo($a_scorm_item_ids, $a_obj_id, $a_omit_failed=false)
_lookupTitle($a_obj_id)

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

+ Here is the call graph for this function:

◆ determinePercentage()

ilLPStatusSCORM::determinePercentage (   $a_obj_id,
  $a_user_id,
  $a_obj = null 
)

Determine percentage.

Parameters
integerobject id
integeruser id
objectobject (optional depends on object type)
Returns
integer percentage

Reimplemented from ilLPStatus.

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

272 {
273 // Which sco's determine the status
274 include_once './Services/Object/classes/class.ilObjectLP.php';
275 $olp = ilObjectLP::getInstance($a_obj_id);
276 $collection = $olp->getCollectionInstance();
277 if($collection)
278 {
279 $scos = $collection->getItems();
280 $reqscos = count($scos);
281
282 include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
283 $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
284 if ($subtype != "scorm2004")
285 {
286 include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
287 $compl = ilObjSCORMTracking::_countCompleted($scos, $a_obj_id, $a_user_id);
288 }
289 else
290 {
291 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
292 $compl = ilSCORM2004Tracking::_countCompleted($scos, $a_obj_id, $a_user_id, true);
293 }
294 }
295
296 if ($reqscos > 0)
297 {
298 $per = min(100, 100 / $reqscos * $compl);
299 }
300 else
301 {
302 $per = 100;
303 }
304
305 return $per;
306 }
static _countCompleted($a_scos, $a_obj_id, $a_user_id)
static _countCompleted($a_scos, $a_obj_id, $a_user_id, $a_omit_failed=false)

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

+ Here is the call graph for this function:

◆ determineStatus()

ilLPStatusSCORM::determineStatus (   $a_obj_id,
  $a_user_id,
  $a_obj = null 
)

Determine status.

Parameters
integerobject id
integeruser id
objectobject (optional depends on object type)
Returns
integer status

Reimplemented from ilLPStatus.

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

204 {
205 global $ilObjDataCache, $ilDB, $ilLog;
206
208
209 // if the user has accessed the scorm object
210 // the status is at least "in progress"
211 include_once("./Services/Tracking/classes/class.ilChangeEvent.php");
212 if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id))
213 {
215 }
216//$ilLog->write("-".$status."-");
217
218 // Which sco's determine the status
219 include_once './Services/Object/classes/class.ilObjectLP.php';
220 $olp = ilObjectLP::getInstance($a_obj_id);
221 $collection = $olp->getCollectionInstance();
222 if($collection)
223 {
224 $scos = $collection->getItems();
225 if(sizeof($scos)) // #15462 (#11513 - empty collections cannot be completed)
226 {
227 include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
228 $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
229 switch($subtype)
230 {
231 case 'hacp':
232 case 'aicc':
233 case 'scorm':
234 include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
235 $scorm_status = ilObjSCORMTracking::_getCollectionStatus($scos, $a_obj_id, $a_user_id);
236 break;
237
238 case 'scorm2004':
239 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
240 $scorm_status = ilSCORM2004Tracking::_getCollectionStatus($scos, $a_obj_id, $a_user_id);
241 break;
242 }
243
244 switch ($scorm_status)
245 {
246 case "in_progress":
248 break;
249 case "completed":
251 break;
252 case "failed":
254 break;
255 }
256 }
257 }
258
259//$ilLog->write("-".$status."-");
260 return $status;
261 }
static hasAccessed($a_obj_id, $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($a_scos, $a_obj_id, $a_user_id)
static _getCollectionStatus($a_scos, $a_obj_id, $a_user_id)

References $ilDB, $ilLog, ilSCORM2004Tracking\_getCollectionStatus(), ilObjSCORMTracking\_getCollectionStatus(), ilObjSAHSLearningModule\_lookupSubType(), ilObjectLP\getInstance(), ilChangeEvent\hasAccessed(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

+ Here is the call graph for this function:

◆ ilLPStatusSCORM()

ilLPStatusSCORM::ilLPStatusSCORM (   $a_obj_id)

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

19 {
20 global $ilDB;
21
22 parent::ilLPStatus($a_obj_id);
23 $this->db =& $ilDB;
24 }

References $ilDB.

◆ refreshStatus()

ilLPStatusSCORM::refreshStatus (   $a_obj_id)

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

309 {
310 parent::refreshStatus($a_obj_id);
311
312 // this is restricted to SCOs in the current collection
313 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
314 $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
315 $completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
317 $all_active_users = array_unique(array_merge($in_progress, $completed, $failed));
318
319 // get all tracked users regardless of SCOs
320 include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
321 $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
322 if ($subtype != "scorm2004")
323 {
324 include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
325 $all_tracked_users = ilObjSCORMTracking::_getTrackedUsers($a_obj_id);
326 }
327 else
328 {
329 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
330 $all_tracked_users = ilSCORM2004Tracking::_getTrackedUsers($a_obj_id);
331 }
332
333 $not_attempted_users = array_diff($all_tracked_users, $all_active_users);
334 unset($all_tracked_users);
335 unset($all_active_users);
336
337 // reset all users which have no data for the current SCOs
338 if($not_attempted_users)
339 {
340 foreach($not_attempted_users as $usr_id)
341 {
342 // this will update any (parent) collections if necessary
343 ilLPStatus::writeStatus($a_obj_id, $usr_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, 0);
344 }
345 }
346 }
$failed
Definition: Utf8Test.php:86
_getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
static writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
Write status for user and object.
_getTrackedUsers($a_obj_id)
Get all tracked users.
_getTrackedUsers($a_obj_id)
Get all tracked users.

References $failed, 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: