ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLMEditorGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
16{
20 protected $ctrl;
21
25 protected $rbacsystem;
26
30 protected $nav_history;
31
35 protected $error;
36
40 protected $help;
41
45 protected $tpl;
46
50 protected $lng;
51
55 protected $objDefinition;
56
60 protected $ref_id;
61
65 protected $lm_obj;
66
70 protected $tree;
71
75 protected $obj_id;
76
81 public function __construct()
82 {
83 global $DIC;
84
85 $this->rbacsystem = $DIC->rbac()->system();
86 $this->nav_history = $DIC["ilNavigationHistory"];
87 $this->error = $DIC["ilErr"];
88 $this->help = $DIC["ilHelp"];
89 $tpl = $DIC["tpl"];
90 $lng = $DIC->language();
91 $objDefinition = $DIC["objDefinition"];
92 $ilCtrl = $DIC->ctrl();
93 $rbacsystem = $DIC->rbac()->system();
94 $ilNavigationHistory = $DIC["ilNavigationHistory"];
95 $ilErr = $DIC["ilErr"];
96
97 $lng->loadLanguageModule("content");
98 $lng->loadLanguageModule("lm");
99
100 // check write permission
101 if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
102 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
103 }
104
105 $this->ctrl = $ilCtrl;
106
107 $this->ctrl->saveParameter($this, array("ref_id", "transl"));
108
109 // initiate variables
110 $this->tpl = $tpl;
111 $this->lng = $lng;
112 $this->objDefinition = $objDefinition;
113 $this->ref_id = $_GET["ref_id"];
114 $this->obj_id = $_GET["obj_id"];
115
116 $this->lm_obj = ilObjectFactory::getInstanceByRefId($this->ref_id);
117 $this->tree = new ilTree($this->lm_obj->getId());
118 $this->tree->setTableNames('lm_tree', 'lm_data');
119 $this->tree->setTreeTablePK("lm_id");
120
121
122 $ilNavigationHistory->addItem(
123 $_GET["ref_id"],
124 "ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"],
125 "lm"
126 );
127
128 $this->checkRequestParameters();
129 }
130
136 protected function checkRequestParameters()
137 {
138 $forwards_to_role = $this->ctrl->checkCurrentPathForClass("ilobjrolegui");
139
140 if (!$forwards_to_role && $this->obj_id > 0 && ilLMObject::_lookupContObjID($this->obj_id) != $this->lm_obj->getId()) {
141 throw new ilException("Object ID does not match learning module.");
142 }
143 if ($_REQUEST["active_node"] > 0 && ilLMObject::_lookupContObjID((int) $_REQUEST["active_node"]) != $this->lm_obj->getId()) {
144 throw new ilException("Active node does not match learning module.");
145 }
146 }
147
148
153 public function executeCommand()
154 {
155 global $DIC;
156
158 $loc = $DIC["ilLocator"];
159 $loc->addRepositoryItems((int) $_GET["ref_id"]);
160
161 if ($_GET["to_page"] == 1) {
162 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $_GET["obj_id"]);
163 $this->ctrl->redirectByClass(array("ilobjlearningmodulegui", "illmpageobjectgui"), "edit");
164 }
165
166 $this->showTree();
167
168 $next_class = $this->ctrl->getNextClass($this);
169
170 if ($next_class == "" && ($cmd != "explorer")
171 && ($cmd != "showImageMap")) {
172 $next_class = "ilobjlearningmodulegui";
173 }
174
175 // show footer
176 $show_footer = ($cmd == "explorer")
177 ? false
178 : true;
179
180 switch ($next_class) {
181 case "ilobjlearningmodulegui":
182 include_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
183 include_once("./Modules/LearningModule/classes/class.ilObjLearningModuleGUI.php");
184 $this->main_header($this->lm_obj->getType());
185 $lm_gui = new ilObjLearningModuleGUI("", $_GET["ref_id"], true, false);
186
187 $ret = $this->ctrl->forwardCommand($lm_gui);
188 if (strcmp($cmd, "explorer") != 0) {
189 // don't call the locator in the explorer frame
190 // this prevents a lot of log errors
191 // Helmut Schottmüller, 2006-07-21
192 $this->displayLocator();
193 }
194 // (horrible) workaround for preventing template engine
195 // from hiding paragraph text that is enclosed
196 // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage())
197 $output = $this->tpl->get("DEFAULT", true, true, $show_footer, true);
198 $output = str_replace("&#123;", "{", $output);
199 $output = str_replace("&#125;", "}", $output);
200 header('Content-type: text/html; charset=UTF-8');
201 echo $output;
202 break;
203
204 default:
205 $ret = $this->$cmd();
206 break;
207 }
208 }
209
213 public function showTree()
214 {
216
217 include_once("./Modules/LearningModule/classes/class.ilLMEditorExplorerGUI.php");
218 $exp = new ilLMEditorExplorerGUI($this, "showTree", $this->lm_obj);
219 if (!$exp->handleCommand()) {
220 $tpl->setLeftNavContent($exp->getHTML());
221 }
222 }
223
227 public function main_header()
228 {
229 $this->tpl->getStandardTemplate();
230
231 // content style
232 $this->tpl->setCurrentBlock("ContentStyle");
233 $this->tpl->setVariable(
234 "LOCATION_CONTENT_STYLESHEET",
235 ilObjStyleSheet::getContentStylePath($this->lm_obj->getStyleSheetId())
236 );
237 $this->tpl->parseCurrentBlock();
238
239 // syntax style
240 $this->tpl->setCurrentBlock("SyntaxStyle");
241 $this->tpl->setVariable(
242 "LOCATION_SYNTAX_STYLESHEET",
244 );
245 $this->tpl->parseCurrentBlock();
246 }
247
248
252 public function displayLocator()
253 {
254 $this->tpl->setLocator();
255 }
256}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
Base class for ILIAS Exception handling.
LM editor explorer GUI class.
GUI class for learning module editor.
checkRequestParameters()
Check request parameters.
main_header()
output main header (title and locator)
__construct()
Constructor @access public.
displayLocator()
Display locator.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
Class ilLearningModuleGUI.
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
$ilErr
Definition: raiseError.php:18
global $DIC
Definition: saml.php:7