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));
468 $this->tpl->setVariable(
'TREE_JS',
"components/ILIAS/Scorm2004/scripts/ilNestedList.js");
469 foreach ($langstrings as $key => $value) {
470 $this->tpl->setVariable($key, $value);
472 $this->tpl->setVariable(
'DOC_TITLE',
'ILIAS: ' . $this->slm->getTitle());
474 $this->tpl->setVariable(
'INIT_CP_DATA', json_encode(json_decode($this->
getCPDataInit())));
475 $this->tpl->setVariable(
'INIT_CMI_DATA', json_encode($this->
getCMIData($this->userId, $this->packageId)));
476 $this->tpl->setVariable(
'INIT_ADLACT_DATA', json_encode($initAdlactData));
477 $this->tpl->setVariable(
'INIT_GLOBALOBJ_DATA', json_encode($initGlobalobjData));
478 $this->tpl->setVariable(
'JS_DATA', json_encode($config));
479 list($tsfrac, $tsint) = explode(
' ', microtime());
480 $this->tpl->setVariable(
'TIMESTAMP', sprintf(
'%d%03d', $tsint, 1000 * (
float) $tsfrac));
481 $this->tpl->setVariable(
'BASE_DIR',
'../components/ILIAS/Scorm2004/');
482 $this->tpl->setVariable(
'TXT_COLLAPSE',
$lng->
txt(
'scplayer_collapsetree'));
483 if ($this->slm->getDebug()) {
484 $this->tpl->setVariable(
'TXT_DEBUGGER',
$lng->
txt(
'scplayer_debugger'));
485 $debug_url =
$DIC->ctrl()->getLinkTarget($this,
'debugGUI');
486 $this->tpl->setVariable(
'DEBUG_URL',
"PopupCenter('" . $debug_url .
"','Debug',800,600);");
488 $this->tpl->setVariable(
'TXT_DEBUGGER',
'');
489 $this->tpl->setVariable(
'DEBUG_URL',
'');
493 $this->tpl->setVariable(
'INLINE_CSS', ilSCORM13PlayerGUI::getInlineCss());
496 if ($this->slm->getCacheDeactivated()) {
497 $rtejs_url =
$DIC->ctrl()->getLinkTarget($this,
'getRTEjs');
498 $this->tpl->setVariable(
'JS_SCRIPTS', $rtejs_url);
500 $this->tpl->setVariable(
'JS_SCRIPTS',
'components/ILIAS/Scorm2004/scripts/buildrte/rte-min.js');
504 if ($this->slm->getNoMenu() ===
true) {
505 $this->tpl->setVariable(
"VAL_DISPLAY",
"style=\"display:none;\"");
507 $this->tpl->setVariable(
"VAL_DISPLAY",
"");
524 $this->tpl->printToStdout(
"DEFAULT",
false);
529 $is_tpl =
new ilTemplate(
"tpl.scorm2004.inlinecss.html",
true,
true,
"components/ILIAS/Scorm2004");
538 return $is_tpl->get();
545 header(
'Content-Type: text/javascript; charset=UTF-8');
548 header(
'Content-Type: text/plain; charset=UTF-8');
549 $jsdata = json_decode($jsdata);
560 'SELECT jsdata FROM cp_package WHERE obj_id = %s',
562 array($this->packageId)
566 $jsdata = $packageData[
'jsdata'] ??
false;
581 'SELECT activitytree FROM cp_package WHERE obj_id = %s',
583 array($this->packageId)
587 $activitytree =
$data[
'activitytree'] ??
false;
589 if (!$activitytree) {
590 $activitytree =
'null';
592 return $activitytree;
599 header(
'Content-Type: text/javascript; charset=UTF-8');
600 print($activitytree);
602 header(
'Content-Type: text/plain; charset=UTF-8');
603 $activitytree = json_decode($activitytree);
604 print_r($activitytree);
612 header(
'Content-Type: text/plain; charset=UTF-8');
620 $ilUser =
$DIC->user();
623 'SELECT global_to_system FROM cp_package WHERE obj_id = %s',
625 array($this->packageId)
629 $gystem =
$data[
'global_to_system'] ?? 1;
633 $gsystem = (string) $this->packageId;
643 $ilUser =
$DIC->user();
646 'SELECT data FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
647 array(
'integer',
'integer'),
648 array($this->packageId, $ilUser->getId())
654 'DELETE FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
655 array(
'integer',
'integer'),
656 array($this->packageId, $ilUser->getId())
658 if (is_array(
$data)) {
659 return $data[
'data'];
668 header(
'Content-Type: text/javascript; charset=UTF-8');
669 print($suspend_data);
671 header(
'Content-Type: text/plain; charset=UTF-8');
672 $suspend_data = json_decode($suspend_data);
673 print_r($suspend_data);
681 $ilUser =
$DIC->user();
684 'SELECT * FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
685 array(
'integer',
'integer'),
686 array($this->packageId, $ilUser->getId())
690 $ilDB->insert(
'cp_suspend', array(
691 'data' => array(
'clob', file_get_contents(
'php://input')),
692 'obj_id' => array(
'integer', $this->packageId),
693 'user_id' => array(
'integer', $ilUser->getId())
699 'data' => array(
'clob', file_get_contents(
'php://input'))
702 'obj_id' => array(
'integer', $this->packageId),
703 'user_id' => array(
'integer', $ilUser->getId())
713 $ilUser =
$DIC->user();
718 $global_to_system = 1;
721 'SELECT global_to_system FROM cp_package WHERE obj_id = %s',
723 array($this->packageId)
726 $global_to_system =
$data[
'global_to_system'];
729 $query =
'SELECT objective_id, scope_id, satisfied, measure, user_id,
730 score_min, score_max, score_raw, completion_status,
732 .
'FROM cmi_gobjective, cp_node, cp_mapinfo '
733 .
'WHERE (cmi_gobjective.objective_id <> %s AND cmi_gobjective.status IS NULL '
734 .
'AND cp_node.slm_id = %s AND cp_node.nodename = %s '
735 .
'AND cp_node.cp_node_id = cp_mapinfo.cp_node_id '
736 .
'AND cmi_gobjective.objective_id = cp_mapinfo.targetobjectiveid) '
737 .
'GROUP BY objective_id, scope_id, satisfied, measure, user_id,
738 score_min, score_max, score_raw, completion_status,
742 array(
'text',
'integer',
'text'),
743 array(
'-course_overall_status-', $this->packageId,
'mapInfo')
746 if (($global_to_system == 1 && $row[
'scope_id'] == 0) || ($global_to_system == 0 && $row[
'scope_id'] == $this->packageId)) {
747 $learner = $row[
'user_id'];
748 $objective_id = $row[
'objective_id'];
749 if ($row[
'scope_id'] == 0) {
752 $scope = $row[
'scope_id'];
755 if ($row[
'satisfied'] !=
null) {
756 $toset = $row[
'satisfied'];
757 $g_data[
"satisfied"][$objective_id][$learner][
$scope] = $toset;
760 if ($row[
'measure'] !=
null) {
761 $toset = $row[
'measure'];
762 $g_data[
"measure"][$objective_id][$learner][
$scope] = $toset;
765 if ($row[
'score_raw'] !=
null) {
766 $toset = $row[
'score_raw'];
767 $g_data[
"score_raw"][$objective_id][$learner][
$scope] = $toset;
770 if ($row[
'score_min'] !=
null) {
771 $toset = $row[
'score_min'];
772 $g_data[
"score_min"][$objective_id][$learner][
$scope] = $toset;
775 if ($row[
'score_max'] !=
null) {
776 $toset = $row[
'score_max'];
777 $g_data[
"score_max"][$objective_id][$learner][
$scope] = $toset;
780 if ($row[
'progress_measure'] !=
null) {
781 $toset = $row[
'progress_measure'];
782 $g_data[
"progress_measure"][$objective_id][$learner][
$scope] = $toset;
785 if ($row[
'completion_status'] !=
null) {
786 $toset = $row[
'completion_status'];
787 $g_data[
"completion_status"][$objective_id][$learner][
$scope] = $toset;
798 header(
'Content-Type: text/javascript; charset=UTF-8');
799 print($gobjective_data);
801 header(
'Content-Type: text/plain; charset=UTF-8');
802 $gobjective_data = json_decode($gobjective_data);
803 print_r($gobjective_data);
813 $ilUser =
$DIC->user();
814 $dataStores = array(
"data" => array(),
815 "permissions" => array());
816 $readPermissions = array();
818 $query =
'SELECT target_id, read_shared_data, write_shared_data '
820 .
'WHERE slm_id = %s '
821 .
'AND sco_node_id = %s '
822 .
'GROUP BY target_id, read_shared_data, write_shared_data';
827 array(
'integer',
'integer'),
828 array($this->packageId, $sco_node_id)
834 $storeVal = ($row[
'read_shared_data'] == 0 && $row[
'write_shared_data'] == 1)
838 $dataStores[
"data"][$row[
'target_id']] = array(
"store" => $storeVal,
839 "readSharedData" => $row[
'read_shared_data'],
840 "writeSharedData" => $row[
'write_shared_data']);
841 $dataStores[
"readPermissions"][$row[
'target_id']] = $row[
'read_shared_data'];
844 if (count($dataStores) < 1) {
850 if (isset($dataStores[
"readPermissions"]) && $dataStores[
"readPermissions"] !=
null && array_sum($dataStores[
"readPermissions"]) != 0) {
855 $params = array(
"types" => array(
"integer",
"integer"),
856 "values" => array($this->userId, $this->packageId));
862 foreach ($dataStores[
"data"] as $key => $val) {
863 if ($dataStores[
"readPermissions"][(
string) $key] == 1
864 && $dataStores[
"data"][(
string) $key][
"store"] !==
'notWritten') {
867 $paramTemplate .=
'%s, ';
872 $paramTemplate = substr($paramTemplate, 0, -2);
875 $query =
'SELECT target_id, store '
876 .
'FROM adl_shared_data '
877 .
'WHERE user_id = %s '
879 .
'AND target_id IN (' . $paramTemplate .
')';
889 $dataStores[
"data"][$row[
'target_id']][
"store"] = $row[
'store'];
893 header(
'Content-Type: text/javascript; charset=UTF-8');
895 echo json_encode($dataStores[
"data"]);
902 $ilUser =
$DIC->user();
903 $g_data = json_decode(file_get_contents(
'php://input'));
905 if ($g_data ==
null) {
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"))));
1701 echo $this->tpl->get(
"DEFAULT",
true);
1706 return new ilTemplate(
"tpl.scorm2004.debugtxt.txt",
true,
true,
"components/ILIAS/Scorm2004");
1730 $debug_fields = parse_ini_file(
"../components/ILIAS/Scorm2004/scripts/rtemain/debug_default.ini",
true);
1733 $ini_array = $debug_fields[
'test_sco'];
1735 $ini_array = $debug_fields[
'normal_sco'];
1737 foreach ($ini_array as $key => $value) {
1750 $lng->loadLanguageModule(
"scormdebug");
1752 $logdata = json_decode(file_get_contents(
'php://input'));
1754 $tmp_name = $this->logTmpName();
1756 $fh_txt = fopen(
$filename .
".html",
'a') or die(
"can't open txt file");
1757 $fh_csv = fopen(
$filename .
".csv",
'a') or die(
"can't open csv file");
1758 $fh_tmp = fopen($tmp_name,
'r') or die(
"can't open tmp file");
1761 if (filesize($tmp_name) > 0) {
1762 $tmp_content = unserialize(fread($fh_tmp, filesize($tmp_name)));
1764 $tmp_content =
null;
1771 if ($logdata->action !=
"SUMMARY") {
1773 $fh_tmp2 = fopen($tmp_name,
'w') or die(
"can't open tmp file");
1776 $tmp_content[$logdata->scoid][$logdata->key][
'value'] = $logdata->value;
1777 $tmp_content[$logdata->scoid][$logdata->key][
'status'] = $logdata->result;
1778 $tmp_content[$logdata->scoid][$logdata->key][
'action'] = $logdata->action;
1780 fwrite($fh_tmp2, serialize($tmp_content));
1783 $errorcode = (
int) $logdata->errorcode;
1784 $fixedFailure =
false;
1785 $toleratedFailure =
false;
1786 $extraErrorDescription =
"";
1787 if ($errorcode == 200000) {
1789 $toleratedFailure =
true;
1790 $extraErrorDescription =
"tolerated failure";
1792 if ($errorcode > 99999) {
1793 $errorcode -= 100000;
1794 $fixedFailure =
true;
1795 $extraErrorDescription =
" failure corrected by ILIAS";
1797 if (strpos($logdata->action,
"ANALYZE") ===
false) {
1798 $errorDescriptions = array(
"0" =>
"",
1799 "101" =>
"General Exeption",
1800 "102" =>
"General Initialization Failure",
1801 "103" =>
"Already Initialized",
1802 "104" =>
"Content Instance Terminated",
1803 "111" =>
"General Termination Failure",
1804 "112" =>
"Termination Before Initialization",
1805 "113" =>
"Termination After Termination",
1806 "122" =>
"Retrieve Data Before Initialization",
1807 "123" =>
"Retrieve Data After Termination",
1808 "132" =>
"Store Data Before Initialization",
1809 "133" =>
"Store Data After Termination",
1810 "142" =>
"Commit Before Initialization",
1811 "143" =>
"Commit After Termination",
1812 "201" =>
"General Argument Error",
1813 "301" =>
"General Get Failure",
1814 "351" =>
"General Set Failure",
1815 "391" =>
"General Commit Failure",
1816 "401" =>
"Undefined Data Model Element",
1817 "402" =>
"Unimplemented Data Model Element",
1818 "403" =>
"Data Model Element Value Not Initialized",
1819 "404" =>
"Data Model Element Is Read Only",
1820 "405" =>
"Data Model Element Is Write Only",
1821 "406" =>
"Data Model Element Type Mismatch",
1822 "407" =>
"Data Model Element Value Out Of Range",
1823 "408" =>
"Data Model Dependency Not Established"
1825 $csv_string = $this->packageId .
';"'
1826 . $logdata->scoid .
'";"'
1827 . $logdata->scotitle .
'";'
1828 . date(
"d.m.Y H:i", time()) .
';"'
1829 . $logdata->action .
'";"'
1830 . $logdata->key .
'";"'
1831 . str_replace(
"\"",
"\"\"", $logdata->value) .
'";"'
1832 . str_replace(
"\"",
"\"\"", $logdata->result) .
'";'
1834 . $logdata->timespan .
';"'
1835 . $errorDescriptions[(string) $errorcode] . $extraErrorDescription .
'"' .
"\n";
1836 fwrite($fh_csv, $csv_string);
1841 if ($logdata->action ===
"Commit" || $logdata->action ===
"Terminate") {
1843 $sql_data = $this->getNodeData($logdata->scoid);
1844 if (count($sql_data) != 0) {
1845 foreach ($sql_data as $key => $value) {
1846 $sql_string = $this->packageId .
';"'
1847 . $logdata->scoid .
'";"'
1848 . $logdata->scotitle .
'";'
1851 . str_replace(
"\"",
"\"\"", (
string) $value) .
'";;;;' .
"\n";
1852 fwrite($fh_csv, $sql_string);
1858 if ($logdata->action ===
"DELETE") {
1867 $logtpl = $this->getLogTemplate();
1870 $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');
1872 switch ($logdata->action) {
1874 if ($logdata->result ===
"true" && $errorcode == 0) {
1877 if ($color ===
"green" && $logdata->key ===
"cmi.exit" && $logdata->value !==
"suspend") {
1880 if ($fixedFailure ==
false && $errorcode != 406) {
1881 $logdata->value =
'"' . $logdata->value .
'"';
1883 if ($toleratedFailure ==
true) {
1886 if ($fixedFailure ==
true) {
1891 if ($errorcode == 0) {
1896 if ($errorcode == 0) {
1898 $logtpl->setCurrentBlock(
"InitializeStart");
1899 $logtpl->setVariable(
"SCO-title",
$lng->txt(
"SCO-title"));
1900 $logtpl->setVariable(
"SCO_TITLE", $logdata->scotitle);
1901 $logtpl->setVariable(
"SCO-name",
$lng->txt(
"SCO-name"));
1902 $logtpl->setVariable(
"SCO_NAME", $logdata->scoid);
1903 $logtpl->setVariable(
"started",
$lng->txt(
"started"));
1904 $logtpl->setVariable(
"TIMESTAMP",
$timestamp);
1905 $logtpl->setVariable(
"milliseconds",
$lng->txt(
"milliseconds"));
1906 $logtpl->setVariable(
"API-call",
$lng->txt(
"API-call"));
1907 $logtpl->setVariable(
"return_value",
$lng->txt(
"return_value"));
1908 $logtpl->setVariable(
"error",
$lng->txt(
"error"));
1909 $logtpl->parseCurrentBlock();
1913 if ($errorcode == 0) {
1916 if ($fixedFailure ==
true) {
1921 if ($errorcode == 0) {
1925 case 'GetErrorString':
1927 if ($errorcode == 0) {
1931 case 'GetLastError':
1932 $logtpl->setCurrentBlock(
"GetLastError");
1933 $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
1934 $logtpl->setVariable(
"RESULT", $logdata->result);
1935 $logtpl->parseCurrentBlock();
1937 case 'GetDiagnostic':
1938 $logtpl->setCurrentBlock(
"GetDiagnostic");
1939 $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
1940 $logtpl->setVariable(
"KEY", $logdata->key);
1941 $logtpl->setVariable(
"RESULT", $logdata->result);
1942 $logtpl->parseCurrentBlock();
1945 $logtpl->setCurrentBlock(
"INFO");
1946 $logtpl->setVariable(
"hint",
$lng->txt(
"hint"));
1947 $logtpl->setVariable(
"KEY",
$lng->txt($logdata->key));
1948 $logtpl->setVariable(
"VALUE", $logdata->value);
1949 $logtpl->parseCurrentBlock();
1952 $logtpl->setCurrentBlock(
"COMMENT");
1953 $logtpl->setVariable(
"comment",
$lng->txt(
"comment"));
1954 $logtpl->setVariable(
"generated",
$lng->txt(
"generated"));
1955 $logtpl->setVariable(
"TIMESTAMP",
$timestamp);
1956 $logtpl->setVariable(
"VALUE", $logdata->value);
1957 $logtpl->parseCurrentBlock();
1960 $logtpl->setCurrentBlock(
"ANALYZE");
1961 if (count($logdata->value) == 0) {
1963 $logtpl->setVariable(
"ANALYZE_SUMMARY",
$lng->txt(
"no_missing_API-calls"));
1964 $logtpl->setVariable(
"VALUE",
"");
1966 $tmpvalue =
"SetValue(\"" . implode(
"\", ... ),<br/>SetValue(\"", $logdata->value) .
"\", ... )";
1967 foreach ($ArGetValues as $value) {
1968 $tmpvalue = str_replace(
"SetValue(\"cmi." . $value .
"\", ... )",
"GetValue(\"cmi." . $value .
"\")", $tmpvalue);
1970 $logtpl->setVariable(
"ANALYZE_SUMMARY",
$lng->txt(
"missing_API-calls"));
1971 $logtpl->setVariable(
"VALUE", $tmpvalue);
1973 $logtpl->setVariable(
"summary_for_SCO_without_test",
$lng->txt(
"summary_for_SCO_without_test"));
1974 $logtpl->setVariable(
"generated",
$lng->txt(
"generated"));
1975 $logtpl->setVariable(
"TIMESTAMP",
$timestamp);
1976 $logtpl->setVariable(
"COLOR", $color);
1977 $logtpl->parseCurrentBlock();
1980 $logtpl->setCurrentBlock(
"ANALYZETEST");
1981 if (count($logdata->value) == 0) {
1983 $logtpl->setVariable(
"ANALYZE_SUMMARY",
$lng->txt(
"no_missing_API-calls"));
1984 $logtpl->setVariable(
"VALUE",
"");
1986 $tmpvalue =
"SetValue(\"" . implode(
"\", ... ),<br/>SetValue(\"", $logdata->value) .
"\", ... )";
1987 foreach ($ArGetValues as $value) {
1988 $tmpvalue = str_replace(
"SetValue(\"cmi." . $value .
"\", ... )",
"GetValue(\"cmi." . $value .
"\")", $tmpvalue);
1990 $logtpl->setVariable(
"ANALYZE_SUMMARY",
$lng->txt(
"missing_API-calls"));
1991 $logtpl->setVariable(
"VALUE", $tmpvalue);
1993 $logtpl->setVariable(
"summary_for_SCO_with_test",
$lng->txt(
"summary_for_SCO_with_test"));
1994 $logtpl->setVariable(
"generated",
$lng->txt(
"generated"));
1995 $logtpl->setVariable(
"TIMESTAMP",
$timestamp);
1996 $logtpl->setVariable(
"COLOR", $color);
1997 $logtpl->parseCurrentBlock();
2000 $logtpl->setCurrentBlock(
"SUMMARY");
2001 $logtpl->setVariable(
"summary_csv",
$lng->txt(
"summary_csv"));
2002 $logtpl->setVariable(
"TIMESTAMP",
$timestamp);
2003 $logtpl->setVariable(
"summary_download",
$lng->txt(
"summary_download"));
2004 $logtpl->parseCurrentBlock();
2011 if ($logdata->action ===
'SetValue' || $logdata->action ===
'GetValue') {
2012 $logtpl->setCurrentBlock($logdata->action);
2013 $logtpl->setVariable(
"ACTION", $logdata->action);
2014 $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
2015 $logtpl->setVariable(
"KEY", $logdata->key);
2016 $logtpl->setVariable(
"VALUE", $logdata->value);
2017 $logtpl->setVariable(
"RESULT", $logdata->result);
2018 $logtpl->setVariable(
"ERRORCODE", $errorcode);
2019 $debugfields = $this->getDebugValues(
true);
2021 foreach ($debugfields as $value) {
2022 if ($logdata->key == $value) {
2026 $logtpl->setVariable(
"IMPORTANTKEY",
"" . $importantkey);
2027 $logtpl->setVariable(
"COLOR", $color);
2028 $logtpl->parseCurrentBlock();
2029 } elseif ($logdata->action !==
'INFO' && $logdata->action !==
'ANALYZE' && $logdata->action !==
'ANALYZETEST' && $logdata->action !==
'SUMMARY' && $logdata->action !==
'COMMENT' && $logdata->action !==
'GetDiagnostic' && $logdata->action !==
'GetLastError') {
2030 $logtpl->setCurrentBlock(
"defaultCall");
2031 $logtpl->setVariable(
"ACTION", $logdata->action);
2032 $logtpl->setVariable(
"TIMESPAN", $logdata->timespan);
2033 $logtpl->setVariable(
"KEY", $logdata->key);
2034 $logtpl->setVariable(
"VALUE", $logdata->value);
2035 $logtpl->setVariable(
"RESULT", $logdata->result);
2036 $logtpl->setVariable(
"ERRORCODE", $errorcode);
2037 $logtpl->setVariable(
"IMPORTANTKEY",
"" . $importantkey);
2038 $logtpl->setVariable(
"COLOR", $color);
2039 $logtpl->parseCurrentBlock();
2052 if ($logdata->action ===
"SUMMARY") {
2053 $this->createSummary($tmp_content);
2056 fwrite($fh_txt, $logtpl->get());
2063 foreach (
$data as $i => $value) {
2065 $element[
'title'] = $value[
'title'];
2066 $element[
'id'] = $value[
'id'];
2067 if ($value[
'sco'] == 1) {
2068 $element[
'sco'] =
"sco";
2070 $element[
'sco'] =
"asset";
2072 if ($value[
'href'] !=
null) {
2073 $this->flat_structure[] = $element;
2075 if (isset($value[
'item']) && $value[
'item'] !=
null) {
2076 $this->getStructureFlat($value[
'item']);
2088 $columns_fixed = array(
'id',
'title',
'type',
'attempted');
2090 $ini_data = parse_ini_file(
"./components/ILIAS/Scorm2004/scripts/rtemain/debug_default.ini",
true);
2091 $ini_array = $ini_data[
'summary'];
2092 $colums_variable = array();
2093 $api_keys = array();
2095 foreach ($ini_array as $key => $value) {
2097 $colums_variable[] = $key;
2099 $colums_variable[] =
"Status";
2103 $header_array = array_merge($columns_fixed, $colums_variable);
2105 $csv_header = implode(
";", $header_array);
2109 'SELECT jsdata FROM cp_package WHERE obj_id = %s',
2111 array($this->packageId)
2116 $structure = json_decode($packageData[
'jsdata'],
true);
2119 $this->flat_structure = array();
2121 $this->getStructureFlat(
$structure[
'item'][
'item']);
2123 foreach ($this->flat_structure as $tree_element) {
2124 $csv_data = $csv_data . $tree_element[
'id'] .
";" . $tree_element[
'title'] .
";" . $tree_element[
'sco'] .
";";
2125 if (isset($api_data[$tree_element[
'id']])) {
2126 $csv_data = $csv_data .
"X" .
";";
2128 $csv_data = $csv_data .
";";
2132 $id = $tree_element[
'id'];
2133 foreach ($api_keys as $api_element) {
2134 if (isset($api_data[
$id])) {
2135 if (isset($api_data[
$id][$api_element])) {
2136 $csv_data = $csv_data . $api_data[
$id][$api_element][
'value'] .
";" . $api_data[
$id][$api_element][
'status'] .
";";
2138 $csv_data = $csv_data .
";;";
2142 $csv_data = $csv_data .
"\n";
2145 $fh = fopen($this->summaryFileName(),
"wb");
2146 fwrite($fh, $csv_header .
"\n" . $csv_data);
2148 unlink($this->logTmpName());
2169 if (strtotime(
$a[
'date']) == strtotime(
$b[
'date'])) {
2172 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 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'))