ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilAdministrationGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
44{
48 protected $objDefinition;
49
53 protected $main_menu;
54
58 protected $help;
59
63 protected $error;
64
68 protected $db;
69
70 public $lng;
71 public $tpl;
72 public $tree;
75 public $cmd;
76 public $mode;
77 public $ctrl;
78
82 private $logger = null;
83
88 public function __construct()
89 {
90 global $DIC;
91
92 $this->main_menu = $DIC["ilMainMenu"];
93 $this->help = $DIC["ilHelp"];
94 $this->error = $DIC["ilErr"];
95 $this->db = $DIC->database();
96 $lng = $DIC->language();
97 $tpl = $DIC["tpl"];
98 $tree = $DIC->repositoryTree();
99 $rbacsystem = $DIC->rbac()->system();
100 $objDefinition = $DIC["objDefinition"];
101 $ilCtrl = $DIC->ctrl();
102 $ilMainMenu = $DIC["ilMainMenu"];
103
104 $this->lng = $lng;
105 $this->lng->loadLanguageModule('administration');
106 $this->tpl = $tpl;
107 $this->tree = $tree;
108 $this->rbacsystem = $rbacsystem;
109 $this->objDefinition = $objDefinition;
110 $this->ctrl = $ilCtrl;
111
112 $this->logger = $DIC->logger()->adm();
113
114 $context = $DIC->globalScreen()->tool()->context();
115 $context->claim()->administration();
116
117 $ilMainMenu->setActive("administration");
118
119 $this->ctrl->saveParameter($this, array("ref_id", "admin_mode"));
120
121 if ($_GET["admin_mode"] != "repository") {
122 $_GET["admin_mode"] = "settings";
123 }
124
125 if (!ilUtil::isAPICall()) {
126 $this->ctrl->setReturn($this, "");
127 }
128
129 // determine current ref id and mode
130 if (!empty($_GET["ref_id"]) && $tree->isInTree($_GET["ref_id"])) {
131 $this->cur_ref_id = $_GET["ref_id"];
132 } else {
133 //$this->cur_ref_id = $this->tree->getRootId();
134 $_POST = array();
135 if ($_GET["cmd"] != "getDropDown") {
136 $_GET["cmd"] = "";
137 }
138 }
139 }
140
141
145 public function executeCommand()
146 {
149 $ilHelp = $this->help;
152
153 // permission checks
154 if (!$rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID) &&
155 !$rbacsystem->checkAccess("read", SYSTEM_FOLDER_ID)) {
156 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
157 }
158
159 // check creation mode
160 // determined by "new_type" parameter
161 $new_type = empty($_REQUEST['new_type']) ? '' : $_REQUEST['new_type'];
162 if ($new_type) {
163 $this->creation_mode = true;
164 }
165 // determine next class
166 if ($this->creation_mode) {
167 $obj_type = $new_type;
168 $class_name = $this->objDefinition->getClassName($obj_type);
169 $next_class = strtolower("ilObj" . $class_name . "GUI");
170 $this->ctrl->setCmdClass($next_class);
171 }
172
173 // set next_class directly for page translations
174 // (no cmdNode is given in translation link)
175 if ($this->ctrl->getCmdClass() == "ilobjlanguageextgui") {
176 $next_class = "ilobjlanguageextgui";
177 } else {
178 $next_class = $this->ctrl->getNextClass($this);
179 }
180
181 if ((
182 $next_class == "iladministrationgui" || $next_class == ""
183 ) && ($this->ctrl->getCmd() == "return")) {
184 // get GUI of current object
185 $obj_type = ilObject::_lookupType($this->cur_ref_id, true);
186 $class_name = $this->objDefinition->getClassName($obj_type);
187 $next_class = strtolower("ilObj" . $class_name . "GUI");
188 $this->ctrl->setCmdClass($next_class);
189 $this->ctrl->setCmd("view");
190 }
191
192 $cmd = $this->ctrl->getCmd("forward");
193
194 //echo "<br>cmd:$cmd:nextclass:$next_class:-".$_GET["cmdClass"]."-".$_GET["cmd"]."-";
195 switch ($next_class) {
196 default:
197
198 // forward all other classes to gui commands
199 if ($next_class != "" && $next_class != "iladministrationgui") {
200 // check db update
201 $dbupdate = new ilDBUpdate($ilDB);
202 if (!$dbupdate->getDBVersionStatus()) {
203 ilUtil::sendFailure($this->lng->txt("db_need_update"));
204 } elseif ($dbupdate->hotfixAvailable()) {
205 ilUtil::sendFailure($this->lng->txt("db_need_hotfix"));
206 }
207
208 $class_path = $this->ctrl->lookupClassPath($next_class);
209 require_once $class_path;
210 // get gui class instance
211 $class_name = $this->ctrl->getClassForClasspath($class_path);
212 if (($next_class == "ilobjrolegui" || $next_class == "ilobjusergui"
213 || $next_class == "ilobjroletemplategui")) {
214 if ($_GET["obj_id"] != "") {
215 $this->gui_obj = new $class_name("", $_GET["obj_id"], false, false);
216 $this->gui_obj->setCreationMode(false);
217 } else {
218 $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
219 $this->gui_obj->setCreationMode(true);
220 }
221 } else {
222 if ($objDefinition->isPlugin(ilObject::_lookupType($this->cur_ref_id, true))) {
223 $this->gui_obj = new $class_name($this->cur_ref_id);
224 } else {
225 if (!$this->creation_mode) {
226 if (is_subclass_of($class_name, "ilObject2GUI")) {
227 $this->gui_obj = new $class_name($this->cur_ref_id, ilObject2GUI::REPOSITORY_NODE_ID);
228 } else {
229 $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
230 }
231 } else {
232 if (is_subclass_of($class_name, "ilObject2GUI")) {
233 $this->gui_obj = new $class_name(null, ilObject2GUI::REPOSITORY_NODE_ID, $this->cur_ref_id);
234 } else {
235 $this->gui_obj = new $class_name("", 0, true, false);
236 }
237 }
238 }
239 $this->gui_obj->setCreationMode($this->creation_mode);
240 }
241 $tabs_out = true;
242 $ilHelp->setScreenIdComponent(ilObject::_lookupType($this->cur_ref_id, true));
243 $this->showTree();
244
245 $this->ctrl->setReturn($this, "return");
246 $ret = $this->ctrl->forwardCommand($this->gui_obj);
247 $html = $this->gui_obj->getHTML();
248
249 if ($html != "") {
250 $this->tpl->setVariable("OBJECTS", $html);
251 }
252 $this->tpl->printToStdout();
253 } else { //
254 $cmd = $this->ctrl->getCmd("forward");
255 $this->$cmd();
256 }
257 break;
258 }
259 }
260
264 public function forward()
265 {
267
268 if ($_GET["admin_mode"] != "repository") { // settings
269 if ($_GET["ref_id"] == USER_FOLDER_ID) {
270 $this->ctrl->setParameter($this, "ref_id", USER_FOLDER_ID);
271 $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
272 if (((int) $_GET["jmpToUser"]) > 0 && ilObject::_lookupType((int) $_GET["jmpToUser"]) == "usr") {
273 $this->ctrl->setParameterByClass(
274 "ilobjuserfoldergui",
275 "jmpToUser",
276 (int) $_GET["jmpToUser"]
277 );
278 $this->ctrl->redirectByClass("ilobjuserfoldergui", "jumpToUser");
279 } else {
280 $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
281 }
282 } else {
283 $this->ctrl->setParameter($this, "ref_id", SYSTEM_FOLDER_ID);
284 $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
285
286 if ($_GET['fr']) {
287 // Security check: We do only allow relative urls
288 $url_parts = parse_url(base64_decode(rawurldecode($_GET['fr'])));
289 if ($url_parts['http'] || $url_parts['host']) {
290 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
291 }
292
293 $fs_gui->setMainFrameSource(
294 base64_decode(rawurldecode($_GET['fr']))
295 );
296 ilUtil::redirect(ILIAS_HTTP_PATH . '/' . base64_decode(rawurldecode($_GET['fr'])));
297 } else {
298 $fs_gui->setMainFrameSource(
299 $this->ctrl->getLinkTargetByClass("ilobjsystemfoldergui", "view")
300 );
301 $this->ctrl->redirectByClass("ilobjsystemfoldergui", "view");
302 }
303 }
304 } else {
305 $this->ctrl->setParameter($this, "ref_id", ROOT_FOLDER_ID);
306 $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "repository");
307 $this->ctrl->redirectByClass("ilobjrootfoldergui", "view");
308 }
309 }
310
314 public function showTree()
315 {
316 global $DIC;
317
318 if ($_GET["admin_mode"] != "repository") {
319 return;
320 }
321
322 $DIC->globalScreen()->tool()->context()->current()->addAdditionalData(ilAdminGSToolProvider::SHOW_ADMIN_TREE, true);
323
324 $exp = new ilAdministrationExplorerGUI($this, "showTree");
325 $exp->handleCommand();
326 }
327
331 public function jumpToPluginSlot()
332 {
333 $ilCtrl = $this->ctrl;
334
335 $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "ctype", $_GET["ctype"]);
336 $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "cname", $_GET["cname"]);
337 $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "slot_id", $_GET["slot_id"]);
338
339 if ($_GET["plugin_id"]) {
340 $ilCtrl->setParameter($this, "plugin_id", $_GET["plugin_id"]);
341 $ilCtrl->redirectByClass("ilobjcomponentsettingsgui", "showPlugin");
342 } else {
343 $ilCtrl->redirectByClass("ilobjcomponentsettingsgui", "listPlugins");
344 }
345 }
346
347
351 public function jump()
352 {
353 $ilCtrl = $this->ctrl;
355
356 $ref_id = (int) $_GET["ref_id"];
357 $obj_id = ilObject::_lookupObjId($ref_id);
358 $obj_type = ilObject::_lookupType($obj_id);
359 $class_name = $objDefinition->getClassName($obj_type);
360 $class = strtolower("ilObj" . $class_name . "GUI");
361 $ilCtrl->setParameterByClass($class, "ref_id", $ref_id);
362 $ilCtrl->redirectByClass($class, "view");
363 }
364}
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
Administration explorer GUI class.
Class ilAdministratioGUI.
jumpToPluginSlot()
Special jump to plugin slot after ilCtrl has been reloaded.
forward()
Forward to class/command.
__construct()
Constructor @access public.
Database Update class.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static isAPICall()
const USER_FOLDER_ID
Definition: constants.php:31
const SYSTEM_FOLDER_ID
Definition: constants.php:33
const ROOT_FOLDER_ID
Definition: constants.php:30
global $DIC
Definition: goto.php:24
help()
Definition: help.php:2
$ret
Definition: parser.php:6
$ilErr
Definition: raiseError.php:18
global $ilDB
$context
Definition: webdav.php:26