ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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=true)
 

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 $DIC, and $ilDB.

18  {
19  global $DIC;
20 
21  $ilDB = $DIC['ilDB'];
22 
23  parent::__construct($a_obj_id);
24  $this->db = $ilDB;
25  }
global $DIC
Definition: saml.php:7
global $ilDB

Member Function Documentation

◆ _getCompleted()

static ilLPStatusSCORM::_getCompleted (   $a_obj_id)
static

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

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

43  {
44  global $DIC;
45 
46  $ilDB = $DIC['ilDB'];
47 
48  include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
49 
50  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
51 
52  $items = $status_info['scos'];
53 
54  $counter = 0;
55  $users = array();
56  foreach ($items as $sco_id) {
57  $tmp_users = $status_info['completed'][$sco_id];
58 
59  if (!$counter++) {
60  $users = $tmp_users;
61  } else {
62  $users = array_intersect($users, $tmp_users);
63  }
64  }
65 
66  $users = array_diff($users, ilLPStatusWrapper::_getFailed($a_obj_id));
67  return $users;
68  }
global $DIC
Definition: saml.php:7
static _getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
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 70 of file class.ilLPStatusSCORM.php.

References $users, and ilLPStatusWrapper\_getStatusInfo().

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

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

29  {
30  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
31  $users = array();
32  foreach ($status_info['in_progress'] as $in_progress) {
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  }
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'.
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 116 of file class.ilLPStatusSCORM.php.

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

117  {
118  $users = array();
119 
120  $members = ilObjectLP::getInstance($a_obj_id)->getMembers();
121  if ($members) {
122  // diff in progress and completed (use stored result in LPStatusWrapper)
123  $users = array_diff((array) $members, ilLPStatusWrapper::_getInProgress($a_obj_id));
124  $users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
125  $users = array_diff((array) $users, ilLPStatusWrapper::_getFailed($a_obj_id));
126  }
127 
128  return $users;
129  }
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'.
$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 132 of file class.ilLPStatusSCORM.php.

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

133  {
134  // Which sco's determine the status
135  include_once './Services/Object/classes/class.ilObjectLP.php';
136  $olp = ilObjectLP::getInstance($a_obj_id);
137  $collection = $olp->getCollectionInstance();
138  if ($collection) {
139  $status_info['scos'] = $collection->getItems();
140  } else {
141  $status_info['scos'] = array();
142  }
143  $status_info['num_scos'] = count($status_info['scos']);
144 
145  // Get subtype
146  include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
147  $status_info['subtype'] = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
148 
149  switch ($status_info['subtype']) {
150  case 'hacp':
151  case 'aicc':
152  include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
153  $status_info['num_completed'] = ilObjSCORMTracking::_getCountCompletedPerUser($status_info['scos'], $a_obj_id);
154 
155  include_once './Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php';
156  foreach (ilObjAICCLearningModule::_getTrackingItems($a_obj_id) as $item) {
157  if (in_array($item['obj_id'], $status_info['scos'])) {
158  $status_info['scos_title']["$item[obj_id]"] = $item['title'];
159  }
160  }
161  $info = ilObjSCORMTracking::_getProgressInfo($status_info['scos'], $a_obj_id);
162  break;
163 
164  case 'scorm':
165  include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php';
166  $status_info['num_completed'] = ilObjSCORMTracking::_getCountCompletedPerUser($status_info['scos'], $a_obj_id);
167 
168  include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
169  foreach ($status_info['scos'] as $sco_id) {
170  $status_info['scos_title'][$sco_id] = ilSCORMItem::_lookupTitle($sco_id);
171  }
172  $info = ilObjSCORMTracking::_getProgressInfo($status_info['scos'], $a_obj_id);
173  break;
174 
175  case "scorm2004":
176  include_once './Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php';
177  $status_info['num_completed'] = ilSCORM2004Tracking::_getCountCompletedPerUser($status_info['scos'], $a_obj_id, true);
178  include_once './Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
179  foreach ($status_info['scos'] as $sco_id) {
180  $status_info['scos_title'][$sco_id] = ilObjSCORM2004LearningModule::_lookupItemTitle($sco_id);
181  }
182 
183  $info = ilSCORM2004Tracking::_getItemProgressInfo($status_info['scos'], $a_obj_id, true);
184  break;
185  }
186 
187  $status_info['completed'] = array();
188  $status_info['failed'] = array();
189  $status_info['in_progress'] = array();
190  foreach ($status_info['scos'] as $sco_id) {
191  $status_info['completed'][$sco_id] = $info['completed'][$sco_id] ? $info['completed'][$sco_id] : array();
192  $status_info['failed'][$sco_id] = $info['failed'][$sco_id] ? $info['failed'][$sco_id] : array();
193  $status_info['in_progress'][$sco_id] = $info['in_progress'][$sco_id] ? $info['in_progress'][$sco_id] : array();
194  }
195  //var_dump($status_info["completed"]);
196  return $status_info;
197  }
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.
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 274 of file class.ilLPStatusSCORM.php.

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

275  {
276  // Which sco's determine the status
277  include_once './Services/Object/classes/class.ilObjectLP.php';
278  $olp = ilObjectLP::getInstance($a_obj_id);
279  $collection = $olp->getCollectionInstance();
280  if ($collection) {
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  include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
288  $compl = ilObjSCORMTracking::_countCompleted($scos, $a_obj_id, $a_user_id);
289  } else {
290  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
291  $compl = ilSCORM2004Tracking::_countCompleted($scos, $a_obj_id, $a_user_id, true);
292  }
293  }
294 
295  if ($reqscos > 0) {
296  $per = min(100, 100 / $reqscos * $compl);
297  } else {
298  $per = 100;
299  }
300 
301  return $per;
302  }
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 207 of file class.ilLPStatusSCORM.php.

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

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

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

305  {
306  parent::refreshStatus($a_obj_id, $a_users);
307 
308  // this is restricted to SCOs in the current collection
309  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
310  $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
311  $completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
313  $all_active_users = array_unique(array_merge($in_progress, $completed, $failed));
314 
315  // get all tracked users regardless of SCOs
316  include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
317  $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id);
318  if ($subtype != "scorm2004") {
319  include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
320  $all_tracked_users = ilObjSCORMTracking::_getTrackedUsers($a_obj_id);
321  } else {
322  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
323  $all_tracked_users = ilSCORM2004Tracking::_getTrackedUsers($a_obj_id);
324  }
325 
326  $not_attempted_users = array_diff($all_tracked_users, $all_active_users);
327  unset($all_tracked_users);
328  unset($all_active_users);
329 
330  // reset all users which have no data for the current SCOs
331  if ($not_attempted_users) {
332  foreach ($not_attempted_users as $usr_id) {
333  // this will update any (parent) collections if necessary
334  ilLPStatus::writeStatus($a_obj_id, $usr_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, 0);
335  }
336  }
337  }
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: