ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
24require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMObjectGUI.php");
25require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
26require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
27require_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 $ilias;
48
49 // get ressource identifier
50 $id_ref = $this->sc_object->getIdentifierRef();
51 if ($id_ref != "") {
52 $resource = new ilSCORMResource();
53 $resource->readByIdRef($id_ref, $this->sc_object->getSLMId());
54
55 $slm_obj = new ilObjSCORMLearningModule($_GET["ref_id"]);
56
57 if ($resource->getHref() != "") {
58 $param_str = ($this->sc_object->getParameters() != "")
59 ? "?" . $this->sc_object->getParameters()
60 : "";
61
62 $this->tpl = new ilTemplate("tpl.scorm_content_frameset.html", true, true, "Modules/ScormAicc");
63 $this->tpl->setVariable("ITEM_LOCATION", $slm_obj->getDataDirectory() . "/" . $resource->getHref() . $param_str);
64 $this->tpl->setVariable("ITEM_ID", $_GET["obj_id"]);
65 $this->tpl->setVariable("REF_ID", $_GET["ref_id"]);
66 $this->tpl->setVariable("USER_ID", $ilias->account->getId());
67 $this->tpl->setVariable("ADAPTER_NAME", $slm_obj->getAPIAdapterName());
68 $this->tpl->show();
69 exit;
70 }
71 }
72
73 // this point is only reached if now resource could be displayed above!
74 $this->tpl->addBlockFile("CONTENT", "content", "tpl.scorm_obj.html", "Modules/ScormAicc");
75 $this->tpl->setCurrentBlock("par_table");
76 $this->tpl->setVariable("TXT_OBJECT_TYPE", $this->lng->txt("cont_item"));
77 $this->displayParameter(
78 $this->lng->txt("cont_import_id"),
79 $this->sc_object->getImportId()
80 );
81 $this->displayParameter(
82 $this->lng->txt("cont_id_ref"),
83 $this->sc_object->getIdentifierRef()
84 );
85 $str_visible = ($this->sc_object->getVisible())
86 ? "true"
87 : "false";
88 $this->displayParameter(
89 $this->lng->txt("cont_is_visible"),
90 $str_visible
91 );
92 $this->displayParameter(
93 $this->lng->txt("cont_parameters"),
94 $this->sc_object->getParameters()
95 );
96 $this->displayParameter(
97 $this->lng->txt("cont_sc_title"),
98 $this->sc_object->getTitle()
99 );
100 $this->displayParameter(
101 $this->lng->txt("cont_prereq_type"),
102 $this->sc_object->getPrereqType()
103 );
104 $this->displayParameter(
105 $this->lng->txt("cont_prerequisites"),
106 $this->sc_object->getPrerequisites()
107 );
108 $this->displayParameter(
109 $this->lng->txt("cont_max_time_allowed"),
110 $this->sc_object->getMaxTimeAllowed()
111 );
112 $this->displayParameter(
113 $this->lng->txt("cont_time_limit_action"),
114 $this->sc_object->getTimeLimitAction()
115 );
116 $this->displayParameter(
117 $this->lng->txt("cont_data_from_lms"),
118 $this->sc_object->getDataFromLms()
119 );
120 $this->displayParameter(
121 $this->lng->txt("cont_mastery_score"),
122 $this->sc_object->getMasteryScore()
123 );
124 $this->tpl->parseCurrentBlock();
125 }
126
127 public function api()
128 {
129 global $ilias;
130
131 $slm_obj = new ilObjSCORMLearningModule($_GET["ref_id"]);
132
133 $func_tpl = new ilTemplate("tpl.scorm_functions.html", true, true, "Modules/ScormAicc");
134 $func_tpl->setVariable("PREFIX", $slm_obj->getAPIFunctionsPrefix());
135 $func_tpl->parseCurrentBlock();
136
137 $this->tpl = new ilTemplate("tpl.scorm_api.html", true, true, "Modules/ScormAicc");
138 $this->tpl->setVariable("SCORM_FUNCTIONS", $func_tpl->get());
139 $this->tpl->setVariable("ITEM_ID", $_GET["obj_id"]);
140 $this->tpl->setVariable("USER_ID", $ilias->account->getId());
141 $this->tpl->setVariable("SESSION_ID", session_id());
142
143 $this->tpl->setVariable("CODE_BASE", "http://" . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], "/ilias.php")));
144
145 $this->tpl->show();
146 exit;
147 }
148}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Class ilObjSCORMLearningModule.
GUI class for SCORM Items.
Parent object for SCORM GUI objects.
displayParameter($a_name, $a_value)
special template class to simplify handling of ITX/PEAR
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']