5 require_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
6 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMObjectGUI.php");
38 $this->lng->loadLanguageModule(
'cert');
50 $ilAccess = $DIC[
'ilAccess'];
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 ilTemplate(
"tpl.sahs_pres_frameset_js_debug.html",
false,
false,
"Modules/ScormAicc");
123 $this->tpl =
new ilTemplate(
"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 ilTemplate(
"tpl.sahs_pres_frameset_js_debug_one_page.html",
false,
false,
"Modules/ScormAicc");
133 $this->tpl =
new ilTemplate(
"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(
"API_LINK", $api_link);
140 $this->tpl->show(
"DEFAULT",
false);
151 include_once
"./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
161 $ilDB = $DIC[
'ilDB'];
163 $val_set =
$ilDB->queryF(
164 'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
165 array(
'integer',
'integer'),
166 array($this->slm->getId(),
$ilUser->getId())
168 $val_rec =
$ilDB->fetchAssoc($val_set);
169 $attempts = $val_rec[
"package_attempts"];
170 if ($attempts == null) {
263 $ilDB = $DIC[
'ilDB'];
266 'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
267 array(
'integer',
'integer'),
268 array($this->slm->getId(),
$ilUser->getId())
271 if ($val_rec[
"cnt"] == 0) {
274 'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
275 array(
'integer',
'integer',
'integer',
'integer',
'timestamp'),
276 array($this->slm->getId(),
$ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date(
'Y-m-d H:i:s'))
279 $attempts = $val_rec[
"package_attempts"];
280 if ($attempts == null) {
285 'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
286 array(
'integer',
'integer',
'timestamp',
'integer',
'integer'),
287 array($attempts, $this->slm->getModuleVersion(), date(
'Y-m-d H:i:s'), $this->slm->getId(),
$ilUser->getId())
291 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
349 public function explorer($a_target =
"sahs_content")
355 $ilBench->start(
"SCORMExplorer",
"initExplorer");
357 $this->tpl =
new ilTemplate(
"tpl.sahs_exp_main.html",
true,
true,
"Modules/ScormAicc");
359 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
362 $exp->setFrameTarget($a_target);
366 if (
$_GET[
"jsApi"] ==
"1") {
370 if (
$_GET[
"scexpand"] ==
"") {
374 $expanded =
$_GET[
"scexpand"];
376 $exp->setExpand($expanded);
378 $exp->forceExpandAll(
true,
false);
379 $ilBench->stop(
"SCORMExplorer",
"initExplorer");
382 $ilBench->start(
"SCORMExplorer",
"setOutput");
384 $ilBench->stop(
"SCORMExplorer",
"setOutput");
386 $ilBench->start(
"SCORMExplorer",
"getOutput");
387 $output = $exp->getOutput($jsApi);
388 $ilBench->stop(
"SCORMExplorer",
"getOutput");
391 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.sahs_explorer.html",
"Modules/ScormAicc");
393 $this->tpl->setVariable(
"EXP_REFRESH", $this->lng->txt(
"refresh"));
394 $this->tpl->setVariable(
"EXPLORER",
$output);
395 $this->tpl->setVariable(
"ACTION",
"ilias.php?baseClass=ilSAHSPresentationGUI&cmd=" .
$_GET[
"cmd"] .
"&frame=" .
$_GET[
"frame"] .
396 "&ref_id=" . $this->slm->getRefId() .
"&scexpand=" .
$_GET[
"scexpand"]);
397 $this->tpl->parseCurrentBlock();
399 $this->tpl->show(
"DEFAULT",
false);
410 if (is_object($sc_gui_object)) {
411 $sc_gui_object->view();
415 $this->tpl->show(
false);
422 $this->tpl =
new ilTemplate(
"tpl.scorm_content_select.html",
true,
true,
"Modules/ScormAicc");
424 $this->tpl->setVariable(
'TXT_SPECIALPAGE',
$lng->txt(
"seq_toc"));
440 if (
$_GET[
"ref_id"] ==
"") {
441 print(
'alert("no start without ref_id");');
445 header(
'Content-Type: text/javascript; charset=UTF-8');
446 print(
"function iliasApi() {\r\n");
447 $js_data = file_get_contents(
"./Modules/ScormAicc/scripts/basisAPI.js");
449 $js_data = file_get_contents(
"./Modules/ScormAicc/scripts/SCORM1_2standard.js");
453 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php");
467 if ($this->slm->getAPIAdapterName() !=
"API") {
468 print(
'var ' . $this->slm->getAPIAdapterName() .
'=new iliasApi();');
470 print(
'var API=new iliasApi();');
482 $this->tpl =
new ilTemplate(
"tpl.sahs_api.html",
true,
true,
"Modules/ScormAicc");
485 if (
$_GET[
"autolaunch"] !=
"") {
486 $this->tpl->setCurrentBlock(
"auto_launch");
487 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
488 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
490 $id_ref = $sc_object->getIdentifierRef();
494 if ($scormtype ==
"asset") {
495 $item_command =
"IliasLaunchAsset";
497 $item_command =
"IliasLaunchSahs";
499 $this->tpl->setVariable(
"AUTO_LAUNCH_ID",
$_GET[
"autolaunch"]);
500 $this->tpl->setVariable(
"AUTO_LAUNCH_CMD",
"this.autoLaunch();");
501 $this->tpl->setVariable(
"AUTO_LAUNCH_ITEM_CMD", $item_command);
502 $this->tpl->parseCurrentBlock();
506 if ($slm_obj->getSession()) {
507 $session_timeout = (int) (
$ilias->ini->readVariable(
"session",
"expire")) / 2;
509 $session_timeout = 0;
511 $this->tpl->setVariable(
"PING_SESSION", $session_timeout);
513 $this->tpl->setVariable(
"USER_ID",
$ilias->account->getId());
514 $this->tpl->setVariable(
"USER_FIRSTNAME",
$ilias->account->getFirstname());
515 $this->tpl->setVariable(
"USER_LASTNAME",
$ilias->account->getLastname());
516 $this->tpl->setVariable(
"USER_LOGIN",
$ilias->account->getLogin());
517 $this->tpl->setVariable(
"USER_OU",
$ilias->account->getDepartment());
518 $this->tpl->setVariable(
"REF_ID",
$_GET[
"ref_id"]);
519 $this->tpl->setVariable(
"SESSION_ID", session_id());
520 $this->tpl->setVariable(
"CODE_BASE",
"http://" .
$_SERVER[
'SERVER_NAME'] . substr(
$_SERVER[
'PHP_SELF'], 0, strpos(
$_SERVER[
'PHP_SELF'],
"/ilias.php")));
522 $this->tpl->parseCurrentBlock();
523 $this->tpl->show(
false);
535 $ilDB = $DIC[
'ilDB'];
537 $sco_id = (
$_GET[
"sahs_id"] ==
"")
540 $ref_id = (
$_GET[
"ref_id"] ==
"")
546 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
547 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
550 $id_ref = $item->getIdentifierRef();
552 $resource->readByIdRef($id_ref, $item->getSLMId());
554 $href = $resource->getHref();
555 $this->tpl =
new ilTemplate(
"tpl.sahs_launch_cbt.html",
true,
true,
"Modules/ScormAicc");
556 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output") .
"/" . $href);
559 $this->tpl->setVariable(
"LAUNCH_DATA", $item->getDataFromLms());
560 $this->tpl->setVariable(
"MAST_SCORE", $item->getMasteryScore());
561 $this->tpl->setVariable(
"MAX_TIME", $item->getMaxTimeAllowed());
562 $this->tpl->setVariable(
"LIMIT_ACT", $item->getTimeLimitAction());
565 if ($this->slm->getAPIAdapterName() !=
"API") {
566 $this->tpl->setCurrentBlock(
"alt_api_ref");
567 $this->tpl->setVariable(
"API_NAME", $this->slm->getAPIAdapterName());
568 $this->tpl->parseCurrentBlock();
571 $val_set =
$ilDB->queryF(
573 SELECT * FROM scorm_tracking 577 array(
'integer',
'integer',
'integer'),
578 array(
$ilUser->getId(),$sco_id,$this->slm->getId())
581 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
582 $val_rec[
"rvalue"] = str_replace(
"\r\n",
"\n", $val_rec[
"rvalue"]);
583 $val_rec[
"rvalue"] = str_replace(
"\r",
"\n", $val_rec[
"rvalue"]);
584 $val_rec[
"rvalue"] = str_replace(
"\n",
"\\n", $val_rec[
"rvalue"]);
585 $re_value[$val_rec[
"lvalue"]] = $val_rec[
"rvalue"];
588 foreach ($re_value as $var => $value) {
590 case "cmi.core.lesson_location":
591 case "cmi.core.lesson_status":
592 case "cmi.core.entry":
593 case "cmi.core.score.raw":
594 case "cmi.core.score.max":
595 case "cmi.core.score.min":
596 case "cmi.core.total_time":
597 case "cmi.core.exit":
598 case "cmi.suspend_data":
600 case "cmi.student_preference.audio":
601 case "cmi.student_preference.language":
602 case "cmi.student_preference.speed":
603 case "cmi.student_preference.text":
607 case "cmi.objectives._count":
609 $this->
setArray(
"cmi.objectives", $value,
"id", $re_value);
610 $this->
setArray(
"cmi.objectives", $value,
"score.raw", $re_value);
611 $this->
setArray(
"cmi.objectives", $value,
"score.max", $re_value);
612 $this->
setArray(
"cmi.objectives", $value,
"score.min", $re_value);
613 $this->
setArray(
"cmi.objectives", $value,
"status", $re_value);
616 case "cmi.interactions._count":
618 $this->
setArray(
"cmi.interactions", $value,
"id", $re_value);
619 for (
$i = 0;
$i < $value;
$i++) {
620 $var2 =
"cmi.interactions." .
$i .
".objectives._count";
621 if (isset($v_array[$var2])) {
622 $cnt = $v_array[$var2];
624 "cmi.interactions." .
$i .
".objectives",
640 $this->
setArray(
"cmi.interactions", $value,
"time", $re_value);
641 $this->
setArray(
"cmi.interactions", $value,
"type", $re_value);
642 for (
$i = 0;
$i < $value;
$i++) {
643 $var2 =
"cmi.interactions." .
$i .
".correct_responses._count";
644 if (isset($v_array[$var2])) {
645 $cnt = $v_array[$var2];
647 "cmi.interactions." .
$i .
".correct_responses",
653 "cmi.interactions." .
$i .
".correct_responses",
660 $this->
setArray(
"cmi.interactions", $value,
"student_response", $re_value);
661 $this->
setArray(
"cmi.interactions", $value,
"result", $re_value);
662 $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(
674 $lng->txt(
"cont_status") .
": " 675 .
$lng->txt(
"cont_sc_stat_running")
677 $this->tpl->parseCurrentBlock();
681 if (count($items) > 1) {
682 $this->tpl->setVariable(
"SWITCH_ICON_CMD",
"switch_icon();");
687 $lesson_mode = $this->slm->getDefaultLessonMode();
688 if ($this->slm->getAutoReview()) {
689 if ($re_value[
"cmi.core.lesson_status"] ==
"completed" ||
690 $re_value[
"cmi.core.lesson_status"] ==
"passed" ||
691 $re_value[
"cmi.core.lesson_status"] ==
"failed") {
692 $lesson_mode =
"review";
695 $this->tpl->setVariable(
"LESSON_MODE", $lesson_mode);
698 if ($lesson_mode ==
"normal") {
699 $this->tpl->setVariable(
701 str_replace(
"_",
"-", $this->slm->getCreditMode())
704 $this->tpl->setVariable(
"CREDIT_MODE",
"no-credit");
709 if (!isset($re_value[
"cmi.core.total_time"])) {
710 $item->insertTrackData(
"cmi.core.total_time",
"0000:00:00", $sahs_obj_id);
712 if (!isset($re_value[
"cmi.core.lesson_status"])) {
713 $item->insertTrackData(
"cmi.core.lesson_status",
"not attempted", $sahs_obj_id);
715 if (!isset($re_value[
"cmi.core.entry"])) {
716 $item->insertTrackData(
"cmi.core.entry",
"", $sahs_obj_id);
727 $this->tpl =
new ilTemplate(
"tpl.sahs_finish_cbt.html",
true,
true,
"Modules/ScormAicc");
732 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
733 $this->tpl->setVariable(
736 "scorm/" . str_replace(
" ",
"_",
$_GET[
"status"]) .
'.svg' 739 $this->tpl->setVariable(
741 $lng->txt(
"cont_status") .
": " 742 .
$lng->txt(
"cont_sc_stat_" . str_replace(
" ",
"_",
$_GET[
"status"])) .
", " 743 .
$lng->txt(
"cont_total_time") .
": " 753 $launch_id =
$_GET[
'launch'];
754 if ($launch_id ==
'null' || $launch_id == null) {
755 require_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
758 if ($node_data && $node_data[type] ==
'sit') {
759 $launch_id = $node_data[
'child'];
763 $this->tpl->setVariable(
"SCO_LAUNCH_ID", $launch_id);
770 $this->tpl =
new ilTemplate(
"tpl.sahs_unload_cbt.html",
true,
true,
"Modules/ScormAicc");
772 $this->tpl->setVariable(
"SCO_ID",
$_GET[
"sahs_id"]);
781 $ilDB = $DIC[
'ilDB'];
783 $sco_id = (
$_GET[
"asset_id"] ==
"")
786 $ref_id = (
$_GET[
"ref_id"] ==
"")
792 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
793 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
796 $id_ref = $item->getIdentifierRef();
798 $resource->readByIdRef($id_ref, $item->getSLMId());
799 $href = $resource->getHref();
800 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output") .
"/" . $href);
801 $this->tpl =
new ilTemplate(
"tpl.scorm_launch_asset.html",
true,
true,
"Modules/ScormAicc");
802 $this->tpl->setVariable(
"HREF", $this->slm->getDataDirectory(
"output") .
"/" . $href);
809 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
818 $logString = file_get_contents(
'php://input');
819 $ilLog->write(
"ScormAicc: ApiLog: Message: " . $logString);
826 $logString = file_get_contents(
'php://input');
827 $ilLog->write(
"ScormAicc: ApiLog: Warning: " . $logString, 20);
835 $this->tpl->setCurrentBlock(
"set_value");
836 $this->tpl->setVariable(
"VAR", $a_var);
837 $this->tpl->setVariable(
"VALUE", $a_value);
838 $this->tpl->parseCurrentBlock();
844 public function setArray($a_left, $a_value, $a_name, &$v_array)
846 for (
$i = 0;
$i < $a_value;
$i++) {
847 $var = $a_left .
"." .
$i .
"." . $a_name;
848 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();
865 $tree = $DIC[
'tree'];
871 $allowed = $certValidator->isCertificateDownloadable(
$ilUser->getId(), $obj_id);
873 $certificateLogger = $DIC->logger()->cert();
876 $pdfGenerator =
new ilPdfGenerator($ilUserCertificateRepository, $certificateLogger);
882 $this->lng->txt(
'error_creating_certificate_pdf')
889 $parent =
$tree->getParentId(
$_GET[
"ref_id"]);
890 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $parent);
891 $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)
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 _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)
special template class to simplify handling of ITX/PEAR
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