ILIAS  eassessment Revision 61809
 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  $fs_gui->setMainFrameSource(
310  base64_decode(rawurldecode($_GET['fr'])));
311  }
312  else
313  {
314  $fs_gui->setMainFrameSource(
315  $this->ctrl->getLinkTargetByClass("ilobjsystemfoldergui", "view"));
316  }
317  }
318  $this->ctrl->setParameter($this, "expand", "1");
319  $fs_gui->setSideFrameSource(
320  $this->ctrl->getLinkTarget($this, "showTree"));
321  }
322  else
323  {
324  $this->ctrl->setParameter($this, "ref_id", ROOT_FOLDER_ID);
325  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "repository");
326  $fs_gui->setMainFrameSource(
327  $this->ctrl->getLinkTargetByClass("ilobjrootfoldergui", "view"));
328  $this->ctrl->setParameter($this, "expand", "1");
329  $fs_gui->setSideFrameSource(
330  $this->ctrl->getLinkTarget($this, "showTree"));
331  }
332 
333  $fs_gui->show();
334  exit;
335  }
336 
340  function showTree()
341  {
342  global $tpl, $tree, $lng;
343 
344  require_once "./Services/Administration/classes/class.ilAdministrationExplorer.php";
345 
346  $explorer = new ilAdministrationExplorer("ilias.php?baseClass=ilAdministrationGUI&cmd=view");
347  $explorer->setExpand($_GET["expand"]);
348  $explorer->setExpandTarget($this->ctrl->getLinkTarget($this, "showTree"));
349  $explorer->setUseStandardFrame(true);
350 
351  // hide RecoveryFolder if empty
352  if (!$tree->getChilds(RECOVERY_FOLDER_ID))
353  {
354  $explorer->addFilter("recf");
355  }
356  //$explorer->addFilter("rolf");
357 
358  if ($_GET["admin_mode"] == "settings")
359  {
360  $explorer->addFilter("cat");
361  $explorer->addFilter("catr");
362  }
363  else
364  {
365  $explorer->addFilter("adm");
366  }
367  /*
368  $explorer->addFilter("root");
369  $explorer->addFilter("cat");
370  $explorer->addFilter("grp");
371  $explorer->addFilter("crs");
372  $explorer->addFilter("le");
373  $explorer->addFilter("lo");
374  $explorer->addFilter("rolf");
375  $explorer->addFilter("adm");
376  $explorer->addFilter("lngf");
377  $explorer->addFilter("usrf");
378  $explorer->addFilter("objf");
379  */
380  //$explorer->setFiltered(false);
381  $explorer->setOutput(0);
382  $output = $explorer->getOutput();
383  $this->ctrl->setParameter($this, "expand", $_GET["expand"]);
384  echo $output;
385  }
386 
390  function jumpToPluginSlot()
391  {
392  global $ilCtrl;
393 
394  $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "ctype", $_GET["ctype"]);
395  $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "cname", $_GET["cname"]);
396  $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "slot_id", $_GET["slot_id"]);
397  $ilCtrl->redirectByClass("ilobjcomponentsettingsgui", "showPluginSlot");
398 
399  }
400 
401 } // END class.ilRepository
402 
403 
404 ?>