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"));
106 if ($javascriptAPI ==
false) {
107 if (count($items) > 1
108 || strtolower(get_class($this->slm)) ==
"ilobjaicclearningmodule" 109 || strtolower(get_class($this->slm)) ==
"ilobjhacplearningmodule")
111 $this->ctrl->setParameter($this,
"expand",
"1");
112 $exp_link = $this->ctrl->getLinkTarget($this,
"explorer");
113 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset.html",
false,
false,
"Modules/ScormAicc");
114 $this->tpl->setVariable(
"EXPLORER_LINK", $exp_link);
115 $api_link = $this->ctrl->getLinkTarget($this,
"api");
116 $this->tpl->setVariable(
"API_LINK", $api_link);
117 $pres_link = $this->ctrl->getLinkTarget($this,
"view");
118 $this->tpl->setVariable(
"PRESENTATION_LINK", $pres_link);
119 $this->tpl->show(
"DEFAULT",
false);
121 else if (count($items) == 1)
123 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_one_page.html",
false,
false,
"Modules/ScormAicc");
124 $this->ctrl->setParameter($this,
"autolaunch", $items[0]);
125 $api_link = $this->ctrl->getLinkTarget($this,
"api");
126 $this->tpl->setVariable(
"API_LINK", $api_link);
127 $pres_link = $this->ctrl->getLinkTarget($this,
"view");
128 $this->tpl->setVariable(
"PRESENTATION_LINK", $pres_link);
129 $this->tpl->show(
"DEFAULT",
false);
133 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
136 $debug = $this->slm->getDebug();
137 if (count($items) > 1
138 || strtolower(get_class($this->slm)) ==
"ilobjaicclearningmodule" 139 || strtolower(get_class($this->slm)) ==
"ilobjhacplearningmodule")
141 $this->ctrl->setParameter($this,
"expand",
"1");
142 $this->ctrl->setParameter($this,
"jsApi",
"1");
143 $exp_link = $this->ctrl->getLinkTarget($this,
"explorer");
149 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js_debug.html",
false,
false,
"Modules/ScormAicc");
154 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js.html",
false,
false,
"Modules/ScormAicc");
157 $this->tpl->setVariable(
"EXPLORER_LINK", $exp_link);
158 $pres_link = $this->ctrl->getLinkTarget($this,
"contentSelect");
159 $this->tpl->setVariable(
"PRESENTATION_LINK", $pres_link);
165 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js_debug_one_page.html",
false,
false,
"Modules/ScormAicc");
169 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js_one_page.html",
false,
false,
"Modules/ScormAicc");
172 $this->ctrl->setParameter($this,
"autolaunch", $items[0]);
174 $api_link = $this->ctrl->getLinkTarget($this,
"apiInitData");
175 $this->tpl->setVariable(
"API_LINK", $api_link);
176 $this->tpl->show(
"DEFAULT",
false);
187 include_once
"./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
197 $val_set = $ilDB->queryF(
'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
198 array(
'integer',
'integer'),
array($this->slm->getId(),$ilUser->getId()));
199 $val_rec = $ilDB->fetchAssoc($val_set);
200 $attempts = $val_rec[
"package_attempts"];
201 if ($attempts == null) $attempts = 0;
288 $res = $ilDB->queryF(
289 'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
290 array(
'integer',
'integer'),
291 array($this->slm->getId(),$ilUser->getId()));
292 $val_rec = $ilDB->fetchAssoc(
$res);
293 if ($val_rec[
"cnt"] == 0) {
296 'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
297 array(
'integer',
'integer',
'integer',
'integer',
'timestamp'),
298 array($this->slm->getId(), $ilUser->getId(), $attempts, $this->slm->getModuleVersion(),
date(
'Y-m-d H:i:s')));
300 $attempts = $val_rec[
"package_attempts"];
301 if ($attempts == null) $attempts = 0;
304 'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
305 array(
'integer',
'integer',
'timestamp',
'integer',
'integer'),
306 array($attempts, $this->slm->getModuleVersion(),
date(
'Y-m-d H:i:s'), $this->slm->getId(), $ilUser->getId()));
309 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
369 $ilBench->start(
"SCORMExplorer",
"initExplorer");
371 $this->tpl =
new ilTemplate(
"tpl.sahs_exp_main.html",
true,
true,
"Modules/ScormAicc");
373 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
376 $exp->setFrameTarget($a_target);
380 if (
$_GET[
"jsApi"] ==
"1") $jsApi=
true;
382 if (
$_GET[
"scexpand"] ==
"")
389 $expanded =
$_GET[
"scexpand"];
391 $exp->setExpand($expanded);
393 $exp->forceExpandAll(
true,
false);
394 $ilBench->stop(
"SCORMExplorer",
"initExplorer");
397 $ilBench->start(
"SCORMExplorer",
"setOutput");
399 $ilBench->stop(
"SCORMExplorer",
"setOutput");
401 $ilBench->start(
"SCORMExplorer",
"getOutput");
402 $output = $exp->getOutput($jsApi);
403 $ilBench->stop(
"SCORMExplorer",
"getOutput");
406 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.sahs_explorer.html",
"Modules/ScormAicc");
408 $this->tpl->setVariable(
"EXP_REFRESH", $this->lng->txt(
"refresh"));
409 $this->tpl->setVariable(
"EXPLORER",
$output);
410 $this->tpl->setVariable(
"ACTION",
"ilias.php?baseClass=ilSAHSPresentationGUI&cmd=".
$_GET[
"cmd"].
"&frame=".
$_GET[
"frame"].
411 "&ref_id=".$this->slm->getRefId().
"&scexpand=".
$_GET[
"scexpand"]);
412 $this->tpl->parseCurrentBlock();
414 $this->tpl->show(
"DEFAULT",
false);
425 if(is_object($sc_gui_object))
427 $sc_gui_object->view();
431 $this->tpl->show(
false);
436 $this->tpl =
new ilTemplate(
"tpl.scorm_content_select.html",
true,
true,
"Modules/ScormAicc");
438 $this->tpl->setVariable(
'TXT_SPECIALPAGE',$lng->txt(
"seq_toc"));
448 if (
$_GET[
"ref_id"] ==
"") {
449 print (
'alert("no start without ref_id");');
453 header(
'Content-Type: text/javascript; charset=UTF-8');
454 print(
"function iliasApi() {\r\n");
455 $js_data = file_get_contents(
"./Modules/ScormAicc/scripts/basisAPI.js");
457 $js_data = file_get_contents(
"./Modules/ScormAicc/scripts/SCORM1_2standard.js");
461 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php");
475 if ($this->slm->getAPIAdapterName() !=
"API") print(
'var '.$this->slm->getAPIAdapterName().
'=new iliasApi();');
476 else print(
'var API=new iliasApi();');
486 $this->tpl =
new ilTemplate(
"tpl.sahs_api.html",
true,
true,
"Modules/ScormAicc");
489 if (
$_GET[
"autolaunch"] !=
"")
491 $this->tpl->setCurrentBlock(
"auto_launch");
492 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
493 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
495 $id_ref = $sc_object->getIdentifierRef();
499 if ($scormtype ==
"asset")
501 $item_command =
"IliasLaunchAsset";
505 $item_command =
"IliasLaunchSahs";
507 $this->tpl->setVariable(
"AUTO_LAUNCH_ID",
$_GET[
"autolaunch"]);
508 $this->tpl->setVariable(
"AUTO_LAUNCH_CMD",
"this.autoLaunch();");
509 $this->tpl->setVariable(
"AUTO_LAUNCH_ITEM_CMD", $item_command);
510 $this->tpl->parseCurrentBlock();
514 if ($slm_obj->getSession()) {
515 $session_timeout = (int)($ilias->ini->readVariable(
"session",
"expire"))/2;
517 $session_timeout = 0;
519 $this->tpl->setVariable(
"PING_SESSION",$session_timeout);
521 $this->tpl->setVariable(
"USER_ID",$ilias->account->getId());
522 $this->tpl->setVariable(
"USER_FIRSTNAME",$ilias->account->getFirstname());
523 $this->tpl->setVariable(
"USER_LASTNAME",$ilias->account->getLastname());
524 $this->tpl->setVariable(
"USER_LOGIN",$ilias->account->getLogin());
525 $this->tpl->setVariable(
"USER_OU",$ilias->account->getDepartment());
526 $this->tpl->setVariable(
"REF_ID",
$_GET[
"ref_id"]);
527 $this->tpl->setVariable(
"SESSION_ID",session_id());
528 $this->tpl->setVariable(
"CODE_BASE",
"http://".
$_SERVER[
'SERVER_NAME'].substr(
$_SERVER[
'PHP_SELF'], 0, strpos (
$_SERVER[
'PHP_SELF'],
"/ilias.php")));
530 $this->tpl->parseCurrentBlock();
531 $this->tpl->show(
false);
543 $sco_id = (
$_GET[
"sahs_id"] ==
"")
552 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
553 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
556 $id_ref = $item->getIdentifierRef();
558 $resource->readByIdRef($id_ref, $item->getSLMId());
560 $href = $resource->getHref();
561 $this->tpl =
new ilTemplate(
"tpl.sahs_launch_cbt.html",
true,
true,
"Modules/ScormAicc");
562 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output").
"/".$href);
565 $this->tpl->setVariable(
"LAUNCH_DATA", $item->getDataFromLms());
566 $this->tpl->setVariable(
"MAST_SCORE", $item->getMasteryScore());
567 $this->tpl->setVariable(
"MAX_TIME", $item->getMaxTimeAllowed());
568 $this->tpl->setVariable(
"LIMIT_ACT", $item->getTimeLimitAction());
571 if ($this->slm->getAPIAdapterName() !=
"API")
573 $this->tpl->setCurrentBlock(
"alt_api_ref");
574 $this->tpl->setVariable(
"API_NAME", $this->slm->getAPIAdapterName());
575 $this->tpl->parseCurrentBlock();
578 $val_set = $ilDB->queryF(
' 579 SELECT * FROM scorm_tracking 583 array(
'integer',
'integer',
'integer'),
584 array($ilUser->getId(),$sco_id,$this->slm->getId())
587 while($val_rec = $ilDB->fetchAssoc($val_set))
589 $val_rec[
"rvalue"] = str_replace(
"\r\n",
"\n", $val_rec[
"rvalue"]);
590 $val_rec[
"rvalue"] = str_replace(
"\r",
"\n", $val_rec[
"rvalue"]);
591 $val_rec[
"rvalue"] = str_replace(
"\n",
"\\n", $val_rec[
"rvalue"]);
592 $re_value[$val_rec[
"lvalue"]] = $val_rec[
"rvalue"];
595 foreach($re_value as $var => $value)
599 case "cmi.core.lesson_location":
600 case "cmi.core.lesson_status":
601 case "cmi.core.entry":
602 case "cmi.core.score.raw":
603 case "cmi.core.score.max":
604 case "cmi.core.score.min":
605 case "cmi.core.total_time":
606 case "cmi.core.exit":
607 case "cmi.suspend_data":
609 case "cmi.student_preference.audio":
610 case "cmi.student_preference.language":
611 case "cmi.student_preference.speed":
612 case "cmi.student_preference.text":
616 case "cmi.objectives._count":
618 $this->
setArray(
"cmi.objectives", $value,
"id", $re_value);
619 $this->
setArray(
"cmi.objectives", $value,
"score.raw", $re_value);
620 $this->
setArray(
"cmi.objectives", $value,
"score.max", $re_value);
621 $this->
setArray(
"cmi.objectives", $value,
"score.min", $re_value);
622 $this->
setArray(
"cmi.objectives", $value,
"status", $re_value);
625 case "cmi.interactions._count":
627 $this->
setArray(
"cmi.interactions", $value,
"id", $re_value);
628 for($i=0; $i<$value; $i++)
630 $var2 =
"cmi.interactions.".$i.
".objectives._count";
631 if (isset($v_array[$var2]))
633 $cnt = $v_array[$var2];
634 $this->
setArray(
"cmi.interactions.".$i.
".objectives",
635 $cnt,
"id", $re_value);
647 $this->
setArray(
"cmi.interactions", $value,
"time", $re_value);
648 $this->
setArray(
"cmi.interactions", $value,
"type", $re_value);
649 for($i=0; $i<$value; $i++)
651 $var2 =
"cmi.interactions.".$i.
".correct_responses._count";
652 if (isset($v_array[$var2]))
654 $cnt = $v_array[$var2];
655 $this->
setArray(
"cmi.interactions.".$i.
".correct_responses",
656 $cnt,
"pattern", $re_value);
657 $this->
setArray(
"cmi.interactions.".$i.
".correct_responses",
658 $cnt,
"weighting", $re_value);
661 $this->
setArray(
"cmi.interactions", $value,
"student_response", $re_value);
662 $this->
setArray(
"cmi.interactions", $value,
"result", $re_value);
663 $this->
setArray(
"cmi.interactions", $value,
"latency", $re_value);
669 $this->tpl->setCurrentBlock(
"switch_icon");
670 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
672 $this->tpl->setVariable(
"SCO_ALT",
673 $lng->txt(
"cont_status").
": " 674 .$lng->txt(
"cont_sc_stat_running")
676 $this->tpl->parseCurrentBlock();
680 if (count($items) > 1
681 || strtolower(get_class($this->slm)) ==
"ilobjaicclearningmodule" 682 || strtolower(get_class($this->slm)) ==
"ilobjhacplearningmodule")
684 $this->tpl->setVariable(
"SWITCH_ICON_CMD",
"switch_icon();");
689 $lesson_mode = $this->slm->getDefaultLessonMode();
690 if ($this->slm->getAutoReview())
692 if ($re_value[
"cmi.core.lesson_status"] ==
"completed" ||
693 $re_value[
"cmi.core.lesson_status"] ==
"passed" ||
694 $re_value[
"cmi.core.lesson_status"] ==
"failed")
696 $lesson_mode =
"review";
699 $this->tpl->setVariable(
"LESSON_MODE", $lesson_mode);
702 if ($lesson_mode ==
"normal")
704 $this->tpl->setVariable(
"CREDIT_MODE",
705 str_replace(
"_",
"-", $this->slm->getCreditMode()));
709 $this->tpl->setVariable(
"CREDIT_MODE",
"no-credit");
714 if (!isset($re_value[
"cmi.core.total_time"]))
716 $item->insertTrackData(
"cmi.core.total_time",
"0000:00:00", $sahs_obj_id);
718 if (!isset($re_value[
"cmi.core.lesson_status"]))
720 $item->insertTrackData(
"cmi.core.lesson_status",
"not attempted", $sahs_obj_id);
722 if (!isset($re_value[
"cmi.core.entry"]))
724 $item->insertTrackData(
"cmi.core.entry",
"", $sahs_obj_id);
734 $this->tpl =
new ilTemplate(
"tpl.sahs_finish_cbt.html",
true,
true,
"Modules/ScormAicc");
739 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
741 "scorm/".str_replace(
" ",
"_",
$_GET[
"status"]).
'.svg')
743 $this->tpl->setVariable(
"SCO_ALT",
744 $lng->txt(
"cont_status").
": " 745 .$lng->txt(
"cont_sc_stat_".str_replace(
" ",
"_",
$_GET[
"status"])).
", " 746 .$lng->txt(
"cont_total_time").
": " 756 $launch_id =
$_GET[
'launch'];
757 if ($launch_id ==
'null' || $launch_id == null) {
758 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
761 if ($node_data && $node_data[type] ==
'sit')
763 $launch_id = $node_data[
'child'];
767 $this->tpl->setVariable(
"SCO_LAUNCH_ID", $launch_id);
774 $this->tpl =
new ilTemplate(
"tpl.sahs_unload_cbt.html",
true,
true,
"Modules/ScormAicc");
776 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
785 $sco_id = (
$_GET[
"asset_id"] ==
"")
794 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
795 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
798 $id_ref = $item->getIdentifierRef();
800 $resource->readByIdRef($id_ref, $item->getSLMId());
801 $href = $resource->getHref();
802 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output").
"/".$href);
803 $this->tpl =
new ilTemplate(
"tpl.scorm_launch_asset.html",
true,
true,
"Modules/ScormAicc");
804 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output").
"/".$href);
811 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
818 $logString = file_get_contents(
'php://input');
819 $ilLog->write(
"ScormAicc: ApiLog: Message: ".$logString);
824 $logString = file_get_contents(
'php://input');
825 $ilLog->write(
"ScormAicc: ApiLog: Warning: ".$logString,20);
833 $this->tpl->setCurrentBlock(
"set_value");
834 $this->tpl->setVariable(
"VAR", $a_var);
835 $this->tpl->setVariable(
"VALUE", $a_value);
836 $this->tpl->parseCurrentBlock();
842 function setArray($a_left, $a_value, $a_name, &$v_array)
844 for($i=0; $i<$a_value; $i++)
846 $var = $a_left.
".".$i.
".".$a_name;
847 if (isset($v_array[$var]))
849 $this->tpl->setCurrentBlock(
"set_value");
850 $this->tpl->setVariable(
"VAR", $var);
851 $this->tpl->setVariable(
"VALUE", $v_array[$var]);
852 $this->tpl->parseCurrentBlock();
867 include_once
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
870 include_once
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
875 include_once
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
880 include_once
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
891 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
892 include_once
"./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
896 "last_access" => $last_access
902 $parent = $tree->getParentId(
$_GET[
"ref_id"]);
903 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $parent);
904 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
static getIliasScormData($a_packageId)
launchSahs()
This function is called by the API applet in the content frame when a SCO is started.
static _lookupLastAccess($a_obj_id, $a_usr_id)
Return the last access timestamp for a given user.
static getIliasScormResources($a_packageId)
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
setArray($a_left, $a_value, $a_name, &$v_array)
set single value
apiInitData()
SCORM Data for Javascript-API.
get_max_attempts()
Get max.
setTargetGet($a_target_get)
set the varname in Get-string public
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static signFolderOfStartFile($start_file_path, ilWACCookieInterface $ilWACCookieInterface=null)
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
setSingleVariable($a_var, $a_value)
set single value
executeCommand()
execute command
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
static _lookupLastAccess($a_obj_id, $a_usr_id)
Return the last access timestamp for a given user.
static _lookupIdByIdRef($a_id_ref, $a_slm_id)
static _lookupScormType($a_obj_id)
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
static getIliasScormVars($slm_obj)
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
static _lookupPresentableItems($a_slm_id)
Count number of presentable SCOs/Assets of SCORM learning module.
& getInstance($a_id)
get instance of specialized GUI class
static get_max_attempts($a_packageId)
Get max.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
special template class to simplify handling of ITX/PEAR
redirection script todo: (a better solution should control the processing via a xml file) ...
increase_attemptAndsave_module_version()
Increases attempts by one for this package.
Add a drawing to the header
Explorer View for SCORM Learning Modules.
Create styles array
The data for the language used.
Class ilSCORMPresentationGUI.
explorer($a_target="sahs_content")
save the active module version to scorm_tracking
SCORM certificate adapter.
static _lookupFields($a_user_id)
lookup fields (deprecated; use more specific methods instead)
downloadCertificate()
Download the certificate for the active user.
fetchSuccessorNode($a_node_id, $a_type="")
get node data of successor node
frameset()
Output main frameset.
get_actual_attempts()
Get number of actual attempts for the user.
Class ilObjSCORMLearningModule.
attrib2arr(&$a_attributes)
static getIliasScormTree($a_packageId)
view()
SCORM content screen.
static _lookupUserCertificate($obj_id, $usr_id=0)
Checks whether a certificate exists for the active user or not.
readRootId()
read root id from database