ILIAS  Release_4_0_x_branch Revision 61816
 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 
57 {
58  var $lng;
59  var $ilias;
60  var $tpl;
61  var $tree;
64  var $cmd;
65  var $mode;
66  var $ctrl;
67 
73  {
74  global $lng, $ilias, $tpl, $tree, $rbacsystem, $objDefinition,
75  $_GET, $ilCtrl, $ilLog, $ilMainMenu;
76 
77  $this->lng =& $lng;
78  $this->lng->loadLanguageModule('administration');
79  $this->ilias =& $ilias;
80  $this->tpl =& $tpl;
81  $this->tree =& $tree;
82  $this->rbacsystem =& $rbacsystem;
83  $this->objDefinition =& $objDefinition;
84 
85  $this->ctrl =& $ilCtrl;
86  $ilMainMenu->setActive("administration");
87 
88  $this->creation_mode = false;
89 
90  $this->ctrl->saveParameter($this, array("ref_id", "admin_mode"));
91 
92  if ($_GET["admin_mode"] != "repository")
93  {
94  $_GET["admin_mode"] = "settings";
95  }
96 
97  if (!ilUtil::isAPICall())
98  $this->ctrl->setReturn($this,"");
99 
100  // determine current ref id and mode
101  if (!empty($_GET["ref_id"]) && $tree->isInTree($_GET["ref_id"]))
102  {
103  $this->cur_ref_id = $_GET["ref_id"];
104  }
105  else
106  {
107  //$this->cur_ref_id = $this->tree->getRootId();
108  $_POST = array();
109  $_GET["cmd"] = "";
110  }
111  }
112 
113 
117  function &executeCommand()
118  {
119  global $tree, $rbacsystem, $ilias, $lng, $objDefinition;
120 
121  // permission checks
122  include_once './Services/MainMenu/classes/class.ilMainMenuGUI.php';
124  {
125  $ilias->raiseError("You are not entitled to access this page!",$ilias->error_obj->WARNING);
126  }
127  // check creation mode
128  // determined by "new_type" parameter
129  $new_type = $_POST["new_type"]
130  ? $_POST["new_type"]
131  : $_GET["new_type"];
132  if ($new_type != "" && $this->ctrl->getCmd() == "create")
133  {
134  $this->creation_mode = true;
135  }
136 
137  // determine next class
138  if ($this->creation_mode)
139  {
140  $obj_type = $new_type;
141  $class_name = $this->objDefinition->getClassName($obj_type);
142  $next_class = strtolower("ilObj".$class_name."GUI");
143  $this->ctrl->setCmdClass($next_class);
144  }
145  // set next_class directly for page translations
146  // (no cmdNode is given in translation link)
147  elseif ($this->ctrl->getCmdClass() == "ilobjlanguageextgui")
148  {
149  $next_class = "ilobjlanguageextgui";
150  }
151  else
152  {
153  $next_class = $this->ctrl->getNextClass($this);
154 
155  }
156 
157  if (($next_class == "iladministrationgui" || $next_class == ""
158  ) && ($this->ctrl->getCmd() == "return"))
159  {
160  // get GUI of current object
161  $obj_type = ilObject::_lookupType($this->cur_ref_id,true);
162  $class_name = $this->objDefinition->getClassName($obj_type);
163  $next_class = strtolower("ilObj".$class_name."GUI");
164  $this->ctrl->setCmdClass($next_class);
165  $this->ctrl->setCmd("view");
166  }
167 
168  $cmd = $this->ctrl->getCmd("frameset");
169 
170 //echo "<br>cmd:$cmd:nextclass:$next_class:-".$_GET["cmdClass"]."-".$_GET["cmd"]."-";
171  switch ($next_class)
172  {
173  /*
174  case "ilobjusergui":
175  include_once('./Services/User/classes/class.ilObjUserGUI.php');
176 
177  if(!$_GET['obj_id'])
178  {
179  $this->gui_obj = new ilObjUserGUI("",$_GET['ref_id'],true, false);
180  $this->gui_obj->setCreationMode($this->creation_mode);
181 
182  $this->prepareOutput(false);
183  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
184  }
185  else
186  {
187  $this->gui_obj = new ilObjUserGUI("", $_GET['obj_id'],false, false);
188  $this->gui_obj->setCreationMode($this->creation_mode);
189 
190  $this->prepareOutput(false);
191  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
192  }
193  $this->tpl->show();
194  break;
195  */
196 
197  /*
198  case "ilobjuserfoldergui":
199  include_once('./Services/User/classes/class.ilObjUserFolderGUI.php');
200 
201  $this->gui_obj = new ilObjUserFolderGUI("", $_GET['ref_id'],true, false);
202  $this->gui_obj->setCreationMode($this->creation_mode);
203 
204  $this->prepareOutput(false);
205  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
206  $this->tpl->show();
207  break;*/
208 
209  default:
210 
211  // forward all other classes to gui commands
212  if ($next_class != "" && $next_class != "iladministrationgui")
213  {
214  $class_path = $this->ctrl->lookupClassPath($next_class);
215  // get gui class instance
216  include_once($class_path);
217  $class_name = $this->ctrl->getClassForClasspath($class_path);
218  if (($next_class == "ilobjrolegui" || $next_class == "ilobjusergui"
219  || $next_class == "ilobjroletemplategui"
220  || $next_class == "ilobjstylesheetgui"))
221  {
222  if ($_GET["obj_id"] != "")
223  {
224  $this->gui_obj = new $class_name("", $_GET["obj_id"], false, false);
225  $this->gui_obj->setCreationMode(false);
226  }
227  else
228  {
229  $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
230  $this->gui_obj->setCreationMode(true);
231  }
232  }
233  else
234  {
235  if ($objDefinition->isPlugin(ilObject::_lookupType($this->cur_ref_id,true)))
236  {
237  $this->gui_obj = new $class_name($this->cur_ref_id);
238  }
239  else
240  {
241  $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
242  }
243  $this->gui_obj->setCreationMode($this->creation_mode);
244  }
245  $tabs_out = ($new_type == "")
246  ? true
247  : false;
248 
249  $this->ctrl->setReturn($this, "return");
250  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
251  $html = $this->gui_obj->getHTML();
252 
253  if ($html != "")
254  {
255  $this->tpl->setVariable("OBJECTS", $html);
256  }
257  $this->tpl->show();
258  }
259  else //
260  {
261  $cmd = $this->ctrl->getCmd("frameset");
262  $this->$cmd();
263  }
264  break;
265  }
266  }
267 
271  function frameset()
272  {
273  global $tree;
274 
275  include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
276  $fs_gui = new ilFramesetGUI();
277 
278  $fs_gui->setMainFrameName("content");
279  $fs_gui->setSideFrameName("tree");
280  $fs_gui->setFrameSetTitle($this->lng->txt("administration"));
281 
282  if ($_GET["admin_mode"] != "repository") // settings
283  {
284  $this->ctrl->setParameter($this, "ref_id", SYSTEM_FOLDER_ID);
285  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
286  $fs_gui->setMainFrameSource(
287  $this->ctrl->getLinkTargetByClass("ilobjsystemfoldergui", "view"));
288  $this->ctrl->setParameter($this, "expand", "1");
289  $fs_gui->setSideFrameSource(
290  $this->ctrl->getLinkTarget($this, "showTree"));
291  }
292  else
293  {
294  $this->ctrl->setParameter($this, "ref_id", ROOT_FOLDER_ID);
295  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "repository");
296  $fs_gui->setMainFrameSource(
297  $this->ctrl->getLinkTargetByClass("ilobjrootfoldergui", "view"));
298  $this->ctrl->setParameter($this, "expand", "1");
299  $fs_gui->setSideFrameSource(
300  $this->ctrl->getLinkTarget($this, "showTree"));
301  }
302 
303  $fs_gui->show();
304  exit;
305  }
306 
310  function showTree()
311  {
312  global $tpl, $tree, $lng;
313 
314  require_once "./Services/Administration/classes/class.ilAdministrationExplorer.php";
315 
316  $explorer = new ilAdministrationExplorer("ilias.php?baseClass=ilAdministrationGUI&cmd=view");
317  $explorer->setExpand($_GET["expand"]);
318  $explorer->setExpandTarget($this->ctrl->getLinkTarget($this, "showTree"));
319  $explorer->setUseStandardFrame(true);
320 
321  // hide RecoveryFolder if empty
322  if (!$tree->getChilds(RECOVERY_FOLDER_ID))
323  {
324  $explorer->addFilter("recf");
325  }
326  //$explorer->addFilter("rolf");
327 
328  if ($_GET["admin_mode"] == "settings")
329  {
330  $explorer->addFilter("cat");
331  $explorer->addFilter("catr");
332  }
333  else
334  {
335  $explorer->addFilter("adm");
336  }
337  /*
338  $explorer->addFilter("root");
339  $explorer->addFilter("cat");
340  $explorer->addFilter("grp");
341  $explorer->addFilter("crs");
342  $explorer->addFilter("le");
343  $explorer->addFilter("frm");
344  $explorer->addFilter("lo");
345  $explorer->addFilter("rolf");
346  $explorer->addFilter("adm");
347  $explorer->addFilter("lngf");
348  $explorer->addFilter("usrf");
349  $explorer->addFilter("objf");
350  */
351  //$explorer->setFiltered(false);
352  $explorer->setOutput(0);
353  $output = $explorer->getOutput();
354  $this->ctrl->setParameter($this, "expand", $_GET["expand"]);
355  echo $output;
356  }
357 
361  function jumpToPluginSlot()
362  {
363  global $ilCtrl;
364 
365  $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "ctype", $_GET["ctype"]);
366  $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "cname", $_GET["cname"]);
367  $ilCtrl->setParameterByClass("ilobjcomponentsettingsgui", "slot_id", $_GET["slot_id"]);
368  $ilCtrl->redirectByClass("ilobjcomponentsettingsgui", "showPluginSlot");
369 
370  }
371 
372 } // END class.ilRepository
373 
374 
375 ?>