ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSCORMItemGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMObjectGUI.php");
25 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
26 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
27 require_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
28 
38 {
39  public function __construct($a_id)
40  {
41  parent::__construct();
42  $this->sc_object = new ilSCORMItem($a_id);
43  }
44 
45  public function view()
46  {
47  global $DIC;
48  $ilias = $DIC['ilias'];
49 
50  // get ressource identifier
51  $id_ref = $this->sc_object->getIdentifierRef();
52  if ($id_ref != "") {
53  $resource = new ilSCORMResource();
54  $resource->readByIdRef($id_ref, $this->sc_object->getSLMId());
55 
56  $slm_obj = new ilObjSCORMLearningModule($_GET["ref_id"]);
57 
58  if ($resource->getHref() != "") {
59  $param_str = ($this->sc_object->getParameters() != "")
60  ? "?" . $this->sc_object->getParameters()
61  : "";
62 
63  $this->tpl = new ilTemplate("tpl.scorm_content_frameset.html", true, true, "Modules/ScormAicc");
64  $this->tpl->setVariable("ITEM_LOCATION", $slm_obj->getDataDirectory() . "/" . $resource->getHref() . $param_str);
65  $this->tpl->setVariable("ITEM_ID", $_GET["obj_id"]);
66  $this->tpl->setVariable("REF_ID", $_GET["ref_id"]);
67  $this->tpl->setVariable("USER_ID", $ilias->account->getId());
68  $this->tpl->setVariable("ADAPTER_NAME", $slm_obj->getAPIAdapterName());
69  $this->tpl->show();
70  exit;
71  }
72  }
73 
74  // this point is only reached if now resource could be displayed above!
75  $this->tpl->addBlockFile("CONTENT", "content", "tpl.scorm_obj.html", "Modules/ScormAicc");
76  $this->tpl->setCurrentBlock("par_table");
77  $this->tpl->setVariable("TXT_OBJECT_TYPE", $this->lng->txt("cont_item"));
78  $this->displayParameter(
79  $this->lng->txt("cont_import_id"),
80  $this->sc_object->getImportId()
81  );
82  $this->displayParameter(
83  $this->lng->txt("cont_id_ref"),
84  $this->sc_object->getIdentifierRef()
85  );
86  $str_visible = ($this->sc_object->getVisible())
87  ? "true"
88  : "false";
89  $this->displayParameter(
90  $this->lng->txt("cont_is_visible"),
91  $str_visible
92  );
93  $this->displayParameter(
94  $this->lng->txt("cont_parameters"),
95  $this->sc_object->getParameters()
96  );
97  $this->displayParameter(
98  $this->lng->txt("cont_sc_title"),
99  $this->sc_object->getTitle()
100  );
101  $this->displayParameter(
102  $this->lng->txt("cont_prereq_type"),
103  $this->sc_object->getPrereqType()
104  );
105  $this->displayParameter(
106  $this->lng->txt("cont_prerequisites"),
107  $this->sc_object->getPrerequisites()
108  );
109  $this->displayParameter(
110  $this->lng->txt("cont_max_time_allowed"),
111  $this->sc_object->getMaxTimeAllowed()
112  );
113  $this->displayParameter(
114  $this->lng->txt("cont_time_limit_action"),
115  $this->sc_object->getTimeLimitAction()
116  );
117  $this->displayParameter(
118  $this->lng->txt("cont_data_from_lms"),
119  $this->sc_object->getDataFromLms()
120  );
121  $this->displayParameter(
122  $this->lng->txt("cont_mastery_score"),
123  $this->sc_object->getMasteryScore()
124  );
125  $this->tpl->parseCurrentBlock();
126  }
127 
128  public function api()
129  {
130  global $DIC;
131  $ilias = $DIC['ilias'];
132 
133  $slm_obj = new ilObjSCORMLearningModule($_GET["ref_id"]);
134 
135  $func_tpl = new ilTemplate("tpl.scorm_functions.html", true, true, "Modules/ScormAicc");
136  $func_tpl->setVariable("PREFIX", $slm_obj->getAPIFunctionsPrefix());
137  $func_tpl->parseCurrentBlock();
138 
139  $this->tpl = new ilTemplate("tpl.scorm_api.html", true, true, "Modules/ScormAicc");
140  $this->tpl->setVariable("SCORM_FUNCTIONS", $func_tpl->get());
141  $this->tpl->setVariable("ITEM_ID", $_GET["obj_id"]);
142  $this->tpl->setVariable("USER_ID", $ilias->account->getId());
143  $this->tpl->setVariable("SESSION_ID", session_id());
144 
145  $this->tpl->setVariable("CODE_BASE", "http://" . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], "/ilias.php")));
146 
147  $this->tpl->show();
148  exit;
149  }
150 }
Parent object for SCORM GUI objects.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
global $DIC
Definition: saml.php:7
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
SCORM Item.
displayParameter($a_name, $a_value)
exit
Definition: backend.php:16
GUI class for SCORM Items.
Class ilObjSCORMLearningModule.