ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $this->tool_context = $DIC->globalScreen()->tool()->context();
107
108 $this->ctrl->saveParameter($this, array("ref_id", "transl"));
109
110 // initiate variables
111 $this->tpl = $tpl;
112 $this->lng = $lng;
113 $this->objDefinition = $objDefinition;
114 $this->ref_id = $_GET["ref_id"];
115 $this->obj_id = $_GET["obj_id"];
116
117 $this->lm_obj = ilObjectFactory::getInstanceByRefId($this->ref_id);
118 $this->tree = new ilTree($this->lm_obj->getId());
119 $this->tree->setTableNames('lm_tree', 'lm_data');
120 $this->tree->setTreeTablePK("lm_id");
121
122
123 $ilNavigationHistory->addItem(
124 $_GET["ref_id"],
125 "ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"],
126 "lm"
127 );
128
129 $this->checkRequestParameters();
130 }
131
137 protected function checkRequestParameters()
138 {
139 $forwards_to_role = $this->ctrl->checkCurrentPathForClass("ilobjrolegui");
140
141 if (!$forwards_to_role && $this->obj_id > 0 && ilLMObject::_lookupContObjID($this->obj_id) != $this->lm_obj->getId()) {
142 throw new ilException("Object ID does not match learning module.");
143 }
144 if ($_REQUEST["active_node"] > 0 && ilLMObject::_lookupContObjID((int) $_REQUEST["active_node"]) != $this->lm_obj->getId()) {
145 throw new ilException("Active node does not match learning module.");
146 }
147 }
148
149
154 public function executeCommand()
155 {
156 global $DIC;
157
158 $this->tool_context->claim()->repository();
159
161 $loc = $DIC["ilLocator"];
162 $loc->addRepositoryItems((int) $_GET["ref_id"]);
163
164 if ($_GET["to_page"] == 1) {
165 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $_GET["obj_id"]);
166 $this->ctrl->redirectByClass(array("ilobjlearningmodulegui", "illmpageobjectgui"), "edit");
167 }
168
169 $this->showTree();
170
171 $next_class = $this->ctrl->getNextClass($this);
172
173 if ($next_class == "" && ($cmd != "explorer")
174 && ($cmd != "showImageMap")) {
175 $next_class = "ilobjlearningmodulegui";
176 }
177
178 // show footer
179 $show_footer = ($cmd == "explorer")
180 ? false
181 : true;
182
183 switch ($next_class) {
184 case "ilobjlearningmodulegui":
185 $this->main_header($this->lm_obj->getType());
186 $lm_gui = new ilObjLearningModuleGUI("", $_GET["ref_id"], true, false);
187
188 $ret = $this->ctrl->forwardCommand($lm_gui);
189 if (strcmp($cmd, "explorer") != 0) {
190 // don't call the locator in the explorer frame
191 // this prevents a lot of log errors
192 // Helmut Schottmüller, 2006-07-21
193 $this->displayLocator();
194 }
195 // (horrible) workaround for preventing template engine
196 // from hiding paragraph text that is enclosed
197 // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage())
198 // @todo 6.0
199 /*
200 $output = $this->tpl->getSpecial("DEFAULT", true, true, $show_footer,true);
201 $output = str_replace("&#123;", "{", $output);
202 $output = str_replace("&#125;", "}", $output);
203 header('Content-type: text/html; charset=UTF-8');
204 echo $output;*/
205 $this->tpl->printToStdout();
206 break;
207
208 default:
209 $ret = $this->$cmd();
210 break;
211 }
212 }
213
217 public function showTree()
218 {
220
221 $this->tool_context->current()->addAdditionalData(ilLMEditGSToolProvider::SHOW_TREE, true);
222
223 $exp = new ilLMEditorExplorerGUI($this, "showTree", $this->lm_obj);
224 if (!$exp->handleCommand()) {
225// $tpl->setLeftNavContent($exp->getHTML());
226 }
227 }
228
232 public function main_header()
233 {
234 $this->tpl->loadStandardTemplate();
235
236 // content style
237 $this->tpl->setCurrentBlock("ContentStyle");
238 $this->tpl->setVariable(
239 "LOCATION_CONTENT_STYLESHEET",
240 ilObjStyleSheet::getContentStylePath($this->lm_obj->getStyleSheetId())
241 );
242 $this->tpl->parseCurrentBlock();
243
244 // syntax style
245 $this->tpl->setCurrentBlock("SyntaxStyle");
246 $this->tpl->setVariable(
247 "LOCATION_SYNTAX_STYLESHEET",
249 );
250 $this->tpl->parseCurrentBlock();
251 }
252
253
257 public function displayLocator()
258 {
259 $this->tpl->setLocator();
260 }
261}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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, $add_token=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 $DIC
Definition: goto.php:24
help()
Definition: help.php:2
$ret
Definition: parser.php:6
$ilErr
Definition: raiseError.php:18