5 require_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
6 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMObjectGUI.php");
31 $ilCtrl = $DIC[
'ilCtrl'];
36 $this->ctrl = $ilCtrl;
38 $this->lng->loadLanguageModule(
'cert');
50 $ilAccess = $DIC[
'ilAccess'];
51 $ilLog = $DIC[
'ilLog'];
55 $next_class = $this->ctrl->getNextClass($this);
56 $cmd = $this->ctrl->getCmd(
"frameset");
58 if (!$ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]) &&
59 (!$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]) ||
60 $this->slm->getOfflineStatus())) {
61 $ilias->raiseError(
$lng->txt(
"permission_denied"),
$ilias->error_obj->WARNING);
64 switch ($next_class) {
75 if (!is_array($a_attributes)) {
78 foreach ($a_attributes as $attribute) {
79 $attr[$attribute->name()] = $attribute->value();
94 $javascriptAPI =
true;
95 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
101 header(
'Content-Type: text/html; charset=utf-8');
102 echo(
$lng->txt(
"cont_sc_max_attempt_exceed"));
110 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
113 $debug = $this->slm->getDebug();
114 if (count($items) > 1) {
115 $this->ctrl->setParameter($this,
"expand",
"1");
116 $this->ctrl->setParameter($this,
"jsApi",
"1");
117 $exp_link = $this->ctrl->getLinkTarget($this,
"explorer");
121 $this->tpl =
new ilGlobalTemplate(
"tpl.sahs_pres_frameset_js_debug.html",
false,
false,
"Modules/ScormAicc");
123 $this->tpl =
new ilGlobalTemplate(
"tpl.sahs_pres_frameset_js.html",
false,
false,
"Modules/ScormAicc");
126 $this->tpl->setVariable(
"EXPLORER_LINK", $exp_link);
127 $pres_link = $this->ctrl->getLinkTarget($this,
"contentSelect");
128 $this->tpl->setVariable(
"PRESENTATION_LINK", $pres_link);
131 $this->tpl =
new ilGlobalTemplate(
"tpl.sahs_pres_frameset_js_debug_one_page.html",
false,
false,
"Modules/ScormAicc");
133 $this->tpl =
new ilGlobalTemplate(
"tpl.sahs_pres_frameset_js_one_page.html",
false,
false,
"Modules/ScormAicc");
136 $this->ctrl->setParameter($this,
"autolaunch", $items[0]);
138 $api_link = $this->ctrl->getLinkTarget($this,
"apiInitData");
139 $this->tpl->setVariable(
"TITLE", $this->slm->getTitle());
140 $this->tpl->setVariable(
"API_LINK", $api_link);
141 $this->tpl->printToStdout(
"DEFAULT",
false);
152 include_once
"./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
162 $ilDB = $DIC[
'ilDB'];
164 $val_set =
$ilDB->queryF(
165 'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
166 array(
'integer',
'integer'),
167 array($this->slm->getId(),
$ilUser->getId())
169 $val_rec =
$ilDB->fetchAssoc($val_set);
170 $attempts = $val_rec[
"package_attempts"];
171 if ($attempts == null) {
264 $ilDB = $DIC[
'ilDB'];
267 'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
268 array(
'integer',
'integer'),
269 array($this->slm->getId(),
$ilUser->getId())
272 if ($val_rec[
"cnt"] == 0) {
275 'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
276 array(
'integer',
'integer',
'integer',
'integer',
'timestamp'),
277 array($this->slm->getId(),
$ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date(
'Y-m-d H:i:s'))
280 $attempts = $val_rec[
"package_attempts"];
281 if ($attempts == null) {
286 'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
287 array(
'integer',
'integer',
'timestamp',
'integer',
'integer'),
288 array($attempts, $this->slm->getModuleVersion(), date(
'Y-m-d H:i:s'), $this->slm->getId(),
$ilUser->getId())
292 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
350 public function explorer($a_target =
"sahs_content")
354 $ilLog = $DIC[
'ilLog'];
356 $ilBench->start(
"SCORMExplorer",
"initExplorer");
358 $this->tpl =
new ilGlobalTemplate(
"tpl.sahs_exp_main.html",
true,
true,
"Modules/ScormAicc");
360 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
363 $exp->setFrameTarget($a_target);
367 if (
$_GET[
"jsApi"] ==
"1") {
371 if (
$_GET[
"scexpand"] ==
"") {
375 $expanded =
$_GET[
"scexpand"];
377 $exp->setExpand($expanded);
379 $exp->forceExpandAll(
true,
false);
380 $ilBench->stop(
"SCORMExplorer",
"initExplorer");
383 $ilBench->start(
"SCORMExplorer",
"setOutput");
385 $ilBench->stop(
"SCORMExplorer",
"setOutput");
387 $ilBench->start(
"SCORMExplorer",
"getOutput");
388 $output = $exp->getOutput($jsApi);
389 $ilBench->stop(
"SCORMExplorer",
"getOutput");
392 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.sahs_explorer.html",
"Modules/ScormAicc");
394 $this->tpl->setVariable(
"EXP_REFRESH", $this->lng->txt(
"refresh"));
395 $this->tpl->setVariable(
"EXPLORER", $output);
396 $this->tpl->setVariable(
"ACTION",
"ilias.php?baseClass=ilSAHSPresentationGUI&cmd=" .
$_GET[
"cmd"] .
"&frame=" .
$_GET[
"frame"] .
397 "&ref_id=" . $this->slm->getRefId() .
"&scexpand=" .
$_GET[
"scexpand"]);
398 $this->tpl->parseCurrentBlock();
400 $this->tpl->printToStdout(
"DEFAULT",
false);
411 if (is_object($sc_gui_object)) {
412 $sc_gui_object->view();
416 $this->tpl->printToStdout(
false);
423 $this->tpl =
new ilGlobalTemplate(
"tpl.scorm_content_select.html",
true,
true,
"Modules/ScormAicc");
425 $this->tpl->setVariable(
'TXT_SPECIALPAGE',
$lng->txt(
"seq_toc"));
426 $this->tpl->printToStdout();
441 if (
$_GET[
"ref_id"] ==
"") {
442 print(
'alert("no start without ref_id");');
446 header(
'Content-Type: text/javascript; charset=UTF-8');
447 print(
"function iliasApi() {\r\n");
448 $js_data = file_get_contents(
"./Modules/ScormAicc/scripts/basisAPI.js");
450 $js_data = file_get_contents(
"./Modules/ScormAicc/scripts/SCORM1_2standard.js");
454 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php");
468 if ($this->slm->getAPIAdapterName() !=
"API") {
469 print(
'var ' . $this->slm->getAPIAdapterName() .
'=new iliasApi();');
471 print(
'var API=new iliasApi();');
483 $this->tpl =
new ilGlobalTemplate(
"tpl.sahs_api.html",
true,
true,
"Modules/ScormAicc");
486 if (
$_GET[
"autolaunch"] !=
"") {
487 $this->tpl->setCurrentBlock(
"auto_launch");
488 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
489 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
491 $id_ref = $sc_object->getIdentifierRef();
495 if ($scormtype ==
"asset") {
496 $item_command =
"IliasLaunchAsset";
498 $item_command =
"IliasLaunchSahs";
500 $this->tpl->setVariable(
"AUTO_LAUNCH_ID",
$_GET[
"autolaunch"]);
501 $this->tpl->setVariable(
"AUTO_LAUNCH_CMD",
"this.autoLaunch();");
502 $this->tpl->setVariable(
"AUTO_LAUNCH_ITEM_CMD", $item_command);
503 $this->tpl->parseCurrentBlock();
507 if ($slm_obj->getSession()) {
508 $session_timeout = (int) (
$ilias->ini->readVariable(
"session",
"expire")) / 2;
510 $session_timeout = 0;
512 $this->tpl->setVariable(
"PING_SESSION", $session_timeout);
514 $this->tpl->setVariable(
"USER_ID",
$ilias->account->getId());
515 $this->tpl->setVariable(
"USER_FIRSTNAME",
$ilias->account->getFirstname());
516 $this->tpl->setVariable(
"USER_LASTNAME",
$ilias->account->getLastname());
517 $this->tpl->setVariable(
"USER_LOGIN",
$ilias->account->getLogin());
518 $this->tpl->setVariable(
"USER_OU",
$ilias->account->getDepartment());
519 $this->tpl->setVariable(
"REF_ID",
$_GET[
"ref_id"]);
520 $this->tpl->setVariable(
"SESSION_ID", session_id());
521 $this->tpl->setVariable(
"CODE_BASE",
"http://" .
$_SERVER[
'SERVER_NAME'] . substr(
$_SERVER[
'PHP_SELF'], 0, strpos(
$_SERVER[
'PHP_SELF'],
"/ilias.php")));
523 $this->tpl->parseCurrentBlock();
524 $this->tpl->printToStdout(
false);
536 $ilDB = $DIC[
'ilDB'];
538 $sco_id = (
$_GET[
"sahs_id"] ==
"")
541 $ref_id = (
$_GET[
"ref_id"] ==
"")
547 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
548 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
551 $id_ref = $item->getIdentifierRef();
553 $resource->readByIdRef($id_ref, $item->getSLMId());
555 $href = $resource->getHref();
556 $this->tpl =
new ilGlobalTemplate(
"tpl.sahs_launch_cbt.html",
true,
true,
"Modules/ScormAicc");
557 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output") .
"/" . $href);
560 $this->tpl->setVariable(
"LAUNCH_DATA", $item->getDataFromLms());
561 $this->tpl->setVariable(
"MAST_SCORE", $item->getMasteryScore());
562 $this->tpl->setVariable(
"MAX_TIME", $item->getMaxTimeAllowed());
563 $this->tpl->setVariable(
"LIMIT_ACT", $item->getTimeLimitAction());
566 if ($this->slm->getAPIAdapterName() !=
"API") {
567 $this->tpl->setCurrentBlock(
"alt_api_ref");
568 $this->tpl->setVariable(
"API_NAME", $this->slm->getAPIAdapterName());
569 $this->tpl->parseCurrentBlock();
572 $val_set =
$ilDB->queryF(
574 SELECT * FROM scorm_tracking 578 array(
'integer',
'integer',
'integer'),
579 array(
$ilUser->getId(),$sco_id,$this->slm->getId())
582 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
583 $val_rec[
"rvalue"] = str_replace(
"\r\n",
"\n", $val_rec[
"rvalue"]);
584 $val_rec[
"rvalue"] = str_replace(
"\r",
"\n", $val_rec[
"rvalue"]);
585 $val_rec[
"rvalue"] = str_replace(
"\n",
"\\n", $val_rec[
"rvalue"]);
586 $re_value[$val_rec[
"lvalue"]] = $val_rec[
"rvalue"];
589 foreach ($re_value as $var => $value) {
591 case "cmi.core.lesson_location":
592 case "cmi.core.lesson_status":
593 case "cmi.core.entry":
594 case "cmi.core.score.raw":
595 case "cmi.core.score.max":
596 case "cmi.core.score.min":
597 case "cmi.core.total_time":
598 case "cmi.core.exit":
599 case "cmi.suspend_data":
601 case "cmi.student_preference.audio":
602 case "cmi.student_preference.language":
603 case "cmi.student_preference.speed":
604 case "cmi.student_preference.text":
608 case "cmi.objectives._count":
610 $this->
setArray(
"cmi.objectives", $value,
"id", $re_value);
611 $this->
setArray(
"cmi.objectives", $value,
"score.raw", $re_value);
612 $this->
setArray(
"cmi.objectives", $value,
"score.max", $re_value);
613 $this->
setArray(
"cmi.objectives", $value,
"score.min", $re_value);
614 $this->
setArray(
"cmi.objectives", $value,
"status", $re_value);
617 case "cmi.interactions._count":
619 $this->
setArray(
"cmi.interactions", $value,
"id", $re_value);
620 for (
$i = 0;
$i < $value;
$i++) {
621 $var2 =
"cmi.interactions." .
$i .
".objectives._count";
622 if (isset($v_array[$var2])) {
623 $cnt = $v_array[$var2];
625 "cmi.interactions." .
$i .
".objectives",
641 $this->
setArray(
"cmi.interactions", $value,
"time", $re_value);
642 $this->
setArray(
"cmi.interactions", $value,
"type", $re_value);
643 for (
$i = 0;
$i < $value;
$i++) {
644 $var2 =
"cmi.interactions." .
$i .
".correct_responses._count";
645 if (isset($v_array[$var2])) {
646 $cnt = $v_array[$var2];
648 "cmi.interactions." .
$i .
".correct_responses",
654 "cmi.interactions." .
$i .
".correct_responses",
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);
670 $this->tpl->setCurrentBlock(
"switch_icon");
671 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
673 $this->tpl->setVariable(
675 $lng->txt(
"cont_status") .
": " 676 .
$lng->txt(
"cont_sc_stat_running")
678 $this->tpl->parseCurrentBlock();
682 if (count($items) > 1) {
683 $this->tpl->setVariable(
"SWITCH_ICON_CMD",
"switch_icon();");
688 $lesson_mode = $this->slm->getDefaultLessonMode();
689 if ($this->slm->getAutoReview()) {
690 if ($re_value[
"cmi.core.lesson_status"] ==
"completed" ||
691 $re_value[
"cmi.core.lesson_status"] ==
"passed" ||
692 $re_value[
"cmi.core.lesson_status"] ==
"failed") {
693 $lesson_mode =
"review";
696 $this->tpl->setVariable(
"LESSON_MODE", $lesson_mode);
699 if ($lesson_mode ==
"normal") {
700 $this->tpl->setVariable(
702 str_replace(
"_",
"-", $this->slm->getCreditMode())
705 $this->tpl->setVariable(
"CREDIT_MODE",
"no-credit");
710 if (!isset($re_value[
"cmi.core.total_time"])) {
711 $item->insertTrackData(
"cmi.core.total_time",
"0000:00:00", $sahs_obj_id);
713 if (!isset($re_value[
"cmi.core.lesson_status"])) {
714 $item->insertTrackData(
"cmi.core.lesson_status",
"not attempted", $sahs_obj_id);
716 if (!isset($re_value[
"cmi.core.entry"])) {
717 $item->insertTrackData(
"cmi.core.entry",
"", $sahs_obj_id);
720 $this->tpl->printToStdout();
728 $this->tpl =
new ilGlobalTemplate(
"tpl.sahs_finish_cbt.html",
true,
true,
"Modules/ScormAicc");
733 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
734 $this->tpl->setVariable(
737 "scorm/" . str_replace(
" ",
"_",
$_GET[
"status"]) .
'.svg' 740 $this->tpl->setVariable(
742 $lng->txt(
"cont_status") .
": " 743 .
$lng->txt(
"cont_sc_stat_" . str_replace(
" ",
"_",
$_GET[
"status"])) .
", " 744 .
$lng->txt(
"cont_total_time") .
": " 754 $launch_id =
$_GET[
'launch'];
755 if ($launch_id ==
'null' || $launch_id == null) {
756 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
759 if ($node_data && $node_data[type] ==
'sit') {
760 $launch_id = $node_data[
'child'];
764 $this->tpl->setVariable(
"SCO_LAUNCH_ID", $launch_id);
766 $this->tpl->printToStdout();
771 $this->tpl =
new ilGlobalTemplate(
"tpl.sahs_unload_cbt.html",
true,
true,
"Modules/ScormAicc");
773 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
774 $this->tpl->printToStdout();
782 $ilDB = $DIC[
'ilDB'];
784 $sco_id = (
$_GET[
"asset_id"] ==
"")
787 $ref_id = (
$_GET[
"ref_id"] ==
"")
793 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
794 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
797 $id_ref = $item->getIdentifierRef();
799 $resource->readByIdRef($id_ref, $item->getSLMId());
800 $href = $resource->getHref();
801 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output") .
"/" . $href);
802 $this->tpl =
new ilGlobalTemplate(
"tpl.scorm_launch_asset.html",
true,
true,
"Modules/ScormAicc");
803 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output") .
"/" . $href);
804 $this->tpl->printToStdout();
810 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
818 $ilLog = $DIC[
'ilLog'];
819 $logString = file_get_contents(
'php://input');
820 $ilLog->write(
"ScormAicc: ApiLog: Message: " . $logString);
826 $ilLog = $DIC[
'ilLog'];
827 $logString = file_get_contents(
'php://input');
828 $ilLog->write(
"ScormAicc: ApiLog: Warning: " . $logString, 20);
836 $this->tpl->setCurrentBlock(
"set_value");
837 $this->tpl->setVariable(
"VAR", $a_var);
838 $this->tpl->setVariable(
"VALUE", $a_value);
839 $this->tpl->parseCurrentBlock();
845 public function setArray($a_left, $a_value, $a_name, &$v_array)
847 for (
$i = 0;
$i < $a_value;
$i++) {
848 $var = $a_left .
"." .
$i .
"." . $a_name;
849 if (isset($v_array[$var])) {
850 $this->tpl->setCurrentBlock(
"set_value");
851 $this->tpl->setVariable(
"VAR", $var);
852 $this->tpl->setVariable(
"VALUE", $v_array[$var]);
853 $this->tpl->parseCurrentBlock();
866 $tree = $DIC[
'tree'];
867 $ilCtrl = $DIC->ctrl();
872 $allowed = $certValidator->isCertificateDownloadable(
$ilUser->getId(), $obj_id);
874 $certificateLogger = $DIC->logger()->cert();
877 $pdfGenerator =
new ilPdfGenerator($ilUserCertificateRepository, $certificateLogger);
883 $this->lng->txt(
'error_creating_certificate_pdf')
890 $parent = $tree->getParentId(
$_GET[
"ref_id"]);
891 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $parent);
892 $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.
Class ilPdfGeneratorConstantsTest.
static getIliasScormResources($a_packageId)
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
special template class to simplify handling of ITX/PEAR
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 _lookupIdByIdRef($a_id_ref, $a_slm_id)
static _lookupScormType($a_obj_id)
static signFolderOfStartFile($start_file_path)
static getIliasScormVars($slm_obj)
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)
Validates if an active certificate is stored in the database and can be downloaded by the user...
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.
Explorer View for SCORM Learning Modules.
Just a wrapper class to create Unit Test for other classes.
Class ilSCORMPresentationGUI.
explorer($a_target="sahs_content")
save the active module version to scorm_tracking
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.
downloadPdf(int $userId, int $objectId)
readRootId()
read root id from database