ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSCORMPresentationGUI Class Reference

Class ilSCORMPresentationGUI. More...

+ Collaboration diagram for ilSCORMPresentationGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 execute command More...
 
 attrib2arr (&$a_attributes)
 
 frameset ()
 Output main frameset. More...
 
 get_max_attempts ()
 Get max. More...
 
 get_actual_attempts ()
 Get number of actual attempts for the user. More...
 
 increase_attemptAndsave_module_version ()
 Increases attempts by one for this package. More...
 
 explorer ($a_target="sahs_content")
 save the active module version to scorm_tracking More...
 
 view ()
 SCORM content screen. More...
 
 contentSelect ()
 
 apiInitData ()
 SCORM Data for Javascript-API. More...
 
 api ()
 
 launchSahs ()
 This function is called by the API applet in the content frame when a SCO is started. More...
 
 finishSahs ()
 
 unloadSahs ()
 
 launchAsset ()
 
 pingSession ()
 
 logMessage ()
 
 logWarning ()
 
 setSingleVariable ($a_var, $a_value)
 set single value More...
 
 setArray ($a_left, $a_value, $a_name, &$v_array)
 set single value More...
 
 downloadCertificate ()
 Download the certificate for the active user. More...
 

Data Fields

 $ilias
 
 $slm
 
 $tpl
 
 $lng
 

Detailed Description

Class ilSCORMPresentationGUI.

GUI class for scorm learning module presentation

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 18 of file class.ilSCORMPresentationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSCORMPresentationGUI::__construct ( )

Definition at line 25 of file class.ilSCORMPresentationGUI.php.

26 {
27 global $DIC;
28 $ilias = $DIC['ilias'];
29 $tpl = $DIC['tpl'];
30 $lng = $DIC['lng'];
31 $ilCtrl = $DIC['ilCtrl'];
32
33 $this->ilias = $ilias;
34 $this->tpl = $tpl;
35 $this->lng = $lng;
36 $this->ctrl = $ilCtrl;
37
38 $this->lng->loadLanguageModule('cert');
39
40 // Todo: check lm id
41 $this->slm = new ilObjSCORMLearningModule($_GET["ref_id"], true);
42 }
$_GET["client_id"]
Class ilObjSCORMLearningModule.
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
global $DIC
Definition: saml.php:7

References $_GET, $DIC, $ilCtrl, $ilias, $lng, and $tpl.

Member Function Documentation

◆ api()

ilSCORMPresentationGUI::api ( )

Definition at line 475 of file class.ilSCORMPresentationGUI.php.

476 {
477 global $DIC;
478 $ilias = $DIC['ilias'];
479
480 $slm_obj = new ilObjSCORMLearningModule($_GET["ref_id"]);
481
482 $this->tpl = new ilTemplate("tpl.sahs_api.html", true, true, "Modules/ScormAicc");
483
484 // for scorm modules with only one presentable item: launch item
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");
489 $sc_object = new ilSCORMItem($_GET["autolaunch"]);
490 $id_ref = $sc_object->getIdentifierRef();
491 $sc_res_id = ilSCORMResource::_lookupIdByIdRef($id_ref, $sc_object->getSLMId());
492 $scormtype = strtolower(ilSCORMResource::_lookupScormType($sc_res_id));
493
494 if ($scormtype == "asset") {
495 $item_command = "IliasLaunchAsset";
496 } else {
497 $item_command = "IliasLaunchSahs";
498 }
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();
503 }
504
505 //unlimited sessions
506 if ($slm_obj->getSession()) {
507 $session_timeout = (int) ($ilias->ini->readVariable("session", "expire")) / 2;
508 } else {
509 $session_timeout = 0;
510 }
511 $this->tpl->setVariable("PING_SESSION", $session_timeout);
512
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")));
521
522 $this->tpl->parseCurrentBlock();
523 $this->tpl->show(false);
524 exit;
525 }
exit
Definition: backend.php:16
static _lookupIdByIdRef($a_id_ref, $a_slm_id)
static _lookupScormType($a_obj_id)
special template class to simplify handling of ITX/PEAR
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_GET, $_SERVER, $DIC, $ilias, ilSCORMResource\_lookupIdByIdRef(), ilSCORMResource\_lookupScormType(), and exit.

+ Here is the call graph for this function:

◆ apiInitData()

ilSCORMPresentationGUI::apiInitData ( )

SCORM Data for Javascript-API.

Definition at line 431 of file class.ilSCORMPresentationGUI.php.

432 {
433 // global $DIC;
434 // $ilias = $DIC['ilias'];
435 // $ilLog = $DIC['ilLog'];
436 // $ilUser = $DIC['ilUser'];
437 // $lng = $DIC['lng'];
438 // $ilDB = $DIC['ilDB'];
439
440 if ($_GET["ref_id"] == "") {
441 print('alert("no start without ref_id");');
442 die;
443 }
444
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");
448 echo $js_data;
449 $js_data = file_get_contents("./Modules/ScormAicc/scripts/SCORM1_2standard.js");//want to give opportunities to different files (Uwe Kohnle)
450 echo $js_data;
451 print("}\r\n");
452
453 include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php");
454
455 print("IliasScormVars=" . ilObjSCORMInitData::getIliasScormVars($this->slm) . ";\r\n");
456
457 //Resources
458 print("IliasScormResources=" . ilObjSCORMInitData::getIliasScormResources($this->slm->getId()) . ";\r\n");
459
460 //Tree
461 print("IliasScormTree=" . ilObjSCORMInitData::getIliasScormTree($this->slm->getId()) . ";\r\n");
462
463 //prevdata
464 print("IliasScormData=" . ilObjSCORMInitData::getIliasScormData($this->slm->getId()) . ";\r\n");
465
466 // set alternative API name - not necessary for scorm
467 if ($this->slm->getAPIAdapterName() != "API") {
468 print('var ' . $this->slm->getAPIAdapterName() . '=new iliasApi();');
469 } else {
470 print('var API=new iliasApi();');
471 }
472 }
if(! $in) print
static getIliasScormData($a_packageId)
static getIliasScormVars($slm_obj)
static getIliasScormResources($a_packageId)
static getIliasScormTree($a_packageId)

References $_GET, ilObjSCORMInitData\getIliasScormData(), ilObjSCORMInitData\getIliasScormResources(), ilObjSCORMInitData\getIliasScormTree(), ilObjSCORMInitData\getIliasScormVars(), and print.

+ Here is the call graph for this function:

◆ attrib2arr()

ilSCORMPresentationGUI::attrib2arr ( $a_attributes)

Definition at line 71 of file class.ilSCORMPresentationGUI.php.

72 {
73 $attr = array();
74
75 if (!is_array($a_attributes)) {
76 return $attr;
77 }
78 foreach ($a_attributes as $attribute) {
79 $attr[$attribute->name()] = $attribute->value();
80 }
81
82 return $attr;
83 }

◆ contentSelect()

ilSCORMPresentationGUI::contentSelect ( )

Definition at line 418 of file class.ilSCORMPresentationGUI.php.

419 {
420 global $DIC;
421 $lng = $DIC['lng'];
422 $this->tpl = new ilTemplate("tpl.scorm_content_select.html", true, true, "Modules/ScormAicc");
423 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
424 $this->tpl->setVariable('TXT_SPECIALPAGE', $lng->txt("seq_toc"));
425 $this->tpl->show();
426 }
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user

References $DIC, $lng, and ilUtil\getStyleSheetLocation().

+ Here is the call graph for this function:

◆ downloadCertificate()

ilSCORMPresentationGUI::downloadCertificate ( )

Download the certificate for the active user.

Definition at line 860 of file class.ilSCORMPresentationGUI.php.

861 {
862 global $DIC;
863
864 $ilUser = $DIC->user();
865 $tree = $DIC['tree'];
866 $ilCtrl = $DIC->ctrl();
867
868 $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
869
870 $certValidator = new ilCertificateDownloadValidator();
871 $allowed = $certValidator->isCertificateDownloadable($ilUser->getId(), $obj_id);
872 if ($allowed) {
873 $certificateLogger = $DIC->logger()->cert();
874
875 $ilUserCertificateRepository = new ilUserCertificateRepository();
876 $pdfGenerator = new ilPdfGenerator($ilUserCertificateRepository, $certificateLogger);
877
878 $pdfAction = new ilCertificatePdfAction(
879 $certificateLogger,
880 $pdfGenerator,
882 $this->lng->txt('error_creating_certificate_pdf')
883 );
884
885 $pdfAction->downloadPdf($ilUser->getId(), $obj_id);
886 exit;
887 }
888 // redirect to parent category if certificate is not accessible
889 $parent = $tree->getParentId($_GET["ref_id"]);
890 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent);
891 $ilCtrl->redirectByClass("ilrepositorygui", "");
892 }
Validates if an active certificate is stored in the database and can be downloaded by the user.
Just a wrapper class to create Unit Test for other classes.
static _lookupObjId($a_id)
Class ilPdfGeneratorConstantsTest.
$ilUser
Definition: imgupload.php:18

References $_GET, $DIC, $ilCtrl, $ilUser, $tree, ilObject\_lookupObjId(), and exit.

+ Here is the call graph for this function:

◆ executeCommand()

ilSCORMPresentationGUI::executeCommand ( )

execute command

Definition at line 47 of file class.ilSCORMPresentationGUI.php.

48 {
49 global $DIC;
50 $ilAccess = $DIC['ilAccess'];
51 $ilLog = $DIC['ilLog'];
52 $ilias = $DIC['ilias'];
53 $lng = $DIC['lng'];
54
55 $next_class = $this->ctrl->getNextClass($this);
56 $cmd = $this->ctrl->getCmd("frameset");
57
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);
62 }
63
64 switch ($next_class) {
65 default:
66 $this->$cmd();
67 }
68 }

References $_GET, $DIC, $ilias, $ilLog, and $lng.

◆ explorer()

ilSCORMPresentationGUI::explorer (   $a_target = "sahs_content")

save the active module version to scorm_tracking

output table of content

Definition at line 349 of file class.ilSCORMPresentationGUI.php.

350 {
351 global $DIC;
352 $ilBench = $DIC['ilBench'];
353 $ilLog = $DIC['ilLog'];
354
355 $ilBench->start("SCORMExplorer", "initExplorer");
356
357 $this->tpl = new ilTemplate("tpl.sahs_exp_main.html", true, true, "Modules/ScormAicc");
358
359 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
360 $exp = new ilSCORMExplorer($this->ctrl->getLinkTarget($this, "view"), $this->slm);
361 $exp->setTargetGet("obj_id");
362 $exp->setFrameTarget($a_target);
363
364 //$exp->setFiltered(true);
365 $jsApi = false;
366 if ($_GET["jsApi"] == "1") {
367 $jsApi = true;
368 }
369
370 if ($_GET["scexpand"] == "") {
371 $mtree = new ilSCORMTree($this->slm->getId());
372 $expanded = $mtree->readRootId();
373 } else {
374 $expanded = $_GET["scexpand"];
375 }
376 $exp->setExpand($expanded);
377
378 $exp->forceExpandAll(true, false);
379 $ilBench->stop("SCORMExplorer", "initExplorer");
380
381 // build html-output
382 $ilBench->start("SCORMExplorer", "setOutput");
383 $exp->setOutput(0);
384 $ilBench->stop("SCORMExplorer", "setOutput");
385
386 $ilBench->start("SCORMExplorer", "getOutput");
387 $output = $exp->getOutput($jsApi);
388 $ilBench->stop("SCORMExplorer", "getOutput");
389
390 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
391 $this->tpl->addBlockFile("CONTENT", "content", "tpl.sahs_explorer.html", "Modules/ScormAicc");
392 //$this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_content"));
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();
398 //BUG 16794? $this->tpl->show();
399 $this->tpl->show("DEFAULT", false);
400 }
Explorer View for SCORM Learning Modules.
SCORM Object Tree.
global $ilBench
Definition: ilias.php:18

References $_GET, $DIC, $ilBench, $ilLog, Sabre\VObject\$output, and ilUtil\getStyleSheetLocation().

+ Here is the call graph for this function:

◆ finishSahs()

ilSCORMPresentationGUI::finishSahs ( )

Definition at line 723 of file class.ilSCORMPresentationGUI.php.

724 {
725 global $DIC;
726 $lng = $DIC['lng'];
727 $this->tpl = new ilTemplate("tpl.sahs_finish_cbt.html", true, true, "Modules/ScormAicc");
728 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
729
730 // block not in template
731 // $this->tpl->setCurrentBlock("switch_icon");
732 $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
733 $this->tpl->setVariable(
734 "SCO_ICO",
736 "scorm/" . str_replace(" ", "_", $_GET["status"]) . '.svg'
737 )
738 );
739 $this->tpl->setVariable(
740 "SCO_ALT",
741 $lng->txt("cont_status") . ": "
742 . $lng->txt("cont_sc_stat_" . str_replace(" ", "_", $_GET["status"])) . ", "
743 . $lng->txt("cont_total_time") . ": "
744 . $_GET["totime"]
745 );
746 // BEGIN Partial fix for SCO sequencing:
747 // With this partial fix, ILIAS can now proceed to the next
748 // SCO, if it is a sibling of the current SCO.
749 // This fix doesn't fix the case, if the next SCO has a
750 // different parent item.
751 //$this->tpl->setVariable("SCO_LAUNCH_ID", $_GET["launch"]);
752
753 $launch_id = $_GET['launch'];
754 if ($launch_id == 'null' || $launch_id == null) {
755 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
756 $mtree = new ilSCORMTree($this->slm->getId());
757 $node_data = $mtree->fetchSuccessorNode($_GET['sahs_id']);
758 if ($node_data && $node_data[type] == 'sit') {
759 $launch_id = $node_data['child'];
760 }
761 }
762 // END Partial fix for SCO sequencing
763 $this->tpl->setVariable("SCO_LAUNCH_ID", $launch_id);
764 // $this->tpl->parseCurrentBlock();
765 $this->tpl->show();
766 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $_GET, $DIC, $lng, ilUtil\getImagePath(), and ilUtil\getStyleSheetLocation().

+ Here is the call graph for this function:

◆ frameset()

ilSCORMPresentationGUI::frameset ( )

Output main frameset.

If only one SCO/Asset is given, it is displayed without the table of contents explorer frame on the left.

Definition at line 90 of file class.ilSCORMPresentationGUI.php.

91 {
92 global $DIC;
93 $lng = $DIC['lng'];
94 $javascriptAPI = true;
95 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
96 $items = ilSCORMObject::_lookupPresentableItems($this->slm->getId());
97
98 //check for max_attempts and raise error if max_attempts is exceeded
99 if ($this->get_max_attempts() != 0) {
100 if ($this->get_actual_attempts() >= $this->get_max_attempts()) {
101 header('Content-Type: text/html; charset=utf-8');
102 echo($lng->txt("cont_sc_max_attempt_exceed"));
103 exit;
104 }
105 }
106
108
109 //WAC
110 require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
111 ilWACSignedPath::signFolderOfStartFile($this->slm->getDataDirectory() . '/imsmanifest.xml');
112
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");
118
119 // should be able to grep templates
120 if ($debug) {
121 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_debug.html", false, false, "Modules/ScormAicc");
122 } else {
123 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js.html", false, false, "Modules/ScormAicc");
124 }
125
126 $this->tpl->setVariable("EXPLORER_LINK", $exp_link);
127 $pres_link = $this->ctrl->getLinkTarget($this, "contentSelect");
128 $this->tpl->setVariable("PRESENTATION_LINK", $pres_link);
129 } else {
130 if ($debug) {
131 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_debug_one_page.html", false, false, "Modules/ScormAicc");
132 } else {
133 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_one_page.html", false, false, "Modules/ScormAicc");
134 }
135
136 $this->ctrl->setParameter($this, "autolaunch", $items[0]);
137 }
138 $api_link = $this->ctrl->getLinkTarget($this, "apiInitData");
139 $this->tpl->setVariable("API_LINK", $api_link);
140 $this->tpl->show("DEFAULT", false);
141
142
143 exit;
144 }
static _lookupPresentableItems($a_slm_id)
Count number of presentable SCOs/Assets of SCORM learning module.
get_actual_attempts()
Get number of actual attempts for the user.
increase_attemptAndsave_module_version()
Increases attempts by one for this package.
static signFolderOfStartFile($start_file_path)

References Sabre\VObject\$debug, $DIC, $lng, ilSCORMObject\_lookupPresentableItems(), exit, get_actual_attempts(), get_max_attempts(), increase_attemptAndsave_module_version(), and ilWACSignedPath\signFolderOfStartFile().

+ Here is the call graph for this function:

◆ get_actual_attempts()

ilSCORMPresentationGUI::get_actual_attempts ( )

Get number of actual attempts for the user.

Definition at line 158 of file class.ilSCORMPresentationGUI.php.

159 {
160 global $DIC;
161 $ilDB = $DIC['ilDB'];
162 $ilUser = $DIC['ilUser'];
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())
167 );
168 $val_rec = $ilDB->fetchAssoc($val_set);
169 $attempts = $val_rec["package_attempts"];
170 if ($attempts == null) {
171 $attempts = 0;
172 }
173 return $attempts;
174 }
global $ilDB

References $DIC, $ilDB, and $ilUser.

Referenced by frameset().

+ Here is the caller graph for this function:

◆ get_max_attempts()

ilSCORMPresentationGUI::get_max_attempts ( )

Get max.

number of attempts allowed for this package

Definition at line 149 of file class.ilSCORMPresentationGUI.php.

150 {
151 include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
152 return ilObjSCORMInitData::get_max_attempts($this->slm->getId());
153 }
static get_max_attempts($a_packageId)
Get max.

References ilObjSCORMInitData\get_max_attempts().

Referenced by frameset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ increase_attemptAndsave_module_version()

ilSCORMPresentationGUI::increase_attemptAndsave_module_version ( )

Increases attempts by one for this package.

Increases attempts by one and saves module_version for this package

Definition at line 260 of file class.ilSCORMPresentationGUI.php.

261 {
262 global $DIC;
263 $ilDB = $DIC['ilDB'];
264 $ilUser = $DIC['ilUser'];
265 $res = $ilDB->queryF(
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())
269 );
270 $val_rec = $ilDB->fetchAssoc($res);
271 if ($val_rec["cnt"] == 0) { //offline_mode could be inserted
272 $attempts = 1;
273 $ilDB->manipulateF(
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'))
277 );
278 } else {
279 $attempts = $val_rec["package_attempts"];
280 if ($attempts == null) {
281 $attempts = 0;
282 }
283 $attempts++;
284 $ilDB->manipulateF(
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())
288 );
289 }
290 //only SCORM 1.2, not 2004
291 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
292 ilLPStatusWrapper::_updateStatus($this->slm->getId(), $ilUser->getId());
293 }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $ilUser, $res, and ilLPStatusWrapper\_updateStatus().

Referenced by frameset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ launchAsset()

ilSCORMPresentationGUI::launchAsset ( )

Definition at line 777 of file class.ilSCORMPresentationGUI.php.

778 {
779 global $DIC;
780 $ilUser = $DIC['ilUser'];
781 $ilDB = $DIC['ilDB'];
782
783 $sco_id = ($_GET["asset_id"] == "")
784 ? $_POST["asset_id"]
785 : $_GET["asset_id"];
786 $ref_id = ($_GET["ref_id"] == "")
787 ? $_POST["ref_id"]
788 : $_GET["ref_id"];
789
790 $this->slm = new ilObjSCORMLearningModule($ref_id, true);
791
792 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
793 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
794 $item = new ilSCORMItem($sco_id);
795
796 $id_ref = $item->getIdentifierRef();
797 $resource = new ilSCORMResource();
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);
803 $this->tpl->show();
804 }
$_POST["username"]

References $_GET, $_POST, $DIC, $ilDB, and $ilUser.

◆ launchSahs()

ilSCORMPresentationGUI::launchSahs ( )

This function is called by the API applet in the content frame when a SCO is started.

Definition at line 531 of file class.ilSCORMPresentationGUI.php.

532 {
533 global $DIC;
534 $ilUser = $DIC['ilUser'];
535 $ilDB = $DIC['ilDB'];
536
537 $sco_id = ($_GET["sahs_id"] == "")
538 ? $_POST["sahs_id"]
539 : $_GET["sahs_id"];
540 $ref_id = ($_GET["ref_id"] == "")
541 ? $_POST["ref_id"]
542 : $_GET["ref_id"];
543
544 $this->slm = new ilObjSCORMLearningModule($ref_id, true);
545
546 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
547 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
548 $item = new ilSCORMItem($sco_id);
549
550 $id_ref = $item->getIdentifierRef();
551 $resource = new ilSCORMResource();
552 $resource->readByIdRef($id_ref, $item->getSLMId());
553 //$slm_obj = new ilObjSCORMLearningModule($_GET["ref_id"]);
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);
557
558 // set item data
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());
563
564 // set alternative API name
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();
569 }
570
571 $val_set = $ilDB->queryF(
572 '
573 SELECT * FROM scorm_tracking
574 WHERE user_id = %s
575 AND sco_id = %s
576 AND obj_id = %s',
577 array('integer','integer','integer'),
578 array($ilUser->getId(),$sco_id,$this->slm->getId())
579 );
580 $re_value = array();
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"];
586 }
587
588 foreach ($re_value as $var => $value) {
589 switch ($var) {
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":
599 case "cmi.comments":
600 case "cmi.student_preference.audio":
601 case "cmi.student_preference.language":
602 case "cmi.student_preference.speed":
603 case "cmi.student_preference.text":
604 $this->setSingleVariable($var, $value);
605 break;
606
607 case "cmi.objectives._count":
608 $this->setSingleVariable($var, $value);
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);
614 break;
615
616 case "cmi.interactions._count":
617 $this->setSingleVariable($var, $value);
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];
623 $this->setArray(
624 "cmi.interactions." . $i . ".objectives",
625 $cnt,
626 "id",
627 $re_value
628 );
629 /*
630 $this->setArray("cmi.interactions.".$i.".objectives",
631 $cnt, "score.raw", $re_value);
632 $this->setArray("cmi.interactions.".$i.".objectives",
633 $cnt, "score.max", $re_value);
634 $this->setArray("cmi.interactions.".$i.".objectives",
635 $cnt, "score.min", $re_value);
636 $this->setArray("cmi.interactions.".$i.".objectives",
637 $cnt, "status", $re_value);*/
638 }
639 }
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];
646 $this->setArray(
647 "cmi.interactions." . $i . ".correct_responses",
648 $cnt,
649 "pattern",
650 $re_value
651 );
652 $this->setArray(
653 "cmi.interactions." . $i . ".correct_responses",
654 $cnt,
655 "weighting",
656 $re_value
657 );
658 }
659 }
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);
663 break;
664 }
665 }
666
667 global $DIC;
668 $lng = $DIC['lng'];
669 $this->tpl->setCurrentBlock("switch_icon");
670 $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
671 $this->tpl->setVariable("SCO_ICO", ilUtil::getImagePath("scorm/running.svg"));
672 $this->tpl->setVariable(
673 "SCO_ALT",
674 $lng->txt("cont_status") . ": "
675 . $lng->txt("cont_sc_stat_running")
676 );
677 $this->tpl->parseCurrentBlock();
678
679 // set icon, if more than one SCO/Asset is presented
680 $items = ilSCORMObject::_lookupPresentableItems($this->slm->getId());
681 if (count($items) > 1) {
682 $this->tpl->setVariable("SWITCH_ICON_CMD", "switch_icon();");
683 }
684
685
686 // lesson mode
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";
693 }
694 }
695 $this->tpl->setVariable("LESSON_MODE", $lesson_mode);
696
697 // credit mode
698 if ($lesson_mode == "normal") {
699 $this->tpl->setVariable(
700 "CREDIT_MODE",
701 str_replace("_", "-", $this->slm->getCreditMode())
702 );
703 } else {
704 $this->tpl->setVariable("CREDIT_MODE", "no-credit");
705 }
706
707 // init cmi.core.total_time, cmi.core.lesson_status and cmi.core.entry
708 $sahs_obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
709 if (!isset($re_value["cmi.core.total_time"])) {
710 $item->insertTrackData("cmi.core.total_time", "0000:00:00", $sahs_obj_id);
711 }
712 if (!isset($re_value["cmi.core.lesson_status"])) {
713 $item->insertTrackData("cmi.core.lesson_status", "not attempted", $sahs_obj_id);
714 }
715 if (!isset($re_value["cmi.core.entry"])) {
716 $item->insertTrackData("cmi.core.entry", "", $sahs_obj_id);
717 }
718
719 $this->tpl->show();
720 //echo htmlentities($this->tpl->get()); exit;
721 }
setSingleVariable($a_var, $a_value)
set single value
setArray($a_left, $a_value, $a_name, &$v_array)
set single value
$i
Definition: disco.tpl.php:19

References $_GET, $_POST, $DIC, $i, $ilDB, $ilUser, $lng, ilObject\_lookupObjId(), ilSCORMObject\_lookupPresentableItems(), ilUtil\getImagePath(), setArray(), and setSingleVariable().

+ Here is the call graph for this function:

◆ logMessage()

ilSCORMPresentationGUI::logMessage ( )

Definition at line 814 of file class.ilSCORMPresentationGUI.php.

815 {
816 global $DIC;
817 $ilLog = $DIC['ilLog'];
818 $logString = file_get_contents('php://input');
819 $ilLog->write("ScormAicc: ApiLog: Message: " . $logString);
820 }

References $DIC, and $ilLog.

◆ logWarning()

ilSCORMPresentationGUI::logWarning ( )

Definition at line 822 of file class.ilSCORMPresentationGUI.php.

823 {
824 global $DIC;
825 $ilLog = $DIC['ilLog'];
826 $logString = file_get_contents('php://input');
827 $ilLog->write("ScormAicc: ApiLog: Warning: " . $logString, 20);
828 }

References $DIC, and $ilLog.

◆ pingSession()

ilSCORMPresentationGUI::pingSession ( )

Definition at line 806 of file class.ilSCORMPresentationGUI.php.

807 {
808 //WAC
809 require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
810 ilWACSignedPath::signFolderOfStartFile($this->slm->getDataDirectory() . '/imsmanifest.xml');
811 return true;
812 }

References ilWACSignedPath\signFolderOfStartFile().

+ Here is the call graph for this function:

◆ setArray()

ilSCORMPresentationGUI::setArray (   $a_left,
  $a_value,
  $a_name,
$v_array 
)

set single value

Definition at line 844 of file class.ilSCORMPresentationGUI.php.

845 {
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();
853 }
854 }
855 }

References $i.

Referenced by launchSahs().

+ Here is the caller graph for this function:

◆ setSingleVariable()

ilSCORMPresentationGUI::setSingleVariable (   $a_var,
  $a_value 
)

set single value

Definition at line 833 of file class.ilSCORMPresentationGUI.php.

834 {
835 $this->tpl->setCurrentBlock("set_value");
836 $this->tpl->setVariable("VAR", $a_var);
837 $this->tpl->setVariable("VALUE", $a_value);
838 $this->tpl->parseCurrentBlock();
839 }

Referenced by launchSahs().

+ Here is the caller graph for this function:

◆ unloadSahs()

ilSCORMPresentationGUI::unloadSahs ( )

Definition at line 768 of file class.ilSCORMPresentationGUI.php.

769 {
770 $this->tpl = new ilTemplate("tpl.sahs_unload_cbt.html", true, true, "Modules/ScormAicc");
771 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
772 $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
773 $this->tpl->show();
774 }

References $_GET, and ilUtil\getStyleSheetLocation().

+ Here is the call graph for this function:

◆ view()

ilSCORMPresentationGUI::view ( )

SCORM content screen.

Definition at line 406 of file class.ilSCORMPresentationGUI.php.

407 {
408 $sc_gui_object = ilSCORMObjectGUI::getInstance($_GET["obj_id"]);
409
410 if (is_object($sc_gui_object)) {
411 $sc_gui_object->view();
412 }
413
414 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
415 $this->tpl->show(false);
416 }
& getInstance($a_id)
get instance of specialized GUI class

References $_GET, ilSCORMObjectGUI\getInstance(), and ilUtil\getStyleSheetLocation().

+ Here is the call graph for this function:

Field Documentation

◆ $ilias

ilSCORMPresentationGUI::$ilias

Definition at line 20 of file class.ilSCORMPresentationGUI.php.

Referenced by __construct(), api(), and executeCommand().

◆ $lng

ilSCORMPresentationGUI::$lng

◆ $slm

ilSCORMPresentationGUI::$slm

Definition at line 21 of file class.ilSCORMPresentationGUI.php.

◆ $tpl

ilSCORMPresentationGUI::$tpl

Definition at line 22 of file class.ilSCORMPresentationGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: