4 include_once
'./Modules/ScormAicc/classes/class.ilSCORMTrackingItems.php';
5 include_once
'./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
33 $this->db = $DIC->database();
34 $this->lng = $DIC->language();
42 $query =
'SELECT cp_item.cp_node_id, cp_item.title ' 43 .
'FROM cp_item, cmi_node, cp_node ' 44 .
'WHERE cp_node.slm_id = %s ' 45 .
'AND cp_item.cp_node_id = cmi_node.cp_node_id ' 46 .
'AND cp_node.cp_node_id = cmi_node.cp_node_id ' 47 .
'GROUP BY cp_item.cp_node_id, cp_item.title';
54 $scoTitles[
$row[
'cp_node_id']] = $row[
'title'];
63 $lng = $DIC->language();
64 $lng->loadLanguageModule(
"scormtrac");
67 $udh = self::userDataHeaderForExport();
70 'lm_id,lm_title,cp_node_id,sco_marked_for_learning_progress,sco_title,' . $udh[
"cols"]
71 .
',audio_captioning,audio_level,completion_status,completion_threshold,credit,delivery_speed' 72 .
',c_entry,c_exit,c_language,c_location,c_mode,progress_measure,c_max,c_min,c_raw,scaled' 73 .
',scaled_passing_score,session_time,session_time_seconds,success_status,total_time,total_time_seconds,c_timestamp,suspend_data,launch_data' 75 $a_true = explode(
',', $udh[
"default"] .
",sco_title,success_status,completion_status");
76 for (
$i = 0;
$i < count($a_cols);
$i++) {
77 $cols[$a_cols[
$i]] = array(
"txt" =>
$lng->txt($a_cols[
$i]),
"default" =>
false);
79 for (
$i = 0;
$i < count($a_true);
$i++) {
80 $cols[$a_true[
$i]][
"default"] =
true;
85 public function exportSelectedCore($a_user = array(), $a_sco = array(), $b_orderBySCO =
false, $allowExportPrivacy =
false, $obj_id, $lmTitle)
89 $lng->loadLanguageModule(
"scormtrac");
91 $returnData = array();
93 $scoTitles = self::scoTitlesForExportSelected($obj_id);
95 $scoProgress = self::markedLearningStatusForExportSelected($scoTitles, $obj_id);
99 $query =
'SELECT user_id, cp_node_id, ' 100 .
'audio_captioning, audio_level, completion_status, completion_threshold, credit, delivery_speed, ' 101 .
'c_entry, c_exit, c_language, location as c_location, c_mode, progress_measure, c_max, c_min, c_raw, scaled, ' 102 .
'scaled_passing_score, session_time, success_status, total_time, c_timestamp, suspend_data, launch_data ' 104 .
'WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' ' 105 .
'AND ' .
$ilDB->in(
'user_id', $a_user,
false,
'integer') .
' ' 108 $query .=
'cp_node_id, user_id';
110 $query .=
'user_id, cp_node_id';
116 foreach ($dbdata as
$data) {
117 $data[
"lm_id"] = $obj_id;
118 $data[
"lm_title"] = $lmTitle;
119 $data = array_merge($data, self::userDataArrayForExport($data[
"user_id"], $allowExportPrivacy));
120 $data[
"sco_marked_for_learning_progress"] = $scoProgress[$data[
"cp_node_id"]];
121 $data[
"sco_title"] = $scoTitles[$data[
"cp_node_id"]];
122 $data[
"audio_captioning"] =
"" . $data[
"audio_captioning"];
123 $data[
"audio_level"] =
"" . $data[
"audio_level"];
124 $data[
"completion_status"] =
"" . $data[
"completion_status"];
125 $data[
"completion_threshold"] =
"" . $data[
"completion_threshold"];
126 $data[
"credit"] =
"" . $data[
"credit"];
127 $data[
"delivery_speed"] =
"" . $data[
"delivery_speed"];
128 $data[
"c_entry"] =
"" . $data[
"c_entry"];
129 $data[
"c_exit"] =
"" . $data[
"c_exit"];
130 $data[
"c_language"] =
"" . $data[
"c_language"];
131 $data[
"c_location"] =
"" . str_replace(
'"',
'', $data[
"c_location"]);
132 $data[
"c_mode"] =
"" . $data[
"c_mode"];
133 $data[
"progress_measure"] =
"" . $data[
"progress_measure"];
134 $data[
"c_max"] =
"" . $data[
"c_max"];
135 $data[
"c_min"] =
"" . $data[
"c_min"];
136 $data[
"c_raw"] =
"" . $data[
"c_raw"];
137 $data[
"scaled"] =
"" . $data[
"scaled"];
138 $data[
"scaled_passing_score"] =
"" . $data[
"scaled_passing_score"];
139 $data[
"session_time"] =
"" . $data[
"session_time"];
140 $data[
"session_time_seconds"] =
"";
141 if ($data[
"session_time"] !=
"") {
144 $data[
"success_status"] =
"" . $data[
"success_status"];
145 $data[
"total_time"] =
"" . $data[
"total_time"];
146 $data[
"total_time_seconds"] =
"";
147 if ($data[
"total_time"] !=
"") {
150 $data[
"c_timestamp"] = $data[
"c_timestamp"];
151 $data[
"suspend_data"] =
"" . $data[
"suspend_data"];
152 $data[
"launch_data"] =
"" . $data[
"launch_data"];
162 $returnData[] =
$data;
172 $lng = $DIC->language();
173 $lng->loadLanguageModule(
"scormtrac");
175 $udh = self::userDataHeaderForExport();
178 'lm_id,lm_title,cp_node_id,sco_marked_for_learning_progress,sco_title,' . $udh[
"cols"]
179 .
',id,description,weighting,c_type,result,latency,latency_seconds,c_timestamp,learner_response' 181 $a_true = explode(
',', $udh[
"default"] .
",sco_title,id,result,learner_response");
182 for (
$i = 0;
$i < count($a_cols);
$i++) {
183 $cols[$a_cols[
$i]] = array(
"txt" =>
$lng->txt($a_cols[
$i]),
"default" =>
false);
185 for (
$i = 0;
$i < count($a_true);
$i++) {
186 $cols[$a_true[
$i]][
"default"] =
true;
191 public function exportSelectedInteractions($a_user = array(), $a_sco = array(), $b_orderBySCO =
false, $allowExportPrivacy =
false, $obj_id, $lmTitle)
195 $lng->loadLanguageModule(
"scormtrac");
197 $returnData = array();
199 $scoTitles = self::scoTitlesForExportSelected($obj_id);
201 $scoProgress = self::markedLearningStatusForExportSelected($scoTitles, $obj_id);
204 $query =
'SELECT cmi_node.user_id, cmi_node.cp_node_id, 205 cmi_interaction.cmi_interaction_id, 207 cmi_interaction.description, 208 cmi_interaction.weighting, 209 cmi_interaction.c_type, 210 cmi_interaction.result, 211 cmi_interaction.latency, 212 cmi_interaction.c_timestamp, 213 cmi_interaction.learner_response, 214 cmi_interaction.cmi_interaction_id, 215 cmi_interaction.cmi_node_id 216 FROM cmi_interaction, cmi_node 217 WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' 218 AND ' .
$ilDB->in(
'cmi_node.user_id', $a_user,
false,
'integer') .
' 219 AND cmi_node.cmi_node_id = cmi_interaction.cmi_node_id 222 $query .=
'cmi_node.cp_node_id, cmi_node.user_id';
224 $query .=
'cmi_node.user_id, cmi_node.cp_node_id';
226 $query .=
', cmi_interaction.cmi_interaction_id, cmi_interaction.cmi_node_id';
231 foreach ($dbdata as
$data) {
232 $data[
"lm_id"] = $obj_id;
233 $data[
"lm_title"] = $lmTitle;
234 $data = array_merge($data, self::userDataArrayForExport($data[
"user_id"], $allowExportPrivacy));
235 $data[
"sco_marked_for_learning_progress"] = $scoProgress[$data[
"cp_node_id"]];
236 $data[
"sco_title"] = $scoTitles[$data[
"cp_node_id"]];
237 $data[
"description"] =
"" . $data[
"description"];
238 $data[
"weighting"] =
"" . $data[
"weighting"];
239 $data[
"c_type"] =
"" . $data[
"c_type"];
240 $data[
"result"] =
"" . $data[
"result"];
241 $data[
"latency"] =
"" . $data[
"latency"];
242 $data[
"latency_seconds"] =
"";
243 if ($data[
"latency"] !=
"") {
246 $data[
"c_timestamp"] =
"" . $data[
"c_timestamp"];
247 $data[
"learner_response"] =
"" . str_replace(
'"',
'', $data[
"learner_response"]);
248 $returnData[] =
$data;
258 $lng = $DIC->language();
259 $lng->loadLanguageModule(
"scormtrac");
261 $udh = self::userDataHeaderForExport();
264 'lm_id,lm_title,cp_node_id,sco_marked_for_learning_progress,sco_title,' . $udh[
"cols"]
265 .
',id,description,completion_status,progress_measure,success_status,scaled,c_max,c_min,c_raw,scope' 267 $a_true = explode(
',', $udh[
"default"] .
",sco_title,id,completion_status,success_status");
268 for (
$i = 0;
$i < count($a_cols);
$i++) {
269 $cols[$a_cols[
$i]] = array(
"txt" =>
$lng->txt($a_cols[
$i]),
"default" =>
false);
271 for (
$i = 0;
$i < count($a_true);
$i++) {
272 $cols[$a_true[
$i]][
"default"] =
true;
277 public function exportSelectedObjectives($a_user = array(), $a_sco = array(), $b_orderBySCO =
false, $allowExportPrivacy =
false, $obj_id, $lmTitle)
281 $lng->loadLanguageModule(
"scormtrac");
283 $returnData = array();
285 $scoTitles = self::scoTitlesForExportSelected($obj_id);
287 $scoProgress = self::markedLearningStatusForExportSelected($scoTitles, $obj_id);
290 $query =
'SELECT cmi_node.user_id, cmi_node.cp_node_id, 291 cmi_objective.cmi_objective_id, 293 cmi_objective.description, 294 cmi_objective.completion_status, 295 cmi_objective.progress_measure, 296 cmi_objective.success_status, 297 cmi_objective.scaled, 302 FROM cmi_objective, cmi_node 303 WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' 304 AND ' .
$ilDB->in(
'cmi_node.user_id', $a_user,
false,
'integer') .
' 305 AND cmi_node.cmi_node_id = cmi_objective.cmi_node_id 306 AND cmi_interaction_id is null 309 $query .=
'cmi_node.cp_node_id, cmi_node.user_id';
311 $query .=
'cmi_node.user_id, cmi_node.cp_node_id';
313 $query .=
', cmi_objective.cmi_node_id';
318 foreach ($dbdata as
$data) {
319 $data[
"lm_id"] = $obj_id;
320 $data[
"lm_title"] = $lmTitle;
321 $data = array_merge($data, self::userDataArrayForExport($data[
"user_id"], $allowExportPrivacy));
322 $data[
"sco_marked_for_learning_progress"] = $scoProgress[$data[
"cp_node_id"]];
323 $data[
"sco_title"] = $scoTitles[$data[
"cp_node_id"]];
324 $data[
"description"] =
"" . $data[
"description"];
325 $data[
"completion_status"] =
"" . $data[
"completion_status"];
326 $data[
"progress_measure"] =
"" . $data[
"progress_measure"];
327 $data[
"success_status"] =
"" . $data[
"success_status"];
328 $data[
"scaled"] =
"" . $data[
"scaled"];
329 $data[
"c_max"] =
"" . $data[
"c_max"];
330 $data[
"c_min"] =
"" . $data[
"c_min"];
331 $data[
"c_raw"] =
"" . $data[
"c_raw"];
332 $data[
"scope"] =
"" . $data[
"scope"];
333 $returnData[] =
$data;
343 $lng = $DIC->language();
344 $lng->loadLanguageModule(
"scormtrac");
346 $udh = self::userDataHeaderForExport();
349 'lm_id,lm_title,' . $udh[
"cols"]
350 .
',Status,satisfied,measure,c_raw,c_min,c_max,completion_status,progress_measure' 352 $a_true = explode(
',', $udh[
"default"] .
",lm_title,Status,satisfied,completion_status");
353 for (
$i = 0;
$i < count($a_cols);
$i++) {
354 $cols[$a_cols[
$i]] = array(
"txt" =>
$lng->txt($a_cols[
$i]),
"default" =>
false);
356 for (
$i = 0;
$i < count($a_true);
$i++) {
357 $cols[$a_true[
$i]][
"default"] =
true;
366 $lng->loadLanguageModule(
"scormtrac");
367 $returnData = array();
369 $query =
'SELECT user_id, scope_id, 380 AND ' .
$ilDB->in(
'user_id', $a_user,
false,
'integer') .
' 381 ORDER BY user_id, scope_id';
386 foreach ($dbdata as
$data) {
387 $data[
"lm_id"] = $data[
"scope_id"];
388 $data[
"lm_title"] = $lmTitle;
389 $data = array_merge($data, self::userDataArrayForExport($data[
"user_id"], $allowExportPrivacy));
390 $data[
"Status"] =
"" . $data[
"status"];
391 $data[
"satisfied"] =
"" . $data[
"satisfied"];
392 $data[
"measure"] =
"" . $data[
"measure"];
393 $data[
"c_raw"] =
"" . $data[
"c_raw"];
394 $data[
"c_min"] =
"" . $data[
"c_min"];
395 $data[
"c_max"] =
"" . $data[
"c_max"];
396 $data[
"completion_status"] =
"" . $data[
"completion_status"];
397 $data[
"progress_measure"] =
"" . $data[
"progress_measure"];
398 $returnData[] =
$data;
409 $lng = $DIC->language();
410 $lng->loadLanguageModule(
"scormtrac");
414 'lm_id,lm_title,cp_node_id,sco_marked_for_learning_progress,sco_title' 415 .
',id,description,counter_all' 416 .
',counter_correct,counter_correct_percent' 417 .
',counter_incorrect,counter_incorrect_percent' 418 .
',counter_other,counter_other_percent' 420 $a_true = explode(
',',
"sco_title,description,counter_correct,counter_incorrect");
421 for (
$i = 0;
$i < count($a_cols);
$i++) {
422 $cols[$a_cols[
$i]] = array(
"txt" =>
$lng->txt($a_cols[
$i]),
"default" =>
false);
424 for (
$i = 0;
$i < count($a_true);
$i++) {
425 $cols[$a_true[
$i]][
"default"] =
true;
430 public function tracInteractionItem($a_user = array(), $a_sco = array(), $b_orderBySCO =
false, $allowExportPrivacy =
false, $obj_id, $lmTitle)
434 $lng->loadLanguageModule(
"scormtrac");
436 $returnData = array();
438 $scoTitles = self::scoTitlesForExportSelected($obj_id);
440 $scoProgress = self::markedLearningStatusForExportSelected($scoTitles, $obj_id);
442 $a_correct = array();
443 $a_incorrect = array();
444 $query =
'SELECT cmi_node.cp_node_id, cmi_interaction.id, count(*) as counter 445 FROM cmi_interaction, cmi_node 446 WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' 447 AND ' .
$ilDB->in(
'cmi_node.user_id', $a_user,
false,
'integer') .
' 448 AND cmi_node.cmi_node_id = cmi_interaction.cmi_node_id 449 AND cmi_interaction.result = %s 450 GROUP BY cmi_node.cp_node_id,cmi_interaction.id';
454 $a_correct[
$row[
'cp_node_id'] .
':' .
$row[
'id']] =
$row[
'counter'];
459 $a_incorrect[
$row[
'cp_node_id'] .
':' .
$row[
'id']] =
$row[
'counter'];
463 $query =
'SELECT cmi_node.cp_node_id, cmi_interaction.id, cmi_interaction.description, count(*) as counter_all 464 FROM cmi_interaction, cmi_node 465 WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' 466 AND ' .
$ilDB->in(
'cmi_node.user_id', $a_user,
false,
'integer') .
' 467 AND cmi_node.cmi_node_id = cmi_interaction.cmi_node_id 468 GROUP BY cmi_node.cp_node_id,cmi_interaction.id,cmi_interaction.description';
473 foreach ($dbdata as
$data) {
474 $skey = $data[
"cp_node_id"] .
':' . $data[
"id"];
475 $all = $data[
"counter_all"];
477 if ($a_correct[$skey] != null) {
478 $correct = $a_correct[$skey];
481 if ($a_incorrect[$skey] != null) {
482 $incorrect = $a_incorrect[$skey];
484 $other = $all - ($correct + $incorrect);
485 $data[
"lm_id"] = $obj_id;
486 $data[
"lm_title"] = $lmTitle;
487 $data[
"sco_marked_for_learning_progress"] = $scoProgress[$data[
"cp_node_id"]];
488 $data[
"sco_title"] = $scoTitles[$data[
"cp_node_id"]];
490 $data[
"description"] =
"" . $data[
"description"];
492 $data[
"counter_correct"] = $correct;
493 $data[
"counter_correct_percent"] = $correct * 100 / $all;
494 $data[
"counter_incorrect"] = $incorrect;
495 $data[
"counter_incorrect_percent"] = $incorrect * 100 / $all;
496 $data[
"counter_other"] = $other;
497 $data[
"counter_other_percent"] = $other * 100 / $all;
498 $returnData[] =
$data;
507 $lng = $DIC->language();
508 $lng->loadLanguageModule(
"scormtrac");
511 $udh = self::userDataHeaderForExport();
514 'lm_id,lm_title,cp_node_id,sco_marked_for_learning_progress,sco_title,' . $udh[
"cols"]
515 .
',counter_i_correct,counter_i_correct_percent' 516 .
',counter_i_incorrect,counter_i_incorrect_percent' 517 .
',counter_i_other,counter_i_other_percent' 518 .
',audio_captioning,audio_level,completion_status,completion_threshold,credit,delivery_speed' 519 .
',c_entry,c_exit,c_language,c_location,c_mode,progress_measure,c_max,c_min,c_raw,scaled' 520 .
',scaled_passing_score,session_time,session_time_seconds,success_status,total_time,total_time_seconds,c_timestamp,suspend_data,launch_data' 522 $a_true = explode(
',', $udh[
"default"] .
',sco_title' 523 .
',counter_i_correct,counter_i_correct_percent' 524 .
',counter_i_incorrect,counter_i_incorrect_percent' 525 .
',counter_i_other,counter_i_other_percent' 527 for (
$i = 0;
$i < count($a_cols);
$i++) {
528 $cols[$a_cols[
$i]] = array(
"txt" =>
$lng->txt($a_cols[
$i]),
"default" =>
false);
530 for (
$i = 0;
$i < count($a_true);
$i++) {
531 $cols[$a_true[
$i]][
"default"] =
true;
536 public function tracInteractionUser($a_user = array(), $a_sco = array(), $b_orderBySCO =
false, $allowExportPrivacy =
false, $obj_id, $lmTitle)
540 $lng->loadLanguageModule(
"scormtrac");
542 $returnData = array();
544 $scoTitles = self::scoTitlesForExportSelected($obj_id);
546 $scoProgress = self::markedLearningStatusForExportSelected($scoTitles, $obj_id);
548 $a_correct = array();
549 $a_incorrect = array();
551 $query =
'SELECT cmi_node.user_id, cmi_node.cp_node_id, count(*) as counter 552 FROM cmi_interaction, cmi_node 553 WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' 554 AND ' .
$ilDB->in(
'cmi_node.user_id', $a_user,
false,
'integer') .
' 555 AND cmi_node.cmi_node_id = cmi_interaction.cmi_node_id 556 AND cmi_interaction.result = %s 557 GROUP BY cmi_node.user_id,cmi_node.cp_node_id';
561 $a_correct[
$row[
'user_id'] .
':' .
$row[
'cp_node_id']] =
$row[
'counter'];
566 $a_incorrect[
$row[
'user_id'] .
':' .
$row[
'cp_node_id']] =
$row[
'counter'];
569 $query =
'SELECT cmi_node.user_id, cmi_node.cp_node_id, count(*) as counter 570 FROM cmi_interaction, cmi_node 571 WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' 572 AND ' .
$ilDB->in(
'cmi_node.user_id', $a_user,
false,
'integer') .
' 573 AND cmi_node.cmi_node_id = cmi_interaction.cmi_node_id 574 AND cmi_interaction.result <> %s AND cmi_interaction.result <> %s 575 GROUP BY cmi_node.user_id,cmi_node.cp_node_id';
576 $res =
$ilDB->queryF(
$query, array(
'text',
'text'), array(
'correct',
'incorrect'));
578 $a_other[
$row[
'user_id'] .
':' .
$row[
'cp_node_id']] =
$row[
'counter'];
582 $query =
'SELECT user_id, cp_node_id, ' 583 .
'audio_captioning, audio_level, completion_status, completion_threshold, credit, delivery_speed, ' 584 .
'c_entry, c_exit, c_language, location as c_location, c_mode, progress_measure, c_max, c_min, c_raw, scaled, ' 585 .
'scaled_passing_score, session_time, success_status, total_time, c_timestamp, suspend_data, launch_data ' 587 .
'WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' ' 588 .
'AND ' .
$ilDB->in(
'user_id', $a_user,
false,
'integer') .
' ' 591 $query .=
'cp_node_id, user_id';
593 $query .=
'user_id, cp_node_id';
599 foreach ($dbdata as
$data) {
600 $skey = $data[
"user_id"] .
':' . $data[
"cp_node_id"];
602 if ($a_correct[$skey] != null) {
603 $correct = $a_correct[$skey];
606 if ($a_incorrect[$skey] != null) {
607 $incorrect = $a_incorrect[$skey];
610 if ($a_other[$skey] != null) {
611 $other = $a_other[$skey];
613 $all = $correct + $incorrect + $other;
614 $data[
"lm_id"] = $obj_id;
615 $data[
"lm_title"] = $lmTitle;
616 $data = array_merge($data, self::userDataArrayForExport($data[
"user_id"], $allowExportPrivacy));
617 $data[
"sco_marked_for_learning_progress"] = $scoProgress[$data[
"cp_node_id"]];
618 $data[
"sco_title"] = $scoTitles[$data[
"cp_node_id"]];
619 $data[
"counter_i_correct"] = $correct;
621 $data[
"counter_i_correct_percent"] = $correct * 100 / $all;
623 $data[
"counter_i_correct_percent"] = 0;
625 $data[
"counter_i_incorrect"] = $incorrect;
627 $data[
"counter_i_incorrect_percent"] = $incorrect * 100 / $all;
629 $data[
"counter_i_incorrect_percent"] = 0;
631 $data[
"counter_i_other"] = $other;
633 $data[
"counter_i_other_percent"] = $other * 100 / $all;
635 $data[
"counter_i_other_percent"] = 0;
637 $data[
"audio_captioning"] =
"" . $data[
"audio_captioning"];
638 $data[
"audio_level"] =
"" . $data[
"audio_level"];
639 $data[
"completion_status"] =
"" . $data[
"completion_status"];
640 $data[
"completion_threshold"] =
"" . $data[
"completion_threshold"];
641 $data[
"credit"] =
"" . $data[
"credit"];
642 $data[
"delivery_speed"] =
"" . $data[
"delivery_speed"];
643 $data[
"c_entry"] =
"" . $data[
"c_entry"];
644 $data[
"c_exit"] =
"" . $data[
"c_exit"];
645 $data[
"c_language"] =
"" . $data[
"c_language"];
646 $data[
"c_location"] =
"" . str_replace(
'"',
'', $data[
"c_location"]);
647 $data[
"c_mode"] =
"" . $data[
"c_mode"];
648 $data[
"progress_measure"] =
"" . $data[
"progress_measure"];
649 $data[
"c_max"] =
"" . $data[
"c_max"];
650 $data[
"c_min"] =
"" . $data[
"c_min"];
651 $data[
"c_raw"] =
"" . $data[
"c_raw"];
652 $data[
"scaled"] =
"" . $data[
"scaled"];
653 $data[
"scaled_passing_score"] =
"" . $data[
"scaled_passing_score"];
654 $data[
"session_time"] =
"" . $data[
"session_time"];
655 $data[
"session_time_seconds"] =
"";
656 if ($data[
"session_time"] !=
"") {
659 $data[
"success_status"] =
"" . $data[
"success_status"];
660 $data[
"total_time"] =
"" . $data[
"total_time"];
661 $data[
"total_time_seconds"] =
"";
662 if ($data[
"total_time"] !=
"") {
665 $data[
"c_timestamp"] = $data[
"c_timestamp"];
666 $data[
"suspend_data"] =
"" . $data[
"suspend_data"];
667 $data[
"launch_data"] =
"" . $data[
"launch_data"];
677 $returnData[] =
$data;
687 $lng = $DIC->language();
688 $ilDB = $DIC->database();
689 $lng->loadLanguageModule(
"scormtrac");
692 $a_interaction = array();
693 $a_interactionDescription = array();
695 $query =
'SELECT cmi_node.cp_node_id, 696 cmi_interaction.cmi_interaction_id, 698 cmi_interaction.description 699 FROM cmi_interaction, cmi_node 700 WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' 701 AND ' .
$ilDB->in(
'cmi_node.user_id', $a_user,
false,
'integer') .
' 702 AND cmi_node.cmi_node_id = cmi_interaction.cmi_node_id 705 $query .=
'cmi_node.cp_node_id, cmi_node.user_id';
707 $query .=
'cmi_node.user_id, cmi_node.cp_node_id';
709 $query .=
', cmi_interaction.cmi_interaction_id, cmi_interaction.id';
715 foreach ($dbdata as
$data) {
716 $key = $data[
"cp_node_id"] .
':' . $data[
"id"];
718 for (
$i = 0;
$i < count($a_interaction);
$i++) {
719 if ($a_interaction[
$i] ==
$key) {
723 if ($exist ==
false) {
724 $a_interaction[] =
$key;
726 if ($a_interactionDescription[
$key] == null) {
727 $a_interactionDescription[
$key] =
"" . $data[
"description"];
730 $udh = self::userDataHeaderForExport();
731 $a_cols = explode(
',',
'lm_id,lm_title,cp_node_id,sco_marked_for_learning_progress,sco_title,' . $udh[
"cols"]);
732 $a_true = explode(
',', $udh[
"default"] .
",sco_title");
733 for (
$i = 0;
$i < count($a_cols);
$i++) {
734 $cols[$a_cols[
$i]] = array(
"txt" =>
$lng->txt($a_cols[
$i]),
"default" =>
false);
736 for (
$i = 0;
$i < count($a_true);
$i++) {
737 $cols[$a_true[
$i]][
"default"] =
true;
739 for (
$i = 0;
$i < count($a_interaction);
$i++) {
745 $cols[
"interaction_value" .
$i .
" " . $a_interactionDescription[$a_interaction[
$i]]] = array(
"txt" => sprintf(
$lng->txt(
"interaction_value"),
$i) .
" " . $a_interactionDescription[$a_interaction[
$i]],
"default" =>
true);
750 public function tracInteractionUserAnswers($a_user = array(), $a_sco = array(), $b_orderBySCO =
false, $allowExportPrivacy =
false, $obj_id, $lmTitle)
754 $lng->loadLanguageModule(
"scormtrac");
756 $returnData = array();
758 $scoTitles = self::scoTitlesForExportSelected($obj_id);
760 $scoProgress = self::markedLearningStatusForExportSelected($scoTitles, $obj_id);
762 $a_interaction = array();
763 $a_interactionId = array();
764 $a_interactionDescription = array();
765 $a_interactionUser = array();
767 $query =
'SELECT cmi_node.user_id, cmi_node.cp_node_id, 768 cmi_interaction.cmi_interaction_id, 770 cmi_interaction.result, 771 cmi_interaction.description 772 FROM cmi_interaction, cmi_node 773 WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' 774 AND ' .
$ilDB->in(
'cmi_node.user_id', $a_user,
false,
'integer') .
' 775 AND cmi_node.cmi_node_id = cmi_interaction.cmi_node_id 778 $query .=
'cmi_node.cp_node_id, cmi_node.user_id';
780 $query .=
'cmi_node.user_id, cmi_node.cp_node_id';
782 $query .=
', cmi_interaction.cmi_interaction_id, cmi_interaction.id';
787 foreach ($dbdata as
$data) {
788 $key = $data[
"cp_node_id"] .
':' . $data[
"id"];
790 for (
$i = 0;
$i < count($a_interaction);
$i++) {
791 if ($a_interaction[
$i] ==
$key) {
798 if ($exist ==
false) {
799 $a_interaction[] =
$key;
800 $a_interactionId[
$key] =
"" . $data[
"id"];
801 $a_interactionDescription[
$key] =
"" . $data[
"description"];
803 $key .=
':' . $data[
"user_id"];
804 $a_interactionUser[
$key] =
"" . $data[
"result"];
809 $query =
'SELECT user_id, cp_node_id ' 811 .
'WHERE ' .
$ilDB->in(
'cp_node_id', $a_sco,
false,
'integer') .
' ' 812 .
'AND ' .
$ilDB->in(
'user_id', $a_user,
false,
'integer') .
' ' 816 $query .=
'cp_node_id, user_id';
818 $query .=
'user_id, cp_node_id';
824 foreach ($dbdata as $data) {
825 for (
$i = 0;
$i < count($a_interaction);
$i++) {
831 $intdesc =
"interaction_value" .
$i .
" " . $a_interactionDescription[$a_interaction[
$i]];
832 $data[$intdesc] =
"";
833 $ukey = $a_interaction[
$i] .
':' . $data[
"user_id"];
834 if ($a_interactionUser[$ukey] != null) {
835 $data[$intdesc] = $a_interactionUser[$ukey];
838 $data[
"lm_id"] = $obj_id;
839 $data[
"lm_title"] = $lmTitle;
840 $data = array_merge($data, self::userDataArrayForExport($data[
"user_id"], $allowExportPrivacy));
841 $data[
"sco_marked_for_learning_progress"] = $scoProgress[$data[
"cp_node_id"]];
842 $data[
"sco_title"] = $scoTitles[$data[
"cp_node_id"]];
843 $returnData[] =
$data;
855 $query =
'SELECT count(distinct(cp_node.cp_node_id)) counter ' 856 .
'FROM cp_node, cp_resource, cp_item ' 857 .
'WHERE cp_item.cp_node_id = cp_node.cp_node_id ' 858 .
'AND cp_item.resourceid = cp_resource.id AND scormtype = %s ' 859 .
'AND nodename = %s AND cp_node.slm_id = %s';
862 array(
'text',
'text',
'integer'),
863 array(
'sco',
'item', $obj_id)
866 $scoCounter =
$row[
'counter'];
869 $u_startedSCO = array();
870 $u_completedSCO = array();
871 $u_passedSCO = array();
872 for (
$i = 0;
$i < count($a_user);
$i++) {
873 $u_startedSCO[$a_user[
$i]] = 0;
874 $u_completedSCO[$a_user[
$i]] = 0;
875 $u_passedSCO[$a_user[
$i]] = 0;
878 $query =
'SELECT user_id, count(*) counter ' 879 .
'FROM cmi_node, cp_node ' 880 .
'WHERE cmi_node.cp_node_id = cp_node.cp_node_id ' 881 .
'AND cp_node.slm_id = %s ' 882 .
'AND ' .
$ilDB->in(
'user_id', $a_user,
false,
'integer') .
' ' 883 .
'GROUP BY user_id';
890 $u_startedSCO[
$data[
'user_id']] = $data[
'counter'];
893 $query =
'SELECT user_id, count(*) counter ' 894 .
'FROM cmi_node, cp_node ' 895 .
'WHERE cmi_node.cp_node_id = cp_node.cp_node_id ' 896 .
'AND cp_node.slm_id = %s ' 897 .
"AND cmi_node.completion_status = 'completed' " 898 .
'AND ' .
$ilDB->in(
'user_id', $a_user,
false,
'integer') .
' ' 899 .
'GROUP BY user_id';
906 $u_completedSCO[
$data[
'user_id']] = $data[
'counter'];
909 $query =
'SELECT user_id, count(*) counter ' 910 .
'FROM cmi_node, cp_node ' 911 .
'WHERE cmi_node.cp_node_id = cp_node.cp_node_id ' 912 .
'AND cp_node.slm_id = %s ' 913 .
"AND cmi_node.success_status = 'passed' " 914 .
'AND ' .
$ilDB->in(
'user_id', $a_user,
false,
'integer') .
' ' 915 .
'GROUP BY user_id';
922 $u_passedSCO[
$data[
'user_id']] = $data[
'counter'];
927 $query =
'SELECT * FROM sahs_user WHERE obj_id = ' .
$ilDB->quote($obj_id,
'integer')
928 .
' AND ' .
$ilDB->in(
'user_id', $a_user,
false,
'integer')
929 .
' ORDER BY user_id';
935 return self::exportSelectedSuccessRows($a_user, $allowExportPrivacy, $dbdata, $scoCounter, $u_startedSCO, $u_completedSCO, $u_passedSCO, $obj_id, $lmTitle);
Class ilSCORM2004TrackingItems.
static tracInteractionUserColumns($b_orderBySCO, $b_allowExportPrivacy)
static exportSelectedObjectivesColumns()
tracInteractionUserAnswers($a_user=array(), $a_sco=array(), $b_orderBySCO=false, $allowExportPrivacy=false, $obj_id, $lmTitle)
scoTitlesForExportSelected($obj_id)
static exportSelectedCoreColumns($b_orderBySCO, $b_allowExportPrivacy)
exportObjGlobalToSystem($a_user=array(), $allowExportPrivacy=false, $obj_id, $lmTitle)
foreach($_POST as $key=> $value) $res
tracInteractionUser($a_user=array(), $a_sco=array(), $b_orderBySCO=false, $allowExportPrivacy=false, $obj_id, $lmTitle)
exportSelectedObjectives($a_user=array(), $a_sco=array(), $b_orderBySCO=false, $allowExportPrivacy=false, $obj_id, $lmTitle)
tracInteractionItem($a_user=array(), $a_sco=array(), $b_orderBySCO=false, $allowExportPrivacy=false, $obj_id, $lmTitle)
static tracInteractionUserAnswersColumns($a_user=array(), $a_sco=array(), $b_orderBySCO, $b_allowExportPrivacy)
exportSelectedSuccess($a_user=array(), $allowExportPrivacy=false, $obj_id, $lmTitle)
exportSelectedInteractions($a_user=array(), $a_sco=array(), $b_orderBySCO=false, $allowExportPrivacy=false, $obj_id, $lmTitle)
exportSelectedCore($a_user=array(), $a_sco=array(), $b_orderBySCO=false, $allowExportPrivacy=false, $obj_id, $lmTitle)
static tracInteractionItemColumns($b_orderBySCO, $b_allowExportPrivacy)
static _ISODurationToCentisec($str)
convert ISO 8601 Timeperiods to centiseconds ta
Class ilSCORMTrackingItems.
static exportSelectedInteractionsColumns()
__construct()
Constructor.
static exportObjGlobalToSystemColumns()