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())) {
51 $ilias->raiseError($lng->txt(
"permission_denied"), $ilias->error_obj->WARNING);
54 switch ($next_class) {
65 if (!is_array($a_attributes)) {
68 foreach ($a_attributes as $attribute) {
69 $attr[$attribute->name()] = $attribute->value();
83 $javascriptAPI =
true;
84 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
90 header(
'Content-Type: text/html; charset=utf-8');
91 echo($lng->txt(
"cont_sc_max_attempt_exceed"));
99 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
102 $debug = $this->slm->getDebug();
103 if (count($items) > 1) {
104 $this->ctrl->setParameter($this,
"expand",
"1");
105 $this->ctrl->setParameter($this,
"jsApi",
"1");
106 $exp_link = $this->ctrl->getLinkTarget($this,
"explorer");
110 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js_debug.html",
false,
false,
"Modules/ScormAicc");
112 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js.html",
false,
false,
"Modules/ScormAicc");
115 $this->tpl->setVariable(
"EXPLORER_LINK", $exp_link);
116 $pres_link = $this->ctrl->getLinkTarget($this,
"contentSelect");
117 $this->tpl->setVariable(
"PRESENTATION_LINK", $pres_link);
120 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js_debug_one_page.html",
false,
false,
"Modules/ScormAicc");
122 $this->tpl =
new ilTemplate(
"tpl.sahs_pres_frameset_js_one_page.html",
false,
false,
"Modules/ScormAicc");
125 $this->ctrl->setParameter($this,
"autolaunch", $items[0]);
127 $api_link = $this->ctrl->getLinkTarget($this,
"apiInitData");
128 $this->tpl->setVariable(
"API_LINK", $api_link);
129 $this->tpl->show(
"DEFAULT",
false);
140 include_once
"./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
150 $val_set = $ilDB->queryF(
151 'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
152 array(
'integer',
'integer'),
153 array($this->slm->getId(),$ilUser->getId())
155 $val_rec = $ilDB->fetchAssoc($val_set);
156 $attempts = $val_rec[
"package_attempts"];
157 if ($attempts == null) {
246 $res = $ilDB->queryF(
247 'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
248 array(
'integer',
'integer'),
249 array($this->slm->getId(),$ilUser->getId())
251 $val_rec = $ilDB->fetchAssoc(
$res);
252 if ($val_rec[
"cnt"] == 0) {
255 'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
256 array(
'integer',
'integer',
'integer',
'integer',
'timestamp'),
257 array($this->slm->getId(), $ilUser->getId(), $attempts, $this->slm->getModuleVersion(),
date(
'Y-m-d H:i:s'))
260 $attempts = $val_rec[
"package_attempts"];
261 if ($attempts == null) {
266 'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
267 array(
'integer',
'integer',
'timestamp',
'integer',
'integer'),
268 array($attempts, $this->slm->getModuleVersion(),
date(
'Y-m-d H:i:s'), $this->slm->getId(), $ilUser->getId())
272 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
328 public function explorer($a_target =
"sahs_content")
332 $ilBench->start(
"SCORMExplorer",
"initExplorer");
334 $this->tpl =
new ilTemplate(
"tpl.sahs_exp_main.html",
true,
true,
"Modules/ScormAicc");
336 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
339 $exp->setFrameTarget($a_target);
343 if (
$_GET[
"jsApi"] ==
"1") {
347 if (
$_GET[
"scexpand"] ==
"") {
351 $expanded =
$_GET[
"scexpand"];
353 $exp->setExpand($expanded);
355 $exp->forceExpandAll(
true,
false);
356 $ilBench->stop(
"SCORMExplorer",
"initExplorer");
359 $ilBench->start(
"SCORMExplorer",
"setOutput");
361 $ilBench->stop(
"SCORMExplorer",
"setOutput");
363 $ilBench->start(
"SCORMExplorer",
"getOutput");
364 $output = $exp->getOutput($jsApi);
365 $ilBench->stop(
"SCORMExplorer",
"getOutput");
368 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.sahs_explorer.html",
"Modules/ScormAicc");
370 $this->tpl->setVariable(
"EXP_REFRESH", $this->lng->txt(
"refresh"));
371 $this->tpl->setVariable(
"EXPLORER",
$output);
372 $this->tpl->setVariable(
"ACTION",
"ilias.php?baseClass=ilSAHSPresentationGUI&cmd=" .
$_GET[
"cmd"] .
"&frame=" .
$_GET[
"frame"] .
373 "&ref_id=" . $this->slm->getRefId() .
"&scexpand=" .
$_GET[
"scexpand"]);
374 $this->tpl->parseCurrentBlock();
376 $this->tpl->show(
"DEFAULT",
false);
387 if (is_object($sc_gui_object)) {
388 $sc_gui_object->view();
392 $this->tpl->show(
false);
398 $this->tpl =
new ilTemplate(
"tpl.scorm_content_select.html",
true,
true,
"Modules/ScormAicc");
400 $this->tpl->setVariable(
'TXT_SPECIALPAGE', $lng->txt(
"seq_toc"));
411 if (
$_GET[
"ref_id"] ==
"") {
412 print(
'alert("no start without ref_id");');
416 header(
'Content-Type: text/javascript; charset=UTF-8');
417 print(
"function iliasApi() {\r\n");
418 $js_data = file_get_contents(
"./Modules/ScormAicc/scripts/basisAPI.js");
420 $js_data = file_get_contents(
"./Modules/ScormAicc/scripts/SCORM1_2standard.js");
424 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php");
438 if ($this->slm->getAPIAdapterName() !=
"API") {
439 print(
'var ' . $this->slm->getAPIAdapterName() .
'=new iliasApi();');
441 print(
'var API=new iliasApi();');
452 $this->tpl =
new ilTemplate(
"tpl.sahs_api.html",
true,
true,
"Modules/ScormAicc");
455 if (
$_GET[
"autolaunch"] !=
"") {
456 $this->tpl->setCurrentBlock(
"auto_launch");
457 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
458 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
460 $id_ref = $sc_object->getIdentifierRef();
464 if ($scormtype ==
"asset") {
465 $item_command =
"IliasLaunchAsset";
467 $item_command =
"IliasLaunchSahs";
469 $this->tpl->setVariable(
"AUTO_LAUNCH_ID",
$_GET[
"autolaunch"]);
470 $this->tpl->setVariable(
"AUTO_LAUNCH_CMD",
"this.autoLaunch();");
471 $this->tpl->setVariable(
"AUTO_LAUNCH_ITEM_CMD", $item_command);
472 $this->tpl->parseCurrentBlock();
476 if ($slm_obj->getSession()) {
477 $session_timeout = (int) ($ilias->ini->readVariable(
"session",
"expire"))/2;
479 $session_timeout = 0;
481 $this->tpl->setVariable(
"PING_SESSION", $session_timeout);
483 $this->tpl->setVariable(
"USER_ID", $ilias->account->getId());
484 $this->tpl->setVariable(
"USER_FIRSTNAME", $ilias->account->getFirstname());
485 $this->tpl->setVariable(
"USER_LASTNAME", $ilias->account->getLastname());
486 $this->tpl->setVariable(
"USER_LOGIN", $ilias->account->getLogin());
487 $this->tpl->setVariable(
"USER_OU", $ilias->account->getDepartment());
488 $this->tpl->setVariable(
"REF_ID",
$_GET[
"ref_id"]);
489 $this->tpl->setVariable(
"SESSION_ID", session_id());
490 $this->tpl->setVariable(
"CODE_BASE",
"http://" .
$_SERVER[
'SERVER_NAME'] . substr(
$_SERVER[
'PHP_SELF'], 0, strpos(
$_SERVER[
'PHP_SELF'],
"/ilias.php")));
492 $this->tpl->parseCurrentBlock();
493 $this->tpl->show(
false);
505 $sco_id = (
$_GET[
"sahs_id"] ==
"")
508 $ref_id = (
$_GET[
"ref_id"] ==
"")
514 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
515 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
518 $id_ref = $item->getIdentifierRef();
520 $resource->readByIdRef($id_ref, $item->getSLMId());
522 $href = $resource->getHref();
523 $this->tpl =
new ilTemplate(
"tpl.sahs_launch_cbt.html",
true,
true,
"Modules/ScormAicc");
524 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output") .
"/" . $href);
527 $this->tpl->setVariable(
"LAUNCH_DATA", $item->getDataFromLms());
528 $this->tpl->setVariable(
"MAST_SCORE", $item->getMasteryScore());
529 $this->tpl->setVariable(
"MAX_TIME", $item->getMaxTimeAllowed());
530 $this->tpl->setVariable(
"LIMIT_ACT", $item->getTimeLimitAction());
533 if ($this->slm->getAPIAdapterName() !=
"API") {
534 $this->tpl->setCurrentBlock(
"alt_api_ref");
535 $this->tpl->setVariable(
"API_NAME", $this->slm->getAPIAdapterName());
536 $this->tpl->parseCurrentBlock();
539 $val_set = $ilDB->queryF(
541 SELECT * FROM scorm_tracking 545 array(
'integer',
'integer',
'integer'),
546 array($ilUser->getId(),$sco_id,$this->slm->getId())
549 while ($val_rec = $ilDB->fetchAssoc($val_set)) {
550 $val_rec[
"rvalue"] = str_replace(
"\r\n",
"\n", $val_rec[
"rvalue"]);
551 $val_rec[
"rvalue"] = str_replace(
"\r",
"\n", $val_rec[
"rvalue"]);
552 $val_rec[
"rvalue"] = str_replace(
"\n",
"\\n", $val_rec[
"rvalue"]);
553 $re_value[$val_rec[
"lvalue"]] = $val_rec[
"rvalue"];
556 foreach ($re_value as $var => $value) {
558 case "cmi.core.lesson_location":
559 case "cmi.core.lesson_status":
560 case "cmi.core.entry":
561 case "cmi.core.score.raw":
562 case "cmi.core.score.max":
563 case "cmi.core.score.min":
564 case "cmi.core.total_time":
565 case "cmi.core.exit":
566 case "cmi.suspend_data":
568 case "cmi.student_preference.audio":
569 case "cmi.student_preference.language":
570 case "cmi.student_preference.speed":
571 case "cmi.student_preference.text":
575 case "cmi.objectives._count":
577 $this->
setArray(
"cmi.objectives", $value,
"id", $re_value);
578 $this->
setArray(
"cmi.objectives", $value,
"score.raw", $re_value);
579 $this->
setArray(
"cmi.objectives", $value,
"score.max", $re_value);
580 $this->
setArray(
"cmi.objectives", $value,
"score.min", $re_value);
581 $this->
setArray(
"cmi.objectives", $value,
"status", $re_value);
584 case "cmi.interactions._count":
586 $this->
setArray(
"cmi.interactions", $value,
"id", $re_value);
587 for (
$i=0;
$i<$value;
$i++) {
588 $var2 =
"cmi.interactions." .
$i .
".objectives._count";
589 if (isset($v_array[$var2])) {
590 $cnt = $v_array[$var2];
592 "cmi.interactions." .
$i .
".objectives",
608 $this->
setArray(
"cmi.interactions", $value,
"time", $re_value);
609 $this->
setArray(
"cmi.interactions", $value,
"type", $re_value);
610 for (
$i=0;
$i<$value;
$i++) {
611 $var2 =
"cmi.interactions." .
$i .
".correct_responses._count";
612 if (isset($v_array[$var2])) {
613 $cnt = $v_array[$var2];
615 "cmi.interactions." .
$i .
".correct_responses",
621 "cmi.interactions." .
$i .
".correct_responses",
628 $this->
setArray(
"cmi.interactions", $value,
"student_response", $re_value);
629 $this->
setArray(
"cmi.interactions", $value,
"result", $re_value);
630 $this->
setArray(
"cmi.interactions", $value,
"latency", $re_value);
636 $this->tpl->setCurrentBlock(
"switch_icon");
637 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
639 $this->tpl->setVariable(
641 $lng->txt(
"cont_status") .
": " 642 . $lng->txt(
"cont_sc_stat_running")
644 $this->tpl->parseCurrentBlock();
648 if (count($items) > 1) {
649 $this->tpl->setVariable(
"SWITCH_ICON_CMD",
"switch_icon();");
654 $lesson_mode = $this->slm->getDefaultLessonMode();
655 if ($this->slm->getAutoReview()) {
656 if ($re_value[
"cmi.core.lesson_status"] ==
"completed" ||
657 $re_value[
"cmi.core.lesson_status"] ==
"passed" ||
658 $re_value[
"cmi.core.lesson_status"] ==
"failed") {
659 $lesson_mode =
"review";
662 $this->tpl->setVariable(
"LESSON_MODE", $lesson_mode);
665 if ($lesson_mode ==
"normal") {
666 $this->tpl->setVariable(
668 str_replace(
"_",
"-", $this->slm->getCreditMode())
671 $this->tpl->setVariable(
"CREDIT_MODE",
"no-credit");
676 if (!isset($re_value[
"cmi.core.total_time"])) {
677 $item->insertTrackData(
"cmi.core.total_time",
"0000:00:00", $sahs_obj_id);
679 if (!isset($re_value[
"cmi.core.lesson_status"])) {
680 $item->insertTrackData(
"cmi.core.lesson_status",
"not attempted", $sahs_obj_id);
682 if (!isset($re_value[
"cmi.core.entry"])) {
683 $item->insertTrackData(
"cmi.core.entry",
"", $sahs_obj_id);
693 $this->tpl =
new ilTemplate(
"tpl.sahs_finish_cbt.html",
true,
true,
"Modules/ScormAicc");
698 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
699 $this->tpl->setVariable(
702 "scorm/" . str_replace(
" ",
"_",
$_GET[
"status"]) .
'.svg' 705 $this->tpl->setVariable(
707 $lng->txt(
"cont_status") .
": " 708 . $lng->txt(
"cont_sc_stat_" . str_replace(
" ",
"_",
$_GET[
"status"])) .
", " 709 . $lng->txt(
"cont_total_time") .
": " 719 $launch_id =
$_GET[
'launch'];
720 if ($launch_id ==
'null' || $launch_id == null) {
721 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
724 if ($node_data && $node_data[type] ==
'sit') {
725 $launch_id = $node_data[
'child'];
729 $this->tpl->setVariable(
"SCO_LAUNCH_ID", $launch_id);
736 $this->tpl =
new ilTemplate(
"tpl.sahs_unload_cbt.html",
true,
true,
"Modules/ScormAicc");
738 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
747 $sco_id = (
$_GET[
"asset_id"] ==
"")
750 $ref_id = (
$_GET[
"ref_id"] ==
"")
756 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
757 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
760 $id_ref = $item->getIdentifierRef();
762 $resource->readByIdRef($id_ref, $item->getSLMId());
763 $href = $resource->getHref();
764 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output") .
"/" . $href);
765 $this->tpl =
new ilTemplate(
"tpl.scorm_launch_asset.html",
true,
true,
"Modules/ScormAicc");
766 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output") .
"/" . $href);
773 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
781 $logString = file_get_contents(
'php://input');
782 $ilLog->write(
"ScormAicc: ApiLog: Message: " . $logString);
788 $logString = file_get_contents(
'php://input');
789 $ilLog->write(
"ScormAicc: ApiLog: Warning: " . $logString, 20);
797 $this->tpl->setCurrentBlock(
"set_value");
798 $this->tpl->setVariable(
"VAR", $a_var);
799 $this->tpl->setVariable(
"VALUE", $a_value);
800 $this->tpl->parseCurrentBlock();
806 public function setArray($a_left, $a_value, $a_name, &$v_array)
808 for (
$i=0;
$i<$a_value;
$i++) {
809 $var = $a_left .
"." .
$i .
"." . $a_name;
810 if (isset($v_array[$var])) {
811 $this->tpl->setCurrentBlock(
"set_value");
812 $this->tpl->setVariable(
"VAR", $var);
813 $this->tpl->setVariable(
"VALUE", $v_array[$var]);
814 $this->tpl->parseCurrentBlock();
829 include_once
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
831 include_once
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
835 include_once
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
840 include_once
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
850 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
851 include_once
"./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
855 "last_access" => $last_access
861 $parent = $tree->getParentId(
$_GET[
"ref_id"]);
862 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $parent);
863 $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 _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, )
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 signFolderOfStartFile($start_file_path)
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
foreach($_POST as $key=> $value) $res
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