ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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, $ilCtrl, $ilias, $lng, and $tpl.

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  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
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 446 of file class.ilSCORMPresentationGUI.php.

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

447  {
448  global $ilias;
449 
450  $slm_obj = new ilObjSCORMLearningModule($_GET["ref_id"]);
451 
452  $this->tpl = new ilTemplate("tpl.sahs_api.html", true, true, "Modules/ScormAicc");
453 
454  // for scorm modules with only one presentable item: launch item
455  if ($_GET["autolaunch"] != "") {
456  $this->tpl->setCurrentBlock("auto_launch");
457  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
458  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
459  $sc_object = new ilSCORMItem($_GET["autolaunch"]);
460  $id_ref = $sc_object->getIdentifierRef();
461  $sc_res_id = ilSCORMResource::_lookupIdByIdRef($id_ref, $sc_object->getSLMId());
462  $scormtype = strtolower(ilSCORMResource::_lookupScormType($sc_res_id));
463 
464  if ($scormtype == "asset") {
465  $item_command = "IliasLaunchAsset";
466  } else {
467  $item_command = "IliasLaunchSahs";
468  }
469  $this->tpl->setVariable("AUTO_LAUNCH_ID", $_GET["autolaunch"]);
470  $this->tpl->setVariable("AUTO_LAUNCH_CMD", "this.autoLaunch();");
471  $this->tpl->setVariable("AUTO_LAUNCH_ITEM_CMD", $item_command);
472  $this->tpl->parseCurrentBlock();
473  }
474 
475  //unlimited sessions
476  if ($slm_obj->getSession()) {
477  $session_timeout = (int) ($ilias->ini->readVariable("session", "expire"))/2;
478  } else {
479  $session_timeout = 0;
480  }
481  $this->tpl->setVariable("PING_SESSION", $session_timeout);
482 
483  $this->tpl->setVariable("USER_ID", $ilias->account->getId());
484  $this->tpl->setVariable("USER_FIRSTNAME", $ilias->account->getFirstname());
485  $this->tpl->setVariable("USER_LASTNAME", $ilias->account->getLastname());
486  $this->tpl->setVariable("USER_LOGIN", $ilias->account->getLogin());
487  $this->tpl->setVariable("USER_OU", $ilias->account->getDepartment());
488  $this->tpl->setVariable("REF_ID", $_GET["ref_id"]);
489  $this->tpl->setVariable("SESSION_ID", session_id());
490  $this->tpl->setVariable("CODE_BASE", "http://" . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], "/ilias.php")));
491 
492  $this->tpl->parseCurrentBlock();
493  $this->tpl->show(false);
494  exit;
495  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$_GET["client_id"]
static _lookupIdByIdRef($a_id_ref, $a_slm_id)
static _lookupScormType($a_obj_id)
special template class to simplify handling of ITX/PEAR
SCORM Item.
Class ilObjSCORMLearningModule.
+ Here is the call graph for this function:

◆ apiInitData()

ilSCORMPresentationGUI::apiInitData ( )

SCORM Data for Javascript-API.

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

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

408  {
409  // global $ilias, $ilLog, $ilUser, $lng, $ilDB;
410 
411  if ($_GET["ref_id"] == "") {
412  print('alert("no start without ref_id");');
413  die;
414  }
415 
416  header('Content-Type: text/javascript; charset=UTF-8');
417  print("function iliasApi() {\r\n");
418  $js_data = file_get_contents("./Modules/ScormAicc/scripts/basisAPI.js");
419  echo $js_data;
420  $js_data = file_get_contents("./Modules/ScormAicc/scripts/SCORM1_2standard.js");//want to give opportunities to different files (Uwe Kohnle)
421  echo $js_data;
422  print("}\r\n");
423 
424  include_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php");
425 
426  print("IliasScormVars=" . ilObjSCORMInitData::getIliasScormVars($this->slm) . ";\r\n");
427 
428  //Resources
429  print("IliasScormResources=" . ilObjSCORMInitData::getIliasScormResources($this->slm->getId()) . ";\r\n");
430 
431  //Tree
432  print("IliasScormTree=" . ilObjSCORMInitData::getIliasScormTree($this->slm->getId()) . ";\r\n");
433 
434  //prevdata
435  print("IliasScormData=" . ilObjSCORMInitData::getIliasScormData($this->slm->getId()) . ";\r\n");
436 
437  // set alternative API name - not necessary for scorm
438  if ($this->slm->getAPIAdapterName() != "API") {
439  print('var ' . $this->slm->getAPIAdapterName() . '=new iliasApi();');
440  } else {
441  print('var API=new iliasApi();');
442  }
443  }
static getIliasScormData($a_packageId)
static getIliasScormResources($a_packageId)
$_GET["client_id"]
static getIliasScormVars($slm_obj)
Add a drawing to the header
Definition: 04printing.php:69
static getIliasScormTree($a_packageId)
+ Here is the call graph for this function:

◆ attrib2arr()

ilSCORMPresentationGUI::attrib2arr ( $a_attributes)

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

References array.

62  {
63  $attr = array();
64 
65  if (!is_array($a_attributes)) {
66  return $attr;
67  }
68  foreach ($a_attributes as $attribute) {
69  $attr[$attribute->name()] = $attribute->value();
70  }
71 
72  return $attr;
73  }
Create styles array
The data for the language used.

◆ contentSelect()

ilSCORMPresentationGUI::contentSelect ( )

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

References $lng, and ilUtil\getStyleSheetLocation().

396  {
397  global $lng;
398  $this->tpl = new ilTemplate("tpl.scorm_content_select.html", true, true, "Modules/ScormAicc");
399  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
400  $this->tpl->setVariable('TXT_SPECIALPAGE', $lng->txt("seq_toc"));
401  $this->tpl->show();
402  }
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ downloadCertificate()

ilSCORMPresentationGUI::downloadCertificate ( )

Download the certificate for the active user.

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

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

823  {
824  global $ilUser, $tree, $ilCtrl;
825 
826  $allowed = false;
827  $last_access = 0;
828  $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
829  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
831  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
833  switch ($type) {
834  case "scorm":
835  include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
836  $allowed = true;
837  $last_access = ilObjSCORMLearningModule::_lookupLastAccess($obj_id, $ilUser->getId());
838  break;
839  case "scorm2004":
840  include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
841  $allowed = true;
842  $last_access = ilObjSCORM2004LearningModule::_lookupLastAccess($obj_id, $ilUser->getId());
843  break;
844  default:
845  break;
846  }
847  }
848 
849  if ($allowed) {
850  include_once "./Services/Certificate/classes/class.ilCertificate.php";
851  include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
853  $params = array(
854  "user_data" => ilObjUser::_lookupFields($ilUser->getId()),
855  "last_access" => $last_access
856  );
857  $certificate->outCertificate($params, true);
858  exit;
859  }
860  // redirect to parent category if certificate is not accessible
861  $parent = $tree->getParentId($_GET["ref_id"]);
862  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent);
863  $ilCtrl->redirectByClass("ilrepositorygui", "");
864  }
$params
Definition: disable.php:11
static _lookupLastAccess($a_obj_id, $a_usr_id)
Return the last access timestamp for a given user.
$type
$_GET["client_id"]
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static _lookupLastAccess($a_obj_id, $a_usr_id)
Return the last access timestamp for a given user.
global $ilCtrl
Definition: ilias.php:18
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
Create PDF certificates.
static _lookupFields($a_user_id)
lookup fields (deprecated; use more specific methods instead)
static _lookupUserCertificate($obj_id, $usr_id=0)
Checks whether a certificate exists for the active user or not.
+ Here is the call graph for this function:

◆ executeCommand()

ilSCORMPresentationGUI::executeCommand ( )

execute command

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

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

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  $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
52  }
53 
54  switch ($next_class) {
55  default:
56  $this->$cmd();
57  }
58  }
$_GET["client_id"]

◆ explorer()

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

save the active module version to scorm_tracking

output table of content

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

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

329  {
330  global $ilBench, $ilLog;
331 
332  $ilBench->start("SCORMExplorer", "initExplorer");
333 
334  $this->tpl = new ilTemplate("tpl.sahs_exp_main.html", true, true, "Modules/ScormAicc");
335 
336  require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
337  $exp = new ilSCORMExplorer($this->ctrl->getLinkTarget($this, "view"), $this->slm);
338  $exp->setTargetGet("obj_id");
339  $exp->setFrameTarget($a_target);
340 
341  //$exp->setFiltered(true);
342  $jsApi=false;
343  if ($_GET["jsApi"] == "1") {
344  $jsApi=true;
345  }
346 
347  if ($_GET["scexpand"] == "") {
348  $mtree = new ilSCORMTree($this->slm->getId());
349  $expanded = $mtree->readRootId();
350  } else {
351  $expanded = $_GET["scexpand"];
352  }
353  $exp->setExpand($expanded);
354 
355  $exp->forceExpandAll(true, false);
356  $ilBench->stop("SCORMExplorer", "initExplorer");
357 
358  // build html-output
359  $ilBench->start("SCORMExplorer", "setOutput");
360  $exp->setOutput(0);
361  $ilBench->stop("SCORMExplorer", "setOutput");
362 
363  $ilBench->start("SCORMExplorer", "getOutput");
364  $output = $exp->getOutput($jsApi);
365  $ilBench->stop("SCORMExplorer", "getOutput");
366 
367  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
368  $this->tpl->addBlockFile("CONTENT", "content", "tpl.sahs_explorer.html", "Modules/ScormAicc");
369  //$this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_content"));
370  $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
371  $this->tpl->setVariable("EXPLORER", $output);
372  $this->tpl->setVariable("ACTION", "ilias.php?baseClass=ilSAHSPresentationGUI&cmd=" . $_GET["cmd"] . "&frame=" . $_GET["frame"] .
373  "&ref_id=" . $this->slm->getRefId() . "&scexpand=" . $_GET["scexpand"]);
374  $this->tpl->parseCurrentBlock();
375  //BUG 16794? $this->tpl->show();
376  $this->tpl->show("DEFAULT", false);
377  }
setTargetGet($a_target_get)
set the varname in Get-string public
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
special template class to simplify handling of ITX/PEAR
Explorer View for SCORM Learning Modules.
SCORM Object Tree.
global $ilBench
Definition: ilias.php:18
readRootId()
read root id from database
+ Here is the call graph for this function:

◆ finishSahs()

ilSCORMPresentationGUI::finishSahs ( )

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

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

691  {
692  global $lng;
693  $this->tpl = new ilTemplate("tpl.sahs_finish_cbt.html", true, true, "Modules/ScormAicc");
694  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
695 
696  // block not in template
697  // $this->tpl->setCurrentBlock("switch_icon");
698  $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
699  $this->tpl->setVariable(
700  "SCO_ICO",
702  "scorm/" . str_replace(" ", "_", $_GET["status"]) . '.svg'
703  )
704  );
705  $this->tpl->setVariable(
706  "SCO_ALT",
707  $lng->txt("cont_status") . ": "
708  . $lng->txt("cont_sc_stat_" . str_replace(" ", "_", $_GET["status"])) . ", "
709  . $lng->txt("cont_total_time") . ": "
710  . $_GET["totime"]
711  );
712  // BEGIN Partial fix for SCO sequencing:
713  // With this partial fix, ILIAS can now proceed to the next
714  // SCO, if it is a sibling of the current SCO.
715  // This fix doesn't fix the case, if the next SCO has a
716  // different parent item.
717  //$this->tpl->setVariable("SCO_LAUNCH_ID", $_GET["launch"]);
718 
719  $launch_id = $_GET['launch'];
720  if ($launch_id == 'null' || $launch_id == null) {
721  require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
722  $mtree = new ilSCORMTree($this->slm->getId());
723  $node_data = $mtree->fetchSuccessorNode($_GET['sahs_id']);
724  if ($node_data && $node_data[type] == 'sit') {
725  $launch_id = $node_data['child'];
726  }
727  }
728  // END Partial fix for SCO sequencing
729  $this->tpl->setVariable("SCO_LAUNCH_ID", $launch_id);
730  // $this->tpl->parseCurrentBlock();
731  $this->tpl->show();
732  }
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)
special template class to simplify handling of ITX/PEAR
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 80 of file class.ilSCORMPresentationGUI.php.

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

81  {
82  global $lng;
83  $javascriptAPI = true;
84  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
85  $items = ilSCORMObject::_lookupPresentableItems($this->slm->getId());
86 
87  //check for max_attempts and raise error if max_attempts is exceeded
88  if ($this->get_max_attempts()!=0) {
89  if ($this->get_actual_attempts() >= $this->get_max_attempts()) {
90  header('Content-Type: text/html; charset=utf-8');
91  echo($lng->txt("cont_sc_max_attempt_exceed"));
92  exit;
93  }
94  }
95 
97 
98  //WAC
99  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
100  ilWACSignedPath::signFolderOfStartFile($this->slm->getDataDirectory() . '/imsmanifest.xml');
101 
102  $debug = $this->slm->getDebug();
103  if (count($items) > 1) {
104  $this->ctrl->setParameter($this, "expand", "1");
105  $this->ctrl->setParameter($this, "jsApi", "1");
106  $exp_link = $this->ctrl->getLinkTarget($this, "explorer");
107 
108  // should be able to grep templates
109  if ($debug) {
110  $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_debug.html", false, false, "Modules/ScormAicc");
111  } else {
112  $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js.html", false, false, "Modules/ScormAicc");
113  }
114 
115  $this->tpl->setVariable("EXPLORER_LINK", $exp_link);
116  $pres_link = $this->ctrl->getLinkTarget($this, "contentSelect");
117  $this->tpl->setVariable("PRESENTATION_LINK", $pres_link);
118  } else {
119  if ($debug) {
120  $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_debug_one_page.html", false, false, "Modules/ScormAicc");
121  } else {
122  $this->tpl = new ilTemplate("tpl.sahs_pres_frameset_js_one_page.html", false, false, "Modules/ScormAicc");
123  }
124 
125  $this->ctrl->setParameter($this, "autolaunch", $items[0]);
126  }
127  $api_link = $this->ctrl->getLinkTarget($this, "apiInitData");
128  $this->tpl->setVariable("API_LINK", $api_link);
129  $this->tpl->show("DEFAULT", false);
130 
131 
132  exit;
133  }
static signFolderOfStartFile($start_file_path)
static _lookupPresentableItems($a_slm_id)
Count number of presentable SCOs/Assets of SCORM learning module.
special template class to simplify handling of ITX/PEAR
increase_attemptAndsave_module_version()
Increases attempts by one for this package.
Add a drawing to the header
Definition: 04printing.php:69
$debug
Definition: loganalyzer.php:16
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 147 of file class.ilSCORMPresentationGUI.php.

References $ilDB, $ilUser, and array.

Referenced by frameset().

148  {
149  global $ilDB, $ilUser;
150  $val_set = $ilDB->queryF(
151  'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
152  array('integer','integer'),
153  array($this->slm->getId(),$ilUser->getId())
154  );
155  $val_rec = $ilDB->fetchAssoc($val_set);
156  $attempts = $val_rec["package_attempts"];
157  if ($attempts == null) {
158  $attempts = 0;
159  }
160  return $attempts;
161  }
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB
+ 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 138 of file class.ilSCORMPresentationGUI.php.

References ilObjSCORMInitData\get_max_attempts().

Referenced by frameset().

139  {
140  include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
141  return ilObjSCORMInitData::get_max_attempts($this->slm->getId());
142  }
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 243 of file class.ilSCORMPresentationGUI.php.

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

Referenced by frameset().

244  {
245  global $ilDB, $ilUser;
246  $res = $ilDB->queryF(
247  'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
248  array('integer','integer'),
249  array($this->slm->getId(),$ilUser->getId())
250  );
251  $val_rec = $ilDB->fetchAssoc($res);
252  if ($val_rec["cnt"] == 0) { //offline_mode could be inserted
253  $attempts = 1;
254  $ilDB->manipulateF(
255  'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
256  array('integer', 'integer', 'integer', 'integer', 'timestamp'),
257  array($this->slm->getId(), $ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s'))
258  );
259  } else {
260  $attempts = $val_rec["package_attempts"];
261  if ($attempts == null) {
262  $attempts = 0;
263  }
264  $attempts++;
265  $ilDB->manipulateF(
266  'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
267  array('integer', 'integer', 'timestamp', 'integer', 'integer'),
268  array($attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s'), $this->slm->getId(), $ilUser->getId())
269  );
270  }
271  //only SCORM 1.2, not 2004
272  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
273  ilLPStatusWrapper::_updateStatus($this->slm->getId(), $ilUser->getId());
274  }
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
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ launchAsset()

ilSCORMPresentationGUI::launchAsset ( )

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

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

744  {
745  global $ilUser, $ilDB;
746 
747  $sco_id = ($_GET["asset_id"] == "")
748  ? $_POST["asset_id"]
749  : $_GET["asset_id"];
750  $ref_id = ($_GET["ref_id"] == "")
751  ? $_POST["ref_id"]
752  : $_GET["ref_id"];
753 
754  $this->slm = new ilObjSCORMLearningModule($ref_id, true);
755 
756  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
757  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
758  $item = new ilSCORMItem($sco_id);
759 
760  $id_ref = $item->getIdentifierRef();
761  $resource = new ilSCORMResource();
762  $resource->readByIdRef($id_ref, $item->getSLMId());
763  $href = $resource->getHref();
764  $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output") . "/" . $href);
765  $this->tpl = new ilTemplate("tpl.scorm_launch_asset.html", true, true, "Modules/ScormAicc");
766  $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output") . "/" . $href);
767  $this->tpl->show();
768  }
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
SCORM Item.
$ilUser
Definition: imgupload.php:18
global $ilDB
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 501 of file class.ilSCORMPresentationGUI.php.

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

502  {
503  global $ilUser, $ilDB;
504 
505  $sco_id = ($_GET["sahs_id"] == "")
506  ? $_POST["sahs_id"]
507  : $_GET["sahs_id"];
508  $ref_id = ($_GET["ref_id"] == "")
509  ? $_POST["ref_id"]
510  : $_GET["ref_id"];
511 
512  $this->slm = new ilObjSCORMLearningModule($ref_id, true);
513 
514  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
515  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
516  $item = new ilSCORMItem($sco_id);
517 
518  $id_ref = $item->getIdentifierRef();
519  $resource = new ilSCORMResource();
520  $resource->readByIdRef($id_ref, $item->getSLMId());
521  //$slm_obj = new ilObjSCORMLearningModule($_GET["ref_id"]);
522  $href = $resource->getHref();
523  $this->tpl = new ilTemplate("tpl.sahs_launch_cbt.html", true, true, "Modules/ScormAicc");
524  $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output") . "/" . $href);
525 
526  // set item data
527  $this->tpl->setVariable("LAUNCH_DATA", $item->getDataFromLms());
528  $this->tpl->setVariable("MAST_SCORE", $item->getMasteryScore());
529  $this->tpl->setVariable("MAX_TIME", $item->getMaxTimeAllowed());
530  $this->tpl->setVariable("LIMIT_ACT", $item->getTimeLimitAction());
531 
532  // set alternative API name
533  if ($this->slm->getAPIAdapterName() != "API") {
534  $this->tpl->setCurrentBlock("alt_api_ref");
535  $this->tpl->setVariable("API_NAME", $this->slm->getAPIAdapterName());
536  $this->tpl->parseCurrentBlock();
537  }
538 
539  $val_set = $ilDB->queryF(
540  '
541  SELECT * FROM scorm_tracking
542  WHERE user_id = %s
543  AND sco_id = %s
544  AND obj_id = %s',
545  array('integer','integer','integer'),
546  array($ilUser->getId(),$sco_id,$this->slm->getId())
547  );
548  $re_value = array();
549  while ($val_rec = $ilDB->fetchAssoc($val_set)) {
550  $val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
551  $val_rec["rvalue"] = str_replace("\r", "\n", $val_rec["rvalue"]);
552  $val_rec["rvalue"] = str_replace("\n", "\\n", $val_rec["rvalue"]);
553  $re_value[$val_rec["lvalue"]] = $val_rec["rvalue"];
554  }
555 
556  foreach ($re_value as $var => $value) {
557  switch ($var) {
558  case "cmi.core.lesson_location":
559  case "cmi.core.lesson_status":
560  case "cmi.core.entry":
561  case "cmi.core.score.raw":
562  case "cmi.core.score.max":
563  case "cmi.core.score.min":
564  case "cmi.core.total_time":
565  case "cmi.core.exit":
566  case "cmi.suspend_data":
567  case "cmi.comments":
568  case "cmi.student_preference.audio":
569  case "cmi.student_preference.language":
570  case "cmi.student_preference.speed":
571  case "cmi.student_preference.text":
572  $this->setSingleVariable($var, $value);
573  break;
574 
575  case "cmi.objectives._count":
576  $this->setSingleVariable($var, $value);
577  $this->setArray("cmi.objectives", $value, "id", $re_value);
578  $this->setArray("cmi.objectives", $value, "score.raw", $re_value);
579  $this->setArray("cmi.objectives", $value, "score.max", $re_value);
580  $this->setArray("cmi.objectives", $value, "score.min", $re_value);
581  $this->setArray("cmi.objectives", $value, "status", $re_value);
582  break;
583 
584  case "cmi.interactions._count":
585  $this->setSingleVariable($var, $value);
586  $this->setArray("cmi.interactions", $value, "id", $re_value);
587  for ($i=0; $i<$value; $i++) {
588  $var2 = "cmi.interactions." . $i . ".objectives._count";
589  if (isset($v_array[$var2])) {
590  $cnt = $v_array[$var2];
591  $this->setArray(
592  "cmi.interactions." . $i . ".objectives",
593  $cnt,
594  "id",
595  $re_value
596  );
597  /*
598  $this->setArray("cmi.interactions.".$i.".objectives",
599  $cnt, "score.raw", $re_value);
600  $this->setArray("cmi.interactions.".$i.".objectives",
601  $cnt, "score.max", $re_value);
602  $this->setArray("cmi.interactions.".$i.".objectives",
603  $cnt, "score.min", $re_value);
604  $this->setArray("cmi.interactions.".$i.".objectives",
605  $cnt, "status", $re_value);*/
606  }
607  }
608  $this->setArray("cmi.interactions", $value, "time", $re_value);
609  $this->setArray("cmi.interactions", $value, "type", $re_value);
610  for ($i=0; $i<$value; $i++) {
611  $var2 = "cmi.interactions." . $i . ".correct_responses._count";
612  if (isset($v_array[$var2])) {
613  $cnt = $v_array[$var2];
614  $this->setArray(
615  "cmi.interactions." . $i . ".correct_responses",
616  $cnt,
617  "pattern",
618  $re_value
619  );
620  $this->setArray(
621  "cmi.interactions." . $i . ".correct_responses",
622  $cnt,
623  "weighting",
624  $re_value
625  );
626  }
627  }
628  $this->setArray("cmi.interactions", $value, "student_response", $re_value);
629  $this->setArray("cmi.interactions", $value, "result", $re_value);
630  $this->setArray("cmi.interactions", $value, "latency", $re_value);
631  break;
632  }
633  }
634 
635  global $lng;
636  $this->tpl->setCurrentBlock("switch_icon");
637  $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
638  $this->tpl->setVariable("SCO_ICO", ilUtil::getImagePath("scorm/running.svg"));
639  $this->tpl->setVariable(
640  "SCO_ALT",
641  $lng->txt("cont_status") . ": "
642  . $lng->txt("cont_sc_stat_running")
643  );
644  $this->tpl->parseCurrentBlock();
645 
646  // set icon, if more than one SCO/Asset is presented
647  $items = ilSCORMObject::_lookupPresentableItems($this->slm->getId());
648  if (count($items) > 1) {
649  $this->tpl->setVariable("SWITCH_ICON_CMD", "switch_icon();");
650  }
651 
652 
653  // lesson mode
654  $lesson_mode = $this->slm->getDefaultLessonMode();
655  if ($this->slm->getAutoReview()) {
656  if ($re_value["cmi.core.lesson_status"] == "completed" ||
657  $re_value["cmi.core.lesson_status"] == "passed" ||
658  $re_value["cmi.core.lesson_status"] == "failed") {
659  $lesson_mode = "review";
660  }
661  }
662  $this->tpl->setVariable("LESSON_MODE", $lesson_mode);
663 
664  // credit mode
665  if ($lesson_mode == "normal") {
666  $this->tpl->setVariable(
667  "CREDIT_MODE",
668  str_replace("_", "-", $this->slm->getCreditMode())
669  );
670  } else {
671  $this->tpl->setVariable("CREDIT_MODE", "no-credit");
672  }
673 
674  // init cmi.core.total_time, cmi.core.lesson_status and cmi.core.entry
675  $sahs_obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
676  if (!isset($re_value["cmi.core.total_time"])) {
677  $item->insertTrackData("cmi.core.total_time", "0000:00:00", $sahs_obj_id);
678  }
679  if (!isset($re_value["cmi.core.lesson_status"])) {
680  $item->insertTrackData("cmi.core.lesson_status", "not attempted", $sahs_obj_id);
681  }
682  if (!isset($re_value["cmi.core.entry"])) {
683  $item->insertTrackData("cmi.core.entry", "", $sahs_obj_id);
684  }
685 
686  $this->tpl->show();
687  //echo htmlentities($this->tpl->get()); exit;
688  }
setArray($a_left, $a_value, $a_name, &$v_array)
set single value
$_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)
special template class to simplify handling of ITX/PEAR
SCORM Item.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB
$i
Definition: disco.tpl.php:19
Class ilObjSCORMLearningModule.
$_POST["username"]
+ Here is the call graph for this function:

◆ logMessage()

ilSCORMPresentationGUI::logMessage ( )

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

References $ilLog.

779  {
780  global $ilLog;
781  $logString = file_get_contents('php://input');
782  $ilLog->write("ScormAicc: ApiLog: Message: " . $logString);
783  }

◆ logWarning()

ilSCORMPresentationGUI::logWarning ( )

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

References $ilLog.

786  {
787  global $ilLog;
788  $logString = file_get_contents('php://input');
789  $ilLog->write("ScormAicc: ApiLog: Warning: " . $logString, 20);
790  }

◆ pingSession()

ilSCORMPresentationGUI::pingSession ( )

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

References ilWACSignedPath\signFolderOfStartFile().

771  {
772  //WAC
773  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
774  ilWACSignedPath::signFolderOfStartFile($this->slm->getDataDirectory() . '/imsmanifest.xml');
775  return true;
776  }
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 806 of file class.ilSCORMPresentationGUI.php.

References $i.

Referenced by launchSahs().

807  {
808  for ($i=0; $i<$a_value; $i++) {
809  $var = $a_left . "." . $i . "." . $a_name;
810  if (isset($v_array[$var])) {
811  $this->tpl->setCurrentBlock("set_value");
812  $this->tpl->setVariable("VAR", $var);
813  $this->tpl->setVariable("VALUE", $v_array[$var]);
814  $this->tpl->parseCurrentBlock();
815  }
816  }
817  }
$i
Definition: disco.tpl.php:19
+ Here is the caller graph for this function:

◆ setSingleVariable()

ilSCORMPresentationGUI::setSingleVariable (   $a_var,
  $a_value 
)

set single value

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

Referenced by launchSahs().

796  {
797  $this->tpl->setCurrentBlock("set_value");
798  $this->tpl->setVariable("VAR", $a_var);
799  $this->tpl->setVariable("VALUE", $a_value);
800  $this->tpl->parseCurrentBlock();
801  }
+ Here is the caller graph for this function:

◆ unloadSahs()

ilSCORMPresentationGUI::unloadSahs ( )

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

References $_GET, and ilUtil\getStyleSheetLocation().

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

◆ view()

ilSCORMPresentationGUI::view ( )

SCORM content screen.

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

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

384  {
385  $sc_gui_object = ilSCORMObjectGUI::getInstance($_GET["obj_id"]);
386 
387  if (is_object($sc_gui_object)) {
388  $sc_gui_object->view();
389  }
390 
391  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
392  $this->tpl->show(false);
393  }
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: