ILIAS  release_4-4 Revision
class.ilAdministrationExplorerGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
5 
17 {
18  protected $type_grps = array();
19  protected $session_materials = array();
20 
24  public function __construct($a_parent_obj, $a_parent_cmd)
25  {
26  global $tree, $ilSetting, $objDefinition;
27 
28  $this->cur_ref_id = (int) $_GET["ref_id"];
29 
30  $this->top_node_id = 0;
31  parent::__construct("adm_exp", $a_parent_obj, $a_parent_cmd, $tree);
32 
33  $this->setSkipRootNode(false);
34  $this->setAjax(true);
35  $this->setOrderField("title");
36 
37  $white = array();
38  foreach ($objDefinition->getSubObjectsRecursively("root") as $rtype)
39  {
40  if ($rtype["name"] != "itgr" && !$objDefinition->isSideBlock($rtype["name"]))
41  {
42  $white[] = $rtype["name"];
43  }
44  }
45  $this->setTypeWhiteList($white);
46 
47  if ((int) $_GET["ref_id"] > 0)
48  {
49  $this->setPathOpen((int) $_GET["ref_id"]);
50  }
51  }
52 
59  function getNodeContent($a_node)
60  {
61  global $lng;
62 
63  $title = $a_node["title"];
64  if ($a_node["child"] == $this->getNodeId($this->getRootNode()))
65  {
66  if ($title == "ILIAS")
67  {
68  $title = $lng->txt("repository");
69  }
70  }
71 
72  return $title;
73  }
74 
81  function getNodeIcon($a_node)
82  {
83  $obj_id = ilObject::_lookupObjId($a_node["child"]);
84  return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
85  }
86 
93  function getNodeIconAlt($a_node)
94  {
95  global $lng;
96 
97  if ($a_node["child"] == $this->getNodeId($this->getRootNode()))
98  {
99  $title = $a_node["title"];
100  if ($title == "ILIAS")
101  {
102  $title = $lng->txt("repository");
103  }
104  return $lng->txt("icon")." ".$title;
105  }
106 
107 
108  return parent::getNodeIconAlt($a_node);
109  }
110 
117  function isNodeHighlighted($a_node)
118  {
119  if ($a_node["child"] == $_GET["ref_id"] ||
120  ($_GET["ref_id"] == "" && $a_node["child"] == $this->getNodeId($this->getRootNode())))
121  {
122  return true;
123  }
124  return false;
125  }
126 
133  function getNodeHref($a_node)
134  {
135  global $ilCtrl, $objDefinition;
136 
137  $class_name = $objDefinition->getClassName($a_node["type"]);
138  $class = strtolower("ilObj".$class_name."GUI");
139  $ilCtrl->setParameterByClass($class, "ref_id", $a_node["child"]);
140  $link = $ilCtrl->getLinkTargetByClass($class, "view");
141  $ilCtrl->setParameterByClass($class, "ref_id", $_GET["ref_id"]);
142 
143  return $link;
144  }
145 
152  function isNodeVisible($a_node)
153  {
154  global $rbacsystem;
155 
156  $visible = $rbacsystem->checkAccess('visible', $a_node["child"]);
157  if ($a_node["type"] == "rolf" && $a_node["child"] != ROLE_FOLDER_ID)
158  {
159  return false;
160  }
161  return $visible;
162  }
163 
172  function sortChilds($a_childs, $a_parent_node_id)
173  {
174  global $objDefinition;
175 
176  $parent_obj_id = ilObject::_lookupObjId($a_parent_node_id);
177 
178  if ($parent_obj_id > 0)
179  {
180  $parent_type = ilObject::_lookupType($parent_obj_id);
181  }
182  else
183  {
184  $parent_type = "dummy";
185  $this->type_grps["dummy"] = array("root" => "dummy");
186  }
187 
188  if (empty($this->type_grps[$parent_type]))
189  {
190  $this->type_grps[$parent_type] =
191  $objDefinition->getGroupedRepositoryObjectTypes($parent_type);
192  }
193  $group = array();
194 
195  foreach ($a_childs as $child)
196  {
197  $g = $objDefinition->getGroupOfObj($child["type"]);
198  if ($g == "")
199  {
200  $g = $child["type"];
201  }
202  $group[$g][] = $child;
203  }
204 
205  $childs = array();
206  foreach ($this->type_grps[$parent_type] as $t => $g)
207  {
208  if (is_array($group[$t]))
209  {
210  // do we have to sort this group??
211  include_once("./Services/Container/classes/class.ilContainer.php");
212  include_once("./Services/Container/classes/class.ilContainerSorting.php");
213  $sort = ilContainerSorting::_getInstance($parent_obj_id);
214  $group = $sort->sortItems($group);
215 
216  // need extra session sorting here
217  if ($t == "sess")
218  {
219 
220  }
221 
222  foreach ($group[$t] as $k => $item)
223  {
224  $childs[] = $item;
225  }
226  }
227  }
228 
229  return $childs;
230  }
231 
238  function getChildsOfNode($a_parent_node_id)
239  {
240  global $rbacsystem;
241 
242  if (!$rbacsystem->checkAccess("read", $a_parent_node_id))
243  {
244  return array();
245  }
246 
247  return parent::getChildsOfNode($a_parent_node_id);
248  }
249 
256  function isNodeClickable($a_node)
257  {
258  global $rbacsystem,$tree,$ilDB,$ilUser,$ilAccess;
259 
260  return $rbacsystem->checkAccess('read', $a_node["child"]);
261  }
262 
263 }
264 
265 ?>
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
$_GET["client_id"]
setSkipRootNode($a_val)
Set skip root node.
getNodeIconAlt($a_node)
Get node icon alt text.
setPathOpen($a_id)
Set node path to be opened.
setTypeWhiteList($a_val)
Set type white list.
global $ilCtrl
Definition: ilias.php:18
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
static _lookupObjId($a_id)
isNodeHighlighted($a_node)
Is node highlighted?
Administration explorer GUI class.
getNodeId($a_node)
Get id for node.
static _lookupType($a_id, $a_reference=false)
lookup object type
getRootNode()
Get root node.
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
Explorer class that works on tree objects (Services/Tree)
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
global $lng
Definition: privfeed.php:40
setOrderField($a_val, $a_numeric=false)
Set order field.
static _getInstance($a_obj_id)
get instance by obj_id
getChildsOfNode($a_parent_node_id)
Get childs of node.