ILIAS  Release_3_10_x_branch Revision 61812
 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;
120 
121  // permission checks
122  include_once './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  $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
236  $this->gui_obj->setCreationMode($this->creation_mode);
237  }
238  $tabs_out = ($new_type == "")
239  ? true
240  : false;
241 
242  $this->ctrl->setReturn($this, "return");
243  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
244  $html = $this->gui_obj->getHTML();
245 
246  if ($html != "")
247  {
248  $this->tpl->setVariable("OBJECTS", $html);
249  }
250  $this->tpl->show();
251  }
252  else //
253  {
254  $cmd = $this->ctrl->getCmd("frameset");
255  $this->$cmd();
256  }
257  break;
258  }
259  }
260 
264  function frameset()
265  {
266  global $tree;
267 
268  include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
269  $fs_gui = new ilFramesetGUI();
270 
271  $fs_gui->setMainFrameName("content");
272  $fs_gui->setSideFrameName("tree");
273  $fs_gui->setFrameSetTitle($this->lng->txt("administration"));
274 
275  if ($_GET["admin_mode"] != "repository") // settings
276  {
277  $this->ctrl->setParameter($this, "ref_id", SYSTEM_FOLDER_ID);
278  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
279  $fs_gui->setMainFrameSource(
280  $this->ctrl->getLinkTargetByClass("ilobjsystemfoldergui", "view"));
281  $this->ctrl->setParameter($this, "expand", "1");
282  $fs_gui->setSideFrameSource(
283  $this->ctrl->getLinkTarget($this, "showTree"));
284  }
285  else
286  {
287  $this->ctrl->setParameter($this, "ref_id", ROOT_FOLDER_ID);
288  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "repository");
289  $fs_gui->setMainFrameSource(
290  $this->ctrl->getLinkTargetByClass("ilobjrootfoldergui", "view"));
291  $this->ctrl->setParameter($this, "expand", "1");
292  $fs_gui->setSideFrameSource(
293  $this->ctrl->getLinkTarget($this, "showTree"));
294  }
295 
296  $fs_gui->show();
297  exit;
298  }
299 
303  function showTree()
304  {
305  global $tpl, $tree, $lng;
306 
307  require_once "classes/class.ilAdministrationExplorer.php";
308 
309  $tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
310  $tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
311 
312  $explorer = new ilAdministrationExplorer("ilias.php?baseClass=ilAdministrationGUI&cmd=view");
313  $explorer->setExpand($_GET["expand"]);
314  $explorer->setExpandTarget($this->ctrl->getLinkTarget($this, "showTree"));
315 
316  // hide RecoveryFolder if empty
317  if (!$tree->getChilds(RECOVERY_FOLDER_ID))
318  {
319  $explorer->addFilter("recf");
320  }
321  //$explorer->addFilter("rolf");
322 
323  if ($_GET["admin_mode"] == "settings")
324  {
325  $explorer->addFilter("cat");
326  $explorer->addFilter("catr");
327  }
328  else
329  {
330  $explorer->addFilter("adm");
331  }
332  /*
333  $explorer->addFilter("root");
334  $explorer->addFilter("cat");
335  $explorer->addFilter("grp");
336  $explorer->addFilter("crs");
337  $explorer->addFilter("le");
338  $explorer->addFilter("frm");
339  $explorer->addFilter("lo");
340  $explorer->addFilter("rolf");
341  $explorer->addFilter("adm");
342  $explorer->addFilter("lngf");
343  $explorer->addFilter("usrf");
344  $explorer->addFilter("objf");
345  */
346  //$explorer->setFiltered(false);
347  $explorer->setOutput(0);
348  $output = $explorer->getOutput();
349  $tpl->setCurrentBlock("content");
350  //$tpl->setVariable("TXT_EXPLORER_HEADER", $lng->txt("all_objects"));
351  $tpl->setVariable("EXP_REFRESH", $lng->txt("refresh"));
352  $tpl->setVariable("EXPLORER",$output);
353  $this->ctrl->setParameter($this, "expand", $_GET["expand"]);
354  $tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "showTree"));
355  $tpl->parseCurrentBlock();
356 
357  $tpl->show(false);
358  }
359 
360 } // END class.ilRepository
361 
362 
363 ?>