ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLMEditorGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
5include_once("./Services/Utilities/classes/class.ilDOMUtil.php");
6include_once("./Services/COPage/classes/class.ilPageEditorGUI.php");
7include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
8include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
9
10
23{
27 protected $ctrl;
28
32 protected $rbacsystem;
33
37 protected $nav_history;
38
42 protected $error;
43
47 protected $help;
48
49 public $tpl;
50 public $lng;
52 public $ref_id;
53 public $lm_obj;
54
55 public $tree;
56 public $obj_id;
57
62 public function __construct()
63 {
64 global $DIC;
65
66 $this->rbacsystem = $DIC->rbac()->system();
67 $this->nav_history = $DIC["ilNavigationHistory"];
68 $this->error = $DIC["ilErr"];
69 $this->help = $DIC["ilHelp"];
70 $tpl = $DIC["tpl"];
71 $lng = $DIC->language();
72 $objDefinition = $DIC["objDefinition"];
73 $ilCtrl = $DIC->ctrl();
74 $rbacsystem = $DIC->rbac()->system();
75 $ilNavigationHistory = $DIC["ilNavigationHistory"];
76 $ilErr = $DIC["ilErr"];
77
78 $lng->loadLanguageModule("content");
79 $lng->loadLanguageModule("lm");
80
81 // check write permission
82 if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
83 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
84 }
85
86
87 $this->ctrl = $ilCtrl;
88
89 //$this->ctrl->saveParameter($this, array("ref_id", "obj_id"));
90 $this->ctrl->saveParameter($this, array("ref_id", "transl"));
91
92 // initiate variables
93 $this->tpl = $tpl;
94 $this->lng = $lng;
95 $this->objDefinition = $objDefinition;
96 $this->ref_id = $_GET["ref_id"];
97 $this->obj_id = $_GET["obj_id"];
98
99 $this->lm_obj = ilObjectFactory::getInstanceByRefId($this->ref_id);
100 $this->tree = new ilTree($this->lm_obj->getId());
101 $this->tree->setTableNames('lm_tree', 'lm_data');
102 $this->tree->setTreeTablePK("lm_id");
103
104
105 $ilNavigationHistory->addItem(
106 $_GET["ref_id"],
107 "ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"],
108 "lm"
109 );
110
111 $this->checkRequestParameters();
112 }
113
119 protected function checkRequestParameters()
120 {
121 $forwards_to_role = $this->ctrl->checkCurrentPathForClass("ilobjrolegui");
122
123 if (!$forwards_to_role && $this->obj_id > 0 && ilLMObject::_lookupContObjID($this->obj_id) != $this->lm_obj->getId()) {
124 throw new ilException("Object ID does not match learning module.");
125 }
126 if ($_REQUEST["active_node"] > 0 && ilLMObject::_lookupContObjID((int) $_REQUEST["active_node"]) != $this->lm_obj->getId()) {
127 throw new ilException("Active node does not match learning module.");
128 }
129 }
130
131
136 public function executeCommand()
137 {
138 $ilHelp = $this->help;
139
140 if ($_GET["to_page"]== 1) {
141 $this->ctrl->setParameterByClass("illmpageobjectgui", "obj_id", $_GET["obj_id"]);
142 $this->ctrl->redirectByClass(array("ilobjlearningmodulegui", "illmpageobjectgui"), "edit");
143 }
144
145 if ($cmd != "showTree") {
146 $this->showTree();
147 }
148
149 $next_class = $this->ctrl->getNextClass($this);
150 //echo "lmeditorgui:$next_class:".$this->ctrl->getCmdClass().":$cmd:<br>";
151
152 if ($next_class == "" && ($cmd != "explorer")
153 && ($cmd != "showImageMap")) {
154 $next_class = "ilobjlearningmodulegui";
155 }
156
157 // show footer
158 $show_footer = ($cmd == "explorer")
159 ? false
160 : true;
161
162 // if ($this->lm_obj->getType()
163 switch ($next_class) {
164 case "ilobjlearningmodulegui":
165 include_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
166 include_once("./Modules/LearningModule/classes/class.ilObjLearningModuleGUI.php");
167 $this->main_header($this->lm_obj->getType());
168 $lm_gui = new ilObjLearningModuleGUI("", $_GET["ref_id"], true, false);
169 //$ret =& $lm_gui->executeCommand();
170 $ret = $this->ctrl->forwardCommand($lm_gui);
171 if (strcmp($cmd, "explorer") != 0) {
172 // don't call the locator in the explorer frame
173 // this prevents a lot of log errors
174 // Helmut Schottmüller, 2006-07-21
175 $this->displayLocator();
176 }
177//echo "*".$this->tpl->get()."*";
178 // (horrible) workaround for preventing template engine
179 // from hiding paragraph text that is enclosed
180 // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage())
181// $this->tpl->fillTabs();
182 $output = $this->tpl->get("DEFAULT", true, true, $show_footer, true);
183 $output = str_replace("&#123;", "{", $output);
184 $output = str_replace("&#125;", "}", $output);
185 header('Content-type: text/html; charset=UTF-8');
186 echo $output;
187 break;
188
189 default:
190 $ret = $this->$cmd();
191 break;
192 }
193 }
194
201 public function showTree()
202 {
204
205 include_once("./Modules/LearningModule/classes/class.ilLMEditorExplorerGUI.php");
206 $exp = new ilLMEditorExplorerGUI($this, "showTree", $this->lm_obj);
207 if (!$exp->handleCommand()) {
208 $tpl->setLeftNavContent($exp->getHTML());
209 }
210 }
211
215 public function main_header($a_type)
216 {
218
219 $this->tpl->getStandardTemplate();
220
221 // content style
222 $this->tpl->setCurrentBlock("ContentStyle");
223 $this->tpl->setVariable(
224 "LOCATION_CONTENT_STYLESHEET",
225 ilObjStyleSheet::getContentStylePath($this->lm_obj->getStyleSheetId())
226 );
227 $this->tpl->parseCurrentBlock();
228
229 // syntax style
230 $this->tpl->setCurrentBlock("SyntaxStyle");
231 $this->tpl->setVariable(
232 "LOCATION_SYNTAX_STYLESHEET",
234 );
235 $this->tpl->parseCurrentBlock();
236 }
237
238
242 public function displayLocator()
243 {
245
246 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
247
248 $modifier = 1;
249
250 $locations = $this->ctrl->getLocations();
251
252 foreach ($locations as $key => $row) {
253 if ($key < count($locations)-$modifier) {
254 $this->tpl->touchBlock("locator_separator");
255 }
256
257 if ($row["ref_id"]> 0 && $row["ref_id"] != ROOT_FOLDER_ID) {
258 $oid = ilObject::_lookupObjId($row["ref_id"]);
260 $this->tpl->setCurrentBlock("locator_img");
261 $this->tpl->setVariable(
262 "IMG_SRC",
263 ilUtil::getImagePath("icon_" . $t . ".svg")
264 );
265 $this->tpl->setVariable(
266 "IMG_ALT",
267 $lng->txt("obj_" . $type)
268 );
269 $this->tpl->parseCurrentBlock();
270 }
271
272 if ($row["link"] != "") {
273 $this->tpl->setCurrentBlock("locator_item");
274 $this->tpl->setVariable("ITEM", $row["title"]);
275 $this->tpl->setVariable("LINK_ITEM", $row["link"]);
276 if ($row["target"] != "") {
277 $this->tpl->setVariable("LINK_TARGET", ' target="' . $row["target"] . '" ');
278 }
279 $this->tpl->parseCurrentBlock();
280 } else {
281 $this->tpl->setCurrentBlock("locator_item");
282 $this->tpl->setVariable("PREFIX", $row["title"]);
283 $this->tpl->parseCurrentBlock();
284 }
285 }
286
287 $this->tpl->setCurrentBlock("locator");
288 $this->tpl->parseCurrentBlock();
289 }
290}
$_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.
__construct()
Constructor @access public.
displayLocator()
display locator
main_header($a_type)
output main header (title and 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
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$key
Definition: croninfo.php:18
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
$type
global $ilErr
Definition: raiseError.php:16
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92