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";
340 if ($status ==
"in_progress" && self::_hasMaxAttempts($a_obj_id, $a_user_id))
353 $res = $ilDB->queryF(
354 'SELECT max_attempt FROM sahs_lm WHERE id = %s',
359 $max_attempts =
$row[
'max_attempt'];
363 $res = $ilDB->queryF(
'
364 SELECT rvalue FROM cmi_custom
365 WHERE user_id = %s AND sco_id = %s
366 AND lvalue = %s AND obj_id = %s',
367 array(
'integer',
'integer',
'text',
'integer'),
368 array($a_user_id, 0,
'package_attempts', $a_obj_id)
372 $row[
'rvalue'] = str_replace(
"\r\n",
"\n",
$row[
'rvalue']);
373 if(
$row[
'rvalue'] == null)
377 $act_attempts =
$row[
'rvalue'];
379 if ($act_attempts >= $max_attempts)
389 $a_omit_failed =
false)
393 if (is_array($a_scos))
395 $in = $ilDB->in(
'cp_node.cp_node_id', $a_scos,
false,
'integer');
397 $res = $ilDB->queryF(
398 'SELECT cp_node.cp_node_id id,
399 cmi_node.completion_status completion,
400 cmi_node.success_status success
401 FROM cp_node, cmi_node
403 AND cp_node.cp_node_id = cmi_node.cp_node_id
404 AND cp_node.slm_id = %s
405 AND cmi_node.user_id = %s',
406 array(
'integer',
'integer'),
407 array($a_obj_id, $a_user_id)
412 while ($rec = $ilDB->fetchAssoc(
$res))
417 if (($rec[
"completion"] ==
"completed" || $rec[
"success"] ==
"passed")
418 && (!$a_omit_failed || $rec[
"success"] !=
"failed"))
439 $val_set = $ilDB->queryF(
'
440 SELECT rvalue FROM cmi_custom
445 array(
'integer',
'integer',
'text',
'integer'),
446 array($a_user_id, 0,
'package_attempts',$a_obj_id));
448 $val_rec = $ilDB->fetchAssoc($val_set);
450 $val_rec[
"rvalue"] = str_replace(
"\r\n",
"\n", $val_rec[
"rvalue"]);
451 if ($val_rec[
"rvalue"] == null) {
452 $val_rec[
"rvalue"]=
"";
455 $attempts = $val_rec[
"rvalue"];
459 $val_set = $ilDB->queryF(
460 'SELECT cp_node_id FROM cp_node
462 AND cp_node.slm_id = %s',
463 array(
'text',
'integer'),
464 array(
'item', $a_obj_id)
466 while($val_rec = $ilDB->fetchAssoc($val_set))
468 array_push($scos,$val_rec[
'cp_node_id']);
471 foreach ($scos as $sco)
473 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
474 $data_set = $ilDB->queryF(
'
477 WHERE cp_node_id = %s
479 array(
'integer',
'integer'),
480 array($sco, $a_user_id)
483 while($data_rec = $ilDB->fetchAssoc($data_set))
494 include_once(
"./Services/Tracking/classes/class.ilChangeEvent.php");
496 $a_obj_id, $a_user_id,
false, $attempts, $time);
505 if ($a_status ==
"completed")
518 if ($a_status !=
"completed")
531 if ($a_status ==
"completed" && $a_satisfied ==
"notSatisfied")