ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAdministrationGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2005 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("./Services/Table/classes/class.ilTableGUI.php");
25 include_once("classes/class.ilTabsGUI.php");
26 
58 {
59  var $lng;
60  var $ilias;
61  var $tpl;
62  var $tree;
65  var $cmd;
66  var $mode;
67  var $ctrl;
68 
74  {
75  global $lng, $ilias, $tpl, $tree, $rbacsystem, $objDefinition,
76  $_GET, $ilCtrl, $ilLog, $ilMainMenu;
77 
78  $this->lng =& $lng;
79  $this->lng->loadLanguageModule('administration');
80  $this->ilias =& $ilias;
81  $this->tpl =& $tpl;
82  $this->tree =& $tree;
83  $this->rbacsystem =& $rbacsystem;
84  $this->objDefinition =& $objDefinition;
85 
86  $this->ctrl =& $ilCtrl;
87  $ilMainMenu->setActive("administration");
88 
89  $this->creation_mode = false;
90 
91  $this->ctrl->saveParameter($this, array("ref_id", "admin_mode"));
92 
93  if ($_GET["admin_mode"] != "repository")
94  {
95  $_GET["admin_mode"] = "settings";
96  }
97 
98  if (!ilUtil::isAPICall())
99  $this->ctrl->setReturn($this,"");
100 
101  // determine current ref id and mode
102  if (!empty($_GET["ref_id"]) && $tree->isInTree($_GET["ref_id"]))
103  {
104  $this->cur_ref_id = $_GET["ref_id"];
105  }
106  else
107  {
108  //$this->cur_ref_id = $this->tree->getRootId();
109  $_POST = array();
110  $_GET["cmd"] = "";
111  }
112  }
113 
114 
118  function &executeCommand()
119  {
120  global $tree, $rbacsystem, $ilias, $lng, $objDefinition;
121 
122  // permission checks
123  include_once './Services/MainMenu/classes/class.ilMainMenuGUI.php';
125  {
126  $ilias->raiseError("You are not entitled to access this page!",$ilias->error_obj->WARNING);
127  }
128  // check creation mode
129  // determined by "new_type" parameter
130  $new_type = $_POST["new_type"]
131  ? $_POST["new_type"]
132  : $_GET["new_type"];
133  if ($new_type != "" && $this->ctrl->getCmd() == "create")
134  {
135  $this->creation_mode = true;
136  }
137 
138  // determine next class
139  if ($this->creation_mode)
140  {
141  $obj_type = $new_type;
142  $class_name = $this->objDefinition->getClassName($obj_type);
143  $next_class = strtolower("ilObj".$class_name."GUI");
144  $this->ctrl->setCmdClass($next_class);
145  }
146  // set next_class directly for page translations
147  // (no cmdNode is given in translation link)
148  elseif ($this->ctrl->getCmdClass() == "ilobjlanguageextgui")
149  {
150  $next_class = "ilobjlanguageextgui";
151  }
152  else
153  {
154  $next_class = $this->ctrl->getNextClass($this);
155 
156  }
157 
158  if (($next_class == "iladministrationgui" || $next_class == ""
159  ) && ($this->ctrl->getCmd() == "return"))
160  {
161  // get GUI of current object
162  $obj_type = ilObject::_lookupType($this->cur_ref_id,true);
163  $class_name = $this->objDefinition->getClassName($obj_type);
164  $next_class = strtolower("ilObj".$class_name."GUI");
165  $this->ctrl->setCmdClass($next_class);
166  $this->ctrl->setCmd("view");
167  }
168 
169  $cmd = $this->ctrl->getCmd("frameset");
170 
171 //echo "<br>cmd:$cmd:nextclass:$next_class:-".$_GET["cmdClass"]."-".$_GET["cmd"]."-";
172  switch ($next_class)
173  {
174  /*
175  case "ilobjusergui":
176  include_once('./Services/User/classes/class.ilObjUserGUI.php');
177 
178  if(!$_GET['obj_id'])
179  {
180  $this->gui_obj = new ilObjUserGUI("",$_GET['ref_id'],true, false);
181  $this->gui_obj->setCreationMode($this->creation_mode);
182 
183  $this->prepareOutput(false);
184  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
185  }
186  else
187  {
188  $this->gui_obj = new ilObjUserGUI("", $_GET['obj_id'],false, false);
189  $this->gui_obj->setCreationMode($this->creation_mode);
190 
191  $this->prepareOutput(false);
192  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
193  }
194  $this->tpl->show();
195  break;
196  */
197 
198  /*
199  case "ilobjuserfoldergui":
200  include_once('./Services/User/classes/class.ilObjUserFolderGUI.php');
201 
202  $this->gui_obj = new ilObjUserFolderGUI("", $_GET['ref_id'],true, false);
203  $this->gui_obj->setCreationMode($this->creation_mode);
204 
205  $this->prepareOutput(false);
206  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
207  $this->tpl->show();
208  break;*/
209 
210  default:
211 
212  // forward all other classes to gui commands
213  if ($next_class != "" && $next_class != "iladministrationgui")
214  {
215  $class_path = $this->ctrl->lookupClassPath($next_class);
216  // get gui class instance
217  include_once($class_path);
218  $class_name = $this->ctrl->getClassForClasspath($class_path);
219  if (($next_class == "ilobjrolegui" || $next_class == "ilobjusergui"
220  || $next_class == "ilobjroletemplategui"
221  || $next_class == "ilobjstylesheetgui"))
222  {
223  if ($_GET["obj_id"] != "")
224  {
225  $this->gui_obj = new $class_name("", $_GET["obj_id"], false, false);
226  $this->gui_obj->setCreationMode(false);
227  }
228  else
229  {
230  $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
231  $this->gui_obj->setCreationMode(true);
232  }
233  }
234  else
235  {
236  if ($objDefinition->isPlugin(ilObject::_lookupType($this->cur_ref_id,true)))
237  {
238  $this->gui_obj = new $class_name($this->cur_ref_id);
239  }
240  else
241  {
242  $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
243  }
244  $this->gui_obj->setCreationMode($this->creation_mode);
245  }
246  $tabs_out = ($new_type == "")
247  ? true
248  : false;
249 
250  $this->ctrl->setReturn($this, "return");
251  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
252  $html = $this->gui_obj->getHTML();
253 
254  if ($html != "")
255  {
256  $this->tpl->setVariable("OBJECTS", $html);
257  }
258  $this->tpl->show();
259  }
260  else //
261  {
262  $cmd = $this->ctrl->getCmd("frameset");
263  $this->$cmd();
264  }
265  break;
266  }
267  }
268 
272  function frameset()
273  {
274  global $tree;
275 
276  include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
277  $fs_gui = new ilFramesetGUI();
278 
279  $fs_gui->setMainFrameName("content");
280  $fs_gui->setSideFrameName("tree");
281  $fs_gui->setFrameSetTitle($this->lng->txt("administration"));
282 
283  if ($_GET["admin_mode"] != "repository") // settings
284  {
285  if ($_GET["ref_id"] == USER_FOLDER_ID)
286  {
287  $this->ctrl->setParameter($this, "ref_id", USER_FOLDER_ID);
288  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
289  if (((int) $_GET["jmpToUser"]) > 0 && ilObject::_lookupType((int)$_GET["jmpToUser"]) == "usr")
290  {
291  $this->ctrl->setParameterByClass("ilobjuserfoldergui", "jmpToUser",
292  (int)$_GET["jmpToUser"]);
293  $fs_gui->setMainFrameSource(
294  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "jumpToUser"));
295  }
296  else
297  {
298  $fs_gui->setMainFrameSource(
299  $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view"));
300  }
301  }
302  else
303  {
304  $this->ctrl->setParameter($this, "ref_id", SYSTEM_FOLDER_ID);
305  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
306 
307  if($_GET['fr'])
308  {
309  // Security check: We do only allow relative urls
310  $url_parts = parse_url(base64_decode(rawurldecode($_GET['fr'])));
311  if($url_parts['http'] || $url_parts['host'])
312  {
313  global $ilias;
314 
315  $ilias->raiseError($this->lng->txt('permission_denied'), $ilias->error_obj->MESSAGE);
316  }
317 
318  $fs_gui->setMainFrameSource(
319  base64_decode(rawurldecode($_GET['fr'])));
320  }
321  else
322  {
323  $fs_gui->setMainFrameSource(
324  $this->ctrl->getLinkTargetByClass("ilobjsystemfoldergui", "view"));
325  }
326  }
327  $this->ctrl->setParameter($this, "expand", "1");
328  $fs_gui->setSideFrameSource(
329  $this->ctrl->getLinkTarget($this, "showTree"));
330  }
331  else
332  {
333  $this->ctrl->setParameter($this, "ref_id", ROOT_FOLDER_ID);
334  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "repository");
335  $fs_gui->setMainFrameSource(
336  $this->ctrl->getLinkTargetByClass("ilobjrootfoldergui", "view"));
337  $this->ctrl->setParameter($this, "expand", "1");
338  $fs_gui->setSideFrameSource(
339  $this->ctrl->getLinkTarget($this, "showTree"));
340  }
341 
342  $fs_gui->show();
343  exit;
344  }
345 
349  function showTree()
350  {
351  global $tpl, $tree, $lng;
352 
353  require_once "./Services/Administration/classes/class.ilAdministrationExplorer.php";
354 
355  $explorer = new ilAdministrationExplorer("ilias.php?baseClass=ilAdministrationGUI&cmd=view");
356  $explorer->setExpand($_GET["expand"]);
357  $explorer->setExpandTarget($this->ctrl->getLinkTarget($this, "showTree"));
358  $explorer->setUseStandardFrame(true);
359 
360  // hide RecoveryFolder if empty
361  if (!$tree->getChilds(RECOVERY_FOLDER_ID))
362  {
363  $explorer->addFilter("recf");
364  }
365  //$explorer->addFilter("rolf");
366 
367  if ($_GET["admin_mode"] == "settings")
368  {
369  $explorer->addFilter("cat");
370  $explorer->addFilter("catr");
371  }
372  else
373  {
374  $explorer->addFilter("adm");
375  }
376  /*
377  $explorer->addFilter("root");
378  $explorer->addFilter("cat");
379  $explorer->addFilter("grp");
380  $explorer->addFilter("crs");
381  $explorer->addFilter("le");
382  $explorer->addFilter("frm");
383  $explorer->addFilter("lo");
384  $explorer->addFilter("rolf");
385  $explorer->addFilter("adm");
386  $explorer->addFilter("lngf");
387  $explorer->addFilter("usrf");
388  $explorer->addFilter("objf");
389  */
390  //$explorer->setFiltered(false);
391  $explorer->setOutput(0);
392  $output = $explorer->getOutput();
393  $this->ctrl->setParameter($this, "expand", $_GET["expand"]);
394  echo $output;
395  }
396 
400  function jumpToPluginSlot()
401  {
402  global $ilCtrl;
403 
404  $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "ctype", $_GET["ctype"]);
405  $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "cname", $_GET["cname"]);
406  $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "slot_id", $_GET["slot_id"]);
407  $ilCtrl->redirectByClass("ilobjcomponentsettingsgui", "showPluginSlot");
408 
409  }
410 
411 } // END class.ilRepository
412 
413 
414 ?>