ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  function ilSCORMItemGUI($a_id)
40  {
42  $this->sc_object =& new ilSCORMItem($a_id);
43  }
44 
45  function view()
46  {
47  global $ilias;
48 
49  // get ressource identifier
50  $id_ref = $this->sc_object->getIdentifierRef();
51  if ($id_ref != "")
52  {
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  {
60  $param_str = ($this->sc_object->getParameters() != "")
61  ? "?".$this->sc_object->getParameters()
62  : "";
63 
64  $this->tpl =& new ilTemplate("tpl.scorm_content_frameset.html", true, true, "Modules/ScormAicc");
65  $this->tpl->setVariable("ITEM_LOCATION",$slm_obj->getDataDirectory()."/".$resource->getHref().$param_str);
66  $this->tpl->setVariable("ITEM_ID", $_GET["obj_id"]);
67  $this->tpl->setVariable("REF_ID", $_GET["ref_id"]);
68  $this->tpl->setVariable("USER_ID",$ilias->account->getId());
69  $this->tpl->setVariable("ADAPTER_NAME", $slm_obj->getAPIAdapterName());
70  $this->tpl->show();
71  exit;
72  }
73  }
74 
75  // this point is only reached if now resource could be displayed above!
76  $this->tpl->addBlockFile("CONTENT", "content", "tpl.scorm_obj.html", "Modules/ScormAicc");
77  $this->tpl->setCurrentBlock("par_table");
78  $this->tpl->setVariable("TXT_OBJECT_TYPE", $this->lng->txt("cont_item"));
79  $this->displayParameter($this->lng->txt("cont_import_id"),
80  $this->sc_object->getImportId());
81  $this->displayParameter($this->lng->txt("cont_id_ref"),
82  $this->sc_object->getIdentifierRef());
83  $str_visible = ($this->sc_object->getVisible())
84  ? "true"
85  : "false";
86  $this->displayParameter($this->lng->txt("cont_is_visible"),
87  $str_visible);
88  $this->displayParameter($this->lng->txt("cont_parameters"),
89  $this->sc_object->getParameters());
90  $this->displayParameter($this->lng->txt("cont_sc_title"),
91  $this->sc_object->getTitle());
92  $this->displayParameter($this->lng->txt("cont_prereq_type"),
93  $this->sc_object->getPrereqType());
94  $this->displayParameter($this->lng->txt("cont_prerequisites"),
95  $this->sc_object->getPrerequisites());
96  $this->displayParameter($this->lng->txt("cont_max_time_allowed"),
97  $this->sc_object->getMaxTimeAllowed());
98  $this->displayParameter($this->lng->txt("cont_time_limit_action"),
99  $this->sc_object->getTimeLimitAction());
100  $this->displayParameter($this->lng->txt("cont_data_from_lms"),
101  $this->sc_object->getDataFromLms());
102  $this->displayParameter($this->lng->txt("cont_mastery_score"),
103  $this->sc_object->getMasteryScore());
104  $this->tpl->parseCurrentBlock();
105 
106  }
107 
108  function api()
109  {
110  global $ilias;
111 
112  $slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]);
113 
114  $func_tpl = new ilTemplate("tpl.scorm_functions.html", true, true, "Modules/ScormAicc");
115  $func_tpl->setVariable("PREFIX", $slm_obj->getAPIFunctionsPrefix());
116  $func_tpl->parseCurrentBlock();
117 
118  $this->tpl =& new ilTemplate("tpl.scorm_api.html", true, true, "Modules/ScormAicc");
119  $this->tpl->setVariable("SCORM_FUNCTIONS", $func_tpl->get());
120  $this->tpl->setVariable("ITEM_ID", $_GET["obj_id"]);
121  $this->tpl->setVariable("USER_ID",$ilias->account->getId());
122  $this->tpl->setVariable("SESSION_ID",session_id());
123 
124  $this->tpl->setVariable("CODE_BASE", "http://".$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, strpos ($_SERVER['PHP_SELF'], "/ilias.php")));
125 
126  $this->tpl->show();
127  exit;
128  }
129 }
130 ?>