ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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
5include_once("./Services/Table/classes/class.ilTableGUI.php");
6
44{
45 var $lng;
46 var $ilias;
47 var $tpl;
48 var $tree;
51 var $cmd;
52 var $mode;
53 var $ctrl;
54
60 {
61 global $lng, $ilias, $tpl, $tree, $rbacsystem, $objDefinition,
62 $_GET, $ilCtrl, $ilLog, $ilMainMenu;
63
64 $this->lng = $lng;
65 $this->lng->loadLanguageModule('administration');
66 $this->ilias = $ilias;
67 $this->tpl = $tpl;
68 $this->tree = $tree;
69 $this->rbacsystem = $rbacsystem;
70 $this->objDefinition = $objDefinition;
71
72 $this->ctrl = $ilCtrl;
73 $ilMainMenu->setActive("administration");
74
75 $this->creation_mode = false;
76
77 $this->ctrl->saveParameter($this, array("ref_id", "admin_mode"));
78
79 if ($_GET["admin_mode"] != "repository")
80 {
81 $_GET["admin_mode"] = "settings";
82 }
83
84 if (!ilUtil::isAPICall())
85 $this->ctrl->setReturn($this,"");
86
87 // determine current ref id and mode
88 if (!empty($_GET["ref_id"]) && $tree->isInTree($_GET["ref_id"]))
89 {
90 $this->cur_ref_id = $_GET["ref_id"];
91 }
92 else
93 {
94 //$this->cur_ref_id = $this->tree->getRootId();
95 $_POST = array();
96 if ($_GET["cmd"] != "getDropDown")
97 {
98 $_GET["cmd"] = "";
99 }
100 }
101 }
102
103
107 function &executeCommand()
108 {
109 global $tree, $rbacsystem, $ilias, $lng, $objDefinition, $ilHelp;
110
111 // permission checks
112 include_once './Services/MainMenu/classes/class.ilMainMenuGUI.php';
114 {
115 $ilias->raiseError($this->lng->txt('permission_denied'),$ilias->error_obj->WARNING);
116 }
117
118 // check creation mode
119 // determined by "new_type" parameter
120 $new_type = $_POST["new_type"]
121 ? $_POST["new_type"]
122 : $_GET["new_type"];
123 if ($new_type != "" && $this->ctrl->getCmd() == "create")
124 {
125 $this->creation_mode = true;
126 }
127
128 // determine next class
129 if ($this->creation_mode)
130 {
131 $obj_type = $new_type;
132 $class_name = $this->objDefinition->getClassName($obj_type);
133 $next_class = strtolower("ilObj".$class_name."GUI");
134 $this->ctrl->setCmdClass($next_class);
135 }
136 // set next_class directly for page translations
137 // (no cmdNode is given in translation link)
138 elseif ($this->ctrl->getCmdClass() == "ilobjlanguageextgui")
139 {
140 $next_class = "ilobjlanguageextgui";
141 }
142 else
143 {
144 $next_class = $this->ctrl->getNextClass($this);
145
146 }
147
148 if (($next_class == "iladministrationgui" || $next_class == ""
149 ) && ($this->ctrl->getCmd() == "return"))
150 {
151 // get GUI of current object
152 $obj_type = ilObject::_lookupType($this->cur_ref_id,true);
153 $class_name = $this->objDefinition->getClassName($obj_type);
154 $next_class = strtolower("ilObj".$class_name."GUI");
155 $this->ctrl->setCmdClass($next_class);
156 $this->ctrl->setCmd("view");
157 }
158
159 $cmd = $this->ctrl->getCmd("forward");
160
161//echo "<br>cmd:$cmd:nextclass:$next_class:-".$_GET["cmdClass"]."-".$_GET["cmd"]."-";
162 switch ($next_class)
163 {
164 default:
165
166 // forward all other classes to gui commands
167 if ($next_class != "" && $next_class != "iladministrationgui")
168 {
169 // check db update
170 include_once ("./Services/Database/classes/class.ilDBUpdate.php");
171 $dbupdate = new ilDBUpdate($this->ilias->db,true);
172 if (!$dbupdate->getDBVersionStatus())
173 {
174 ilUtil::sendFailure($this->lng->txt("db_need_update"));
175 }
176 else if ($dbupdate->hotfixAvailable())
177 {
178 ilUtil::sendFailure($this->lng->txt("db_need_hotfix"));
179 }
180
181 $class_path = $this->ctrl->lookupClassPath($next_class);
182 // get gui class instance
183 include_once($class_path);
184 $class_name = $this->ctrl->getClassForClasspath($class_path);
185 if (($next_class == "ilobjrolegui" || $next_class == "ilobjusergui"
186 || $next_class == "ilobjroletemplategui"
187 || $next_class == "ilobjstylesheetgui"))
188 {
189 if ($_GET["obj_id"] != "")
190 {
191 $this->gui_obj = new $class_name("", $_GET["obj_id"], false, false);
192 $this->gui_obj->setCreationMode(false);
193 }
194 else
195 {
196 $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
197 $this->gui_obj->setCreationMode(true);
198 }
199 }
200 else
201 {
202 if ($objDefinition->isPlugin(ilObject::_lookupType($this->cur_ref_id,true)))
203 {
204 $this->gui_obj = new $class_name($this->cur_ref_id);
205 }
206 else
207 {
208 if(is_subclass_of($class_name, "ilObject2GUI"))
209 {
210 $this->gui_obj = new $class_name($this->cur_ref_id, ilObject2GUI::REPOSITORY_NODE_ID);
211 }
212 else
213 {
214 $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
215 }
216 }
217 $this->gui_obj->setCreationMode($this->creation_mode);
218 }
219 $tabs_out = ($new_type == "")
220 ? true
221 : false;
222
223 // set standard screen id
224// if (strtolower($next_class) == strtolower($this->ctrl->getCmdClass()) ||
225// "ilpermissiongui" == strtolower($this->ctrl->getCmdClass()))
226// {
227 $ilHelp->setScreenIdComponent(ilObject::_lookupType($this->cur_ref_id,true));
228// }
229 $this->showTree();
230
231 $this->ctrl->setReturn($this, "return");
232 $ret = $this->ctrl->forwardCommand($this->gui_obj);
233 $html = $this->gui_obj->getHTML();
234
235 if ($html != "")
236 {
237 $this->tpl->setVariable("OBJECTS", $html);
238 }
239 $this->tpl->show();
240 }
241 else //
242 {
243 $cmd = $this->ctrl->getCmd("forward");
244 $this->$cmd();
245 }
246 break;
247 }
248 }
249
253 function forward()
254 {
255 global $tree;
256
257 if ($_GET["admin_mode"] != "repository") // settings
258 {
259 if ($_GET["ref_id"] == USER_FOLDER_ID)
260 {
261 $this->ctrl->setParameter($this, "ref_id", USER_FOLDER_ID);
262 $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
263 if (((int) $_GET["jmpToUser"]) > 0 && ilObject::_lookupType((int)$_GET["jmpToUser"]) == "usr")
264 {
265 $this->ctrl->setParameterByClass("ilobjuserfoldergui", "jmpToUser",
266 (int)$_GET["jmpToUser"]);
267 $this->ctrl->redirectByClass("ilobjuserfoldergui", "jumpToUser");
268 }
269 else
270 {
271 $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
272 }
273 }
274 else
275 {
276 $this->ctrl->setParameter($this, "ref_id", SYSTEM_FOLDER_ID);
277 $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
278
279 if($_GET['fr'])
280 {
281 // Security check: We do only allow relative urls
282 $url_parts = parse_url(base64_decode(rawurldecode($_GET['fr'])));
283 if($url_parts['http'] || $url_parts['host'])
284 {
285 global $ilias;
286
287 $ilias->raiseError($this->lng->txt('permission_denied'), $ilias->error_obj->MESSAGE);
288 }
289
290 $fs_gui->setMainFrameSource(
291 base64_decode(rawurldecode($_GET['fr'])));
292 ilUtil::redirect(ILIAS_HTTP_PATH.'/'.base64_decode(rawurldecode($_GET['fr'])));
293 }
294 else
295 {
296 $fs_gui->setMainFrameSource(
297 $this->ctrl->getLinkTargetByClass("ilobjsystemfoldergui", "view"));
298 $this->ctrl->redirectByClass("ilobjsystemfoldergui", "view");
299 }
300 }
301 }
302 else
303 {
304 $this->ctrl->setParameter($this, "ref_id", ROOT_FOLDER_ID);
305 $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "repository");
306 $this->ctrl->redirectByClass("ilobjrootfoldergui", "view");
307 }
308 }
309
313 function showTree()
314 {
315 global $tpl, $tree, $lng;
316
317 if ($_GET["admin_mode"] != "repository")
318 {
319 return;
320 }
321
322 include_once("./Services/Administration/classes/class.ilAdministrationExplorerGUI.php");
323 $exp = new ilAdministrationExplorerGUI($this, "showTree");
324 if (!$exp->handleCommand())
325 {
326 $tpl->setLeftNavContent($exp->getHTML());
327 }
328 }
329
334 {
335 global $ilCtrl;
336
337 $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "ctype", $_GET["ctype"]);
338 $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "cname", $_GET["cname"]);
339 $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "slot_id", $_GET["slot_id"]);
340
341 if($_GET["plugin_id"])
342 {
343 $ilCtrl->setParameter($this, "plugin_id", $_GET["plugin_id"]);
344 $ilCtrl->redirectByClass("ilobjcomponentsettingsgui", "showPlugin");
345 }
346 else
347 {
348 $ilCtrl->redirectByClass("ilobjcomponentsettingsgui", "listPlugins");
349 }
350 }
351
355 function getDropDown()
356 {
357 global $tree, $rbacsystem, $lng, $ilSetting, $objDefinition;
358
359 $tpl = new ilTemplate("tpl.admin_drop_down.html", true, true, "Services/Administration");
360
361 $objects = $tree->getChilds(SYSTEM_FOLDER_ID);
362
363 foreach($objects as $object)
364 {
365 $new_objects[$object["title"].":".$object["child"]]
366 = $object;
367 //have to set it manually as translation type of main node cannot be "sys" as this type is a orgu itself.
368 if($object["type"] == "orgu")
369 $new_objects[$object["title"].":".$object["child"]]["title"] = $lng->txt("obj_orgu");
370 }
371
372 // add entry for switching to repository admin
373 // note: please see showChilds methods which prevents infinite look
374 $new_objects[$lng->txt("repository_admin").":".ROOT_FOLDER_ID] =
375 array(
376 "tree" => 1,
377 "child" => ROOT_FOLDER_ID,
378 "ref_id" => ROOT_FOLDER_ID,
379 "depth" => 3,
380 "type" => "root",
381 "title" => $lng->txt("repository_admin"),
382 "description" => $lng->txt("repository_admin_desc"),
383 "desc" => $lng->txt("repository_admin_desc"),
384 );
385
386//$nd = $tree->getNodeData(SYSTEM_FOLDER_ID);
387//var_dump($nd);
388 $new_objects[$lng->txt("general_settings").":".SYSTEM_FOLDER_ID] =
389 array(
390 "tree" => 1,
391 "child" => SYSTEM_FOLDER_ID,
392 "ref_id" => SYSTEM_FOLDER_ID,
393 "depth" => 2,
394 "type" => "adm",
395 "title" => $lng->txt("general_settings"),
396 );
397 ksort($new_objects);
398
399 // determine items to show
400 $items = array();
401 foreach ($new_objects as $c)
402 {
403 // check visibility
404 if ($tree->getParentId($c["ref_id"]) == ROOT_FOLDER_ID && $c["type"] != "adm" &&
405 $_GET["admin_mode"] != "repository")
406 {
407 continue;
408 }
409 // these objects may exist due to test cases that didnt clear
410 // data properly
411 if ($c["type"] == "" || $c["type"] == "objf" ||
412 $c["type"] == "xxx")
413 {
414 continue;
415 }
416 $accessible = $rbacsystem->checkAccess('visible,read', $c["ref_id"]);
417 if (!$accessible)
418 {
419 continue;
420 }
421 if ($c["ref_id"] == ROOT_FOLDER_ID &&
422 !$rbacsystem->checkAccess('write', $c["ref_id"]))
423 {
424 continue;
425 }
426 if ($c["type"] == "rolf" && $c["ref_id"] != ROLE_FOLDER_ID)
427 {
428 continue;
429 }
430 $items[] = $c;
431 }
432
433 $cnt = 0;
434 $titems = array();
435 foreach ($items as $i)
436 {
437 $titems[$i["type"]] = $i;
438 }
439
440 // admin menu layout
441 $layout = array(
442 1 => array(
443 "basic" =>
444 array("adm", "stys", "adve", "lngf", "cmps", "accs", "hlps", "trac"),
445 "users" =>
446 array("usrf", 'tos', "rolf", "auth", "ps", "orgu")
447 ),
448 2 => array(
449 "services" =>
450 array("pdts", "nwss", "tags", "prfa", "skmg", "cals", "mail",
451 "---", "seas", "mds", "taxs", "cert", 'ecss', "pays", "extt")
452 ),
453 3 => array(
454 "objects" =>
455 array("reps", "---", "bibs", "blga", "chta", "crss", "excs", "facs", "frma",
456 "grps", "lrss", "mcts", "mobs", "svyf", "assf", "wbrs", "wiks",
457 "---", 'otpl',"root", "recf")
458 )
459 );
460
461 // now get all items and groups that are accessible
462 $groups = array();
463 for ($i = 1; $i <= 3; $i++)
464 {
465 $groups[$i] = array();
466 foreach ($layout[$i] as $group => $entries)
467 {
468 $groups[$i][$group] = array();
469 $entries_since_last_sep = false;
470 foreach ($entries as $e)
471 {
472 if ($e == "---" || $titems[$e]["type"] != "")
473 {
474 if ($e == "---" && $entries_since_last_sep)
475 {
476 $groups[$i][$group][] = $e;
477 $entries_since_last_sep = false;
478 }
479 else if ($e != "---")
480 {
481 $groups[$i][$group][] = $e;
482 $entries_since_last_sep = true;
483 }
484 }
485 }
486 }
487 }
488
489 include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
490 $gl = new ilGroupedListGUI();
491 $gl->setAsDropDown(true);
492
493 for ($i = 1; $i <= 3; $i++)
494 {
495 if ($i > 1)
496 {
497 $gl->nextColumn();
498 }
499 foreach ($groups[$i] as $group => $entries)
500 {
501 if (count($entries) > 0)
502 {
503 $gl->addGroupHeader($lng->txt("adm_".$group));
504
505 foreach ($entries as $e)
506 {
507 if ($e == "---")
508 {
509 $gl->addSeparator();
510 }
511 else
512 {
513 $path = ilObject::_getIcon("", "tiny", $titems[$e]["type"]);
514 $icon = ($path != "")
515 ? ilUtil::img($path)." "
516 : "";
517
518 if ($_GET["admin_mode"] == "settings" && $titems[$e]["ref_id"] == ROOT_FOLDER_ID)
519 {
520 $gl->addEntry($icon.$titems[$e]["title"],
521 "ilias.php?baseClass=ilAdministrationGUI&ref_id=".
522 $titems[$e]["ref_id"]."&admin_mode=repository",
523 "_top", "", "", "mm_adm_rep",
524 ilHelp::getMainMenuTooltip("mm_adm_rep"),
525 "bottom center", "top center", false);
526 }
527 else
528 {
529 $gl->addEntry($icon.$titems[$e]["title"],
530 "ilias.php?baseClass=ilAdministrationGUI&ref_id=".
531 $titems[$e]["ref_id"]."&cmd=jump",
532 "_top", "", "", "mm_adm_".$titems[$e]["type"],
533 ilHelp::getMainMenuTooltip("mm_adm_".$titems[$e]["type"]),
534 "bottom center", "top center", false);
535 }
536 }
537 }
538 }
539 }
540 }
541
542 //$gl->addSeparator();
543
544 echo $gl->getHTML();
545 exit;
546 }
547
551 function jump()
552 {
553 global $ilCtrl, $objDefinition;
554
555 $ref_id = (int) $_GET["ref_id"];
557 $obj_type = ilObject::_lookupType($obj_id);
558 $class_name = $objDefinition->getClassName($obj_type);
559 $class = strtolower("ilObj".$class_name."GUI");
560 $ilCtrl->setParameterByClass($class, "ref_id", $ref_id);
561 $ilCtrl->redirectByClass($class, "view");
562 }
563}
564
565?>
$_GET["client_id"]
const USER_FOLDER_ID
Class ilObjUserFolder.
Administration explorer GUI class.
Class ilAdministratioGUI.
ilAdministrationGUI()
Constructor @access public.
jumpToPluginSlot()
Special jump to plugin slot after ilCtrl has been reloaded.
& executeCommand()
execute command
forward()
Forward to class/command.
Database Update class.
Grouped list GUI class.
static getMainMenuTooltip($a_item_id)
Get main menu tooltip.
static _lookupObjId($a_id)
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _lookupType($a_id, $a_reference=false)
lookup object type
special template class to simplify handling of ITX/PEAR
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static isAPICall()
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
redirection script todo: (a better solution should control the processing via a xml file)
global $ilSetting
Definition: privfeed.php:40
$ref_id
Definition: sahs_server.php:39
$path
Definition: index.php:22