19declare(strict_types=1);
22use JetBrains\PhpStorm\NoReturn;
44 'user_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'user_id'),
45 'learner_name' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'learner_name'),
46 'slm_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'slm_id'),
47 'mode' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'c_mode'),
48 'credit' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'credit'),
51 'accesscount' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'accesscount'),
52 'accessduration' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'accessduration'),
53 'accessed' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'accessed'),
54 'activityAbsoluteDuration' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'activityabsduration'),
55 'activityAttemptCount' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'activityattemptcount'),
56 'activityExperiencedDuration' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'activityexpduration'),
57 'activityProgressStatus' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'activityprogstatus'),
58 'attemptAbsoluteDuration' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'attemptabsduration'),
59 'attemptCompletionAmount' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'attemptcomplamount'),
60 'attemptCompletionStatus' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'attemptcomplstatus'),
61 'attemptExperiencedDuration' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'attemptexpduration'),
62 'attemptProgressStatus' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'attemptprogstatus'),
63 'audio_captioning' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'audio_captioning'),
64 'audio_level' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'audio_level'),
65 'availableChildren' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'availablechildren'),
66 'cmi_node_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cmi_node_id'),
67 'completion' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'completion'),
68 'completion_status' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'completion_status'),
69 'completion_threshold' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'completion_threshold'),
70 'cp_node_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cp_node_id'),
71 'created' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'created'),
72 'credit' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'credit'),
73 'delivery_speed' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'delivery_speed'),
74 'entry' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_entry'),
75 'exit' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_exit'),
76 'language' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_language'),
77 'launch_data' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'launch_data'),
78 'learner_name' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'learner_name'),
79 'location' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'location'),
80 'max' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_max'),
81 'min' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_min'),
82 'mode' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_mode'),
83 'modified' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'modified'),
84 'progress_measure' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'progress_measure'),
85 'raw' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_raw'),
86 'scaled' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'scaled'),
87 'scaled_passing_score' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'scaled_passing_score'),
88 'session_time' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'session_time'),
89 'success_status' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'success_status'),
90 'suspend_data' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'suspend_data'),
91 'total_time' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'total_time'),
92 'user_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'user_id'),
95 'cmi_comment_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cmi_comment_id'),
96 'cmi_node_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cmi_node_id'),
97 'comment' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_comment'),
98 'timestamp' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_timestamp'),
99 'location' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'location'),
100 'sourceIsLMS' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'sourceislms'),
102 'correct_response' => array(
103 'cmi_correct_response_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cmi_correct_resp_id'),
104 'cmi_interaction_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cmi_interaction_id'),
105 'pattern' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'pattern'),
107 'interaction' => array(
108 'cmi_interaction_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cmi_interaction_id'),
109 'cmi_node_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cmi_node_id'),
110 'description' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'description'),
111 'id' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'id'),
112 'latency' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'latency'),
113 'learner_response' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'learner_response'),
114 'result' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'result'),
115 'timestamp' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_timestamp'),
116 'type' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_type'),
117 'weighting' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'weighting'),
119 'objective' => array(
120 'cmi_interaction_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cmi_interaction_id'),
121 'cmi_node_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cmi_node_id'),
122 'cmi_objective_id' => array(
'pattern' =>
null,
'permission' => self::NONE,
'default' =>
null,
'dbfield' =>
'cmi_objective_id'),
123 'completion_status' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'completion_status'),
124 'description' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'description'),
125 'id' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'id'),
126 'max' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_max'),
127 'min' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_min'),
128 'raw' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'c_raw'),
129 'scaled' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'scaled'),
130 'progress_measure' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'progress_measure'),
131 'success_status' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'success_status'),
132 'scope' => array(
'pattern' =>
null,
'permission' => self::READWRITE,
'default' =>
null,
'dbfield' =>
'scope'),
151 $this->
ctrl = $DIC->ctrl();
152 $this->userId =
$DIC->user()->getId();
153 $this->
lng = $DIC->language();
156 $this->jsMode = strpos(
$_SERVER[
'HTTP_ACCEPT'],
'text/javascript') !==
false;
158 if (
$DIC->http()->wrapper()->query()->has(
'page')) {
159 $this->page =
$DIC->http()->wrapper()->query()->retrieve(
'page',
$DIC->refinery()->kindlyTo()->string());
162 $this->ref_id =
$DIC->http()->wrapper()->query()->retrieve(
'ref_id',
$DIC->refinery()->kindlyTo()->int());
174 $ilAccess =
$DIC->access();
178 $next_class = $this->
ctrl->getNextClass($this);
179 $cmd = $this->
ctrl->getCmd();
181 if (!$ilAccess->checkAccess(
"read",
"", $this->ref_id)) {
186 if (
$DIC->http()->wrapper()->query()->has(
'node_id')) {
187 $nodeId =
$DIC->http()->wrapper()->query()->retrieve(
'node_id',
$DIC->refinery()->kindlyTo()->int());
218 case 'getGobjective':
222 case 'getSharedData':
226 case 'setSharedData':
231 if (
$_SERVER[
'REQUEST_METHOD'] ===
'POST') {
235 $this->slm->getDefaultLessonMode(),
236 $this->slm->getComments(),
237 $this->slm->getInteractions(),
238 $this->slm->getObjectives(),
239 $this->slm->getTime_from_lms(),
261 case 'liveLogContent':
276 case 'scormPlayerUnload':
292 $js_data = file_get_contents(
"../components/ILIAS/Scorm2004/scripts/buildrte/rte.js");
293 if (self::ENABLE_GZIP == 1) {
294 ob_start(
"ob_gzhandler");
296 header(
'Content-Type: text/javascript; charset=UTF-8');
303 $webdir = str_replace(
"/ilias.php",
"",
$_SERVER[
"SCRIPT_NAME"]);
305 $lm_dir = $webdir .
"/" .
ILIAS_WEB_DIR .
"/" .
CLIENT_ID .
"/lm_data" .
"/lm_" . (string) $this->packageId;
316 $ilUser =
$DIC->user();
318 $initSuspendData =
null;
321 'learner_id' => (
string) $ilUser->getID(),
322 'cmi_learner_id' => (
string) $this->slm->getApiStudentId(),
323 'course_id' => (
string) $this->packageId,
324 'learner_name' => (
string) $this->slm->getApiStudentName(),
325 'mode' => $this->slm->getDefaultLessonMode(),
326 'credit' => $this->slm->getCreditMode(),
327 'auto_review' => $this->slm->getAutoReviewChar(),
328 'hide_navig' => $this->slm->getHideNavig(),
329 'hide_menu' => $this->slm->getNoMenu(),
330 'ie_force_render' => $this->slm->getIe_force_render(),
331 'fourth_edition' => $this->slm->getFourth_edition(),
332 'sequencing_enabled' => $this->slm->getSequencing(),
333 'interactions_storable' => $this->slm->getInteractions(),
334 'objectives_storable' => $this->slm->getObjectives(),
335 'comments_storable' => $this->slm->getComments(),
336 'time_from_lms' => $this->slm->getTime_from_lms(),
337 'auto_last_visited' => $this->slm->getAuto_last_visited(),
338 'lesson_mastery_score' => $this->slm->getMasteryScore(),
339 'checkSetValues' => $this->slm->getCheck_values(),
340 'auto_suspend' => $this->slm->getAutoSuspend(),
341 'suspend_data' => $initSuspendData,
344 'adlact_data' =>
null,
345 'globalobj_data' =>
null
371 $initSuspendData =
null;
372 $initAdlactData =
null;
373 $initGlobalobjData =
null;
374 if ($this->slm->getSequencing() ==
true) {
383 if ($this->slm->getSession()) {
386 if ($session_timeout > $max_idle) {
387 $session_timeout = $max_idle;
390 if ($session_timeout > $min_idle) {
391 $session_timeout = $min_idle;
393 $session_timeout -= 10;
395 $session_timeout = 0;
397 $config[
'session_ping'] = $session_timeout;
400 $store_url =
$DIC->ctrl()->getLinkTarget($this,
'cmi');
401 $unload_url =
$DIC->ctrl()->getLinkTarget($this,
'scormPlayerUnload');
402 if ($this->slm->getSessionDeactivated()) {
403 $store_url =
'storeScorm2004.php?package_id=' . $this->packageId .
'&ref_id=' . $this->ref_id .
'&client_id=' .
CLIENT_ID .
'&do=store';
404 $unload_url =
'storeScorm2004.php?package_id=' . $this->packageId .
'&ref_id=' . $this->ref_id .
'&client_id=' .
CLIENT_ID .
'&do=unload';
406 $config[
'cp_url'] =
$DIC->ctrl()->getLinkTarget($this,
'cp');
407 $config[
'cmi_url'] =
$DIC->ctrl()->getLinkTarget($this,
'cmi');
408 $config[
'store_url'] = $store_url;
409 $config[
'get_adldata_url'] =
$DIC->ctrl()->getLinkTarget($this,
'getSharedData');
410 $config[
'set_adldata_url'] =
$DIC->ctrl()->getLinkTarget($this,
'setSharedData');
411 $config[
'adlact_url'] =
$DIC->ctrl()->getLinkTarget($this,
'adlact');
412 $config[
'specialpage_url'] =
$DIC->ctrl()->getLinkTarget($this,
'specialPage');
413 $config[
'suspend_url'] =
$DIC->ctrl()->getLinkTarget($this,
'suspend');
414 $config[
'get_suspend_url'] =
$DIC->ctrl()->getLinkTarget($this,
'getSuspend');
416 $config[
'gobjective_url'] =
$DIC->ctrl()->getLinkTarget($this,
'gobjective');
417 $config[
'get_gobjective_url'] =
$DIC->ctrl()->getLinkTarget($this,
'getGobjective');
418 $config[
'ping_url'] =
$DIC->ctrl()->getLinkTarget($this,
'pingSession');
419 $config[
'scorm_player_unload_url'] = $unload_url;
420 $config[
'post_log_url'] =
$DIC->ctrl()->getLinkTarget($this,
'postLogEntry');
421 $config[
'livelog_url'] =
$DIC->ctrl()->getLinkTarget($this,
'liveLogContent');
425 $config[
'envEditor'] = 0;
428 $config[
'debug'] = $this->slm->getDebug();
433 $langstrings[
'btnStart'] =
$lng->
txt(
'scplayer_start');
434 $langstrings[
'btnExit'] =
$lng->
txt(
'scplayer_exit');
435 $langstrings[
'btnExitAll'] =
$lng->
txt(
'scplayer_exitall');
436 $langstrings[
'btnSuspendAll'] =
$lng->
txt(
'scplayer_suspendall');
437 $langstrings[
'btnPrevious'] =
$lng->
txt(
'scplayer_previous');
438 $langstrings[
'btnContinue'] =
$lng->
txt(
'scplayer_continue');
439 $langstrings[
'btnhidetree'] =
$lng->
txt(
'scplayer_hidetree');
440 $langstrings[
'btnshowtree'] =
$lng->
txt(
'scplayer_showtree');
441 $langstrings[
'linkexpandTree'] =
$lng->
txt(
'scplayer_expandtree');
442 $langstrings[
'linkcollapseTree'] =
$lng->
txt(
'scplayer_collapsetree');
443 $langstrings[
'contCreditOff'] =
$lng->
txt(
'cont_credit_off');
444 if ($this->slm->getAutoReviewChar() ===
"s") {
445 $langstrings[
'contCreditOff'] =
$lng->
txt(
'cont_sc_score_was_higher_message');
447 $config[
'langstrings'] = $langstrings;
451 $this->tpl =
new ilGlobalTemplate(
"tpl.scorm2004.player.html",
true,
true,
"components/ILIAS/Scorm2004");
455 $this->tpl->setVariable(
"JS_FILE", $jQueryPath);
458 $rte_css = $this->slm->getDataDirectory() .
"/ilias_css_4_2/css/style.css";
459 if (is_file($rte_css)) {
460 $this->tpl->setCurrentBlock(
"rte_css");
461 $this->tpl->setVariable(
"RTE_CSS", $rte_css);
462 $this->tpl->parseCurrentBlock();
466 $this->tpl->setVariable(
'JSON_LANGSTRINGS', json_encode($langstrings));
470 $this->tpl->setVariable(
'TREE_JS',
"components/ILIAS/Scorm2004/scripts/ilNestedList.js");
471 foreach ($langstrings as $key => $value) {
472 $this->tpl->setVariable($key, $value);
474 $this->tpl->setVariable(
'DOC_TITLE',
'ILIAS: ' . $this->slm->getTitle());
476 $this->tpl->setVariable(
'INIT_CP_DATA', json_encode(json_decode($this->
getCPDataInit())));
477 $this->tpl->setVariable(
'INIT_CMI_DATA', json_encode($this->
getCMIData($this->userId, $this->packageId)));
478 $this->tpl->setVariable(
'INIT_ADLACT_DATA', json_encode($initAdlactData));
479 $this->tpl->setVariable(
'INIT_GLOBALOBJ_DATA', json_encode($initGlobalobjData));
480 $this->tpl->setVariable(
'JS_DATA', json_encode($config));
481 list($tsfrac, $tsint) = explode(
' ', microtime());
482 $this->tpl->setVariable(
'TIMESTAMP', sprintf(
'%d%03d', $tsint, 1000 * (
float) $tsfrac));
483 $this->tpl->setVariable(
'BASE_DIR',
'../components/ILIAS/Scorm2004/');
484 $this->tpl->setVariable(
'TXT_COLLAPSE',
$lng->
txt(
'scplayer_collapsetree'));
485 if ($this->slm->getDebug()) {
486 $this->tpl->setVariable(
'TXT_DEBUGGER',
$lng->
txt(
'scplayer_debugger'));
487 $debug_url =
$DIC->ctrl()->getLinkTarget($this,
'debugGUI');
488 $this->tpl->setVariable(
'DEBUG_URL',
"PopupCenter('" . $debug_url .
"','Debug',800,600);");
490 $this->tpl->setVariable(
'TXT_DEBUGGER',
'');
491 $this->tpl->setVariable(
'DEBUG_URL',
'');
495 $this->tpl->setVariable(
'INLINE_CSS', ilSCORM13PlayerGUI::getInlineCss());
498 if ($this->slm->getCacheDeactivated()) {
499 $rtejs_url =
$DIC->ctrl()->getLinkTarget($this,
'getRTEjs');
500 $this->tpl->setVariable(
'JS_SCRIPTS', $rtejs_url);
502 $this->tpl->setVariable(
'JS_SCRIPTS',
'components/ILIAS/Scorm2004/scripts/buildrte/rte-min.js');
506 if ($this->slm->getNoMenu() ===
true) {
507 $this->tpl->setVariable(
"VAL_DISPLAY",
"style=\"display:none;\"");
509 $this->tpl->setVariable(
"VAL_DISPLAY",
"");
526 $this->tpl->printToStdout(
"DEFAULT",
false);
531 $is_tpl =
new ilTemplate(
"tpl.scorm2004.inlinecss.html",
true,
true,
"components/ILIAS/Scorm2004");
540 return $is_tpl->get();
547 header(
'Content-Type: text/javascript; charset=UTF-8');
550 header(
'Content-Type: text/plain; charset=UTF-8');
551 $jsdata = json_decode($jsdata);
562 'SELECT jsdata FROM cp_package WHERE obj_id = %s',
564 array($this->packageId)
568 $jsdata = $packageData[
'jsdata'] ??
false;
583 'SELECT activitytree FROM cp_package WHERE obj_id = %s',
585 array($this->packageId)
589 $activitytree =
$data[
'activitytree'] ??
false;
591 if (!$activitytree) {
592 $activitytree =
'null';
594 return $activitytree;
601 header(
'Content-Type: text/javascript; charset=UTF-8');
602 print($activitytree);
604 header(
'Content-Type: text/plain; charset=UTF-8');
605 $activitytree = json_decode($activitytree);
606 print_r($activitytree);
614 header(
'Content-Type: text/plain; charset=UTF-8');
622 $ilUser =
$DIC->user();
625 'SELECT global_to_system FROM cp_package WHERE obj_id = %s',
627 array($this->packageId)
631 $gystem =
$data[
'global_to_system'] ?? 1;
635 $gsystem = (string) $this->packageId;
645 $ilUser =
$DIC->user();
648 'SELECT data FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
649 array(
'integer',
'integer'),
650 array($this->packageId, $ilUser->getId())
656 'DELETE FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
657 array(
'integer',
'integer'),
658 array($this->packageId, $ilUser->getId())
660 if (is_array(
$data)) {
661 return $data[
'data'];
670 header(
'Content-Type: text/javascript; charset=UTF-8');
671 print($suspend_data);
673 header(
'Content-Type: text/plain; charset=UTF-8');
674 $suspend_data = json_decode($suspend_data);
675 print_r($suspend_data);
683 $ilUser =
$DIC->user();
686 'SELECT * FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
687 array(
'integer',
'integer'),
688 array($this->packageId, $ilUser->getId())
692 $ilDB->insert(
'cp_suspend', array(
693 'data' => array(
'clob', file_get_contents(
'php://input')),
694 'obj_id' => array(
'integer', $this->packageId),
695 'user_id' => array(
'integer', $ilUser->getId())
701 'data' => array(
'clob', file_get_contents(
'php://input'))
704 'obj_id' => array(
'integer', $this->packageId),
705 'user_id' => array(
'integer', $ilUser->getId())
715 $ilUser =
$DIC->user();
720 $global_to_system = 1;
723 'SELECT global_to_system FROM cp_package WHERE obj_id = %s',
725 array($this->packageId)
728 $global_to_system =
$data[
'global_to_system'];
731 $query =
'SELECT objective_id, scope_id, satisfied, measure, user_id,
732 score_min, score_max, score_raw, completion_status,
734 .
'FROM cmi_gobjective, cp_node, cp_mapinfo '
735 .
'WHERE (cmi_gobjective.objective_id <> %s AND cmi_gobjective.status IS NULL '
736 .
'AND cp_node.slm_id = %s AND cp_node.nodename = %s '
737 .
'AND cp_node.cp_node_id = cp_mapinfo.cp_node_id '
738 .
'AND cmi_gobjective.objective_id = cp_mapinfo.targetobjectiveid) '
739 .
'GROUP BY objective_id, scope_id, satisfied, measure, user_id,
740 score_min, score_max, score_raw, completion_status,
744 array(
'text',
'integer',
'text'),
745 array(
'-course_overall_status-', $this->packageId,
'mapInfo')
748 if (($global_to_system == 1 && $row[
'scope_id'] == 0) || ($global_to_system == 0 && $row[
'scope_id'] == $this->packageId)) {
749 $learner = $row[
'user_id'];
750 $objective_id = $row[
'objective_id'];
751 if ($row[
'scope_id'] == 0) {
754 $scope = $row[
'scope_id'];
757 if ($row[
'satisfied'] !=
null) {
758 $toset = $row[
'satisfied'];
759 $g_data[
"satisfied"][$objective_id][$learner][
$scope] = $toset;
762 if ($row[
'measure'] !=
null) {
763 $toset = $row[
'measure'];
764 $g_data[
"measure"][$objective_id][$learner][
$scope] = $toset;
767 if ($row[
'score_raw'] !=
null) {
768 $toset = $row[
'score_raw'];
769 $g_data[
"score_raw"][$objective_id][$learner][
$scope] = $toset;
772 if ($row[
'score_min'] !=
null) {
773 $toset = $row[
'score_min'];
774 $g_data[
"score_min"][$objective_id][$learner][
$scope] = $toset;
777 if ($row[
'score_max'] !=
null) {
778 $toset = $row[
'score_max'];
779 $g_data[
"score_max"][$objective_id][$learner][
$scope] = $toset;
782 if ($row[
'progress_measure'] !=
null) {
783 $toset = $row[
'progress_measure'];
784 $g_data[
"progress_measure"][$objective_id][$learner][
$scope] = $toset;
787 if ($row[
'completion_status'] !=
null) {
788 $toset = $row[
'completion_status'];
789 $g_data[
"completion_status"][$objective_id][$learner][
$scope] = $toset;
800 header(
'Content-Type: text/javascript; charset=UTF-8');
801 print($gobjective_data);
803 header(
'Content-Type: text/plain; charset=UTF-8');
804 $gobjective_data = json_decode($gobjective_data);
805 print_r($gobjective_data);
815 $ilUser =
$DIC->user();
816 $dataStores = array(
"data" => array(),
817 "permissions" => array());
818 $readPermissions = array();
820 $query =
'SELECT target_id, read_shared_data, write_shared_data '
822 .
'WHERE slm_id = %s '
823 .
'AND sco_node_id = %s '
824 .
'GROUP BY target_id, read_shared_data, write_shared_data';
829 array(
'integer',
'integer'),
830 array($this->packageId, $sco_node_id)
836 $storeVal = ($row[
'read_shared_data'] == 0 && $row[
'write_shared_data'] == 1)
840 $dataStores[
"data"][$row[
'target_id']] = array(
"store" => $storeVal,
841 "readSharedData" => $row[
'read_shared_data'],
842 "writeSharedData" => $row[
'write_shared_data']);
843 $dataStores[
"readPermissions"][$row[
'target_id']] = $row[
'read_shared_data'];
846 if (count($dataStores) < 1) {
852 if (isset($dataStores[
"readPermissions"]) && $dataStores[
"readPermissions"] !=
null && array_sum($dataStores[
"readPermissions"]) != 0) {
857 $params = array(
"types" => array(
"integer",
"integer"),
858 "values" => array($this->userId, $this->packageId));
864 foreach ($dataStores[
"data"] as $key => $val) {
865 if ($dataStores[
"readPermissions"][(
string) $key] == 1
866 && $dataStores[
"data"][(
string) $key][
"store"] !==
'notWritten') {
869 $paramTemplate .=
'%s, ';
874 $paramTemplate = substr($paramTemplate, 0, -2);
877 $query =
'SELECT target_id, store '
878 .
'FROM adl_shared_data '
879 .
'WHERE user_id = %s '
881 .
'AND target_id IN (' . $paramTemplate .
')';
891 $dataStores[
"data"][$row[
'target_id']][
"store"] = $row[
'store'];
895 header(
'Content-Type: text/javascript; charset=UTF-8');
897 echo json_encode($dataStores[
"data"]);
904 $ilUser =
$DIC->user();
905 $g_data = json_decode(file_get_contents(
'php://input'));
907 if ($g_data ==
null)
return;
910 $query =
'SELECT dm.target_id, sd.store '
911 .
'FROM cp_datamap dm '
912 .
'LEFT JOIN adl_shared_data sd '
913 .
'ON(dm.slm_id = sd.slm_id AND dm.target_id = sd.target_id) '
914 .
'WHERE sco_node_id = %s '
915 .
'AND dm.slm_id = %s '
916 .
'AND write_shared_data = 1 '
917 .
'AND user_id = %s';
921 array(
'integer',
'integer',
'integer'),
922 array($sco_node_id, $this->packageId, $this->userId)
925 $dataStores = array();
926 $originalVals = array();
928 $id = $row[
'target_id'];
929 $dataStores[
$id] = $g_data->{
$id};
930 $originalVals[
$id] = $row[
'store'];
935 foreach ($g_data as $key => $obj) {
938 if (array_key_exists($key, $dataStores)) {
939 if ($obj ===
'notWritten') {
943 $query =
'UPDATE adl_shared_data '
945 .
'WHERE user_id = %s '
946 .
'AND target_id = %s '
947 .
'AND slm_id = %s ';
951 array(
'text',
'integer',
'text',
'integer'),
952 array($dataStores[$key], $this->userId, $key, $this->packageId)
957 'SELECT write_shared_data, cp_node_id '
959 .
'WHERE target_id = %s '
961 .
'AND sco_node_id = %s',
962 array(
'text',
'integer',
'integer'),
963 array($key, $this->packageId, $sco_node_id)
967 if ($row[
"write_shared_data"] != 1) {
973 'INSERT INTO adl_shared_data (slm_id, user_id, target_id, store, cp_node_id) VALUES (%s, %s, %s, %s, %s)',
974 array(
'integer',
'integer',
'text',
'text',
'integer'),
975 array($this->packageId, $this->userId, $key, $obj, $row[
"cp_node_id"])
988 $specialpages = array(
989 "_COURSECOMPLETE_" =>
"seq_coursecomplete",
990 "_ENDSESSION_" =>
"seq_endsession",
991 "_SEQBLOCKED_" =>
"seq_blocked",
992 "_NOTHING_" =>
"seq_nothing",
993 "_ERROR_" =>
"seq_error",
994 "_DEADLOCK_" =>
"seq_deadlock",
995 "_INVALIDNAVREQ_" =>
"seq_invalidnavreq",
996 "_SEQABANDON_" =>
"seq_abandon",
997 "_SEQABANDONALL_" =>
"seq_abandonall",
998 "_TOC_" =>
"seq_toc",
1002 $this->tpl =
new ilGlobalTemplate(
"tpl.scorm2004.specialpages.html",
false,
false,
"components/ILIAS/Scorm2004");
1004 $this->tpl->setVariable(
'TXT_SPECIALPAGE',
$lng->txt($specialpages[$this->page]));
1005 if ($this->page !==
"_TOC_" && $this->page !==
"_SEQABANDON_" && $this->page !==
"_SEQABANDONALL_") {
1006 $this->tpl->setVariable(
'CLOSE_WINDOW',
$lng->txt(
'seq_close'));
1008 $this->tpl->setVariable(
'CLOSE_WINDOW',
"");
1010 $this->tpl->printToStdout(
"DEFAULT",
false);
1016 $data = $this->getCMIData($this->userId, $this->packageId);
1017 if ($this->jsMode) {
1018 header(
'Content-Type: text/javascript; charset=UTF-8');
1019 print(json_encode(
$data));
1021 header(
'Content-Type: text/plain; charset=UTF-8');
1022 print(var_export(
$data,
true));
1052 'schema' => array(),
1056 foreach (self::$schema as $k => &$v) {
1057 $result[
'schema'][$k] = array_keys($v);
1061 $q =
'SELECT cmi_node.*
1063 INNER JOIN cp_node ON cmi_node.cp_node_id = cp_node.cp_node_id
1064 WHERE cmi_node.user_id = %s
1065 AND cp_node.slm_id = %s';
1072 if ($this->slm->getComments()) {
1074 cmi_comment.cmi_comment_id,
1075 cmi_comment.cmi_node_id,
1076 cmi_comment.c_comment,
1077 cmi_comment.c_timestamp,
1078 cmi_comment.location,
1079 cmi_comment.sourceislms
1081 INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_comment.cmi_node_id
1082 INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id
1083 WHERE cmi_node.user_id = %s
1084 AND cp_node.slm_id = %s
1085 ORDER BY cmi_comment.cmi_comment_id';
1091 case "correct_response":
1094 if ($this->slm->getInteractions()) {
1095 $q =
'SELECT cmi_correct_response.*
1096 FROM cmi_correct_response
1097 INNER JOIN cmi_interaction
1098 ON cmi_interaction.cmi_interaction_id = cmi_correct_response.cmi_interaction_id
1099 INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_interaction.cmi_node_id
1100 INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id
1101 WHERE cmi_node.user_id = %s
1102 AND cp_node.slm_id = %s
1103 ORDER BY cmi_correct_response.cmi_correct_resp_id';
1111 if ($this->slm->getInteractions()) {
1113 cmi_interaction.cmi_interaction_id,
1114 cmi_interaction.cmi_node_id,
1115 cmi_interaction.description,
1117 cmi_interaction.latency,
1118 cmi_interaction.learner_response,
1119 cmi_interaction.result,
1120 cmi_interaction.c_timestamp,
1121 cmi_interaction.c_type,
1122 cmi_interaction.weighting
1123 FROM cmi_interaction
1124 INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_interaction.cmi_node_id
1125 INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id
1126 WHERE cmi_node.user_id = %s
1127 AND cp_node.slm_id = %s
1128 ORDER BY cmi_interaction.cmi_interaction_id';
1135 if ($this->slm->getObjectives()) {
1137 cmi_objective.cmi_interaction_id,
1138 cmi_objective.cmi_node_id,
1139 cmi_objective.cmi_objective_id,
1140 cmi_objective.completion_status,
1141 cmi_objective.description,
1143 cmi_objective.c_max,
1144 cmi_objective.c_min,
1145 cmi_objective.c_raw,
1146 cmi_objective.scaled,
1147 cmi_objective.progress_measure,
1148 cmi_objective.success_status,
1151 INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_objective.cmi_node_id
1152 INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id
1153 WHERE cmi_node.user_id = %s
1154 AND cp_node.slm_id = %s
1155 ORDER BY cmi_objective.cmi_objective_id';
1161 $q =
'SELECT usr_data.usr_id user_id,
1162 CONCAT(CONCAT(COALESCE(usr_data.firstname, \'\'), \' \'), COALESCE(usr_data.lastname, \'\')) learner_name,
1163 sahs_lm.id slm_id , sahs_lm.default_lesson_mode "mode", sahs_lm.credit
1164 FROM usr_data, cp_package
1165 INNER JOIN sahs_lm ON cp_package.obj_id = sahs_lm.id
1166 WHERE usr_data.usr_id = %s
1167 AND sahs_lm.id = %s';
1172 $result[
'data'][$k] = array();
1174 $types = array(
'integer',
'integer');
1178 while ($row =
$ilDB->fetchAssoc(
$res)) {
1179 $tmp_result = array();
1180 foreach ($row as $key => $value) {
1181 if ($k ===
"comment" && $key ===
"c_timestamp" && strpos($value,
' ') == 10) {
1182 $value = str_replace(
' ',
'T', $value);
1184 $tmp_result[] = $value;
1185 if ($k ===
"node" && $key ===
"additional_tables" && $i_check < $value) {
1190 $result[
'data'][$k][] = $tmp_result;
1205 if (!is_array($a_array) or !count($a_array)) {
1209 foreach ($a_array as $k => $item) {
1210 if ($item !=
null) {
1211 $a_array[$k] =
$ilDB->quote($item);
1213 $a_array[$k] =
"NULL";
1249 'SELECT module_version FROM sahs_lm WHERE id = %s',
1251 array($this->packageId)
1255 return (
int) $row[
'module_version'];
1265 $ilUser =
$DIC->user();
1266 $val_set =
$ilDB->queryF(
1267 'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
1268 array(
'integer',
'integer'),
1269 array($this->packageId,$this->userId)
1271 $val_rec =
$ilDB->fetchAssoc($val_set);
1272 $attempts = $val_rec[
"package_attempts"];
1273 if ($attempts ==
null) {
1276 return (
int) $attempts;
1286 $ilUser =
$DIC->user();
1288 'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
1289 array(
'integer',
'integer'),
1290 array($this->slm->getId(),$ilUser->getId())
1293 if ($val_rec[
"cnt"] == 0) {
1296 'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
1297 array(
'integer',
'integer',
'integer',
'integer',
'timestamp'),
1298 array($this->slm->getId(), $ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date(
'Y-m-d H:i:s'))
1301 $attempts = $val_rec[
"package_attempts"];
1302 if ($attempts ==
null) {
1307 'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
1308 array(
'integer',
'integer',
'timestamp',
'integer',
'integer'),
1309 array($attempts, $this->slm->getModuleVersion(), date(
'Y-m-d H:i:s'), $this->slm->getId(), $ilUser->getId())
1320 'SELECT shared_data_global_to_system FROM cp_package WHERE obj_id = %s',
1322 array($this->packageId)
1325 $shared_global_to_sys =
$ilDB->fetchObject(
$res)->shared_data_global_to_system ?? 0;
1328 'SELECT data FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
1329 array(
'integer',
'integer'),
1330 array($this->packageId, $this->userId)
1335 $dat =
$data[
'data'];
1336 if ($dat !=
null && $dat !=
'') {
1341 if ($shared_global_to_sys == 0 && !$suspended) {
1343 'DELETE FROM adl_shared_data WHERE slm_id = %s AND user_id = %s',
1344 array(
'integer',
'integer'),
1345 array($this->packageId, $this->userId)
1360 $fieldList =
"cmi_node.cp_node_id, cmi_node.completion_threshold, cmi_node.c_exit, cmi_node.completion_status, cmi_node.progress_measure, cmi_node.success_status, cmi_node.scaled, cmi_node.session_time," .
1361 "cmi_node.c_min, cmi_node.c_max, cmi_node.c_raw, cmi_node.location, cmi_node.suspend_data, cmi_node.scaled_passing_score, cmi_node.total_time";
1366 SELECT ' . $fieldList .
'
1367 FROM cmi_node,cp_node,cp_item
1368 WHERE cp_node.slm_id = %s
1369 AND cp_node.cp_node_id = cp_item.cp_node_id
1371 AND cmi_node.cp_node_id = cp_item.cp_node_id
1372 AND cmi_node.user_id = %s',
1373 array(
'integer',
'text',
'integer'),
1374 array($this->packageId, $sco_id, $this->userId)
1382 $filename = $this->logDirectory() .
"/" . $this->packageId .
".tmp";
1385 $fHandle = fopen(
$filename,
'a') or die(
"can't open file");
1386 fwrite($fHandle,
"");
1394 $filename = $this->logDirectory() .
"/" . $this->packageId .
"_summary_" . $this->get_actual_attempts();
1398 while (file_exists(
$filename .
"_" . $adder . $suffix)) {
1400 $adder = (string) $i;
1402 $retname =
$filename .
"_" . $adder . $suffix;
1404 if (!file_exists($retname)) {
1406 $fHandle = fopen($retname,
'a') or die(
"can't open file");
1407 fwrite($fHandle,
"");
1417 $lng->loadLanguageModule(
"scormdebug");
1419 $filename = $this->logDirectory() .
"/" . $this->packageId .
"_" . $this->get_actual_attempts();
1422 if (!file_exists($path_csv)) {
1424 $fHandle = fopen($path_csv,
'a') or die(
"can't open file");
1425 $string =
'"CourseId";"ScoId";"ScoTitle";"Timestamp";"Action";"Key";"Value";"Return Value";"Errorcode";"Timespan";"ErrorDescription"' .
"\n";
1426 fwrite($fHandle, $string);
1429 if (!file_exists($path_txt)) {
1430 if (file_exists($this->logTmpName())) {
1431 unlink($this->logTmpName());
1434 $fHandle2 = fopen($path_txt,
'a') or die(
"can't open file");
1435 $logtpl = $this->getLogTemplate();
1436 $logtpl->setCurrentBlock(
'NewLog');
1437 $logtpl->setVariable(
"COURSETITLE", $this->slm->getTitle());
1438 $logtpl->setVariable(
"COURSEID", $this->packageId);
1439 $logtpl->setVariable(
"TIMESTAMP", date(
"d.m.Y H:i", time()));
1440 $logtpl->setVariable(
"SESSION", $this->get_actual_attempts());
1441 $logtpl->setVariable(
"error0",
$lng->txt(
"error0"));
1442 $logtpl->setVariable(
"error101",
$lng->txt(
"error101"));
1443 $logtpl->setVariable(
"error102",
$lng->txt(
"error102"));
1444 $logtpl->setVariable(
"error103",
$lng->txt(
"error103"));
1445 $logtpl->setVariable(
"error104",
$lng->txt(
"error104"));
1446 $logtpl->setVariable(
"error111",
$lng->txt(
"error111"));
1447 $logtpl->setVariable(
"error112",
$lng->txt(
"error112"));
1448 $logtpl->setVariable(
"error113",
$lng->txt(
"error113"));
1449 $logtpl->setVariable(
"error122",
$lng->txt(
"error122"));
1450 $logtpl->setVariable(
"error123",
$lng->txt(
"error123"));
1451 $logtpl->setVariable(
"error132",
$lng->txt(
"error132"));
1452 $logtpl->setVariable(
"error133",
$lng->txt(
"error133"));
1453 $logtpl->setVariable(
"error142",
$lng->txt(
"error142"));
1454 $logtpl->setVariable(
"error143",
$lng->txt(
"error143"));
1455 $logtpl->setVariable(
"error201",
$lng->txt(
"error201"));
1456 $logtpl->setVariable(
"error301",
$lng->txt(
"error301"));
1457 $logtpl->setVariable(
"error351",
$lng->txt(
"error351"));
1458 $logtpl->setVariable(
"error391",
$lng->txt(
"error391"));
1459 $logtpl->setVariable(
"error401",
$lng->txt(
"error401"));
1460 $logtpl->setVariable(
"error402",
$lng->txt(
"error402"));
1461 $logtpl->setVariable(
"error403",
$lng->txt(
"error403"));
1462 $logtpl->setVariable(
"error404",
$lng->txt(
"error404"));
1463 $logtpl->setVariable(
"error405",
$lng->txt(
"error405"));
1464 $logtpl->setVariable(
"error406",
$lng->txt(
"error406"));
1465 $logtpl->setVariable(
"error407",
$lng->txt(
"error407"));
1466 $logtpl->setVariable(
"error408",
$lng->txt(
"error408"));
1467 $logtpl->setVariable(
"SetValue",
$lng->txt(
"SetValue"));
1468 $logtpl->setVariable(
"GetValue",
$lng->txt(
"GetValue"));
1469 $logtpl->setVariable(
"Commit",
$lng->txt(
"Commit"));
1470 $logtpl->setVariable(
"Initialize",
$lng->txt(
"Initialize"));
1471 $logtpl->setVariable(
"Terminate",
$lng->txt(
"Terminate"));
1472 $logtpl->setVariable(
"GetErrorString",
$lng->txt(
"GetErrorString"));
1473 $logtpl->setVariable(
"GetLastError",
$lng->txt(
"GetLastError"));
1474 $logtpl->setVariable(
"GetDiagnostic",
$lng->txt(
"GetDiagnostic"));
1475 $logtpl->setVariable(
"cmi._version",
$lng->txt(
"cmi._version"));
1476 $logtpl->setVariable(
"cmi.comments_from_learner._children",
$lng->txt(
"cmi.comments_from_learner._children"));
1477 $logtpl->setVariable(
"cmi.comments_from_learner._count",
$lng->txt(
"cmi.comments_from_learner._count"));
1478 $logtpl->setVariable(
"cmi.comments_from_learner.n.comment",
$lng->txt(
"cmi.comments_from_learner.n.comment"));
1479 $logtpl->setVariable(
"cmi.comments_from_learner.n.location",
$lng->txt(
"cmi.comments_from_learner.n.location"));
1480 $logtpl->setVariable(
"cmi.comments_from_learner.n.timestamp",
$lng->txt(
"cmi.comments_from_learner.n.timestamp"));
1481 $logtpl->setVariable(
"cmi.comments_from_lms._children",
$lng->txt(
"cmi.comments_from_lms._children"));
1482 $logtpl->setVariable(
"cmi.comments_from_lms._count",
$lng->txt(
"cmi.comments_from_lms._count"));
1483 $logtpl->setVariable(
"cmi.comments_from_lms.n.comment",
$lng->txt(
"cmi.comments_from_lms.n.comment"));
1484 $logtpl->setVariable(
"cmi.comments_from_lms.n.location",
$lng->txt(
"cmi.comments_from_lms.n.location"));
1485 $logtpl->setVariable(
"cmi.comments_from_lms.n.timestamp",
$lng->txt(
"cmi.comments_from_lms.n.timestamp"));
1486 $logtpl->setVariable(
"cmi.completion_status",
$lng->txt(
"cmi.completion_status"));
1487 $logtpl->setVariable(
"cmi.completion_threshold",
$lng->txt(
"cmi.completion_threshold"));
1488 $logtpl->setVariable(
"cmi.credit",
$lng->txt(
"cmi.credit"));
1489 $logtpl->setVariable(
"cmi.entry",
$lng->txt(
"cmi.entry"));
1490 $logtpl->setVariable(
"cmi.exit",
$lng->txt(
"cmi.exit"));
1491 $logtpl->setVariable(
"cmi.interactions._children",
$lng->txt(
"cmi.interactions._children"));
1492 $logtpl->setVariable(
"cmi.interactions._count",
$lng->txt(
"cmi.interactions._count"));
1493 $logtpl->setVariable(
"cmi.interactions.n.id",
$lng->txt(
"cmi.interactions.n.id"));
1494 $logtpl->setVariable(
"cmi.interactions.n.type",
$lng->txt(
"cmi.interactions.n.type"));
1495 $logtpl->setVariable(
"cmi.interactions.n.objectives._count",
$lng->txt(
"cmi.interactions.n.objectives._count"));
1496 $logtpl->setVariable(
"cmi.interactions.n.objectives.n.id",
$lng->txt(
"cmi.interactions.n.objectives.n.id"));
1497 $logtpl->setVariable(
"cmi.interactions.n.timestamp",
$lng->txt(
"cmi.interactions.n.timestamp"));
1498 $logtpl->setVariable(
"cmi.interactions.n.correct_responses._count",
$lng->txt(
"cmi.interactions.n.correct_responses._count"));
1499 $logtpl->setVariable(
"cmi.interactions.n.correct_responses.n.pattern",
$lng->txt(
"cmi.interactions.n.correct_responses.n.pattern"));
1500 $logtpl->setVariable(
"cmi.interactions.n.weighting",
$lng->txt(
"cmi.interactions.n.weighting"));
1501 $logtpl->setVariable(
"cmi.interactions.n.learner_response",
$lng->txt(
"cmi.interactions.n.learner_response"));
1502 $logtpl->setVariable(
"cmi.interactions.n.result",
$lng->txt(
"cmi.interactions.n.result"));
1503 $logtpl->setVariable(
"cmi.interactions.n.latency",
$lng->txt(
"cmi.interactions.n.latency"));
1504 $logtpl->setVariable(
"cmi.interactions.n.description",
$lng->txt(
"cmi.interactions.n.description"));
1505 $logtpl->setVariable(
"cmi.launch_data",
$lng->txt(
"cmi.launch_data"));
1506 $logtpl->setVariable(
"cmi.learner_id",
$lng->txt(
"cmi.learner_id"));
1507 $logtpl->setVariable(
"cmi.learner_name",
$lng->txt(
"cmi.learner_name"));
1508 $logtpl->setVariable(
"cmi.learner_preference._children",
$lng->txt(
"cmi.learner_preference._children"));
1509 $logtpl->setVariable(
"cmi.learner_preference.audio_level",
$lng->txt(
"cmi.learner_preference.audio_level"));
1510 $logtpl->setVariable(
"cmi.learner_preference.language",
$lng->txt(
"cmi.learner_preference.language"));
1511 $logtpl->setVariable(
"cmi.learner_preference.delivery_speed",
$lng->txt(
"cmi.learner_preference.delivery_speed"));
1512 $logtpl->setVariable(
"cmi.learner_preference.audio_captioning",
$lng->txt(
"cmi.learner_preference.audio_captioning"));
1513 $logtpl->setVariable(
"cmi.location",
$lng->txt(
"cmi.location"));
1514 $logtpl->setVariable(
"cmi.max_time_allowed",
$lng->txt(
"cmi.max_time_allowed"));
1515 $logtpl->setVariable(
"cmi.mode",
$lng->txt(
"cmi.mode"));
1516 $logtpl->setVariable(
"cmi.objectives._children",
$lng->txt(
"cmi.objectives._children"));
1517 $logtpl->setVariable(
"cmi.objectives._count",
$lng->txt(
"cmi.objectives._count"));
1518 $logtpl->setVariable(
"cmi.objectives.n.id",
$lng->txt(
"cmi.objectives.n.id"));
1519 $logtpl->setVariable(
"cmi.objectives.n.score._children",
$lng->txt(
"cmi.objectives.n.score._children"));
1520 $logtpl->setVariable(
"cmi.objectives.n.score.scaled",
$lng->txt(
"cmi.objectives.n.score.scaled"));
1521 $logtpl->setVariable(
"cmi.objectives.n.score.raw",
$lng->txt(
"cmi.objectives.n.score.raw"));
1522 $logtpl->setVariable(
"cmi.objectives.n.score.min",
$lng->txt(
"cmi.objectives.n.score.min"));
1523 $logtpl->setVariable(
"cmi.objectives.n.score.max",
$lng->txt(
"cmi.objectives.n.score.max"));
1524 $logtpl->setVariable(
"cmi.objectives.n.success_status",
$lng->txt(
"cmi.objectives.n.success_status"));
1525 $logtpl->setVariable(
"cmi.objectives.n.completion_status",
$lng->txt(
"cmi.objectives.n.completion_status"));
1526 $logtpl->setVariable(
"cmi.objectives.n.progress_measure",
$lng->txt(
"cmi.objectives.n.progress_measure"));
1527 $logtpl->setVariable(
"cmi.objectives.n.description",
$lng->txt(
"cmi.objectives.n.description"));
1528 $logtpl->setVariable(
"cmi.progress_measure",
$lng->txt(
"cmi.progress_measure"));
1529 $logtpl->setVariable(
"cmi.scaled_passing_score",
$lng->txt(
"cmi.scaled_passing_score"));
1530 $logtpl->setVariable(
"cmi.score._children",
$lng->txt(
"cmi.score._children"));
1531 $logtpl->setVariable(
"cmi.score.scaled",
$lng->txt(
"cmi.score.scaled"));
1532 $logtpl->setVariable(
"cmi.score.raw",
$lng->txt(
"cmi.score.raw"));
1533 $logtpl->setVariable(
"cmi.score.min",
$lng->txt(
"cmi.score.min"));
1534 $logtpl->setVariable(
"cmi.score.max",
$lng->txt(
"cmi.score.max"));
1535 $logtpl->setVariable(
"cmi.session_time",
$lng->txt(
"cmi.session_time"));
1536 $logtpl->setVariable(
"cmi.success_status",
$lng->txt(
"cmi.success_status"));
1537 $logtpl->setVariable(
"cmi.suspend_data",
$lng->txt(
"cmi.suspend_data"));
1538 $logtpl->setVariable(
"cmi.time_limit_action",
$lng->txt(
"cmi.time_limit_action"));
1539 $logtpl->setVariable(
"cmi.total_time",
$lng->txt(
"cmi.total_time"));
1540 $logtpl->setVariable(
"adl.nav.request",
$lng->txt(
"adl.nav.request"));
1541 $logtpl->setVariable(
"adl.nav.request_valid.continue",
$lng->txt(
"adl.nav.request_valid.continue"));
1542 $logtpl->setVariable(
"adl.nav.request_valid.previous",
$lng->txt(
"adl.nav.request_valid.previous"));
1543 $logtpl->setVariable(
"adl.nav.request_valid.choice",
$lng->txt(
"adl.nav.request_valid.choice"));
1544 $logtpl->setVariable(
"i_green",
$lng->txt(
"i_green"));
1545 $logtpl->setVariable(
"i_red",
$lng->txt(
"i_red"));
1546 $logtpl->setVariable(
"i_orange",
$lng->txt(
"i_orange"));
1547 $logtpl->setVariable(
"i_fuchsia",
$lng->txt(
"i_fuchsia"));
1548 $logtpl->setVariable(
"i_gray",
$lng->txt(
"i_gray"));
1549 $logtpl->setVariable(
"error",
$lng->txt(
"error"));
1550 $logtpl->setVariable(
"strange_error",
$lng->txt(
"strange_error"));
1551 $logtpl->setVariable(
"strange_API-Call",
$lng->txt(
"strange_API-Call"));
1552 $logtpl->setVariable(
"unknown",
$lng->txt(
"unknown"));
1553 $logtpl->setVariable(
"undefined_color",
$lng->txt(
"undefined_color"));
1554 $logtpl->setVariable(
"description_for",
$lng->txt(
"description_for"));
1555 $logtpl->setVariable(
"hide",
$lng->txt(
"hide"));
1556 $logtpl->setVariable(
"all_API-calls_shown",
$lng->txt(
"all_API-calls_shown"));
1557 $logtpl->setVariable(
"show_only_important_API-calls",
$lng->txt(
"show_only_important_API-calls"));
1558 $logtpl->setVariable(
"only_important_API-Calls_shown",
$lng->txt(
"only_important_API-Calls_shown"));
1559 $logtpl->setVariable(
"show_all_API-calls",
$lng->txt(
"show_all_API-calls"));
1560 $logtpl->setVariable(
"log_for",
$lng->txt(
"log_for"));
1561 $logtpl->setVariable(
"started",
$lng->txt(
"started"));
1562 $logtpl->setVariable(
"nr_session",
$lng->txt(
"nr_session"));
1563 $logtpl->setVariable(
"id_learning_module",
$lng->txt(
"id_learning_module"));
1564 if ($this->slm->getCheck_values() ==
false) {
1565 $logtpl->setVariable(
"CHECK_VALUES",
$lng->txt(
"sent_values_not_checked"));
1567 $logtpl->parseCurrentBlock();
1568 fwrite($fHandle2, $logtpl->get());
1576 $webdir = str_replace(
"/ilias.php",
"",
$_SERVER[
"SCRIPT_NAME"]);
1586 $logDir = $this->slm->getDataDirectory() .
"/logs";
1587 if (!file_exists($logDir)) {
1599 header(
'Content-Type: text/html; charset=UTF-8');
1600 echo file_get_contents($this->logDirectory() .
"/" .
$filename);
1611 header(
"Cache-Control: private");
1612 header(
"Cache-Control: must-revalidate, post-check=0, pre-check=0");
1614 header(
"Content-Description: File Transfer");
1615 header(
"Content-Type: application/octet-stream");
1616 header(
"Content-disposition: attachment; filename=$filename");
1617 echo file_get_contents($this->logDirectory() .
"/" .
$filename);
1625 private function getLogFileList(
string $s_delete,
string $s_download,
string $s_open): array
1629 foreach (
new DirectoryIterator($this->logDirectory()) as $fileInfo) {
1630 if ($fileInfo->isDot()) {
1633 $item[
'filename'] = $fileInfo->getFilename();
1634 $parts = pathinfo($item[
'filename']);
1635 $fnameparts = preg_split(
'/_/',
$parts[
'filename'], -1, PREG_SPLIT_NO_EMPTY);
1636 $deleteUrl =
' <a href=#' .
" onclick=\"javascript:deleteFile('" . $item[
'filename'] .
"');\">" . $s_delete .
"</a>";
1638 if (isset($fnameparts[1]) && (
string) $this->get_actual_attempts() == $fnameparts[1]) {
1642 $urlDownload =
$DIC->ctrl()->getLinkTarget($this,
'downloadLog') .
'&logFile=' . $fileInfo->getFilename();
1643 $urlOpen =
$DIC->ctrl()->getLinkTarget($this,
'openLog') .
'&logFile=' . $fileInfo->getFilename();
1644 $item[
'date'] = date(
'Y/m/d H:i:s', $fileInfo->getCTime());
1645 if (
$parts[
'extension'] ===
"html") {
1646 $item[
'action'] = $deleteUrl .
" <a href=" . $urlDownload .
">" . $s_download .
"</a> <a target=_new href=" . $urlOpen .
">" . $s_open .
"</a>";
1648 $item[
'action'] = $deleteUrl .
" <a href=" . $urlDownload .
">" . $s_download .
"</a>";
1650 if (
$parts[
'extension'] ===
"html" ||
$parts[
'extension'] ===
"csv") {
1654 usort(
$data,
"datecmp");
1660 header(
'Content-Type: text/html; charset=UTF-8');
1661 print file_get_contents($this->logFileName() .
".html");
1668 $lng->loadLanguageModule(
"scormdebug");
1680 $this->tpl =
new ilGlobalTemplate(
"tpl.scorm2004.debug.html",
false,
false,
"components/ILIAS/Scorm2004");
1681 $this->tpl->setVariable(
'CONSOLE',
$lng->txt(
"debugwindow_console"));
1682 $this->tpl->setVariable(
'LOGS',
$lng->txt(
"debugwindow_logs"));
1683 $this->tpl->setVariable(
'COMMENT',
$lng->txt(
"debugwindow_comment"));
1684 $this->tpl->setVariable(
'COMMENT_ENTER',
$lng->txt(
"debugwindow_comment_enter"));
1685 $this->tpl->setVariable(
'START_RECORDING',
$lng->txt(
"debugwindow_start_recording"));
1686 $this->tpl->setVariable(
'STOP_RECORDING',
$lng->txt(
"debugwindow_stop_recording"));
1687 $this->tpl->setVariable(
'DELETE_LOGFILE',
$lng->txt(
"debugwindow_delete_logfile"));
1688 $this->tpl->setVariable(
'SUBMISSION_FAILED',
$lng->txt(
"debugwindow_submission_failed"));
1689 $this->tpl->setVariable(
'SUBMIT',
$lng->txt(
"debugwindow_submit"));
1690 $this->tpl->setVariable(
'CANCEL',
$lng->txt(
"debugwindow_cancel"));
1691 $this->tpl->setVariable(
'FILENAME',
$lng->txt(
"debugwindow_filename"));
1692 $this->tpl->setVariable(
'DATE',
$lng->txt(
"debugwindow_date"));
1693 $this->tpl->setVariable(
'ACTION',
$lng->txt(
"debugwindow_action"));
1694 $this->tpl->setVariable(
'RECORD_IMG',
"components/ILIAS/Scorm2004/templates/default/images/record.png");
1695 $this->tpl->setVariable(
'STOP_IMG',
"components/ILIAS/Scorm2004/templates/default/images/stop.png");
1696 $this->tpl->setVariable(
'COMMENT_IMG',
"components/ILIAS/Scorm2004/templates/default/images/comment.png");
1697 $logfile = $this->logFileName() .
".html";
1698 $this->tpl->setVariable(
'LOGFILE', $this->logFileName() .
".html");
1699 $this->tpl->setVariable(
'FILES_DATA', json_encode($this->getLogFileList(
$lng->txt(
"debugwindow_delete"),
$lng->txt(
"debugwindow_download"),
$lng->txt(
"debugwindow_open"))));
1702 echo $this->tpl->get(
"DEFAULT",
true);
1707 return new ilTemplate(
"tpl.scorm2004.debugtxt.txt",
true,
true,
"components/ILIAS/Scorm2004");
1731 $debug_fields = parse_ini_file(
"../components/ILIAS/Scorm2004/scripts/rtemain/debug_default.ini",
true);
1734 $ini_array = $debug_fields[
'test_sco'];
1736 $ini_array = $debug_fields[
'normal_sco'];
1738 foreach ($ini_array as $key => $value) {
1751 $lng->loadLanguageModule(
"scormdebug");
1753 $logdata = json_decode(file_get_contents(
'php://input'));
1755 $tmp_name = $this->logTmpName();
1757 $fh_txt = fopen(
$filename .
".html",
'a') or die(
"can't open txt file");
1758 $fh_csv = fopen(
$filename .
".csv",
'a') or die(
"can't open csv file");
1759 $fh_tmp = fopen($tmp_name,
'r') or die(
"can't open tmp file");
1762 if (filesize($tmp_name) > 0) {
1763 $tmp_content = unserialize(fread($fh_tmp, filesize($tmp_name)));
1765 $tmp_content =
null;
1772 if ($logdata->action !=
"SUMMARY") {
1774 $fh_tmp2 = fopen($tmp_name,
'w') or die(
"can't open tmp file");
1777 $tmp_content[$logdata->scoid][$logdata->key][
'value'] = $logdata->value;
1778 $tmp_content[$logdata->scoid][$logdata->key][
'status'] = $logdata->result;
1779 $tmp_content[$logdata->scoid][$logdata->key][
'action'] = $logdata->action;
1781 fwrite($fh_tmp2, serialize($tmp_content));
1784 $errorcode = (
int) $logdata->errorcode;
1785 $fixedFailure =
false;
1786 $toleratedFailure =
false;
1787 $extraErrorDescription =
"";
1788 if ($errorcode == 200000) {
1790 $toleratedFailure =
true;
1791 $extraErrorDescription =
"tolerated failure";
1793 if ($errorcode > 99999) {
1794 $errorcode -= 100000;
1795 $fixedFailure =
true;
1796 $extraErrorDescription =
" failure corrected by ILIAS";
1798 if (strpos($logdata->action,
"ANALYZE") ===
false) {
1799 $errorDescriptions = array(
"0" =>
"",
1800 "101" =>
"General Exeption",
1801 "102" =>
"General Initialization Failure",
1802 "103" =>
"Already Initialized",
1803 "104" =>
"Content Instance Terminated",
1804 "111" =>
"General Termination Failure",
1805 "112" =>
"Termination Before Initialization",
1806 "113" =>
"Termination After Termination",
1807 "122" =>
"Retrieve Data Before Initialization",
1808 "123" =>
"Retrieve Data After Termination",
1809 "132" =>
"Store Data Before Initialization",
1810 "133" =>
"Store Data After Termination",
1811 "142" =>
"Commit Before Initialization",
1812 "143" =>
"Commit After Termination",
1813 "201" =>
"General Argument Error",
1814 "301" =>
"General Get Failure",
1815 "351" =>
"General Set Failure",
1816 "391" =>
"General Commit Failure",
1817 "401" =>
"Undefined Data Model Element",
1818 "402" =>
"Unimplemented Data Model Element",
1819 "403" =>
"Data Model Element Value Not Initialized",
1820 "404" =>
"Data Model Element Is Read Only",
1821 "405" =>
"Data Model Element Is Write Only",
1822 "406" =>
"Data Model Element Type Mismatch",
1823 "407" =>
"Data Model Element Value Out Of Range",
1824 "408" =>
"Data Model Dependency Not Established"
1826 $csv_string = $this->packageId .
';"'
1827 . $logdata->scoid .
'";"'
1828 . $logdata->scotitle .
'";'
1829 . date(
"d.m.Y H:i", time()) .
';"'
1830 . $logdata->action .
'";"'
1831 . $logdata->key .
'";"'
1832 . str_replace(
"\"",
"\"\"", $logdata->value) .
'";"'
1833 . str_replace(
"\"",
"\"\"", $logdata->result) .
'";'
1835 . $logdata->timespan .
';"'
1836 . $errorDescriptions[(string) $errorcode] . $extraErrorDescription .
'"' .
"\n";
1837 fwrite($fh_csv, $csv_string);
1842 if ($logdata->action ===
"Commit" || $logdata->action ===
"Terminate") {
1844 $sql_data = $this->getNodeData($logdata->scoid);
1845 if (count($sql_data) != 0) {
1846 foreach ($sql_data as $key => $value) {
1847 $sql_string = $this->packageId .
';"'
1848 . $logdata->scoid .
'";"'
1849 . $logdata->scotitle .
'";'
1852 . str_replace(
"\"",
"\"\"", (
string) $value) .
'";;;;' .
"\n";
1853 fwrite($fh_csv, $sql_string);
1859 if ($logdata->action ===
"DELETE") {
1868 $logtpl = $this->getLogTemplate();
1871 $ArGetValues = array(
'comments_from_lms',
'completion_threshold',
'credit',
'entry',
'launch_data',
'learner_id',
'learner_name',
'max_time_allowed',
'mode',
'scaled_passing_score',
'time_limit_action',
'total_time');
1873 switch ($logdata->action) {
1875 if ($logdata->result ===
"true" && $errorcode == 0) {
1878 if ($color ===
"green" && $logdata->key ===
"cmi.exit" && $logdata->value !==
"suspend") {
1881 if ($fixedFailure ==
false && $errorcode != 406) {
1882 $logdata->value =
'"' . $logdata->value .
'"';
1884 if ($toleratedFailure ==
true) {
1887 if ($fixedFailure ==
true) {
1892 if ($errorcode == 0) {
1897 if ($errorcode == 0) {
1899 $logtpl->setCurrentBlock(
"InitializeStart");
1900 $logtpl->setVariable(
"SCO-title",
$lng->txt(
"SCO-title"));
1901 $logtpl->setVariable(
"SCO_TITLE", $logdata->scotitle);
1902 $logtpl->setVariable(
"SCO-name",
$lng->txt(
"SCO-name"));
1903 $logtpl->setVariable(
"SCO_NAME", $logdata->scoid);
1904 $logtpl->setVariable(
"started",
$lng->txt(
"started"));
1905 $logtpl->setVariable(
"TIMESTAMP",
$timestamp);
1906 $logtpl->setVariable(
"milliseconds",
$lng->txt(
"milliseconds"));
1907 $logtpl->setVariable(
"API-call",
$lng->txt(
"API-call"));
1908 $logtpl->setVariable(
"return_value",
$lng->txt(
"return_value"));
1909 $logtpl->setVariable(
"error",
$lng->txt(
"error"));
1910 $logtpl->parseCurrentBlock();
1914 if ($errorcode == 0) {
1917 if ($fixedFailure ==
true) {
1922 if ($errorcode == 0) {
1926 case 'GetErrorString':
1928 if ($errorcode == 0) {
1932 case 'GetLastError':
1933 $logtpl->setCurrentBlock(
"GetLastError");
1934 $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
1935 $logtpl->setVariable(
"RESULT", $logdata->result);
1936 $logtpl->parseCurrentBlock();
1938 case 'GetDiagnostic':
1939 $logtpl->setCurrentBlock(
"GetDiagnostic");
1940 $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
1941 $logtpl->setVariable(
"KEY", $logdata->key);
1942 $logtpl->setVariable(
"RESULT", $logdata->result);
1943 $logtpl->parseCurrentBlock();
1946 $logtpl->setCurrentBlock(
"INFO");
1947 $logtpl->setVariable(
"hint",
$lng->txt(
"hint"));
1948 $logtpl->setVariable(
"KEY",
$lng->txt($logdata->key));
1949 $logtpl->setVariable(
"VALUE", $logdata->value);
1950 $logtpl->parseCurrentBlock();
1953 $logtpl->setCurrentBlock(
"COMMENT");
1954 $logtpl->setVariable(
"comment",
$lng->txt(
"comment"));
1955 $logtpl->setVariable(
"generated",
$lng->txt(
"generated"));
1956 $logtpl->setVariable(
"TIMESTAMP",
$timestamp);
1957 $logtpl->setVariable(
"VALUE", $logdata->value);
1958 $logtpl->parseCurrentBlock();
1961 $logtpl->setCurrentBlock(
"ANALYZE");
1962 if (count($logdata->value) == 0) {
1964 $logtpl->setVariable(
"ANALYZE_SUMMARY",
$lng->txt(
"no_missing_API-calls"));
1965 $logtpl->setVariable(
"VALUE",
"");
1967 $tmpvalue =
"SetValue(\"" . implode(
"\", ... ),<br/>SetValue(\"", $logdata->value) .
"\", ... )";
1968 foreach ($ArGetValues as $value) {
1969 $tmpvalue = str_replace(
"SetValue(\"cmi." . $value .
"\", ... )",
"GetValue(\"cmi." . $value .
"\")", $tmpvalue);
1971 $logtpl->setVariable(
"ANALYZE_SUMMARY",
$lng->txt(
"missing_API-calls"));
1972 $logtpl->setVariable(
"VALUE", $tmpvalue);
1974 $logtpl->setVariable(
"summary_for_SCO_without_test",
$lng->txt(
"summary_for_SCO_without_test"));
1975 $logtpl->setVariable(
"generated",
$lng->txt(
"generated"));
1976 $logtpl->setVariable(
"TIMESTAMP",
$timestamp);
1977 $logtpl->setVariable(
"COLOR", $color);
1978 $logtpl->parseCurrentBlock();
1981 $logtpl->setCurrentBlock(
"ANALYZETEST");
1982 if (count($logdata->value) == 0) {
1984 $logtpl->setVariable(
"ANALYZE_SUMMARY",
$lng->txt(
"no_missing_API-calls"));
1985 $logtpl->setVariable(
"VALUE",
"");
1987 $tmpvalue =
"SetValue(\"" . implode(
"\", ... ),<br/>SetValue(\"", $logdata->value) .
"\", ... )";
1988 foreach ($ArGetValues as $value) {
1989 $tmpvalue = str_replace(
"SetValue(\"cmi." . $value .
"\", ... )",
"GetValue(\"cmi." . $value .
"\")", $tmpvalue);
1991 $logtpl->setVariable(
"ANALYZE_SUMMARY",
$lng->txt(
"missing_API-calls"));
1992 $logtpl->setVariable(
"VALUE", $tmpvalue);
1994 $logtpl->setVariable(
"summary_for_SCO_with_test",
$lng->txt(
"summary_for_SCO_with_test"));
1995 $logtpl->setVariable(
"generated",
$lng->txt(
"generated"));
1996 $logtpl->setVariable(
"TIMESTAMP",
$timestamp);
1997 $logtpl->setVariable(
"COLOR", $color);
1998 $logtpl->parseCurrentBlock();
2001 $logtpl->setCurrentBlock(
"SUMMARY");
2002 $logtpl->setVariable(
"summary_csv",
$lng->txt(
"summary_csv"));
2003 $logtpl->setVariable(
"TIMESTAMP",
$timestamp);
2004 $logtpl->setVariable(
"summary_download",
$lng->txt(
"summary_download"));
2005 $logtpl->parseCurrentBlock();
2012 if ($logdata->action ===
'SetValue' || $logdata->action ===
'GetValue') {
2013 $logtpl->setCurrentBlock($logdata->action);
2014 $logtpl->setVariable(
"ACTION", $logdata->action);
2015 $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
2016 $logtpl->setVariable(
"KEY", $logdata->key);
2017 $logtpl->setVariable(
"VALUE", $logdata->value);
2018 $logtpl->setVariable(
"RESULT", $logdata->result);
2019 $logtpl->setVariable(
"ERRORCODE", $errorcode);
2020 $debugfields = $this->getDebugValues(
true);
2022 foreach ($debugfields as $value) {
2023 if ($logdata->key == $value) {
2027 $logtpl->setVariable(
"IMPORTANTKEY",
"" . $importantkey);
2028 $logtpl->setVariable(
"COLOR", $color);
2029 $logtpl->parseCurrentBlock();
2030 } elseif ($logdata->action !==
'INFO' && $logdata->action !==
'ANALYZE' && $logdata->action !==
'ANALYZETEST' && $logdata->action !==
'SUMMARY' && $logdata->action !==
'COMMENT' && $logdata->action !==
'GetDiagnostic' && $logdata->action !==
'GetLastError') {
2031 $logtpl->setCurrentBlock(
"defaultCall");
2032 $logtpl->setVariable(
"ACTION", $logdata->action);
2033 $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
2034 $logtpl->setVariable(
"KEY", $logdata->key);
2035 $logtpl->setVariable(
"VALUE", $logdata->value);
2036 $logtpl->setVariable(
"RESULT", $logdata->result);
2037 $logtpl->setVariable(
"ERRORCODE", $errorcode);
2038 $logtpl->setVariable(
"IMPORTANTKEY",
"" . $importantkey);
2039 $logtpl->setVariable(
"COLOR", $color);
2040 $logtpl->parseCurrentBlock();
2053 if ($logdata->action ===
"SUMMARY") {
2054 $this->createSummary($tmp_content);
2057 fwrite($fh_txt, $logtpl->get());
2064 foreach (
$data as $i => $value) {
2066 $element[
'title'] = $value[
'title'];
2067 $element[
'id'] = $value[
'id'];
2068 if ($value[
'sco'] == 1) {
2069 $element[
'sco'] =
"sco";
2071 $element[
'sco'] =
"asset";
2073 if ($value[
'href'] !=
null) {
2074 $this->flat_structure[] = $element;
2076 if (isset($value[
'item']) && $value[
'item'] !=
null) {
2077 $this->getStructureFlat($value[
'item']);
2089 $columns_fixed = array(
'id',
'title',
'type',
'attempted');
2091 $ini_data = parse_ini_file(
"./components/ILIAS/Scorm2004/scripts/rtemain/debug_default.ini",
true);
2092 $ini_array = $ini_data[
'summary'];
2093 $colums_variable = array();
2094 $api_keys = array();
2096 foreach ($ini_array as $key => $value) {
2098 $colums_variable[] = $key;
2100 $colums_variable[] =
"Status";
2104 $header_array = array_merge($columns_fixed, $colums_variable);
2106 $csv_header = implode(
";", $header_array);
2110 'SELECT jsdata FROM cp_package WHERE obj_id = %s',
2112 array($this->packageId)
2117 $structure = json_decode($packageData[
'jsdata'],
true);
2120 $this->flat_structure = array();
2122 $this->getStructureFlat(
$structure[
'item'][
'item']);
2124 foreach ($this->flat_structure as $tree_element) {
2125 $csv_data = $csv_data . $tree_element[
'id'] .
";" . $tree_element[
'title'] .
";" . $tree_element[
'sco'] .
";";
2126 if (isset($api_data[$tree_element[
'id']])) {
2127 $csv_data = $csv_data .
"X" .
";";
2129 $csv_data = $csv_data .
";";
2133 $id = $tree_element[
'id'];
2134 foreach ($api_keys as $api_element) {
2135 if (isset($api_data[
$id])) {
2136 if (isset($api_data[
$id][$api_element])) {
2137 $csv_data = $csv_data . $api_data[
$id][$api_element][
'value'] .
";" . $api_data[
$id][$api_element][
'status'] .
";";
2139 $csv_data = $csv_data .
";;";
2143 $csv_data = $csv_data .
"\n";
2146 $fh = fopen($this->summaryFileName(),
"wb");
2147 fwrite($fh, $csv_header .
"\n" . $csv_data);
2149 unlink($this->logTmpName());
2170 if (strtotime(
$a[
'date']) == strtotime(
$b[
'date'])) {
2173 return (strtotime(
$a[
'date']) < strtotime(
$b[
'date'])) ? 1 : -1;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
$structure
TOTAL STRUCTURE.
foreach($mandatory_scripts as $file) $timestamp
datecmp(array $a, array $b)
Class ilCtrl provides processing control methods.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
special template class to simplify handling of ITX/PEAR
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getLogger(string $a_component_id)
Get component logger.
Class ilObjSCORM2004LearningModule.
static getStatus(int $a_packageId, int $a_user_id, bool $auto_last_visited, string $scormType="1.2")
static _lookupObjectId(int $ref_id)
writeSharedData(int $sco_node_id)
getDebugValues(?bool $test_sco=false)
createSummary(array $api_data)
getCMIData(int $userId, int $packageId)
getNodeData(string $sco_id)
getStructureFlat(array $data)
getLogFileList(string $s_delete, string $s_download, string $s_open)
quoteJSONArray(?array $a_array)
get_actual_attempts()
Get number of actual attempts for the user.
readSharedData(int $sco_node_id)
executeCommand()
execute command
ilObjSCORM2004LearningModule $slm
increase_attemptAndsave_module_version()
Increases attempts by one and saves module_version for this package.
static persistCMIData(int $packageId, int $refId, string $defaultLessonMode, bool $comments, bool $interactions, bool $objectives, bool $time_from_lms, ?string $data=null, ?int $userId=null)
static scormPlayerUnload(int $packageId, int $refId, bool $time_from_lms, ?int $userId=null)
const int DEFAULT_MIN_IDLE
default value for settings that have not been defined in setup or administration yet
static getIdleValue()
Returns the idle time in seconds.
special template class to simplify handling of ITX/PEAR
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static signFolderOfStartFile(string $start_file_path)
static getCookieMaxLifetimeInSeconds()
static getLocalPath(string $a_name="")
Get local path of a YUI js file.
static getLocaljQueryPath()
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
if(!file_exists('../ilias.ini.php'))