ILIAS  eassessment Revision 61809
 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: class.ilAdministrationExplorer.php 28404 2011-04-07 05:44:49Z hschottm $
9 *
10 */
11 
12 require_once("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.gif"));
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  // custom icons
134  if ($this->ilias->getSetting("custom_icons") &&
135  in_array($a_type, array("cat","grp","crs")))
136  {
137  require_once("./Services/Container/classes/class.ilContainer.php");
138  if (($path = ilContainer::_lookupIconPath($a_obj_id, "small")) != "")
139  {
140  return $path;
141  }
142  }
143  }
144 
145  return parent::getImage($a_name);
146  }
147 
148  function isClickable($a_type, $a_ref_id)
149  {
150  global $rbacsystem;
151 
152  return $rbacsystem->checkAccess('read',$a_ref_id);
153  }
154 
155  function isVisible($a_ref_id, $a_type)
156  {
157  global $rbacsystem, $ilBench;
158 
159  if ($this->tree->getParentId($a_ref_id) == ROOT_FOLDER_ID && $a_type != "adm" &&
160  $_GET["admin_mode"] != "repository")
161  {
162  return false;
163  }
164 
165  // these objects may exist due to test cases that didnt clear
166  // data properly
167  if ($a_type == "" || $a_type == "xxx" || $a_type == 'frma')
168  {
169  return false;
170  }
171 
172  $ilBench->start("Explorer", "setOutput_isVisible");
173  $visible = $rbacsystem->checkAccess('visible',$a_ref_id);
174  if ($a_type == "rolf" && $a_ref_id != ROLE_FOLDER_ID)
175  {
176  return false;
177  }
178 
179  $ilBench->stop("Explorer", "setOutput_isVisible");
180  return $visible;
181  }
182 
186  function modifyChilds($a_parent_id, $a_objects)
187  {
188  global $lng,$rbacsystem;
189 
190  if ($a_parent_id == SYSTEM_FOLDER_ID)
191  {
192  $new_objects = array();
193  foreach($a_objects as $object)
194  {
195  $new_objects[$object["title"].":".$object["child"]]
196  = $object;
197  }
198 
199  // add entry for switching to repository admin
200  // note: please see showChilds methods which prevents infinite look
201  if($rbacsystem->checkAccess('write',SYSTEM_FOLDER_ID))
202  {
203  $new_objects[$lng->txt("repository_admin").":".ROOT_FOLDER_ID] =
204  array(
205  "tree" => 1,
206  "child" => ROOT_FOLDER_ID,
207  "ref_id" => ROOT_FOLDER_ID,
208  "depth" => 3,
209  "type" => "root",
210  "title" => $lng->txt("repository_admin"),
211  "description" => $lng->txt("repository_admin_desc"),
212  "desc" => $lng->txt("repository_admin_desc"),
213  );
214  }
215  ksort($new_objects);
216 
217  return $new_objects;
218  }
219 
220  return $a_objects;
221  }
222 
223  function showChilds($a_parent_id, $a_obj_id)
224  {
225 
226  // prevent infinite loop due to (root folder tree) node
227  // that is inserted under system admin folder
228  if ($a_parent_id == ROOT_FOLDER_ID)
229  {
230  if ($this->rootfolder_shown == true)
231  {
232  return false;
233  }
234  $this->rootfolder_shown = true;
235  }
236 
237  return true;
238  }
239 
243  function forceExpanded($a_obj_id)
244  {
245  if ($a_obj_id == SYSTEM_FOLDER_ID)
246  {
247  return true;
248  }
249  else
250  {
251  return false;
252  }
253  }
254 
255 
256 } // END class ilAdministrationExplorer
257 ?>