ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAdministrationExplorer.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 /*
5 * Administration Explorer
6 *
7 * @author Alex Killing <alex.killing@gmx.de>
8 * @version $Id$
9 *
10 */
11 
12 require_once("./Services/UIComponent/Explorer/classes/class.ilExplorer.php");
13 
15 {
16 
22  var $root_id;
23  var $output;
24  var $ctrl;
31  function ilAdministrationExplorer($a_target)
32  {
33  global $tree,$ilCtrl,$lng;
34 
35  $this->ctrl = $ilCtrl;
36 
37  parent::ilExplorer($a_target);
38  $this->tree = $tree;
39  $this->root_id = $this->tree->readRootId();
40  $this->order_column = "title";
41  $this->setSessionExpandVariable("expand");
42  $this->setTitle($lng->txt("overview"));
43  }
44 
52  function formatHeader(&$tpl, $a_obj_id,$a_option)
53  {
54  global $lng, $ilias, $objDefinition;
55 
56  if ($_GET["admin_mode"] == "settings")
57  {
58  return;
59  }
60 
61  $tpl->setCurrentBlock("icon");
62  $tpl->setVariable("ICON_IMAGE" , ilUtil::getImagePath("icon_root.png"));
63  $tpl->setVariable("TXT_ALT_IMG", $lng->txt("repository"));
64  $tpl->parseCurrentBlock();
65 
66  $class_name = $objDefinition->getClassName("root");
67  $class = strtolower("ilObj".$class_name."GUI");
68  $this->ctrl->setParameterByClass($class, "ref_id", ROOT_FOLDER_ID);
69  $link = $this->ctrl->getLinkTargetByClass($class, "view");
70 
71  $tpl->setCurrentBlock("link");
72  $tpl->setVariable("TITLE", $lng->txt("repository"));
73  $tpl->setVariable("LINK_TARGET", $link);
74  $tpl->setVariable("TARGET", " target=\"content\"");
75  $tpl->parseCurrentBlock();
76 
77  $tpl->setCurrentBlock("element");
78  $tpl->parseCurrentBlock();
79 
80  }
81 
85  function buildLinkTarget($a_node_id, $a_type)
86  {
87  global $ilCtrl, $objDefinition;
88 
89  if ($a_type == "" || $a_type == "xxx")
90  {
91  return;
92  }
93  if ($_GET["admin_mode"] == "settings" && $a_node_id == ROOT_FOLDER_ID)
94  {
95  $this->ctrl->setParameterByClass("iladministrationgui", "ref_id", ROOT_FOLDER_ID);
96  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "repository");
97  $link = $this->ctrl->getLinkTargetByClass("iladministrationgui", "frameset");
98  $this->ctrl->setParameterByClass("iladministrationgui", "admin_mode", "settings");
99  }
100  else
101  {
102  $class_name = $objDefinition->getClassName($a_type);
103  $class = strtolower("ilObj".$class_name."GUI");
104  $this->ctrl->setParameterByClass($class, "ref_id", $a_node_id);
105  $link = $this->ctrl->getLinkTargetByClass($class, "view");
106  }
107  return $link;
108  }
109 
113  function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
114  {
115  if ($_GET["admin_mode"] == "settings" && $a_child == ROOT_FOLDER_ID)
116  {
117  return ilFrameTargetInfo::_getFrame("MainContent");
118  }
119  else
120  {
121  return $this->frame_target;
122  }
123  }
124 
125 
129  function getImage($a_name, $a_type = "", $a_obj_id = "")
130  {
131  if ($a_type != "")
132  {
133  return ilObject::_getIcon($a_obj_id, "tiny", $a_type);
134  }
135 
136  return parent::getImage($a_name);
137  }
138 
139  function isClickable($a_type, $a_ref_id)
140  {
141  global $rbacsystem;
142 
143  return $rbacsystem->checkAccess('read',$a_ref_id);
144  }
145 
146  function isVisible($a_ref_id, $a_type)
147  {
148  global $rbacsystem, $ilBench;
149 
150  if ($this->tree->getParentId($a_ref_id) == ROOT_FOLDER_ID && $a_type != "adm" &&
151  $_GET["admin_mode"] != "repository")
152  {
153  return false;
154  }
155 
156  // these objects may exist due to test cases that didnt clear
157  // data properly
158  if ($a_type == "" || $a_type == "xxx")
159  {
160  return false;
161  }
162 
163  $ilBench->start("Explorer", "setOutput_isVisible");
164  $visible = $rbacsystem->checkAccess('visible',$a_ref_id);
165  if ($a_type == "rolf" && $a_ref_id != ROLE_FOLDER_ID)
166  {
167  return false;
168  }
169 
170  $ilBench->stop("Explorer", "setOutput_isVisible");
171  return $visible;
172  }
173 
177  function modifyChilds($a_parent_id, $a_objects)
178  {
179  global $lng,$rbacsystem;
180 
181  if ($a_parent_id == SYSTEM_FOLDER_ID)
182  {
183  $new_objects = array();
184  foreach($a_objects as $object)
185  {
186  $new_objects[$object["title"].":".$object["child"]]
187  = $object;
188  }
189 
190  // add entry for switching to repository admin
191  // note: please see showChilds methods which prevents infinite look
192  if($rbacsystem->checkAccess('write',SYSTEM_FOLDER_ID))
193  {
194  $new_objects[$lng->txt("repository_admin").":".ROOT_FOLDER_ID] =
195  array(
196  "tree" => 1,
197  "child" => ROOT_FOLDER_ID,
198  "ref_id" => ROOT_FOLDER_ID,
199  "depth" => 3,
200  "type" => "root",
201  "title" => $lng->txt("repository_admin"),
202  "description" => $lng->txt("repository_admin_desc"),
203  "desc" => $lng->txt("repository_admin_desc"),
204  );
205  }
206  ksort($new_objects);
207 
208  return $new_objects;
209  }
210 
211  return $a_objects;
212  }
213 
214  function showChilds($a_parent_id, $a_obj_id)
215  {
216 
217  // prevent infinite loop due to (root folder tree) node
218  // that is inserted under system admin folder
219  if ($a_parent_id == ROOT_FOLDER_ID)
220  {
221  if ($this->rootfolder_shown == true)
222  {
223  return false;
224  }
225  $this->rootfolder_shown = true;
226  }
227 
228  return true;
229  }
230 
234  function forceExpanded($a_obj_id)
235  {
236  if ($a_obj_id == SYSTEM_FOLDER_ID)
237  {
238  return true;
239  }
240  else
241  {
242  return false;
243  }
244  }
245 
246 
247 } // END class ilAdministrationExplorer
248 ?>