ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilSCORMPresentationGUI Class Reference

Class ilSCORMPresentationGUI. More...

+ Inheritance diagram for ilSCORMPresentationGUI:
+ Collaboration diagram for ilSCORMPresentationGUI:

Public Member Functions

 ilSCORMPresentationGUI ()
 
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.

Member Function Documentation

◆ api()

ilSCORMPresentationGUI::api ( )

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

481 {
482 global $ilias;
483
484 $slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]);
485
486 $this->tpl = new ilTemplate("tpl.sahs_api.html", true, true, "Modules/ScormAicc");
487
488 // for scorm modules with only one presentable item: launch item
489 if ($_GET["autolaunch"] != "")
490 {
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");
494 $sc_object =& new ilSCORMItem($_GET["autolaunch"]);
495 $id_ref = $sc_object->getIdentifierRef();
496 $sc_res_id = ilSCORMResource::_lookupIdByIdRef($id_ref, $sc_object->getSLMId());
497 $scormtype = strtolower(ilSCORMResource::_lookupScormType($sc_res_id));
498
499 if ($scormtype == "asset")
500 {
501 $item_command = "IliasLaunchAsset";
502 }
503 else
504 {
505 $item_command = "IliasLaunchSahs";
506 }
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();
511 }
512
513 //unlimited sessions
514 if ($slm_obj->getSession()) {
515 $session_timeout = (int)($ilias->ini->readVariable("session","expire"))/2;
516 } else {
517 $session_timeout = 0;
518 }
519 $this->tpl->setVariable("PING_SESSION",$session_timeout);
520
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")));
529
530 $this->tpl->parseCurrentBlock();
531 $this->tpl->show(false);
532 exit;
533 }
$_GET["client_id"]
Class ilObjSCORMLearningModule.
_lookupIdByIdRef($a_id_ref, $a_slm_id)
special template class to simplify handling of ITX/PEAR
exit
Definition: login.php:54
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_GET, $_SERVER, $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 445 of file class.ilSCORMPresentationGUI.php.

445 {
446// global $ilias, $ilLog, $ilUser, $lng, $ilDB;
447
448 if ($_GET["ref_id"] == "") {
449 print ('alert("no start without ref_id");');
450 die;
451 }
452
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");
456 echo $js_data;
457 $js_data = file_get_contents("./Modules/ScormAicc/scripts/SCORM1_2standard.js");//want to give opportunities to different files (Uwe Kohnle)
458 echo $js_data;
459 print("}\r\n");
460
461 include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php");
462
463 print("IliasScormVars=".ilObjSCORMInitData::getIliasScormVars($this->slm).";\r\n");
464
465 //Resources
466 print("IliasScormResources=".ilObjSCORMInitData::getIliasScormResources($this->slm->getId()).";\r\n");
467
468 //Tree
469 print("IliasScormTree=".ilObjSCORMInitData::getIliasScormTree($this->slm->getId()).";\r\n");
470
471 //prevdata
472 print("IliasScormData=".ilObjSCORMInitData::getIliasScormData($this->slm->getId()).";\r\n");
473
474 // set alternative API name - not necessary for scorm
475 if ($this->slm->getAPIAdapterName() != "API") print('var '.$this->slm->getAPIAdapterName().'=new iliasApi();');
476 else print('var API=new iliasApi();');
477 }
if(! $in) print

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 63 of file class.ilSCORMPresentationGUI.php.

64 {
65 $attr = array();
66
67 if(!is_array($a_attributes))
68 {
69 return $attr;
70 }
71 foreach ($a_attributes as $attribute)
72 {
73 $attr[$attribute->name()] = $attribute->value();
74 }
75
76 return $attr;
77 }

◆ contentSelect()

ilSCORMPresentationGUI::contentSelect ( )

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

434 {
435 global $lng;
436 $this->tpl = new ilTemplate("tpl.scorm_content_select.html", true, true, "Modules/ScormAicc");
437 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
438 $this->tpl->setVariable('TXT_SPECIALPAGE',$lng->txt("seq_toc"));
439 $this->tpl->show();
440 }
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user

References $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 $ilUser, $tree, $ilCtrl;
863
864 $allowed = false;
865 $last_access = 0;
866 $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
867 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
869 {
870 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
872 switch ($type)
873 {
874 case "scorm":
875 include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
876 $allowed = true;
877 $last_access = ilObjSCORMLearningModule::_lookupLastAccess($obj_id, $ilUser->getId());
878 break;
879 case "scorm2004":
880 include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
881 $allowed = true;
882 $last_access = ilObjSCORM2004LearningModule::_lookupLastAccess($obj_id, $ilUser->getId());
883 break;
884 default:
885 break;
886 }
887 }
888
889 if ($allowed)
890 {
891 include_once "./Services/Certificate/classes/class.ilCertificate.php";
892 include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
894 $params = array(
895 "user_data" => ilObjUser::_lookupFields($ilUser->getId()),
896 "last_access" => $last_access
897 );
898 $certificate->outCertificate($params, true);
899 exit;
900 }
901 // redirect to parent category if certificate is not accessible
902 $parent = $tree->getParentId($_GET["ref_id"]);
903 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent);
904 $ilCtrl->redirectByClass("ilrepositorygui", "");
905 }
Create PDF certificates.
static _lookupUserCertificate($obj_id, $usr_id=0)
Checks whether a certificate exists for the active user or not.
_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 _lookupLastAccess($a_obj_id, $a_usr_id)
Return the last access timestamp for a given user.
_lookupFields($a_user_id)
lookup fields (deprecated; use more specific methods instead)
static _lookupObjId($a_id)
$params
Definition: example_049.php:96
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15

References $_GET, $certificate, $ilCtrl, $ilUser, $params, ilObjUser\_lookupFields(), ilObjSCORM2004LearningModule\_lookupLastAccess(), ilObjSCORMLearningModule\_lookupLastAccess(), ilObject\_lookupObjId(), ilObjSAHSLearningModule\_lookupSubType(), ilObjSAHSLearningModuleAccess\_lookupUserCertificate(), and exit.

+ Here is the call graph for this function:

◆ executeCommand()

& ilSCORMPresentationGUI::executeCommand ( )

execute command

Reimplemented in ilAICCPresentationGUI, and ilHACPPresentationGUI.

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

42 {
43 global $ilAccess, $ilLog, $ilias, $lng;
44
45 $next_class = $this->ctrl->getNextClass($this);
46 $cmd = $this->ctrl->getCmd("frameset");
47
48 if (!$ilAccess->checkAccess("write", "", $_GET["ref_id"]) &&
49 (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) ||
50 !$this->slm->getOnline()))
51 {
52 $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
53 }
54
55 switch($next_class)
56 {
57 default:
58 $this->$cmd();
59 }
60 }
$cmd
Definition: sahs_server.php:35

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

◆ explorer()

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

save the active module version to scorm_tracking

output table of content

Reimplemented in ilAICCPresentationGUI, and ilHACPPresentationGUI.

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

366 {
367 global $ilBench, $ilLog;
368
369 $ilBench->start("SCORMExplorer", "initExplorer");
370
371 $this->tpl = new ilTemplate("tpl.sahs_exp_main.html", true, true, "Modules/ScormAicc");
372
373 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
374 $exp = new ilSCORMExplorer($this->ctrl->getLinkTarget($this, "view"), $this->slm);
375 $exp->setTargetGet("obj_id");
376 $exp->setFrameTarget($a_target);
377
378 //$exp->setFiltered(true);
379 $jsApi=false;
380 if ($_GET["jsApi"] == "1") $jsApi=true;
381
382 if ($_GET["scexpand"] == "")
383 {
384 $mtree = new ilSCORMTree($this->slm->getId());
385 $expanded = $mtree->readRootId();
386 }
387 else
388 {
389 $expanded = $_GET["scexpand"];
390 }
391 $exp->setExpand($expanded);
392
393 $exp->forceExpandAll(true, false);
394 $ilBench->stop("SCORMExplorer", "initExplorer");
395
396 // build html-output
397 $ilBench->start("SCORMExplorer", "setOutput");
398 $exp->setOutput(0);
399 $ilBench->stop("SCORMExplorer", "setOutput");
400
401 $ilBench->start("SCORMExplorer", "getOutput");
402 $output = $exp->getOutput($jsApi);
403 $ilBench->stop("SCORMExplorer", "getOutput");
404
405 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
406 $this->tpl->addBlockFile("CONTENT", "content", "tpl.sahs_explorer.html", "Modules/ScormAicc");
407 //$this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_content"));
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();
413 //BUG 16794? $this->tpl->show();
414 $this->tpl->show("DEFAULT", false);
415 }
Explorer View for SCORM Learning Modules.
SCORM Object Tree.
global $ilBench
Definition: ilias.php:18

References $_GET, $ilBench, $ilLog, and ilUtil\getStyleSheetLocation().

+ Here is the call graph for this function:

◆ finishSahs()

ilSCORMPresentationGUI::finishSahs ( )

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

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

References $_GET, $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 84 of file class.ilSCORMPresentationGUI.php.

84 {
85 global $lng;
86 $javascriptAPI = true;
87 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
88 $items = ilSCORMObject::_lookupPresentableItems($this->slm->getId());
89
90 //check for max_attempts and raise error if max_attempts is exceeded
91 if ($this->get_max_attempts()!=0) {
92 if ($this->get_actual_attempts() >= $this->get_max_attempts()) {
93 header('Content-Type: text/html; charset=utf-8');
94 echo($lng->txt("cont_sc_max_attempt_exceed"));
95 exit;
96 }
97 }
98
99 //count attempt
100 //Cause there is no way to check if the Java-Applet is sucessfully loaded, an attempt equals opening the SCORM player
101
103// $this->increase_attempt();
104// $this->save_module_version();
105
106 if ($javascriptAPI == false) {
107 if (count($items) > 1
108 || strtolower(get_class($this->slm)) == "ilobjaicclearningmodule"
109 || strtolower(get_class($this->slm)) == "ilobjhacplearningmodule")
110 {
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);
120 }
121 else if (count($items) == 1)
122 {
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);
130 }
131 } else {
132 //WAC
133 require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
134 ilWACSignedPath::signFolderOfStartFile($this->slm->getDataDirectory().'/imsmanifest.xml');
135
136 $debug = $this->slm->getDebug();
137 if (count($items) > 1
138 || strtolower(get_class($this->slm)) == "ilobjaicclearningmodule"
139 || strtolower(get_class($this->slm)) == "ilobjhacplearningmodule")
140 {
141 $this->ctrl->setParameter($this, "expand", "1");
142 $this->ctrl->setParameter($this, "jsApi", "1");
143 $exp_link = $this->ctrl->getLinkTarget($this, "explorer");
144
145 // should be able to grep templates
146 if($debug)
147 {
148// $this->tpl = new ilTemplate("tpl.sahs_pres_js_debug.html", false, false, "Modules/ScormAicc");
149 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_debug.html", false, false, "Modules/ScormAicc");
150 }
151 else
152 {
153// $this->tpl = new ilTemplate("tpl.sahs_pres_js_debug.html", false, false, "Modules/ScormAicc");
154 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js.html", false, false, "Modules/ScormAicc");
155 }
156
157 $this->tpl->setVariable("EXPLORER_LINK", $exp_link);
158 $pres_link = $this->ctrl->getLinkTarget($this, "contentSelect");
159 $this->tpl->setVariable("PRESENTATION_LINK", $pres_link);
160 } else {
161
162 // should be able to grep templates
163 if($debug)
164 {
165 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_debug_one_page.html", false, false, "Modules/ScormAicc");
166 }
167 else
168 {
169 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_one_page.html", false, false, "Modules/ScormAicc");
170 }
171
172 $this->ctrl->setParameter($this, "autolaunch", $items[0]);
173 }
174 $api_link = $this->ctrl->getLinkTarget($this, "apiInitData");
175 $this->tpl->setVariable("API_LINK", $api_link);
176 $this->tpl->show("DEFAULT", false);
177 }
178
179 exit;
180
181 }
_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, ilWACCookieInterface $ilWACCookieInterface=null)

References $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 194 of file class.ilSCORMPresentationGUI.php.

195 {
196 global $ilDB, $ilUser;
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;
202 return $attempts;
203 }
global $ilDB

References $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 186 of file class.ilSCORMPresentationGUI.php.

186 {
187 include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
188 return ilObjSCORMInitData::get_max_attempts($this->slm->getId());
189 }
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:

◆ ilSCORMPresentationGUI()

ilSCORMPresentationGUI::ilSCORMPresentationGUI ( )

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

26 {
27 global $ilias, $tpl, $lng, $ilCtrl;
28
29 $this->ilias =& $ilias;
30 $this->tpl =& $tpl;
31 $this->lng =& $lng;
32 $this->ctrl =& $ilCtrl;
33
34 // Todo: check lm id
35 $this->slm =& new ilObjSCORMLearningModule($_GET["ref_id"], true);
36 }
redirection script todo: (a better solution should control the processing via a xml file)

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

◆ 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 285 of file class.ilSCORMPresentationGUI.php.

286 {
287 global $ilDB, $ilUser;
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) { //offline_mode could be inserted
294 $attempts = 1;
295 $ilDB->manipulateF(
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')));
299 } else {
300 $attempts = $val_rec["package_attempts"];
301 if ($attempts == null) $attempts = 0;
302 $attempts++;
303 $ilDB->manipulateF(
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()));
307 }
308 //only SCORM 1.2, not 2004
309 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
310 ilLPStatusWrapper::_updateStatus($this->slm->getId(), $ilUser->getId());
311 }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.

References $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 781 of file class.ilSCORMPresentationGUI.php.

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

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

◆ launchSahs()

ilSCORMPresentationGUI::launchSahs ( )

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

Reimplemented in ilAICCPresentationGUI, and ilHACPPresentationGUI.

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

540 {
541 global $ilUser, $ilDB;
542
543 $sco_id = ($_GET["sahs_id"] == "")
544 ? $_POST["sahs_id"]
545 : $_GET["sahs_id"];
546 $ref_id = ($_GET["ref_id"] == "")
547 ? $_POST["ref_id"]
548 : $_GET["ref_id"];
549
550 $this->slm =& new ilObjSCORMLearningModule($ref_id, true);
551
552 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
553 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
554 $item =& new ilSCORMItem($sco_id);
555
556 $id_ref = $item->getIdentifierRef();
557 $resource =& new ilSCORMResource();
558 $resource->readByIdRef($id_ref, $item->getSLMId());
559 //$slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]);
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);
563
564 // set item data
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());
569
570 // set alternative API name
571 if ($this->slm->getAPIAdapterName() != "API")
572 {
573 $this->tpl->setCurrentBlock("alt_api_ref");
574 $this->tpl->setVariable("API_NAME", $this->slm->getAPIAdapterName());
575 $this->tpl->parseCurrentBlock();
576 }
577
578 $val_set = $ilDB->queryF('
579 SELECT * FROM scorm_tracking
580 WHERE user_id = %s
581 AND sco_id = %s
582 AND obj_id = %s',
583 array('integer','integer','integer'),
584 array($ilUser->getId(),$sco_id,$this->slm->getId())
585 );
586 $re_value = array();
587 while($val_rec = $ilDB->fetchAssoc($val_set))
588 {
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"];
593 }
594
595 foreach($re_value as $var => $value)
596 {
597 switch ($var)
598 {
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":
608 case "cmi.comments":
609 case "cmi.student_preference.audio":
610 case "cmi.student_preference.language":
611 case "cmi.student_preference.speed":
612 case "cmi.student_preference.text":
613 $this->setSingleVariable($var, $value);
614 break;
615
616 case "cmi.objectives._count":
617 $this->setSingleVariable($var, $value);
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);
623 break;
624
625 case "cmi.interactions._count":
626 $this->setSingleVariable($var, $value);
627 $this->setArray("cmi.interactions", $value, "id", $re_value);
628 for($i=0; $i<$value; $i++)
629 {
630 $var2 = "cmi.interactions.".$i.".objectives._count";
631 if (isset($v_array[$var2]))
632 {
633 $cnt = $v_array[$var2];
634 $this->setArray("cmi.interactions.".$i.".objectives",
635 $cnt, "id", $re_value);
636 /*
637 $this->setArray("cmi.interactions.".$i.".objectives",
638 $cnt, "score.raw", $re_value);
639 $this->setArray("cmi.interactions.".$i.".objectives",
640 $cnt, "score.max", $re_value);
641 $this->setArray("cmi.interactions.".$i.".objectives",
642 $cnt, "score.min", $re_value);
643 $this->setArray("cmi.interactions.".$i.".objectives",
644 $cnt, "status", $re_value);*/
645 }
646 }
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++)
650 {
651 $var2 = "cmi.interactions.".$i.".correct_responses._count";
652 if (isset($v_array[$var2]))
653 {
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);
659 }
660 }
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);
664 break;
665 }
666 }
667
668 global $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("SCO_ALT",
673 $lng->txt("cont_status").": "
674 .$lng->txt("cont_sc_stat_running")
675 );
676 $this->tpl->parseCurrentBlock();
677
678 // set icon, if more than one SCO/Asset is presented
679 $items = ilSCORMObject::_lookupPresentableItems($this->slm->getId());
680 if (count($items) > 1
681 || strtolower(get_class($this->slm)) == "ilobjaicclearningmodule"
682 || strtolower(get_class($this->slm)) == "ilobjhacplearningmodule")
683 {
684 $this->tpl->setVariable("SWITCH_ICON_CMD", "switch_icon();");
685 }
686
687
688 // lesson mode
689 $lesson_mode = $this->slm->getDefaultLessonMode();
690 if ($this->slm->getAutoReview())
691 {
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")
695 {
696 $lesson_mode = "review";
697 }
698 }
699 $this->tpl->setVariable("LESSON_MODE", $lesson_mode);
700
701 // credit mode
702 if ($lesson_mode == "normal")
703 {
704 $this->tpl->setVariable("CREDIT_MODE",
705 str_replace("_", "-", $this->slm->getCreditMode()));
706 }
707 else
708 {
709 $this->tpl->setVariable("CREDIT_MODE", "no-credit");
710 }
711
712 // init cmi.core.total_time, cmi.core.lesson_status and cmi.core.entry
713 $sahs_obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
714 if (!isset($re_value["cmi.core.total_time"]))
715 {
716 $item->insertTrackData("cmi.core.total_time", "0000:00:00", $sahs_obj_id);
717 }
718 if (!isset($re_value["cmi.core.lesson_status"]))
719 {
720 $item->insertTrackData("cmi.core.lesson_status", "not attempted", $sahs_obj_id);
721 }
722 if (!isset($re_value["cmi.core.entry"]))
723 {
724 $item->insertTrackData("cmi.core.entry", "", $sahs_obj_id);
725 }
726
727 $this->tpl->show();
728 //echo htmlentities($this->tpl->get()); exit;
729 }
setSingleVariable($a_var, $a_value)
set single value
setArray($a_left, $a_value, $a_name, &$v_array)
set single value

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

+ Here is the call graph for this function:

◆ logMessage()

ilSCORMPresentationGUI::logMessage ( )

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

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

References $ilLog.

◆ logWarning()

ilSCORMPresentationGUI::logWarning ( )

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

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

References $ilLog.

◆ pingSession()

ilSCORMPresentationGUI::pingSession ( )

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

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

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 842 of file class.ilSCORMPresentationGUI.php.

843 {
844 for($i=0; $i<$a_value; $i++)
845 {
846 $var = $a_left.".".$i.".".$a_name;
847 if (isset($v_array[$var]))
848 {
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 }

Referenced by ilAICCPresentationGUI\launchSahs(), ilHACPPresentationGUI\launchSahs(), and launchSahs().

+ Here is the caller graph for this function:

◆ setSingleVariable()

ilSCORMPresentationGUI::setSingleVariable (   $a_var,
  $a_value 
)

set single value

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

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

Referenced by ilAICCPresentationGUI\launchSahs(), ilHACPPresentationGUI\launchSahs(), and launchSahs().

+ Here is the caller graph for this function:

◆ unloadSahs()

ilSCORMPresentationGUI::unloadSahs ( )

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

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

References $_GET, and ilUtil\getStyleSheetLocation().

+ Here is the call graph for this function:

◆ view()

ilSCORMPresentationGUI::view ( )

SCORM content screen.

Reimplemented in ilAICCPresentationGUI.

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

422 {
423 $sc_gui_object =& ilSCORMObjectGUI::getInstance($_GET["obj_id"]);
424
425 if(is_object($sc_gui_object))
426 {
427 $sc_gui_object->view();
428 }
429
430 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
431 $this->tpl->show(false);
432 }
& 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 api(), executeCommand(), and ilSCORMPresentationGUI().

◆ $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 ilSCORMPresentationGUI().


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