ILIAS  release_7 Revision v7.30-3-g800a261c036
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.

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

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"]
global $DIC
Definition: goto.php:24
redirection script todo: (a better solution should control the processing via a xml file) ...
Class ilObjSCORMLearningModule.

Member Function Documentation

◆ api()

ilSCORMPresentationGUI::api ( )

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

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

477  {
478  global $DIC;
479  $ilias = $DIC['ilias'];
480 
481  $slm_obj = new ilObjSCORMLearningModule($_GET["ref_id"]);
482 
483  $this->tpl = new ilGlobalTemplate("tpl.sahs_api.html", true, true, "Modules/ScormAicc");
484 
485  // for scorm modules with only one presentable item: launch item
486  if ($_GET["autolaunch"] != "") {
487  $this->tpl->setCurrentBlock("auto_launch");
488  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
489  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
490  $sc_object = new ilSCORMItem($_GET["autolaunch"]);
491  $id_ref = $sc_object->getIdentifierRef();
492  $sc_res_id = ilSCORMResource::_lookupIdByIdRef($id_ref, $sc_object->getSLMId());
493  $scormtype = strtolower(ilSCORMResource::_lookupScormType($sc_res_id));
494 
495  if ($scormtype == "asset") {
496  $item_command = "IliasLaunchAsset";
497  } else {
498  $item_command = "IliasLaunchSahs";
499  }
500  $this->tpl->setVariable("AUTO_LAUNCH_ID", $_GET["autolaunch"]);
501  $this->tpl->setVariable("AUTO_LAUNCH_CMD", "this.autoLaunch();");
502  $this->tpl->setVariable("AUTO_LAUNCH_ITEM_CMD", $item_command);
503  $this->tpl->parseCurrentBlock();
504  }
505 
506  //unlimited sessions
507  if ($slm_obj->getSession()) {
508  $session_timeout = (int) ($ilias->ini->readVariable("session", "expire")) / 2;
509  } else {
510  $session_timeout = 0;
511  }
512  $this->tpl->setVariable("PING_SESSION", $session_timeout);
513 
514  $this->tpl->setVariable("USER_ID", $ilias->account->getId());
515  $this->tpl->setVariable("USER_FIRSTNAME", $ilias->account->getFirstname());
516  $this->tpl->setVariable("USER_LASTNAME", $ilias->account->getLastname());
517  $this->tpl->setVariable("USER_LOGIN", $ilias->account->getLogin());
518  $this->tpl->setVariable("USER_OU", $ilias->account->getDepartment());
519  $this->tpl->setVariable("REF_ID", $_GET["ref_id"]);
520  $this->tpl->setVariable("SESSION_ID", session_id());
521  $this->tpl->setVariable("CODE_BASE", "http://" . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], "/ilias.php")));
522 
523  $this->tpl->parseCurrentBlock();
524  $this->tpl->printToStdout(false);
525  exit;
526  }
exit
Definition: login.php:29
special template class to simplify handling of ITX/PEAR
$_GET["client_id"]
static _lookupIdByIdRef($a_id_ref, $a_slm_id)
static _lookupScormType($a_obj_id)
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
global $DIC
Definition: goto.php:24
SCORM Item.
Class ilObjSCORMLearningModule.
+ Here is the call graph for this function:

◆ apiInitData()

ilSCORMPresentationGUI::apiInitData ( )

SCORM Data for Javascript-API.

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

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

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

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

420  {
421  global $DIC;
422  $lng = $DIC['lng'];
423  $this->tpl = new ilGlobalTemplate("tpl.scorm_content_select.html", true, true, "Modules/ScormAicc");
424  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
425  $this->tpl->setVariable('TXT_SPECIALPAGE', $lng->txt("seq_toc"));
426  $this->tpl->printToStdout();
427  }
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ downloadCertificate()

ilSCORMPresentationGUI::downloadCertificate ( )

Download the certificate for the active user.

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

References $_GET, $DIC, $ilUser, ilObject\_lookupObjId(), ilCertificatePdfAction\downloadPdf(), and exit.

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

◆ executeCommand()

ilSCORMPresentationGUI::executeCommand ( )

execute command

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

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

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  }
$_GET["client_id"]
global $DIC
Definition: goto.php:24

◆ explorer()

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

save the active module version to scorm_tracking

output table of content

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

References $_GET, $DIC, $ilBench, $slm, ilUtil\getStyleSheetLocation(), ilTree\readRootId(), and ilExplorer\setTargetGet().

351  {
352  global $DIC;
353  $ilBench = $DIC['ilBench'];
354  $ilLog = $DIC['ilLog'];
355 
356  $ilBench->start("SCORMExplorer", "initExplorer");
357 
358  $this->tpl = new ilGlobalTemplate("tpl.sahs_exp_main.html", true, true, "Modules/ScormAicc");
359 
360  require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
361  $exp = new ilSCORMExplorer($this->ctrl->getLinkTarget($this, "view"), $this->slm);
362  $exp->setTargetGet("obj_id");
363  $exp->setFrameTarget($a_target);
364 
365  //$exp->setFiltered(true);
366  $jsApi = false;
367  if ($_GET["jsApi"] == "1") {
368  $jsApi = true;
369  }
370 
371  if ($_GET["scexpand"] == "") {
372  $mtree = new ilSCORMTree($this->slm->getId());
373  $expanded = $mtree->readRootId();
374  } else {
375  $expanded = $_GET["scexpand"];
376  }
377  $exp->setExpand($expanded);
378 
379  $exp->forceExpandAll(true, false);
380  $ilBench->stop("SCORMExplorer", "initExplorer");
381 
382  // build html-output
383  $ilBench->start("SCORMExplorer", "setOutput");
384  $exp->setOutput(0);
385  $ilBench->stop("SCORMExplorer", "setOutput");
386 
387  $ilBench->start("SCORMExplorer", "getOutput");
388  $output = $exp->getOutput($jsApi);
389  $ilBench->stop("SCORMExplorer", "getOutput");
390 
391  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
392  $this->tpl->addBlockFile("CONTENT", "content", "tpl.sahs_explorer.html", "Modules/ScormAicc");
393  //$this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_content"));
394  $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
395  $this->tpl->setVariable("EXPLORER", $output);
396  $this->tpl->setVariable("ACTION", "ilias.php?baseClass=ilSAHSPresentationGUI&cmd=" . $_GET["cmd"] . "&frame=" . $_GET["frame"] .
397  "&ref_id=" . $this->slm->getRefId() . "&scexpand=" . $_GET["scexpand"]);
398  $this->tpl->parseCurrentBlock();
399  //BUG 16794? $this->tpl->show();
400  $this->tpl->printToStdout("DEFAULT", false);
401  }
setTargetGet($a_target_get)
set the varname in Get-string public
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
global $DIC
Definition: goto.php:24
Explorer View for SCORM Learning Modules.
SCORM Object Tree.
global $ilBench
Definition: ilias.php:21
readRootId()
read root id from database
+ Here is the call graph for this function:

◆ finishSahs()

ilSCORMPresentationGUI::finishSahs ( )

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

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

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

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

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 ilGlobalTemplate("tpl.sahs_pres_frameset_js_debug.html", false, false, "Modules/ScormAicc");
122  } else {
123  $this->tpl = new ilGlobalTemplate("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 ilGlobalTemplate("tpl.sahs_pres_frameset_js_debug_one_page.html", false, false, "Modules/ScormAicc");
132  } else {
133  $this->tpl = new ilGlobalTemplate("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("TITLE", $this->slm->getTitle());
140  $this->tpl->setVariable("API_LINK", $api_link);
141  $this->tpl->printToStdout("DEFAULT", false);
142 
143 
144  exit;
145  }
exit
Definition: login.php:29
special template class to simplify handling of ITX/PEAR
static signFolderOfStartFile($start_file_path)
static _lookupPresentableItems($a_slm_id)
Count number of presentable SCOs/Assets of SCORM learning module.
global $DIC
Definition: goto.php:24
increase_attemptAndsave_module_version()
Increases attempts by one for this package.
get_actual_attempts()
Get number of actual attempts for the user.
+ 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 159 of file class.ilSCORMPresentationGUI.php.

References $DIC, $ilDB, and $ilUser.

Referenced by frameset().

160  {
161  global $DIC;
162  $ilDB = $DIC['ilDB'];
163  $ilUser = $DIC['ilUser'];
164  $val_set = $ilDB->queryF(
165  'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
166  array('integer','integer'),
167  array($this->slm->getId(),$ilUser->getId())
168  );
169  $val_rec = $ilDB->fetchAssoc($val_set);
170  $attempts = $val_rec["package_attempts"];
171  if ($attempts == null) {
172  $attempts = 0;
173  }
174  return $attempts;
175  }
global $DIC
Definition: goto.php:24
global $ilDB
$ilUser
Definition: imgupload.php:18
+ 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 150 of file class.ilSCORMPresentationGUI.php.

References ilObjSCORMInitData\get_max_attempts().

Referenced by frameset().

151  {
152  include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
153  return ilObjSCORMInitData::get_max_attempts($this->slm->getId());
154  }
static get_max_attempts($a_packageId)
Get max.
+ 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 261 of file class.ilSCORMPresentationGUI.php.

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

Referenced by frameset().

262  {
263  global $DIC;
264  $ilDB = $DIC['ilDB'];
265  $ilUser = $DIC['ilUser'];
266  $res = $ilDB->queryF(
267  'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
268  array('integer','integer'),
269  array($this->slm->getId(),$ilUser->getId())
270  );
271  $val_rec = $ilDB->fetchAssoc($res);
272  if ($val_rec["cnt"] == 0) { //offline_mode could be inserted
273  $attempts = 1;
274  $ilDB->manipulateF(
275  'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
276  array('integer', 'integer', 'integer', 'integer', 'timestamp'),
277  array($this->slm->getId(), $ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s'))
278  );
279  } else {
280  $attempts = $val_rec["package_attempts"];
281  if ($attempts == null) {
282  $attempts = 0;
283  }
284  $attempts++;
285  $ilDB->manipulateF(
286  'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
287  array('integer', 'integer', 'timestamp', 'integer', 'integer'),
288  array($attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s'), $this->slm->getId(), $ilUser->getId())
289  );
290  }
291  //only SCORM 1.2, not 2004
292  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
293  ilLPStatusWrapper::_updateStatus($this->slm->getId(), $ilUser->getId());
294  }
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
global $DIC
Definition: goto.php:24
global $ilDB
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ launchAsset()

ilSCORMPresentationGUI::launchAsset ( )

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

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

779  {
780  global $DIC;
781  $ilUser = $DIC['ilUser'];
782  $ilDB = $DIC['ilDB'];
783 
784  $sco_id = ($_GET["asset_id"] == "")
785  ? $_POST["asset_id"]
786  : $_GET["asset_id"];
787  $ref_id = ($_GET["ref_id"] == "")
788  ? $_POST["ref_id"]
789  : $_GET["ref_id"];
790 
791  $this->slm = new ilObjSCORMLearningModule($ref_id, true);
792 
793  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
794  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
795  $item = new ilSCORMItem($sco_id);
796 
797  $id_ref = $item->getIdentifierRef();
798  $resource = new ilSCORMResource();
799  $resource->readByIdRef($id_ref, $item->getSLMId());
800  $href = $resource->getHref();
801  $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output") . "/" . $href);
802  $this->tpl = new ilGlobalTemplate("tpl.scorm_launch_asset.html", true, true, "Modules/ScormAicc");
803  $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output") . "/" . $href);
804  $this->tpl->printToStdout();
805  }
special template class to simplify handling of ITX/PEAR
$_GET["client_id"]
global $DIC
Definition: goto.php:24
SCORM Item.
global $ilDB
$ilUser
Definition: imgupload.php:18
Class ilObjSCORMLearningModule.
$_POST["username"]

◆ launchSahs()

ilSCORMPresentationGUI::launchSahs ( )

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

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

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

533  {
534  global $DIC;
535  $ilUser = $DIC['ilUser'];
536  $ilDB = $DIC['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 ilGlobalTemplate("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  $this->tpl->setCurrentBlock("alt_api_ref");
568  $this->tpl->setVariable("API_NAME", $this->slm->getAPIAdapterName());
569  $this->tpl->parseCurrentBlock();
570  }
571 
572  $val_set = $ilDB->queryF(
573  '
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  $val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
584  $val_rec["rvalue"] = str_replace("\r", "\n", $val_rec["rvalue"]);
585  $val_rec["rvalue"] = str_replace("\n", "\\n", $val_rec["rvalue"]);
586  $re_value[$val_rec["lvalue"]] = $val_rec["rvalue"];
587  }
588 
589  foreach ($re_value as $var => $value) {
590  switch ($var) {
591  case "cmi.core.lesson_location":
592  case "cmi.core.lesson_status":
593  case "cmi.core.entry":
594  case "cmi.core.score.raw":
595  case "cmi.core.score.max":
596  case "cmi.core.score.min":
597  case "cmi.core.total_time":
598  case "cmi.core.exit":
599  case "cmi.suspend_data":
600  case "cmi.comments":
601  case "cmi.student_preference.audio":
602  case "cmi.student_preference.language":
603  case "cmi.student_preference.speed":
604  case "cmi.student_preference.text":
605  $this->setSingleVariable($var, $value);
606  break;
607 
608  case "cmi.objectives._count":
609  $this->setSingleVariable($var, $value);
610  $this->setArray("cmi.objectives", $value, "id", $re_value);
611  $this->setArray("cmi.objectives", $value, "score.raw", $re_value);
612  $this->setArray("cmi.objectives", $value, "score.max", $re_value);
613  $this->setArray("cmi.objectives", $value, "score.min", $re_value);
614  $this->setArray("cmi.objectives", $value, "status", $re_value);
615  break;
616 
617  case "cmi.interactions._count":
618  $this->setSingleVariable($var, $value);
619  $this->setArray("cmi.interactions", $value, "id", $re_value);
620  for ($i = 0; $i < $value; $i++) {
621  $var2 = "cmi.interactions." . $i . ".objectives._count";
622  if (isset($v_array[$var2])) {
623  $cnt = $v_array[$var2];
624  $this->setArray(
625  "cmi.interactions." . $i . ".objectives",
626  $cnt,
627  "id",
628  $re_value
629  );
630  /*
631  $this->setArray("cmi.interactions.".$i.".objectives",
632  $cnt, "score.raw", $re_value);
633  $this->setArray("cmi.interactions.".$i.".objectives",
634  $cnt, "score.max", $re_value);
635  $this->setArray("cmi.interactions.".$i.".objectives",
636  $cnt, "score.min", $re_value);
637  $this->setArray("cmi.interactions.".$i.".objectives",
638  $cnt, "status", $re_value);*/
639  }
640  }
641  $this->setArray("cmi.interactions", $value, "time", $re_value);
642  $this->setArray("cmi.interactions", $value, "type", $re_value);
643  for ($i = 0; $i < $value; $i++) {
644  $var2 = "cmi.interactions." . $i . ".correct_responses._count";
645  if (isset($v_array[$var2])) {
646  $cnt = $v_array[$var2];
647  $this->setArray(
648  "cmi.interactions." . $i . ".correct_responses",
649  $cnt,
650  "pattern",
651  $re_value
652  );
653  $this->setArray(
654  "cmi.interactions." . $i . ".correct_responses",
655  $cnt,
656  "weighting",
657  $re_value
658  );
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 $DIC;
669  $lng = $DIC['lng'];
670  $this->tpl->setCurrentBlock("switch_icon");
671  $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
672  $this->tpl->setVariable("SCO_ICO", ilUtil::getImagePath("scorm/running.svg"));
673  $this->tpl->setVariable(
674  "SCO_ALT",
675  $lng->txt("cont_status") . ": "
676  . $lng->txt("cont_sc_stat_running")
677  );
678  $this->tpl->parseCurrentBlock();
679 
680  // set icon, if more than one SCO/Asset is presented
681  $items = ilSCORMObject::_lookupPresentableItems($this->slm->getId());
682  if (count($items) > 1) {
683  $this->tpl->setVariable("SWITCH_ICON_CMD", "switch_icon();");
684  }
685 
686 
687  // lesson mode
688  $lesson_mode = $this->slm->getDefaultLessonMode();
689  if ($this->slm->getAutoReview()) {
690  if ($re_value["cmi.core.lesson_status"] == "completed" ||
691  $re_value["cmi.core.lesson_status"] == "passed" ||
692  $re_value["cmi.core.lesson_status"] == "failed") {
693  $lesson_mode = "review";
694  }
695  }
696  $this->tpl->setVariable("LESSON_MODE", $lesson_mode);
697 
698  // credit mode
699  if ($lesson_mode == "normal") {
700  $this->tpl->setVariable(
701  "CREDIT_MODE",
702  str_replace("_", "-", $this->slm->getCreditMode())
703  );
704  } else {
705  $this->tpl->setVariable("CREDIT_MODE", "no-credit");
706  }
707 
708  // init cmi.core.total_time, cmi.core.lesson_status and cmi.core.entry
709  $sahs_obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
710  if (!isset($re_value["cmi.core.total_time"])) {
711  $item->insertTrackData("cmi.core.total_time", "0000:00:00", $sahs_obj_id);
712  }
713  if (!isset($re_value["cmi.core.lesson_status"])) {
714  $item->insertTrackData("cmi.core.lesson_status", "not attempted", $sahs_obj_id);
715  }
716  if (!isset($re_value["cmi.core.entry"])) {
717  $item->insertTrackData("cmi.core.entry", "", $sahs_obj_id);
718  }
719 
720  $this->tpl->printToStdout();
721  //echo htmlentities($this->tpl->get()); exit;
722  }
setArray($a_left, $a_value, $a_name, &$v_array)
set single value
special template class to simplify handling of ITX/PEAR
$_GET["client_id"]
setSingleVariable($a_var, $a_value)
set single value
static _lookupPresentableItems($a_slm_id)
Count number of presentable SCOs/Assets of SCORM learning module.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
SCORM Item.
global $ilDB
$ilUser
Definition: imgupload.php:18
Class ilObjSCORMLearningModule.
$_POST["username"]
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ logMessage()

ilSCORMPresentationGUI::logMessage ( )

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

References $DIC.

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

◆ logWarning()

ilSCORMPresentationGUI::logWarning ( )

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

References $DIC.

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

◆ pingSession()

ilSCORMPresentationGUI::pingSession ( )

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

References ilWACSignedPath\signFolderOfStartFile().

808  {
809  //WAC
810  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
811  ilWACSignedPath::signFolderOfStartFile($this->slm->getDataDirectory() . '/imsmanifest.xml');
812  return true;
813  }
static signFolderOfStartFile($start_file_path)
+ 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 845 of file class.ilSCORMPresentationGUI.php.

References $i.

Referenced by launchSahs().

846  {
847  for ($i = 0; $i < $a_value; $i++) {
848  $var = $a_left . "." . $i . "." . $a_name;
849  if (isset($v_array[$var])) {
850  $this->tpl->setCurrentBlock("set_value");
851  $this->tpl->setVariable("VAR", $var);
852  $this->tpl->setVariable("VALUE", $v_array[$var]);
853  $this->tpl->parseCurrentBlock();
854  }
855  }
856  }
$i
Definition: metadata.php:24
+ Here is the caller graph for this function:

◆ setSingleVariable()

ilSCORMPresentationGUI::setSingleVariable (   $a_var,
  $a_value 
)

set single value

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

Referenced by launchSahs().

835  {
836  $this->tpl->setCurrentBlock("set_value");
837  $this->tpl->setVariable("VAR", $a_var);
838  $this->tpl->setVariable("VALUE", $a_value);
839  $this->tpl->parseCurrentBlock();
840  }
+ Here is the caller graph for this function:

◆ unloadSahs()

ilSCORMPresentationGUI::unloadSahs ( )

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

References $_GET, and ilUtil\getStyleSheetLocation().

770  {
771  $this->tpl = new ilGlobalTemplate("tpl.sahs_unload_cbt.html", true, true, "Modules/ScormAicc");
772  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
773  $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
774  $this->tpl->printToStdout();
775  }
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
+ Here is the call graph for this function:

◆ view()

ilSCORMPresentationGUI::view ( )

SCORM content screen.

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

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

408  {
409  $sc_gui_object = ilSCORMObjectGUI::getInstance($_GET["obj_id"]);
410 
411  if (is_object($sc_gui_object)) {
412  $sc_gui_object->view();
413  }
414 
415  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
416  $this->tpl->printToStdout(false);
417  }
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
& getInstance($a_id)
get instance of specialized GUI class
+ 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.

Referenced by explorer().

◆ $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: