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 * 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[
"status"]))
181 $info[
'completed'][] =
$row[
"user_id"];
183 if (self::_isInProgress(
$row[
"status"],
$row[
"status"]))
185 $info[
'in_progress'][] =
$row[
"user_id"];
187 if (self::_isFailed(
$row[
"status"],
$row[
"status"]))
189 $info[
'failed'][] =
$row[
"user_id"];
205 $res = $ilDB->queryF(
'
206 SELECT * 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[
"status"]))
218 $status =
"in_progress";
220 if (self::_isCompleted(
$row[
"status"],
$row[
"status"]))
222 $status =
"completed";
224 if (self::_isFailed(
$row[
"status"],
$row[
"status"]))
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";
342 public static function _countCompleted($a_scos, $a_obj_id, $a_user_id, $a_omit_failed =
false)
346 if (is_array($a_scos))
348 $in = $ilDB->in(
'cp_node.cp_node_id', $a_scos,
false,
'integer');
350 $res = $ilDB->queryF(
351 'SELECT cp_node.cp_node_id id,
352 cmi_node.completion_status completion,
353 cmi_node.success_status success
354 FROM cp_node, cmi_node
356 AND cp_node.cp_node_id = cmi_node.cp_node_id
357 AND cp_node.slm_id = %s
358 AND cmi_node.user_id = %s',
359 array(
'integer',
'integer'),
360 array($a_obj_id, $a_user_id)
365 while ($rec = $ilDB->fetchAssoc(
$res))
370 if (($rec[
"completion"] ==
"completed" || $rec[
"success"] ==
"passed")
371 && (!$a_omit_failed || $rec[
"success"] !=
"failed"))
392 $val_set = $ilDB->queryF(
'
393 SELECT * FROM cmi_custom
398 array(
'integer',
'integer',
'text',
'integer'),
399 array($a_user_id, 0,
'package_attempts',$a_obj_id));
401 $val_rec = $ilDB->fetchAssoc($val_set);
403 $val_rec[
"rvalue"] = str_replace(
"\r\n",
"\n", $val_rec[
"rvalue"]);
404 if ($val_rec[
"rvalue"] == null) {
405 $val_rec[
"rvalue"]=
"";
408 $attempts = $val_rec[
"rvalue"];
412 $val_set = $ilDB->queryF(
413 'SELECT cp_node_id FROM cp_node
415 AND cp_node.slm_id = %s',
416 array(
'text',
'integer'),
417 array(
'item', $a_obj_id)
419 while($val_rec = $ilDB->fetchAssoc($val_set))
421 array_push($scos,$val_rec[
'cp_node_id']);
424 foreach ($scos as $sco)
426 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
427 $data_set = $ilDB->queryF(
'
428 SELECT c_timestamp last_access, session_time, success_status, completion_status,
429 c_raw, cp_node_id, total_time
431 WHERE cp_node_id = %s
433 array(
'integer',
'integer'),
434 array($sco, $a_user_id)
437 while($data_rec = $ilDB->fetchAssoc($data_set))
448 include_once(
"./Services/Tracking/classes/class.ilChangeEvent.php");
450 $a_obj_id, $a_user_id,
false, $attempts, $time);
459 if ($a_status ==
"completed")
472 if ($a_status !=
"completed")
485 if ($a_status ==
"completed" && $a_satisfied ==
"notSatisfied")