25 die(
"Not Implemented: ilSCORM2004Tracking_getInProgress");
62 die(
"Not Implemented: ilSCORM2004Tracking_getCompleted");
92 die(
"Not Implemented: ilSCORM2004Tracking_getFailed");
128 $in = $ilDB->in(
'cp_node.cp_node_id', $a_scorm_item_ids,
false,
'integer');
134 $omit_failed =
' AND success_status <> '.$ilDB->quote(
'failed',
'text');
137 $res = $ilDB->queryF(
' 138 SELECT cmi_node.user_id user_id, COUNT(user_id) completed FROM cp_node, cmi_node 139 WHERE '.
$in.$omit_failed.
' 140 AND cp_node.cp_node_id = cmi_node.cp_node_id 141 AND cp_node.slm_id = %s 142 AND completion_status = %s 143 GROUP BY cmi_node.user_id',
144 array(
'integer',
'text'),
145 array($a_obj_id,
'completed')
147 while(
$row = $ilDB->fetchObject(
$res))
149 $users[
$row->user_id] =
$row->completed;
152 return $users ? $users : array();
165 $res = $ilDB->queryF(
' 166 SELECT user_id, status, satisfied FROM cmi_gobjective 167 WHERE objective_id = %s 169 array(
'text',
'integer'),
170 array(
'-course_overall_status-', $a_obj_id)
173 $info[
'completed'] = array();
174 $info[
'failed'] = array();
175 $info[
'in_progress'] = array();
177 while(
$row = $ilDB->fetchAssoc(
$res))
179 if (self::_isCompleted(
$row[
"status"],
$row[
"satisfied"]))
181 $info[
'completed'][] =
$row[
"user_id"];
183 if (self::_isInProgress(
$row[
"status"],
$row[
"satisfied"]))
185 $info[
'in_progress'][] =
$row[
"user_id"];
187 if (self::_isFailed(
$row[
"status"],
$row[
"satisfied"]))
189 $info[
'failed'][] =
$row[
"user_id"];
205 $res = $ilDB->queryF(
' 206 SELECT status, satisfied FROM cmi_gobjective 207 WHERE objective_id = %s 208 AND scope_id = %s AND user_id = %s',
209 array(
'text',
'integer',
'integer'),
210 array(
'-course_overall_status-', $a_obj_id, $a_user_id)
213 $status =
"not_attempted";
216 if (self::_isInProgress(
$row[
"status"],
$row[
"satisfied"]))
218 $status =
"in_progress";
220 if (self::_isCompleted(
$row[
"status"],
$row[
"satisfied"]))
222 $status =
"completed";
224 if (self::_isFailed(
$row[
"status"],
$row[
"satisfied"]))
241 $res = $ilDB->queryF(
' 242 SELECT DISTINCT user_id FROM cmi_gobjective 243 WHERE objective_id = %s 245 array(
'text',
'integer'),
246 array(
'-course_overall_status-', $a_obj_id)
250 while (
$row = $ilDB->fetchAssoc(
$res))
252 $users[] =
$row[
"user_id"];
261 $in = $ilDB->in(
'cp_node.cp_node_id', $a_scorm_item_ids,
false,
'integer');
263 $res = $ilDB->queryF(
264 'SELECT cp_node.cp_node_id id, 265 cmi_node.user_id user_id, 266 cmi_node.completion_status completion, 267 cmi_node.success_status success 268 FROM cp_node, cmi_node 270 AND cp_node.cp_node_id = cmi_node.cp_node_id 271 AND cp_node.slm_id = %s',
276 $info[
'completed'] = array();
277 $info[
'failed'] = array();
278 $info[
'in_progress'] = array();
280 while(
$row = $ilDB->fetchAssoc(
$res))
283 $info[
'in_progress'][
$row[
"id"]][] = $row[
"user_id"];
284 if ($row[
"completion"] ==
"completed" || $row[
"success"] ==
"passed")
287 if(!$a_omit_failed || $row[
"success"] !=
"failed")
289 $info[
'completed'][$row[
"id"]][] = $row[
"user_id"];
292 if ($row[
"success"] ==
"failed")
294 $info[
'failed'][$row[
"id"]][] = $row[
"user_id"];
304 $status =
"not_attempted";
306 if (is_array($a_scos))
308 $in = $ilDB->in(
'cp_node.cp_node_id', $a_scos,
false,
'integer');
310 $res = $ilDB->queryF(
311 'SELECT cp_node.cp_node_id id, 312 cmi_node.completion_status completion, 313 cmi_node.success_status success 314 FROM cp_node, cmi_node 316 AND cp_node.cp_node_id = cmi_node.cp_node_id 317 AND cp_node.slm_id = %s 318 AND cmi_node.user_id = %s',
319 array(
'integer',
'integer'),
320 array($a_obj_id, $a_user_id)
326 while ($rec = $ilDB->fetchAssoc(
$res))
328 if ($rec[
"completion"] ==
"completed" || $rec[
"success"] ==
"passed")
332 if ($rec[
"success"] ==
"failed")
$failed =
true;
335 if ($started ==
true) $status =
"in_progress";
336 if (
$failed ==
true) $status =
"failed";
337 else if ($cntcompleted == count($a_scos)) $status =
"completed";
340 if ($status ==
"in_progress" && self::_hasMaxAttempts($a_obj_id, $a_user_id))
352 $res = $ilDB->queryF(
353 'SELECT max_attempt FROM sahs_lm WHERE id = %s',
358 $max_attempts =
$row[
'max_attempt'];
362 $val_set = $ilDB->queryF(
'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
363 array(
'integer',
'integer'), array($a_obj_id,$a_user_id));
364 $val_rec = $ilDB->fetchAssoc($val_set);
365 $attempts = $val_rec[
"package_attempts"];
366 if ($attempts == null) $attempts = 0;
368 if ($attempts >= $max_attempts)
378 $a_omit_failed =
false)
382 if (is_array($a_scos))
384 $in = $ilDB->in(
'cp_node.cp_node_id', $a_scos,
false,
'integer');
386 $res = $ilDB->queryF(
387 'SELECT cp_node.cp_node_id id, 388 cmi_node.completion_status completion, 389 cmi_node.success_status success 390 FROM cp_node, cmi_node 392 AND cp_node.cp_node_id = cmi_node.cp_node_id 393 AND cp_node.slm_id = %s 394 AND cmi_node.user_id = %s',
395 array(
'integer',
'integer'),
396 array($a_obj_id, $a_user_id)
401 while ($rec = $ilDB->fetchAssoc(
$res))
406 if (($rec[
"completion"] ==
"completed" || $rec[
"success"] ==
"passed")
407 && (!$a_omit_failed || $rec[
"success"] !=
"failed"))
427 $val_set = $ilDB->queryF(
' 428 SELECT package_attempts, sco_total_time_sec 429 FROM sahs_user WHERE obj_id = %s AND user_id = %s',
430 array(
'integer',
'integer'), array($a_obj_id,$a_user_id));
431 $val_rec = $ilDB->fetchAssoc($val_set);
432 $time = $val_rec[
"sco_total_time_sec"];
433 $attempts = $val_rec[
"package_attempts"];
434 if ($attempts == null) $attempts =
"";
436 if ($attempts !=
"" && $time == null) {
437 $time = self::getSumTotalTimeSecondsFromScos($a_obj_id, $a_user_id,
true);
440 include_once(
"./Services/Tracking/classes/class.ilChangeEvent.php");
442 $a_obj_id, $a_user_id,
false, $attempts, $time);
450 if ($a_status ==
"completed" || $a_satisfied ==
"satisfied")
463 if ($a_status !=
"completed")
476 if ($a_status ==
"completed" && $a_satisfied ==
"notSatisfied")
491 $val_set = $ilDB->queryF(
492 'SELECT cp_node_id FROM cp_node 494 AND cp_node.slm_id = %s',
495 array(
'text',
'integer'),
496 array(
'item', $a_obj_id)
498 while($val_rec = $ilDB->fetchAssoc($val_set))
500 array_push($scos,$val_rec[
'cp_node_id']);
503 foreach ($scos as $sco)
505 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
506 $data_set = $ilDB->queryF(
' 509 WHERE cp_node_id = %s 511 array(
'integer',
'integer'),
512 array($sco, $a_user_id)
515 while($data_rec = $ilDB->fetchAssoc($data_set))
523 if ($a_write && $time>0) {
524 $ilDB->queryF(
'UPDATE sahs_user SET sco_total_time_sec=%s WHERE obj_id = %s AND user_id = %s',
525 array(
'integer',
'integer',
'integer'),
526 array($time, $a_obj_id, $a_user_id));
ilObjSCORM2004Tracking()
Constructor public.
static _hasMaxAttempts($a_obj_id, $a_user_id)
_syncReadEvent($a_obj_id, $a_user_id, $a_type, $a_ref_id)
Synch read event table.
_getCompleted($scorm_item_id, $a_obj_id)
_getTrackedUsers($a_obj_id)
Get all tracked users.
_ISODurationToCentisec($str)
convert ISO 8601 Timeperiods to centiseconds ta
_getItemProgressInfo($a_scorm_item_ids, $a_obj_id, $a_omit_failed=false)
static _isInProgress($a_status, $a_satisfied)
static _countCompleted($a_scos, $a_obj_id, $a_user_id, $a_omit_failed=false)
static _isCompleted($a_status, $a_satisfied)
Class ilSCORM2004Tracking.
_getProgressInfo($a_obj_id)
Get overall scorm status.
_getInProgress($scorm_item_id, $a_obj_id)
_recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
_getFailed($scorm_item_id, $a_obj_id)
static _getCollectionStatus($a_scos, $a_obj_id, $a_user_id)
getSumTotalTimeSecondsFromScos($a_obj_id, $a_user_id, $a_write=false)
should be avoided; store value to increase performance for further requests
static _isFailed($a_status, $a_satisfied)
_getProgressInfoOfUser($a_obj_id, $a_user_id)
Get overall scorm status.
_getCountCompletedPerUser($a_scorm_item_ids, $a_obj_id, $a_omit_failed=false)
Get progress of selected scos.