ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
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_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...
 
static validateLPForObjects ($a_user_id, $a_obj_ids, $a_parent_ref_id)
 Process given objects for lp-relevance. More...
 
static checkLPModesForObjects ($a_obj_ids, array &$a_coll_obj_ids)
 Process lp modes for given objects. More...
 
static getLPStatusForObjects ($a_user_id, $a_obj_ids)
 Get LP status for given objects (and user) More...
 

Detailed Description

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

Member Function Documentation

◆ _getCompleted()

ilLPStatusSCORM::_getCompleted (   $a_obj_id)

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

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

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  }
_getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
_getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
global $ilDB
+ Here is the call graph for this function:

◆ _getFailed()

ilLPStatusSCORM::_getFailed (   $a_obj_id)

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

References ilLPStatusWrapper\_getStatusInfo().

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  /* #17913 - max attempts were removed in 5.1
84  // max attempts vs. failed
85  if(sizeof($status_info['in_progress'][$sco_id]))
86  {
87  foreach($status_info['in_progress'][$sco_id] as $user_id)
88  {
89  if(!in_array($user_id, $status_info['failed'][$sco_id]))
90  {
91  switch($status_info["subtype"])
92  {
93  case 'hacp':
94  case 'aicc':
95  case 'scorm':
96  include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
97  $has_max_attempts = ilObjSCORMTracking::_hasMaxAttempts($a_obj_id, $user_id);
98  break;
99 
100  case 'scorm2004':
101  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
102  $has_max_attempts = ilSCORM2004Tracking::_hasMaxAttempts($a_obj_id, $user_id);
103  break;
104  }
105 
106  if($has_max_attempts)
107  {
108  $status_info['failed'][$sco_id][] = $user_id;
109  }
110  }
111  }
112  }
113  */
114 
115  $users = array_merge($users,(array) $status_info['failed'][$sco_id]);
116  }
117  return array_unique($users);
118  }
_getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
+ Here is the call graph for this function:

◆ _getInProgress()

ilLPStatusSCORM::_getInProgress (   $a_obj_id)

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

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

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  }
_getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
_getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
_getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
+ Here is the call graph for this function:

◆ _getStatusInfo()

ilLPStatusSCORM::_getStatusInfo (   $a_obj_id)

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

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

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

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

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

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

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

References $ilDB, $ilLog, ilSCORM2004Tracking\_getCollectionStatus(), ilObjSCORMTracking\_getCollectionStatus(), ilObjSAHSLearningModule\_lookupSubType(), ilObjectLP\getInstance(), and ilChangeEvent\hasAccessed().

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

◆ ilLPStatusSCORM()

ilLPStatusSCORM::ilLPStatusSCORM (   $a_obj_id)

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

References $ilDB.

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

◆ refreshStatus()

ilLPStatusSCORM::refreshStatus (   $a_obj_id)

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

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

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

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