16 die(
"Not Implemented: ilSCORM2004Tracking_getInProgress");
55 $ilDB = $DIC->database();
57 die(
"Not Implemented: ilSCORM2004Tracking_getCompleted");
83 public static function _getFailed($scorm_item_id, $a_obj_id)
87 $ilDB = $DIC->database();
89 die(
"Not Implemented: ilSCORM2004Tracking_getFailed");
125 $ilDB = $DIC->database();
127 $in =
$ilDB->in(
'cp_node.cp_node_id', $a_scorm_item_ids,
false,
'integer');
131 if ($a_omit_failed) {
132 $omit_failed =
' AND success_status <> ' .
$ilDB->quote(
'failed',
'text');
137 SELECT cmi_node.user_id user_id, COUNT(user_id) completed FROM cp_node, cmi_node 138 WHERE ' .
$in . $omit_failed .
' 139 AND cp_node.cp_node_id = cmi_node.cp_node_id 140 AND cp_node.slm_id = %s 141 AND completion_status = %s 142 GROUP BY cmi_node.user_id',
143 array(
'integer',
'text'),
144 array($a_obj_id,
'completed')
163 $ilDB = $DIC->database();
167 SELECT user_id, status, satisfied FROM cmi_gobjective 168 WHERE objective_id = %s 170 array(
'text',
'integer'),
171 array(
'-course_overall_status-', $a_obj_id)
174 $info[
'completed'] = array();
175 $info[
'failed'] = array();
176 $info[
'in_progress'] = array();
179 if (self::_isCompleted(
$row[
"status"],
$row[
"satisfied"])) {
182 if (self::_isInProgress(
$row[
"status"],
$row[
"satisfied"])) {
183 $info[
'in_progress'][] =
$row[
"user_id"];
185 if (self::_isFailed(
$row[
"status"],
$row[
"satisfied"])) {
202 $ilDB = $DIC->database();
207 SELECT status, satisfied FROM cmi_gobjective 208 WHERE objective_id = %s 209 AND scope_id = %s AND user_id = %s',
210 array(
'text',
'integer',
'integer'),
211 array(
'-course_overall_status-', $a_obj_id, $a_user_id)
214 $status =
"not_attempted";
216 if (self::_isInProgress(
$row[
"status"],
$row[
"satisfied"])) {
217 $status =
"in_progress";
219 if (self::_isCompleted(
$row[
"status"],
$row[
"satisfied"])) {
220 $status =
"completed";
222 if (self::_isFailed(
$row[
"status"],
$row[
"satisfied"])) {
238 $ilDB = $DIC->database();
243 SELECT DISTINCT user_id FROM cmi_gobjective 244 WHERE objective_id = %s 246 array(
'text',
'integer'),
247 array(
'-course_overall_status-', $a_obj_id)
261 $ilDB = $DIC->database();
263 $in =
$ilDB->in(
'cp_node.cp_node_id', $a_scorm_item_ids,
false,
'integer');
266 'SELECT cp_node.cp_node_id id, 267 cmi_node.user_id user_id, 268 cmi_node.completion_status completion, 269 cmi_node.success_status success 270 FROM cp_node, cmi_node 272 AND cp_node.cp_node_id = cmi_node.cp_node_id 273 AND cp_node.slm_id = %s',
278 $info[
'completed'] = array();
279 $info[
'failed'] = array();
280 $info[
'in_progress'] = array();
284 $info[
'in_progress'][
$row[
"id"]][] = $row[
"user_id"];
285 if ($row[
"completion"] ==
"completed" || $row[
"success"] ==
"passed") {
287 if (!$a_omit_failed || $row[
"success"] !=
"failed") {
288 $info[
'completed'][$row[
"id"]][] = $row[
"user_id"];
291 if ($row[
"success"] ==
"failed") {
292 $info[
'failed'][$row[
"id"]][] = $row[
"user_id"];
302 $ilDB = $DIC->database();
304 $status =
"not_attempted";
306 if (is_array($a_scos)) {
307 $in =
$ilDB->in(
'cp_node.cp_node_id', $a_scos,
false,
'integer');
310 'SELECT cp_node.cp_node_id id, 311 cmi_node.completion_status completion, 312 cmi_node.success_status success 313 FROM cp_node, cmi_node 315 AND cp_node.cp_node_id = cmi_node.cp_node_id 316 AND cp_node.slm_id = %s 317 AND cmi_node.user_id = %s',
318 array(
'integer',
'integer'),
319 array($a_obj_id, $a_user_id)
326 if ($rec[
"completion"] ==
"completed" || $rec[
"success"] ==
"passed") {
329 if ($rec[
"success"] ==
"failed") {
334 if ($started ==
true) {
335 $status =
"in_progress";
339 } elseif ($cntcompleted == count($a_scos)) {
340 $status =
"completed";
350 $a_omit_failed =
false 354 $ilDB = $DIC->database();
356 if (is_array($a_scos)) {
357 $in =
$ilDB->in(
'cp_node.cp_node_id', $a_scos,
false,
'integer');
360 'SELECT cp_node.cp_node_id id, 361 cmi_node.completion_status completion, 362 cmi_node.success_status success 363 FROM cp_node, cmi_node 365 AND cp_node.cp_node_id = cmi_node.cp_node_id 366 AND cp_node.slm_id = %s 367 AND cmi_node.user_id = %s',
368 array(
'integer',
'integer'),
369 array($a_obj_id, $a_user_id)
378 if (($rec[
"completion"] ==
"completed" || $rec[
"success"] ==
"passed")
379 && (!$a_omit_failed || $rec[
"success"] !=
"failed")) {
397 $ilDB = $DIC->database();
400 $val_set =
$ilDB->queryF(
401 'SELECT time_from_lms FROM sahs_lm WHERE id = %s',
405 $val_rec =
$ilDB->fetchAssoc($val_set);
409 $val_set =
$ilDB->queryF(
411 SELECT package_attempts, sco_total_time_sec, total_time_sec 412 FROM sahs_user WHERE obj_id = %s AND user_id = %s',
413 array(
'integer',
'integer'),
414 array($a_obj_id,$a_user_id)
416 $val_rec =
$ilDB->fetchAssoc($val_set);
417 if ($time_from_lms ==
false) {
418 $time = $val_rec[
"sco_total_time_sec"];
420 $time = $val_rec[
"total_time_sec"];
422 $attempts = $val_rec[
"package_attempts"];
423 if ($attempts == null) {
427 if ($attempts !=
"" &&
$time == null) {
428 $time = self::getSumTotalTimeSecondsFromScos($a_obj_id, $a_user_id,
true);
431 include_once(
"./Services/Tracking/classes/class.ilChangeEvent.php");
448 if ($a_status ==
"completed" || $a_satisfied ==
"satisfied") {
460 if ($a_status !=
"completed") {
470 public static function _isFailed($a_status, $a_satisfied)
472 if ($a_status ==
"completed" && $a_satisfied ==
"notSatisfied") {
486 $ilDB = $DIC->database();
489 $val_set =
$ilDB->queryF(
490 'SELECT cp_node_id FROM cp_node 492 AND cp_node.slm_id = %s',
493 array(
'text',
'integer'),
494 array(
'item', $a_obj_id)
496 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
497 array_push($scos, $val_rec[
'cp_node_id']);
500 foreach ($scos as $sco) {
501 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
502 $data_set =
$ilDB->queryF(
506 WHERE cp_node_id = %s 508 array(
'integer',
'integer'),
509 array($sco, $a_user_id)
512 while ($data_rec =
$ilDB->fetchAssoc($data_set)) {
519 if ($a_write &&
$time > 0) {
521 'UPDATE sahs_user SET sco_total_time_sec=%s WHERE obj_id = %s AND user_id = %s',
522 array(
'integer',
'integer',
'integer'),
523 array(
$time, $a_obj_id, $a_user_id)
static _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.
static _getItemProgressInfo($a_scorm_item_ids, $a_obj_id, $a_omit_failed=false)
static _getProgressInfo($a_obj_id)
Get overall scorm status.
static _getProgressInfoOfUser($a_obj_id, $a_user_id)
Get overall scorm status.
static _isInProgress($a_status, $a_satisfied)
static _getTrackedUsers($a_obj_id)
Get all tracked users.
static _getCountCompletedPerUser($a_scorm_item_ids, $a_obj_id, $a_omit_failed=false)
Get progress of selected scos.
foreach($_POST as $key=> $value) $res
static _getInProgress($scorm_item_id, $a_obj_id)
static _isCompleted($a_status, $a_satisfied)
static _getCompleted($scorm_item_id, $a_obj_id)
Class ilSCORM2004Tracking.
if(php_sapi_name() !='cli') $in
static _getCollectionStatus($a_scos, $a_obj_id, $a_user_id)
static _countCompleted( $a_scos, $a_obj_id, $a_user_id, $a_omit_failed=false)
static _ISODurationToCentisec($str)
convert ISO 8601 Timeperiods to centiseconds ta
static _isFailed($a_status, $a_satisfied)
static _getFailed($scorm_item_id, $a_obj_id)
static yn2tf($a_yn)
convert "y"/"n" to true/false
static getSumTotalTimeSecondsFromScos($a_obj_id, $a_user_id, $a_write=false)
should be avoided; store value to increase performance for further requests
static _syncReadEvent($a_obj_id, $a_user_id, $a_type, $a_ref_id, $time_from_lms=null)
Synch read event table.