ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 475 of file class.ilSCORMPresentationGUI.php.

476 {
477 global $ilias;
478
479 $slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]);
480
481 $this->tpl = new ilTemplate("tpl.sahs_api.html", true, true, "Modules/ScormAicc");
482
483 // for scorm modules with only one presentable item: launch item
484 if ($_GET["autolaunch"] != "")
485 {
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 {
496 $item_command = "IliasLaunchAsset";
497 }
498 else
499 {
500 $item_command = "IliasLaunchSahs";
501 }
502 $this->tpl->setVariable("AUTO_LAUNCH_ID", $_GET["autolaunch"]);
503 $this->tpl->setVariable("AUTO_LAUNCH_CMD", "this.autoLaunch();");
504 $this->tpl->setVariable("AUTO_LAUNCH_ITEM_CMD", $item_command);
505 $this->tpl->parseCurrentBlock();
506 }
507
508 //unlimited sessions
509 if ($slm_obj->getSession()) {
510 $session_timeout = (int)($ilias->ini->readVariable("session","expire"))/2;
511 } else {
512 $session_timeout = 0;
513 }
514 $this->tpl->setVariable("PING_SESSION",$session_timeout);
515
516 $this->tpl->setVariable("USER_ID",$ilias->account->getId());
517 $this->tpl->setVariable("USER_FIRSTNAME",$ilias->account->getFirstname());
518 $this->tpl->setVariable("USER_LASTNAME",$ilias->account->getLastname());
519 $this->tpl->setVariable("USER_LOGIN",$ilias->account->getLogin());
520 $this->tpl->setVariable("USER_OU",$ilias->account->getDepartment());
521 $this->tpl->setVariable("REF_ID",$_GET["ref_id"]);
522 $this->tpl->setVariable("SESSION_ID",session_id());
523 $this->tpl->setVariable("CODE_BASE", "http://".$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, strpos ($_SERVER['PHP_SELF'], "/ilias.php")));
524
525 $this->tpl->parseCurrentBlock();
526 $this->tpl->show(false);
527 exit;
528 }
$_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

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

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

429 {
430 global $lng;
431 $this->tpl = new ilTemplate("tpl.scorm_content_select.html", true, true, "Modules/ScormAicc");
432 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
433 $this->tpl->setVariable('TXT_SPECIALPAGE',$lng->txt("seq_toc"));
434 $this->tpl->show();
435 }
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 852 of file class.ilSCORMPresentationGUI.php.

853 {
854 global $ilUser, $tree, $ilCtrl;
855
856 $allowed = false;
857 $last_access = 0;
858 $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
859 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
861 {
862 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
864 switch ($type)
865 {
866 case "scorm":
867 include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
868 $allowed = true;
869 $last_access = ilObjSCORMLearningModule::_lookupLastAccess($obj_id, $ilUser->getId());
870 break;
871 case "scorm2004":
872 include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
873 $allowed = true;
874 $last_access = ilObjSCORM2004LearningModule::_lookupLastAccess($obj_id, $ilUser->getId());
875 break;
876 default:
877 break;
878 }
879 }
880
881 if ($allowed)
882 {
883 include_once "./Services/Certificate/classes/class.ilCertificate.php";
884 include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
885 $certificate = new ilCertificate(new ilSCORMCertificateAdapter($this->slm));
886 $params = array(
887 "user_data" => ilObjUser::_lookupFields($ilUser->getId()),
888 "last_access" => $last_access
889 );
890 $certificate->outCertificate($params, true);
891 exit;
892 }
893 // redirect to parent category if certificate is not accessible
894 $parent = $tree->getParentId($_GET["ref_id"]);
895 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent);
896 $ilCtrl->redirectByClass("ilrepositorygui", "");
897 }
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)
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15

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

362 {
363 global $ilBench, $ilLog;
364
365 $ilBench->start("SCORMExplorer", "initExplorer");
366
367 $this->tpl = new ilTemplate("tpl.sahs_exp_main.html", true, true, "Modules/ScormAicc");
368
369 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
370 $exp = new ilSCORMExplorer($this->ctrl->getLinkTarget($this, "view"), $this->slm);
371 $exp->setTargetGet("obj_id");
372 $exp->setFrameTarget($a_target);
373
374 //$exp->setFiltered(true);
375 $jsApi=false;
376 if ($_GET["jsApi"] == "1") $jsApi=true;
377
378 if ($_GET["scexpand"] == "")
379 {
380 $mtree = new ilSCORMTree($this->slm->getId());
381 $expanded = $mtree->readRootId();
382 }
383 else
384 {
385 $expanded = $_GET["scexpand"];
386 }
387 $exp->setExpand($expanded);
388
389 $exp->forceExpandAll(true, false);
390 $ilBench->stop("SCORMExplorer", "initExplorer");
391
392 // build html-output
393 $ilBench->start("SCORMExplorer", "setOutput");
394 $exp->setOutput(0);
395 $ilBench->stop("SCORMExplorer", "setOutput");
396
397 $ilBench->start("SCORMExplorer", "getOutput");
398 $output = $exp->getOutput($jsApi);
399 $ilBench->stop("SCORMExplorer", "getOutput");
400
401 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
402 $this->tpl->addBlockFile("CONTENT", "content", "tpl.sahs_explorer.html", "Modules/ScormAicc");
403 //$this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_content"));
404 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
405 $this->tpl->setVariable("EXPLORER",$output);
406 $this->tpl->setVariable("ACTION", "ilias.php?baseClass=ilSAHSPresentationGUI&cmd=".$_GET["cmd"]."&frame=".$_GET["frame"].
407 "&ref_id=".$this->slm->getRefId()."&scexpand=".$_GET["scexpand"]);
408 $this->tpl->parseCurrentBlock();
409 $this->tpl->show();
410 }
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 726 of file class.ilSCORMPresentationGUI.php.

727 {
728 global $lng;
729 $this->tpl = new ilTemplate("tpl.sahs_finish_cbt.html", true, true, "Modules/ScormAicc");
730 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
731
732 // block not in template
733 // $this->tpl->setCurrentBlock("switch_icon");
734 $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
735 $this->tpl->setVariable("SCO_ICO", ilUtil::getImagePath(
736 "scorm/".str_replace(" ", "_", $_GET["status"]).'.svg')
737 );
738 $this->tpl->setVariable("SCO_ALT",
739 $lng->txt("cont_status").": "
740 .$lng->txt("cont_sc_stat_".str_replace(" ", "_", $_GET["status"])).", "
741 .$lng->txt("cont_total_time"). ": "
742 .$_GET["totime"]
743 );
744 // BEGIN Partial fix for SCO sequencing:
745 // With this partial fix, ILIAS can now proceed to the next
746 // SCO, if it is a sibling of the current SCO.
747 // This fix doesn't fix the case, if the next SCO has a
748 // different parent item.
749 //$this->tpl->setVariable("SCO_LAUNCH_ID", $_GET["launch"]);
750
751 $launch_id = $_GET['launch'];
752 if ($launch_id == 'null' || $launch_id == null) {
753 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
754 $mtree = new ilSCORMTree($this->slm->getId());
755 $node_data = $mtree->fetchSuccessorNode($_GET['sahs_id']);
756 if ($node_data && $node_data[type] == 'sit')
757 {
758 $launch_id = $node_data['child'];
759 }
760 }
761 // END Partial fix for SCO sequencing
762 $this->tpl->setVariable("SCO_LAUNCH_ID", $launch_id);
763 // $this->tpl->parseCurrentBlock();
764 $this->tpl->show();
765 }
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 $debug = $this->slm->getDebug();
133 if (count($items) > 1
134 || strtolower(get_class($this->slm)) == "ilobjaicclearningmodule"
135 || strtolower(get_class($this->slm)) == "ilobjhacplearningmodule")
136 {
137 $this->ctrl->setParameter($this, "expand", "1");
138 $this->ctrl->setParameter($this, "jsApi", "1");
139 $exp_link = $this->ctrl->getLinkTarget($this, "explorer");
140
141 // should be able to grep templates
142 if($debug)
143 {
144// $this->tpl = new ilTemplate("tpl.sahs_pres_js_debug.html", false, false, "Modules/ScormAicc");
145 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_debug.html", false, false, "Modules/ScormAicc");
146 }
147 else
148 {
149// $this->tpl = new ilTemplate("tpl.sahs_pres_js_debug.html", false, false, "Modules/ScormAicc");
150 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js.html", false, false, "Modules/ScormAicc");
151 }
152
153 $this->tpl->setVariable("EXPLORER_LINK", $exp_link);
154 $pres_link = $this->ctrl->getLinkTarget($this, "contentSelect");
155 $this->tpl->setVariable("PRESENTATION_LINK", $pres_link);
156 } else {
157
158 // should be able to grep templates
159 if($debug)
160 {
161 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_debug_one_page.html", false, false, "Modules/ScormAicc");
162 }
163 else
164 {
165 $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_one_page.html", false, false, "Modules/ScormAicc");
166 }
167
168 $this->ctrl->setParameter($this, "autolaunch", $items[0]);
169 }
170 $api_link = $this->ctrl->getLinkTarget($this, "apiInitData");
171 $this->tpl->setVariable("API_LINK", $api_link);
172 $this->tpl->show("DEFAULT", false);
173 }
174
175 exit;
176
177 }
_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.

References $lng, ilSCORMObject\_lookupPresentableItems(), exit, get_actual_attempts(), get_max_attempts(), and increase_attemptAndsave_module_version().

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

191 {
192 global $ilDB, $ilUser;
193 $val_set = $ilDB->queryF('SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
194 array('integer','integer'), array($this->slm->getId(),$ilUser->getId()));
195 $val_rec = $ilDB->fetchAssoc($val_set);
196 $attempts = $val_rec["package_attempts"];
197 if ($attempts == null) $attempts = 0;
198 return $attempts;
199 }
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 182 of file class.ilSCORMPresentationGUI.php.

182 {
183 include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
184 return ilObjSCORMInitData::get_max_attempts($this->slm->getId());
185 }
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 281 of file class.ilSCORMPresentationGUI.php.

282 {
283 global $ilDB, $ilUser;
284 $res = $ilDB->queryF(
285 'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
286 array('integer','integer'),
287 array($this->slm->getId(),$ilUser->getId()));
288 $val_rec = $ilDB->fetchAssoc($res);
289 if ($val_rec["cnt"] == 0) { //offline_mode could be inserted
290 $attempts = 1;
291 $ilDB->manipulateF(
292 'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
293 array('integer', 'integer', 'integer', 'integer', 'timestamp'),
294 array($this->slm->getId(), $ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s')));
295 } else {
296 $attempts = $val_rec["package_attempts"];
297 if ($attempts == null) $attempts = 0;
298 $attempts++;
299 $ilDB->manipulateF(
300 'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
301 array('integer', 'integer', 'timestamp', 'integer', 'integer'),
302 array($attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s'), $this->slm->getId(), $ilUser->getId()));
303 }
304 //only SCORM 1.2, not 2004
305 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
306 ilLPStatusWrapper::_updateStatus($this->slm->getId(), $ilUser->getId());
307 }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=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 776 of file class.ilSCORMPresentationGUI.php.

777 {
778 global $ilUser, $ilDB;
779
780 $sco_id = ($_GET["asset_id"] == "")
781 ? $_POST["asset_id"]
782 : $_GET["asset_id"];
783 $ref_id = ($_GET["ref_id"] == "")
784 ? $_POST["ref_id"]
785 : $_GET["ref_id"];
786
787 $this->slm =& new ilObjSCORMLearningModule($ref_id, true);
788
789 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
790 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
791 $item =& new ilSCORMItem($sco_id);
792
793 $id_ref = $item->getIdentifierRef();
794 $resource =& new ilSCORMResource();
795 $resource->readByIdRef($id_ref, $item->getSLMId());
796 $href = $resource->getHref();
797 $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output")."/".$href);
798 $this->tpl = new ilTemplate("tpl.scorm_launch_asset.html", true, true, "Modules/ScormAicc");
799 $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output")."/".$href);
800 $this->tpl->show();
801 }
$_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 534 of file class.ilSCORMPresentationGUI.php.

535 {
536 global $ilUser, $ilDB;
537
538 $sco_id = ($_GET["sahs_id"] == "")
539 ? $_POST["sahs_id"]
540 : $_GET["sahs_id"];
541 $ref_id = ($_GET["ref_id"] == "")
542 ? $_POST["ref_id"]
543 : $_GET["ref_id"];
544
545 $this->slm =& new ilObjSCORMLearningModule($ref_id, true);
546
547 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
548 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
549 $item =& new ilSCORMItem($sco_id);
550
551 $id_ref = $item->getIdentifierRef();
552 $resource =& new ilSCORMResource();
553 $resource->readByIdRef($id_ref, $item->getSLMId());
554 //$slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]);
555 $href = $resource->getHref();
556 $this->tpl = new ilTemplate("tpl.sahs_launch_cbt.html", true, true, "Modules/ScormAicc");
557 $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output")."/".$href);
558
559 // set item data
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());
564
565 // set alternative API name
566 if ($this->slm->getAPIAdapterName() != "API")
567 {
568 $this->tpl->setCurrentBlock("alt_api_ref");
569 $this->tpl->setVariable("API_NAME", $this->slm->getAPIAdapterName());
570 $this->tpl->parseCurrentBlock();
571 }
572
573 $val_set = $ilDB->queryF('
574 SELECT * FROM scorm_tracking
575 WHERE user_id = %s
576 AND sco_id = %s
577 AND obj_id = %s',
578 array('integer','integer','integer'),
579 array($ilUser->getId(),$sco_id,$this->slm->getId())
580 );
581 $re_value = array();
582 while($val_rec = $ilDB->fetchAssoc($val_set))
583 {
584 $val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
585 $val_rec["rvalue"] = str_replace("\r", "\n", $val_rec["rvalue"]);
586 $val_rec["rvalue"] = str_replace("\n", "\\n", $val_rec["rvalue"]);
587 $re_value[$val_rec["lvalue"]] = $val_rec["rvalue"];
588 }
589
590 foreach($re_value as $var => $value)
591 {
592 switch ($var)
593 {
594 case "cmi.core.lesson_location":
595 case "cmi.core.lesson_status":
596 case "cmi.core.entry":
597 case "cmi.core.score.raw":
598 case "cmi.core.score.max":
599 case "cmi.core.score.min":
600 case "cmi.core.total_time":
601 case "cmi.core.exit":
602 case "cmi.suspend_data":
603 case "cmi.comments":
604 case "cmi.student_preference.audio":
605 case "cmi.student_preference.language":
606 case "cmi.student_preference.speed":
607 case "cmi.student_preference.text":
608 $this->setSingleVariable($var, $value);
609 break;
610
611 case "cmi.objectives._count":
612 $this->setSingleVariable($var, $value);
613 $this->setArray("cmi.objectives", $value, "id", $re_value);
614 $this->setArray("cmi.objectives", $value, "score.raw", $re_value);
615 $this->setArray("cmi.objectives", $value, "score.max", $re_value);
616 $this->setArray("cmi.objectives", $value, "score.min", $re_value);
617 $this->setArray("cmi.objectives", $value, "status", $re_value);
618 break;
619
620 case "cmi.interactions._count":
621 $this->setSingleVariable($var, $value);
622 $this->setArray("cmi.interactions", $value, "id", $re_value);
623 for($i=0; $i<$value; $i++)
624 {
625 $var2 = "cmi.interactions.".$i.".objectives._count";
626 if (isset($v_array[$var2]))
627 {
628 $cnt = $v_array[$var2];
629 $this->setArray("cmi.interactions.".$i.".objectives",
630 $cnt, "id", $re_value);
631 /*
632 $this->setArray("cmi.interactions.".$i.".objectives",
633 $cnt, "score.raw", $re_value);
634 $this->setArray("cmi.interactions.".$i.".objectives",
635 $cnt, "score.max", $re_value);
636 $this->setArray("cmi.interactions.".$i.".objectives",
637 $cnt, "score.min", $re_value);
638 $this->setArray("cmi.interactions.".$i.".objectives",
639 $cnt, "status", $re_value);*/
640 }
641 }
642 $this->setArray("cmi.interactions", $value, "time", $re_value);
643 $this->setArray("cmi.interactions", $value, "type", $re_value);
644 for($i=0; $i<$value; $i++)
645 {
646 $var2 = "cmi.interactions.".$i.".correct_responses._count";
647 if (isset($v_array[$var2]))
648 {
649 $cnt = $v_array[$var2];
650 $this->setArray("cmi.interactions.".$i.".correct_responses",
651 $cnt, "pattern", $re_value);
652 $this->setArray("cmi.interactions.".$i.".correct_responses",
653 $cnt, "weighting", $re_value);
654 }
655 }
656 $this->setArray("cmi.interactions", $value, "student_response", $re_value);
657 $this->setArray("cmi.interactions", $value, "result", $re_value);
658 $this->setArray("cmi.interactions", $value, "latency", $re_value);
659 break;
660 }
661 }
662
663 global $lng;
664 $this->tpl->setCurrentBlock("switch_icon");
665 $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
666 $this->tpl->setVariable("SCO_ICO", ilUtil::getImagePath("scorm/running.svg"));
667 $this->tpl->setVariable("SCO_ALT",
668 $lng->txt("cont_status").": "
669 .$lng->txt("cont_sc_stat_running")
670 );
671 $this->tpl->parseCurrentBlock();
672
673 // set icon, if more than one SCO/Asset is presented
674 $items = ilSCORMObject::_lookupPresentableItems($this->slm->getId());
675 if (count($items) > 1
676 || strtolower(get_class($this->slm)) == "ilobjaicclearningmodule"
677 || strtolower(get_class($this->slm)) == "ilobjhacplearningmodule")
678 {
679 $this->tpl->setVariable("SWITCH_ICON_CMD", "switch_icon();");
680 }
681
682
683 // lesson mode
684 $lesson_mode = $this->slm->getDefaultLessonMode();
685 if ($this->slm->getAutoReview())
686 {
687 if ($re_value["cmi.core.lesson_status"] == "completed" ||
688 $re_value["cmi.core.lesson_status"] == "passed" ||
689 $re_value["cmi.core.lesson_status"] == "failed")
690 {
691 $lesson_mode = "review";
692 }
693 }
694 $this->tpl->setVariable("LESSON_MODE", $lesson_mode);
695
696 // credit mode
697 if ($lesson_mode == "normal")
698 {
699 $this->tpl->setVariable("CREDIT_MODE",
700 str_replace("_", "-", $this->slm->getCreditMode()));
701 }
702 else
703 {
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 {
711 $item->insertTrackData("cmi.core.total_time", "0000:00:00", $sahs_obj_id);
712 }
713 if (!isset($re_value["cmi.core.lesson_status"]))
714 {
715 $item->insertTrackData("cmi.core.lesson_status", "not attempted", $sahs_obj_id);
716 }
717 if (!isset($re_value["cmi.core.entry"]))
718 {
719 $item->insertTrackData("cmi.core.entry", "", $sahs_obj_id);
720 }
721
722 $this->tpl->show();
723 //echo htmlentities($this->tpl->get()); exit;
724 }
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 808 of file class.ilSCORMPresentationGUI.php.

808 {
809 global $ilLog;
810 $logString = file_get_contents('php://input');
811 $ilLog->write("ScormAicc: ApiLog: Message: ".$logString);
812 }

References $ilLog.

◆ logWarning()

ilSCORMPresentationGUI::logWarning ( )

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

814 {
815 global $ilLog;
816 $logString = file_get_contents('php://input');
817 $ilLog->write("ScormAicc: ApiLog: Warning: ".$logString,20);
818 }

References $ilLog.

◆ pingSession()

ilSCORMPresentationGUI::pingSession ( )

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

804 {
805 return true;
806 }

◆ setArray()

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

set single value

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

835 {
836 for($i=0; $i<$a_value; $i++)
837 {
838 $var = $a_left.".".$i.".".$a_name;
839 if (isset($v_array[$var]))
840 {
841 $this->tpl->setCurrentBlock("set_value");
842 $this->tpl->setVariable("VAR", $var);
843 $this->tpl->setVariable("VALUE", $v_array[$var]);
844 $this->tpl->parseCurrentBlock();
845 }
846 }
847 }

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

824 {
825 $this->tpl->setCurrentBlock("set_value");
826 $this->tpl->setVariable("VAR", $a_var);
827 $this->tpl->setVariable("VALUE", $a_value);
828 $this->tpl->parseCurrentBlock();
829 }

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

+ Here is the caller graph for this function:

◆ unloadSahs()

ilSCORMPresentationGUI::unloadSahs ( )

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

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

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

417 {
418 $sc_gui_object =& ilSCORMObjectGUI::getInstance($_GET["obj_id"]);
419
420 if(is_object($sc_gui_object))
421 {
422 $sc_gui_object->view();
423 }
424
425 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
426 $this->tpl->show(false);
427 }
& 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: