5 require_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
6 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMObjectGUI.php");
45 $next_class = $this->ctrl->getNextClass($this);
46 $cmd = $this->ctrl->getCmd(
"frameset");
48 if (!$ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]) &&
49 (!$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]) ||
50 !$this->slm->getOnline()))
52 $ilias->raiseError($lng->txt(
"permission_denied"), $ilias->error_obj->WARNING);
67 if(!is_array($a_attributes))
71 foreach ($a_attributes as $attribute)
73 $attr[$attribute->name()] = $attribute->value();
86 $javascriptAPI =
true;
87 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
93 header(
'Content-Type: text/html; charset=utf-8');
94 echo($lng->txt(
"cont_sc_max_attempt_exceed"));
105 if ($javascriptAPI ==
false) {
106 if (count($items) > 1
107 || strtolower(get_class($this->slm)) ==
"ilobjaicclearningmodule"
108 || strtolower(get_class($this->slm)) ==
"ilobjhacplearningmodule")
110 $this->ctrl->setParameter($this,
"expand",
"1");
111 $exp_link = $this->ctrl->getLinkTarget($this,
"explorer");
112 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset.html",
false,
false,
"Modules/ScormAicc");
113 $this->tpl->setVariable(
"EXPLORER_LINK", $exp_link);
114 $api_link = $this->ctrl->getLinkTarget($this,
"api");
115 $this->tpl->setVariable(
"API_LINK", $api_link);
116 $pres_link = $this->ctrl->getLinkTarget($this,
"view");
117 $this->tpl->setVariable(
"PRESENTATION_LINK", $pres_link);
118 $this->tpl->show(
"DEFAULT",
false);
120 else if (count($items) == 1)
122 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_one_page.html",
false,
false,
"Modules/ScormAicc");
123 $this->ctrl->setParameter($this,
"autolaunch", $items[0]);
124 $api_link = $this->ctrl->getLinkTarget($this,
"api");
125 $this->tpl->setVariable(
"API_LINK", $api_link);
126 $pres_link = $this->ctrl->getLinkTarget($this,
"view");
127 $this->tpl->setVariable(
"PRESENTATION_LINK", $pres_link);
128 $this->tpl->show(
"DEFAULT",
false);
131 $debug = $this->slm->getDebug();
132 if (count($items) > 1
133 || strtolower(get_class($this->slm)) ==
"ilobjaicclearningmodule"
134 || strtolower(get_class($this->slm)) ==
"ilobjhacplearningmodule")
136 $this->ctrl->setParameter($this,
"expand",
"1");
137 $this->ctrl->setParameter($this,
"jsApi",
"1");
138 $exp_link = $this->ctrl->getLinkTarget($this,
"explorer");
143 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js_debug.html",
false,
false,
"Modules/ScormAicc");
147 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js.html",
false,
false,
"Modules/ScormAicc");
150 $this->tpl->setVariable(
"EXPLORER_LINK", $exp_link);
151 $pres_link = $this->ctrl->getLinkTarget($this,
"contentSelect");
152 $this->tpl->setVariable(
"PRESENTATION_LINK", $pres_link);
158 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js_debug_one_page.html",
false,
false,
"Modules/ScormAicc");
162 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js_one_page.html",
false,
false,
"Modules/ScormAicc");
165 $this->ctrl->setParameter($this,
"autolaunch", $items[0]);
167 $api_link = $this->ctrl->getLinkTarget($this,
"apiInitData");
168 $this->tpl->setVariable(
"API_LINK", $api_link);
169 $this->tpl->show(
"DEFAULT",
false);
183 $val_set = $ilDB->queryF(
'SELECT * FROM sahs_lm WHERE id = %s',
184 array(
'integer'), array($this->slm->getId()));
185 $val_rec = $ilDB->fetchAssoc($val_set);
187 return $val_rec[
"max_attempt"];
196 $val_set = $ilDB->queryF(
'
197 SELECT * FROM scorm_tracking
202 array(
'integer',
'integer',
'text',
'integer'),
203 array($ilUser->getId(),0,
'package_attempts',$this->slm->getId())
205 $val_rec = $ilDB->fetchAssoc($val_set);
207 $val_rec[
"rvalue"] = str_replace(
"\r\n",
"\n", $val_rec[
"rvalue"]);
208 if ($val_rec[
"rvalue"] == null) {
209 $val_rec[
"rvalue"]=0;
212 return $val_rec[
"rvalue"];
222 $val_set = $ilDB->queryF(
'
223 SELECT * FROM scorm_tracking
228 array(
'integer',
'integer',
'text',
'integer'),
229 array($ilUser->getId(),0,
'package_attempts',$this->slm->getId())
232 $val_rec = $ilDB->fetchAssoc($val_set);
234 $val_rec[
"rvalue"] = str_replace(
"\r\n",
"\n", $val_rec[
"rvalue"]);
235 if ($val_rec[
"rvalue"] == null) {
236 $val_rec[
"rvalue"]=0;
238 $new_rec = $val_rec[
"rvalue"]+1;
240 if($ilDB->numRows($val_set) > 0)
242 $ilDB->update(
'scorm_tracking',
244 'rvalue' => array(
'clob', $new_rec),
248 'user_id' => array(
'integer', $ilUser->getId()),
249 'sco_id' => array(
'integer', 0),
250 'lvalue' => array(
'text',
'package_attempts'),
251 'obj_id' => array(
'integer', $this->slm->getId())
257 $ilDB->insert(
'scorm_tracking', array(
258 'obj_id' => array(
'integer', $this->slm->getId()),
259 'user_id' => array(
'integer', $ilUser->getId()),
260 'sco_id' => array(
'integer', 0),
261 'lvalue' => array(
'text',
'package_attempts'),
262 'rvalue' => array(
'clob', $new_rec),
267 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
278 $val_set = $ilDB->queryF(
'
279 SELECT * FROM scorm_tracking
284 array(
'integer',
'integer',
'text',
'integer'),
285 array($ilUser->getId(),0,
'module_version',$this->slm->getId())
289 if($ilDB->numRows($val_set) > 0)
291 $ilDB->update(
'scorm_tracking',
293 'rvalue' => array(
'clob', $this->slm->getModuleVersion()),
297 'user_id' => array(
'integer', $ilUser->getId()),
298 'sco_id' => array(
'integer', 0),
299 'lvalue' => array(
'text',
'module_version'),
300 'obj_id' => array(
'integer', $this->slm->getId())
306 $ilDB->insert(
'scorm_tracking', array(
307 'obj_id' => array(
'integer', $this->slm->getId()),
308 'user_id' => array(
'integer', $ilUser->getId()),
309 'sco_id' => array(
'integer', 0),
310 'lvalue' => array(
'text',
'module_version'),
311 'rvalue' => array(
'clob', $this->slm->getModuleVersion()),
316 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
328 $ilBench->start(
"SCORMExplorer",
"initExplorer");
330 $this->tpl =
new ilTemplate(
"tpl.sahs_exp_main.html",
true,
true,
"Modules/ScormAicc");
332 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
335 $exp->setFrameTarget($a_target);
339 if (
$_GET[
"jsApi"] ==
"1") $jsApi=
true;
341 if (
$_GET[
"scexpand"] ==
"")
348 $expanded =
$_GET[
"scexpand"];
350 $exp->setExpand($expanded);
352 $exp->forceExpandAll(
true,
false);
353 $ilBench->stop(
"SCORMExplorer",
"initExplorer");
356 $ilBench->start(
"SCORMExplorer",
"setOutput");
358 $ilBench->stop(
"SCORMExplorer",
"setOutput");
360 $ilBench->start(
"SCORMExplorer",
"getOutput");
361 $output = $exp->getOutput($jsApi);
362 $ilBench->stop(
"SCORMExplorer",
"getOutput");
365 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.sahs_explorer.html",
"Modules/ScormAicc");
367 $this->tpl->setVariable(
"EXP_REFRESH", $this->lng->txt(
"refresh"));
368 $this->tpl->setVariable(
"EXPLORER",$output);
369 $this->tpl->setVariable(
"ACTION",
"ilias.php?baseClass=ilSAHSPresentationGUI&cmd=".
$_GET[
"cmd"].
"&frame=".
$_GET[
"frame"].
370 "&ref_id=".$this->slm->getRefId().
"&scexpand=".
$_GET[
"scexpand"]);
371 $this->tpl->parseCurrentBlock();
383 if(is_object($sc_gui_object))
385 $sc_gui_object->view();
389 $this->tpl->show(
false);
394 $this->tpl =
new ilTemplate(
"tpl.scorm_content_select.html",
true,
true,
"Modules/ScormAicc");
396 $this->tpl->setVariable(
'TXT_SPECIALPAGE',$lng->txt(
"seq_toc"));
406 function encodeURIComponent($str) {
407 $revert = array(
'%21'=>
'!',
'%2A'=>
'*',
'%27'=>
"'",
'%28'=>
'(',
'%29'=>
')',
'%7E'=>
'~');
408 return strtr(rawurlencode($str), $revert);
411 if (
$_GET[
"ref_id"] ==
"") {
412 print (
'alert("no start without ref_id");');
417 header(
'Content-Type: text/javascript; charset=UTF-8');
418 print(
"function iliasApi() {\r\n");
419 $js_data = file_get_contents(
"./Modules/ScormAicc/scripts/basisAPI.js");
421 $js_data = file_get_contents(
"./Modules/ScormAicc/scripts/SCORM1_2standard.js");
426 $b_storeObjectives=
'true';
427 $b_storeInteractions=
'true';
428 $b_readInteractions=
'false';
429 $c_storeSessionTime=
's';
430 $i_lessonScoreMax=
'-1';
431 $i_lessonMasteryScore=
'-1';
434 $b_messageLog=
'false';
435 if ($ilLog->current_log_level == 30) $b_messageLog=
'true';
437 if (
$_GET[
"autolaunch"] !=
"") $launchId=
$_GET[
"autolaunch"];
438 $session_timeout = 0;
439 if ($slm_obj->getSession()) {
440 $session_timeout = (int)($ilias->ini->readVariable(
"session",
"expire"))/2;
442 $b_autoReview=
'false';
443 if ($this->slm->getAutoReview()) $b_autoReview=
'true';
445 if ($this->slm->getDebug()) $b_debug=
'true';
446 $b_autoContinue=
'false';
447 if ($this->slm->getAutoContinue()) $b_autoContinue=
'true';
448 $b_checkSetValues=
'false';
449 if ($this->slm->getCheck_values()) $b_checkSetValues=
'true';
450 $b_autoLastVisited=
'false';
451 if ($this->slm->getAuto_last_visited()) {
452 $b_autoLastVisited=
'true';
453 if ($launchId ==
'0') $launchId=$slm_obj->getLastVisited($ilUser->getID());
456 $s_out=
'IliasScormVars={'
457 .
'refId:'.
$_GET[
"ref_id"].
','
458 .
'objId:'.$this->slm->getId().
','
459 .
'launchId:'.$launchId.
','
461 .
'pingSession:'. $session_timeout.
','
462 .
'studentId:'.$ilias->account->getId().
','
463 .
'studentName:"'.encodeURIComponent($ilias->account->getLastname().
', '.$ilias->account->getFirstname()).
'",'
464 .
'studentLogin:"'.encodeURIComponent($ilias->account->getLogin()).
'",'
465 .
'studentOu:"'.encodeURIComponent($ilias->account->getDepartment()).
'",'
466 .
'credit:"'.str_replace(
"_",
"-", $this->slm->getCreditMode()).
'",'
467 .
'lesson_mode:"'.$this->slm->getDefaultLessonMode().
'",'
468 .
'b_autoReview:'.$b_autoReview.
','
469 .
'b_messageLog:'.$b_messageLog.
','
470 .
'b_checkSetValues:'.$b_checkSetValues.
','
471 .
'b_storeObjectives:'.$b_storeObjectives.
','
472 .
'b_storeInteractions:'.$b_storeInteractions.
','
473 .
'b_readInteractions:'.$b_readInteractions.
','
474 .
'c_storeSessionTime:"'.$c_storeSessionTime.
'",'
475 .
'b_autoContinue:'.$b_autoContinue.
','
476 .
'b_autoLastVisited:'.$b_autoLastVisited.
','
477 .
'i_lessonScoreMax:'.$i_lessonScoreMax.
','
478 .
'i_lessonMasteryScore:'.$i_lessonMasteryScore.
','
479 .
'b_debug:'.$b_debug.
','
480 .
'dataDirectory:"'.encodeURIComponent($this->slm->getDataDirectory(
"output").
'/').
'",'
492 .
'wait:"'.encodeURIComponent($lng->txt(
"please_wait")).
'",'
493 .
'status:"'.encodeURIComponent($lng->txt(
"cont_status")).
'",'
494 .
'browsed:"'.encodeURIComponent($lng->txt(
"cont_sc_stat_browsed")).
'",'
495 .
'completed:"'.encodeURIComponent($lng->txt(
"cont_sc_stat_completed")).
'",'
496 .
'failed:"'.encodeURIComponent($lng->txt(
"cont_sc_stat_failed")).
'",'
497 .
'incomplete:"'.encodeURIComponent($lng->txt(
"cont_sc_stat_incomplete")).
'",'
498 .
'not_attempted:"'.encodeURIComponent($lng->txt(
"cont_sc_stat_not_attempted")).
'",'
499 .
'passed:"'.encodeURIComponent($lng->txt(
"cont_sc_stat_passed")).
'",'
500 .
'running:"'.encodeURIComponent($lng->txt(
"cont_sc_stat_running")).
'"'
505 print($s_out.
"\r\n");
507 $s_out =
'IliasScormData=[';
508 $tquery =
'SELECT sco_id,lvalue,rvalue FROM scorm_tracking '
509 .
'WHERE user_id = %s AND obj_id = %s '
510 .
"AND sco_id > 0 AND lvalue != 'cmi.core.entry' AND lvalue != 'cmi.core.session_time'";
511 if ($b_readInteractions ==
'false') $tquery.=
" AND SUBSTR(lvalue, 1, 16) != 'cmi.interactions'";
512 $val_set = $ilDB->queryF($tquery,
513 array(
'integer',
'integer'),
514 array($ilUser->getId(),$this->slm->getId())
516 while($val_rec = $ilDB->fetchAssoc($val_set)) {
517 if (!strpos($val_rec[
"lvalue"],
"._count"))
518 $s_out.=
'['.$val_rec[
"sco_id"].
',"'.$val_rec[
"lvalue"].
'","'.encodeURIComponent($val_rec[
"rvalue"]).
'"],';
521 $val_set = $ilDB->queryF(
'
522 SELECT sc_item.obj_id,maxtimeallowed,timelimitaction,datafromlms,masteryscore
523 FROM sc_item, scorm_object
524 WHERE scorm_object.obj_id=sc_item.obj_id
525 AND scorm_object.c_type = %s
526 AND scorm_object.slm_id = %s',
527 array(
'text',
'integer'),
528 array(
'sit',$this->slm->getId())
530 while($val_rec = $ilDB->fetchAssoc($val_set)) {
531 if($val_rec[
"maxtimeallowed"]!=null)
532 $s_out.=
'['.$val_rec[
"obj_id"].
',"cmi.student_data.max_time_allowed","'.encodeURIComponent($val_rec[
"maxtimeallowed"]).
'"],';
533 if($val_rec[
"timelimitaction"]!=null)
534 $s_out.=
'['.$val_rec[
"obj_id"].
',"cmi.student_data.time_limit_action","'.encodeURIComponent($val_rec[
"timelimitaction"]).
'"],';
535 if($val_rec[
"datafromlms"]!=null)
536 $s_out.=
'['.$val_rec[
"obj_id"].
',"cmi.launch_data","'.encodeURIComponent($val_rec[
"datafromlms"]).
'"],';
537 if($val_rec[
"masteryscore"]!=null)
538 $s_out.=
'['.$val_rec[
"obj_id"].
',"cmi.student_data.mastery_score","'.encodeURIComponent($val_rec[
"masteryscore"]).
'"],';
540 if(substr($s_out,(strlen($s_out)-1))==
",") $s_out=substr($s_out,0,(strlen($s_out)-1));
542 print($s_out.
"\r\n");
545 $s_out=
'IliasScormResources=[';
547 $val_set = $ilDB->queryF(
"
548 SELECT sc_resource.obj_id
549 FROM scorm_tree, sc_resource
550 WHERE scorm_tree.slm_id=%s
551 AND sc_resource.obj_id=scorm_tree.child",
553 array($this->slm->getId())
555 while($val_rec = $ilDB->fetchAssoc($val_set)) {
556 $s_resourceIds .=
",".$val_rec[
"obj_id"];
558 $s_resourceIds = substr($s_resourceIds,1);
560 $tquery=
"SELECT scorm_tree.lft, scorm_tree.child,
561 CASE WHEN sc_resource.scormtype = 'asset' THEN 1 ELSE 0 END AS asset,
563 FROM scorm_tree, sc_resource, sc_item
564 WHERE scorm_tree.slm_id=%s
565 AND sc_item.obj_id=scorm_tree.child
566 AND sc_resource.import_id=sc_item.identifierref
567 AND sc_resource.obj_id in (".$s_resourceIds.
")
568 ORDER BY scorm_tree.lft";
569 $val_set = $ilDB->queryF($tquery,
571 array($this->slm->getId())
573 while($val_rec = $ilDB->fetchAssoc($val_set)) {
574 $s_out.=
'['.$val_rec[
"lft"].
','.$val_rec[
"child"].
','.$val_rec[
"asset"].
',"'.encodeURIComponent($val_rec[
"href"]).
'"],';
576 if(substr($s_out,(strlen($s_out)-1))==
",") $s_out=substr($s_out,0,(strlen($s_out)-1));
579 if ($this->slm->getAPIAdapterName() !=
"API") $s_out.=
'var '.$this->slm->getAPIAdapterName().
'=new iliasApi();';
580 else $s_out.=
'var API=new iliasApi();';
593 $this->tpl =
new ilTemplate(
"tpl.sahs_api.html",
true,
true,
"Modules/ScormAicc");
596 if (
$_GET[
"autolaunch"] !=
"")
598 $this->tpl->setCurrentBlock(
"auto_launch");
599 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
600 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
602 $id_ref = $sc_object->getIdentifierRef();
606 if ($scormtype ==
"asset")
608 $item_command =
"IliasLaunchAsset";
612 $item_command =
"IliasLaunchSahs";
614 $this->tpl->setVariable(
"AUTO_LAUNCH_ID",
$_GET[
"autolaunch"]);
615 $this->tpl->setVariable(
"AUTO_LAUNCH_CMD",
"this.autoLaunch();");
616 $this->tpl->setVariable(
"AUTO_LAUNCH_ITEM_CMD", $item_command);
617 $this->tpl->parseCurrentBlock();
621 if ($slm_obj->getSession()) {
622 $session_timeout = (int)($ilias->ini->readVariable(
"session",
"expire"))/2;
624 $session_timeout = 0;
626 $this->tpl->setVariable(
"PING_SESSION",$session_timeout);
628 $this->tpl->setVariable(
"USER_ID",$ilias->account->getId());
629 $this->tpl->setVariable(
"USER_FIRSTNAME",$ilias->account->getFirstname());
630 $this->tpl->setVariable(
"USER_LASTNAME",$ilias->account->getLastname());
631 $this->tpl->setVariable(
"USER_LOGIN",$ilias->account->getLogin());
632 $this->tpl->setVariable(
"USER_OU",$ilias->account->getDepartment());
633 $this->tpl->setVariable(
"REF_ID",
$_GET[
"ref_id"]);
634 $this->tpl->setVariable(
"SESSION_ID",session_id());
635 $this->tpl->setVariable(
"CODE_BASE",
"http://".$_SERVER[
'SERVER_NAME'].substr($_SERVER[
'PHP_SELF'], 0, strpos ($_SERVER[
'PHP_SELF'],
"/ilias.php")));
637 $this->tpl->parseCurrentBlock();
638 $this->tpl->show(
false);
650 $sco_id = (
$_GET[
"sahs_id"] ==
"")
659 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
660 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
663 $id_ref = $item->getIdentifierRef();
665 $resource->readByIdRef($id_ref, $item->getSLMId());
667 $href = $resource->getHref();
668 $this->tpl =
new ilTemplate(
"tpl.sahs_launch_cbt.html",
true,
true,
"Modules/ScormAicc");
669 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output").
"/".$href);
672 $this->tpl->setVariable(
"LAUNCH_DATA", $item->getDataFromLms());
673 $this->tpl->setVariable(
"MAST_SCORE", $item->getMasteryScore());
674 $this->tpl->setVariable(
"MAX_TIME", $item->getMaxTimeAllowed());
675 $this->tpl->setVariable(
"LIMIT_ACT", $item->getTimeLimitAction());
678 if ($this->slm->getAPIAdapterName() !=
"API")
680 $this->tpl->setCurrentBlock(
"alt_api_ref");
681 $this->tpl->setVariable(
"API_NAME", $this->slm->getAPIAdapterName());
682 $this->tpl->parseCurrentBlock();
685 $val_set = $ilDB->queryF(
'
686 SELECT * FROM scorm_tracking
690 array(
'integer',
'integer',
'integer'),
691 array($ilUser->getId(),$sco_id,$this->slm->getId())
694 while($val_rec = $ilDB->fetchAssoc($val_set))
696 $val_rec[
"rvalue"] = str_replace(
"\r\n",
"\n", $val_rec[
"rvalue"]);
697 $val_rec[
"rvalue"] = str_replace(
"\r",
"\n", $val_rec[
"rvalue"]);
698 $val_rec[
"rvalue"] = str_replace(
"\n",
"\\n", $val_rec[
"rvalue"]);
699 $re_value[$val_rec[
"lvalue"]] = $val_rec[
"rvalue"];
702 foreach($re_value as $var => $value)
706 case "cmi.core.lesson_location":
707 case "cmi.core.lesson_status":
708 case "cmi.core.entry":
709 case "cmi.core.score.raw":
710 case "cmi.core.score.max":
711 case "cmi.core.score.min":
712 case "cmi.core.total_time":
713 case "cmi.core.exit":
714 case "cmi.suspend_data":
716 case "cmi.student_preference.audio":
717 case "cmi.student_preference.language":
718 case "cmi.student_preference.speed":
719 case "cmi.student_preference.text":
723 case "cmi.objectives._count":
725 $this->
setArray(
"cmi.objectives", $value,
"id", $re_value);
726 $this->
setArray(
"cmi.objectives", $value,
"score.raw", $re_value);
727 $this->
setArray(
"cmi.objectives", $value,
"score.max", $re_value);
728 $this->
setArray(
"cmi.objectives", $value,
"score.min", $re_value);
729 $this->
setArray(
"cmi.objectives", $value,
"status", $re_value);
732 case "cmi.interactions._count":
734 $this->
setArray(
"cmi.interactions", $value,
"id", $re_value);
735 for($i=0; $i<$value; $i++)
737 $var2 =
"cmi.interactions.".$i.
".objectives._count";
738 if (isset($v_array[$var2]))
740 $cnt = $v_array[$var2];
741 $this->
setArray(
"cmi.interactions.".$i.
".objectives",
742 $cnt,
"id", $re_value);
754 $this->
setArray(
"cmi.interactions", $value,
"time", $re_value);
755 $this->
setArray(
"cmi.interactions", $value,
"type", $re_value);
756 for($i=0; $i<$value; $i++)
758 $var2 =
"cmi.interactions.".$i.
".correct_responses._count";
759 if (isset($v_array[$var2]))
761 $cnt = $v_array[$var2];
762 $this->
setArray(
"cmi.interactions.".$i.
".correct_responses",
763 $cnt,
"pattern", $re_value);
764 $this->
setArray(
"cmi.interactions.".$i.
".correct_responses",
765 $cnt,
"weighting", $re_value);
768 $this->
setArray(
"cmi.interactions", $value,
"student_response", $re_value);
769 $this->
setArray(
"cmi.interactions", $value,
"result", $re_value);
770 $this->
setArray(
"cmi.interactions", $value,
"latency", $re_value);
776 $this->tpl->setCurrentBlock(
"switch_icon");
777 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
779 $this->tpl->setVariable(
"SCO_ALT",
780 $lng->txt(
"cont_status").
": "
781 .$lng->txt(
"cont_sc_stat_running")
783 $this->tpl->parseCurrentBlock();
787 if (count($items) > 1
788 || strtolower(get_class($this->slm)) ==
"ilobjaicclearningmodule"
789 || strtolower(get_class($this->slm)) ==
"ilobjhacplearningmodule")
791 $this->tpl->setVariable(
"SWITCH_ICON_CMD",
"switch_icon();");
796 $lesson_mode = $this->slm->getDefaultLessonMode();
797 if ($this->slm->getAutoReview())
799 if ($re_value[
"cmi.core.lesson_status"] ==
"completed" ||
800 $re_value[
"cmi.core.lesson_status"] ==
"passed" ||
801 $re_value[
"cmi.core.lesson_status"] ==
"failed")
803 $lesson_mode =
"review";
806 $this->tpl->setVariable(
"LESSON_MODE", $lesson_mode);
809 if ($lesson_mode ==
"normal")
811 $this->tpl->setVariable(
"CREDIT_MODE",
812 str_replace(
"_",
"-", $this->slm->getCreditMode()));
816 $this->tpl->setVariable(
"CREDIT_MODE",
"no-credit");
821 if (!isset($re_value[
"cmi.core.total_time"]))
823 $item->insertTrackData(
"cmi.core.total_time",
"0000:00:00", $sahs_obj_id);
825 if (!isset($re_value[
"cmi.core.lesson_status"]))
827 $item->insertTrackData(
"cmi.core.lesson_status",
"not attempted", $sahs_obj_id);
829 if (!isset($re_value[
"cmi.core.entry"]))
831 $item->insertTrackData(
"cmi.core.entry",
"", $sahs_obj_id);
841 $this->tpl =
new ilTemplate(
"tpl.sahs_finish_cbt.html",
true,
true,
"Modules/ScormAicc");
846 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
848 "scorm/".str_replace(
" ",
"_",
$_GET[
"status"]).
'.png')
850 $this->tpl->setVariable(
"SCO_ALT",
851 $lng->txt(
"cont_status").
": "
852 .$lng->txt(
"cont_sc_stat_".str_replace(
" ",
"_",
$_GET[
"status"])).
", "
853 .$lng->txt(
"cont_total_time").
": "
863 $launch_id =
$_GET[
'launch'];
864 if ($launch_id ==
'null' || $launch_id == null) {
865 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
868 if ($node_data && $node_data[type] ==
'sit')
870 $launch_id = $node_data[
'child'];
874 $this->tpl->setVariable(
"SCO_LAUNCH_ID", $launch_id);
881 $this->tpl =
new ilTemplate(
"tpl.sahs_unload_cbt.html",
true,
true,
"Modules/ScormAicc");
883 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
892 $sco_id = (
$_GET[
"asset_id"] ==
"")
901 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
902 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
905 $id_ref = $item->getIdentifierRef();
907 $resource->readByIdRef($id_ref, $item->getSLMId());
908 $href = $resource->getHref();
909 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output").
"/".$href);
910 $this->tpl =
new ilTemplate(
"tpl.scorm_launch_asset.html",
true,
true,
"Modules/ScormAicc");
911 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output").
"/".$href);
922 $logString = file_get_contents(
'php://input');
923 $ilLog->write(
"ScormAicc: ApiLog: Message: ".$logString);
928 $logString = file_get_contents(
'php://input');
929 $ilLog->write(
"ScormAicc: ApiLog: Warning: ".$logString,20);
937 $this->tpl->setCurrentBlock(
"set_value");
938 $this->tpl->setVariable(
"VAR", $a_var);
939 $this->tpl->setVariable(
"VALUE", $a_value);
940 $this->tpl->parseCurrentBlock();
946 function setArray($a_left, $a_value, $a_name, &$v_array)
948 for($i=0; $i<$a_value; $i++)
950 $var = $a_left.
".".$i.
".".$a_name;
951 if (isset($v_array[$var]))
953 $this->tpl->setCurrentBlock(
"set_value");
954 $this->tpl->setVariable(
"VAR", $var);
955 $this->tpl->setVariable(
"VALUE", $v_array[$var]);
956 $this->tpl->parseCurrentBlock();
971 include_once
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
974 include_once
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
979 include_once
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
984 include_once
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
995 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
996 include_once
"./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
1000 "last_access" => $last_access
1002 $certificate->outCertificate($params,
true);
1006 $parent = $tree->getParentId(
$_GET[
"ref_id"]);
1007 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $parent);
1008 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");