ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLPStatusSCORM Class Reference
+ Inheritance diagram for ilLPStatusSCORM:
+ Collaboration diagram for ilLPStatusSCORM:

Public Member Functions

 __construct ($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, $a_users=null)
 
- Public Member Functions inherited from ilLPStatus
 __construct ($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...
 

Static Public Member Functions

static _getInProgress ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getFailed ($a_obj_id)
 
static _getNotAttempted ($a_obj_id)
 
static _getStatusInfo ($a_obj_id)
 
- Static Public Member Functions inherited from ilLPStatus
static _getCountNotAttempted ($a_obj_id)
 
static _getNotAttempted ($a_obj_id)
 
static _getCountInProgress ($a_obj_id)
 
static _getInProgress ($a_obj_id)
 
static _getCountCompleted ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getFailed ($a_obj_id)
 
static _getCountFailed ()
 
static _getStatusInfo ($a_obj_id)
 
static _getTypicalLearningTime ($a_obj_id)
 
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 _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed. 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, $a_image_only=false)
 

Additional Inherited Members

- 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
 
- Static Protected Member Functions inherited from ilLPStatus
static raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)
 
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.

Constructor & Destructor Documentation

◆ __construct()

ilLPStatusSCORM::__construct (   $a_obj_id)

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

References $ilDB.

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

Member Function Documentation

◆ _getCompleted()

static ilLPStatusSCORM::_getCompleted (   $a_obj_id)
static

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

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

41  {
42  global $ilDB;
43 
44  include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
45 
46  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
47 
48  $items = $status_info['scos'];
49 
50  $counter = 0;
51  $users = array();
52  foreach ($items as $sco_id) {
53  $tmp_users = $status_info['completed'][$sco_id];
54 
55  if (!$counter++) {
56  $users = $tmp_users;
57  } else {
58  $users = array_intersect($users, $tmp_users);
59  }
60  }
61 
62  $users = array_diff($users, ilLPStatusWrapper::_getFailed($a_obj_id));
63  return $users;
64  }
static _getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
$counter
Create styles array
The data for the language used.
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
$users
Definition: authpage.php:44
global $ilDB
+ Here is the call graph for this function:

◆ _getFailed()

static ilLPStatusSCORM::_getFailed (   $a_obj_id)
static

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

References $users, ilLPStatusWrapper\_getStatusInfo(), and array.

67  {
68  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
69 
70  if (!count($status_info['scos'])) {
71  return array();
72  }
73  $users = array();
74  foreach ($status_info['scos'] as $sco_id) {
75  /* #17913 - max attempts were removed in 5.1
76  // max attempts vs. failed
77  if(sizeof($status_info['in_progress'][$sco_id]))
78  {
79  foreach($status_info['in_progress'][$sco_id] as $user_id)
80  {
81  if(!in_array($user_id, $status_info['failed'][$sco_id]))
82  {
83  switch($status_info["subtype"])
84  {
85  case 'hacp':
86  case 'aicc':
87  case 'scorm':
88  include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
89  $has_max_attempts = ilObjSCORMTracking::_hasMaxAttempts($a_obj_id, $user_id);
90  break;
91 
92  case 'scorm2004':
93  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
94  $has_max_attempts = ilSCORM2004Tracking::_hasMaxAttempts($a_obj_id, $user_id);
95  break;
96  }
97 
98  if($has_max_attempts)
99  {
100  $status_info['failed'][$sco_id][] = $user_id;
101  }
102  }
103  }
104  }
105  */
106 
107  $users = array_merge($users, (array) $status_info['failed'][$sco_id]);
108  }
109  return array_unique($users);
110  }
Create styles array
The data for the language used.
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
$users
Definition: authpage.php:44
+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusSCORM::_getInProgress (   $a_obj_id)
static

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

References $users, ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getStatusInfo(), and array.

27  {
28  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
29  $users = array();
30  foreach ($status_info['in_progress'] as $in_progress) {
31  $users = array_merge($users, $in_progress);
32  }
33  $users = array_unique($users);
34  $users = array_diff($users, ilLPStatusWrapper::_getCompleted($a_obj_id));
35  $users = array_diff($users, ilLPStatusWrapper::_getFailed($a_obj_id));
36 
37  return $users;
38  }
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
static _getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
Create styles array
The data for the language used.
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
$users
Definition: authpage.php:44
+ Here is the call graph for this function:

◆ _getNotAttempted()

static ilLPStatusSCORM::_getNotAttempted (   $a_obj_id)
static

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

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

113  {
114  $users = array();
115 
116  $members = ilObjectLP::getInstance($a_obj_id)->getMembers();
117  if ($members) {
118  // diff in progress and completed (use stored result in LPStatusWrapper)
119  $users = array_diff((array) $members, ilLPStatusWrapper::_getInProgress($a_obj_id));
120  $users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
121  $users = array_diff((array) $users, ilLPStatusWrapper::_getFailed($a_obj_id));
122  }
123 
124  return $users;
125  }
static _getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
static _getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
Create styles array
The data for the language used.
$users
Definition: authpage.php:44
static getInstance($a_obj_id)
+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusSCORM::_getStatusInfo (   $a_obj_id)
static

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

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

129  {
130  // Which sco's determine the status
131  include_once './Services/Object/classes/class.ilObjectLP.php';
132  $olp = ilObjectLP::getInstance($a_obj_id);
133  $collection = $olp->getCollectionInstance();
134  if ($collection) {
135  $status_info['scos'] = $collection->getItems();
136  } else {
137  $status_info['scos'] = array();
138  }
139  $status_info['num_scos'] = count($status_info['scos']);
140 
141  // Get subtype
142  include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
143  $status_info['subtype'] = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
144 
145  switch ($status_info['subtype']) {
146  case 'hacp':
147  case 'aicc':
148  include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
149  $status_info['num_completed'] = ilObjSCORMTracking::_getCountCompletedPerUser($status_info['scos'], $a_obj_id);
150 
151  include_once './Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php';
152  foreach (ilObjAICCLearningModule::_getTrackingItems($a_obj_id) as $item) {
153  if (in_array($item['obj_id'], $status_info['scos'])) {
154  $status_info['scos_title']["$item[obj_id]"] = $item['title'];
155  }
156  }
157  $info = ilObjSCORMTracking::_getProgressInfo($status_info['scos'], $a_obj_id);
158  break;
159 
160  case 'scorm':
161  include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
162  $status_info['num_completed'] = ilObjSCORMTracking::_getCountCompletedPerUser($status_info['scos'], $a_obj_id);
163 
164  include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
165  foreach ($status_info['scos'] as $sco_id) {
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  $status_info['scos_title'][$sco_id] = ilObjSCORM2004LearningModule::_lookupItemTitle($sco_id);
177  }
178 
179  $info = ilSCORM2004Tracking::_getItemProgressInfo($status_info['scos'], $a_obj_id, true);
180  break;
181  }
182 
183  $status_info['completed'] = array();
184  $status_info['failed'] = array();
185  $status_info['in_progress'] = array();
186  foreach ($status_info['scos'] as $sco_id) {
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  }
static _getItemProgressInfo($a_scorm_item_ids, $a_obj_id, $a_omit_failed=false)
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static _lookupTitle($a_obj_id)
static _getCountCompletedPerUser($a_scorm_item_ids, $a_obj_id)
Get users who have status completed or passed.
static _getCountCompletedPerUser($a_scorm_item_ids, $a_obj_id, $a_omit_failed=false)
Get progress of selected scos.
Create styles array
The data for the language used.
static _getProgressInfo($sco_item_ids, $a_obj_id)
Get info about.
$info
Definition: index.php:5
static getInstance($a_obj_id)
+ 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 266 of file class.ilLPStatusSCORM.php.

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

267  {
268  // Which sco's determine the status
269  include_once './Services/Object/classes/class.ilObjectLP.php';
270  $olp = ilObjectLP::getInstance($a_obj_id);
271  $collection = $olp->getCollectionInstance();
272  if ($collection) {
273  $scos = $collection->getItems();
274  $reqscos = count($scos);
275 
276  include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
277  $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
278  if ($subtype != "scorm2004") {
279  include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
280  $compl = ilObjSCORMTracking::_countCompleted($scos, $a_obj_id, $a_user_id);
281  } else {
282  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
283  $compl = ilSCORM2004Tracking::_countCompleted($scos, $a_obj_id, $a_user_id, true);
284  }
285  }
286 
287  if ($reqscos > 0) {
288  $per = min(100, 100 / $reqscos * $compl);
289  } else {
290  $per = 100;
291  }
292 
293  return $per;
294  }
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static _countCompleted($a_scos, $a_obj_id, $a_user_id)
static _countCompleted( $a_scos, $a_obj_id, $a_user_id, $a_omit_failed=false)
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 203 of file class.ilLPStatusSCORM.php.

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

204  {
205  global $ilObjDataCache, $ilDB, $ilLog;
206 
207  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
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  $status = self::LP_STATUS_IN_PROGRESS_NUM;
214  }
215  //$ilLog->write("-".$status."-");
216 
217  // Which sco's determine the status
218  include_once './Services/Object/classes/class.ilObjectLP.php';
219  $olp = ilObjectLP::getInstance($a_obj_id);
220  $collection = $olp->getCollectionInstance();
221  if ($collection) {
222  $scos = $collection->getItems();
223  if (sizeof($scos)) { // #15462 (#11513 - empty collections cannot be completed)
224  include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
225  $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
226  switch ($subtype) {
227  case 'hacp':
228  case 'aicc':
229  case 'scorm':
230  include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
231  $scorm_status = ilObjSCORMTracking::_getCollectionStatus($scos, $a_obj_id, $a_user_id);
232  break;
233 
234  case 'scorm2004':
235  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
236  $scorm_status = ilSCORM2004Tracking::_getCollectionStatus($scos, $a_obj_id, $a_user_id);
237  break;
238  }
239 
240  switch ($scorm_status) {
241  case "in_progress":
242  $status = self::LP_STATUS_IN_PROGRESS_NUM;
243  break;
244  case "completed":
245  $status = self::LP_STATUS_COMPLETED_NUM;
246  break;
247  case "failed":
248  $status = self::LP_STATUS_FAILED_NUM;
249  break;
250  }
251  }
252  }
253 
254  //$ilLog->write("-".$status."-");
255  return $status;
256  }
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
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:

◆ refreshStatus()

ilLPStatusSCORM::refreshStatus (   $a_obj_id,
  $a_users = null 
)

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

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

297  {
298  parent::refreshStatus($a_obj_id, $a_users);
299 
300  // this is restricted to SCOs in the current collection
301  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
302  $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
303  $completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
305  $all_active_users = array_unique(array_merge($in_progress, $completed, $failed));
306 
307  // get all tracked users regardless of SCOs
308  include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
309  $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
310  if ($subtype != "scorm2004") {
311  include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
312  $all_tracked_users = ilObjSCORMTracking::_getTrackedUsers($a_obj_id);
313  } else {
314  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
315  $all_tracked_users = ilSCORM2004Tracking::_getTrackedUsers($a_obj_id);
316  }
317 
318  $not_attempted_users = array_diff($all_tracked_users, $all_active_users);
319  unset($all_tracked_users);
320  unset($all_active_users);
321 
322  // reset all users which have no data for the current SCOs
323  if ($not_attempted_users) {
324  foreach ($not_attempted_users as $usr_id) {
325  // this will update any (parent) collections if necessary
326  ilLPStatus::writeStatus($a_obj_id, $usr_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, 0);
327  }
328  }
329  }
static _getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
static _getTrackedUsers($a_obj_id)
Get all tracked users.
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static _getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
static _getTrackedUsers($a_obj_id)
Get all tracked users.
$failed
Definition: Utf8Test.php:85
static writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
Write status for user and object.
+ Here is the call graph for this function:

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