ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 {
21  protected $settings;
22 
26  protected $obj_definition;
27 
31  protected $lng;
32 
36  protected $ctrl;
37 
41  protected $rbacsystem;
42 
46  protected $db;
47 
51  protected $user;
52 
56  protected $access;
57 
58  protected $type_grps = array();
59  protected $session_materials = array();
60 
64  public function __construct($a_parent_obj, $a_parent_cmd)
65  {
66  global $DIC;
67 
68  $this->tree = $DIC->repositoryTree();
69  $this->settings = $DIC->settings();
70  $this->obj_definition = $DIC["objDefinition"];
71  $this->lng = $DIC->language();
72  $this->ctrl = $DIC->ctrl();
73  $this->rbacsystem = $DIC->rbac()->system();
74  $this->db = $DIC->database();
75  $this->user = $DIC->user();
76  $this->access = $DIC->access();
77  $tree = $DIC->repositoryTree();
78  $ilSetting = $DIC->settings();
79  $objDefinition = $DIC["objDefinition"];
80 
81  $this->cur_ref_id = (int) $_GET["ref_id"];
82 
83  $this->top_node_id = 0;
84  parent::__construct("adm_exp", $a_parent_obj, $a_parent_cmd, $tree);
85 
86  $this->setSkipRootNode(false);
87  $this->setAjax(true);
88  $this->setOrderField("title");
89 
90  $white = array();
91  foreach ($objDefinition->getSubObjectsRecursively("root") as $rtype) {
92  if ($rtype["name"] != "itgr" && !$objDefinition->isSideBlock($rtype["name"])) {
93  $white[] = $rtype["name"];
94  }
95  }
96  $this->setTypeWhiteList($white);
97 
98  if ((int) $_GET["ref_id"] > 0) {
99  $this->setPathOpen((int) $_GET["ref_id"]);
100  }
101  }
102 
109  public function getNodeContent($a_node)
110  {
111  $lng = $this->lng;
112 
113  $title = $a_node["title"];
114  if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
115  if ($title == "ILIAS") {
116  $title = $lng->txt("repository");
117  }
118  }
119 
120  return $title;
121  }
122 
129  public function getNodeIcon($a_node)
130  {
131  $obj_id = ilObject::_lookupObjId($a_node["child"]);
132  return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
133  }
134 
141  public function getNodeIconAlt($a_node)
142  {
143  $lng = $this->lng;
144 
145  if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
146  $title = $a_node["title"];
147  if ($title == "ILIAS") {
148  $title = $lng->txt("repository");
149  }
150  return $lng->txt("icon") . " " . $title;
151  }
152 
153 
154  return parent::getNodeIconAlt($a_node);
155  }
156 
163  public function isNodeHighlighted($a_node)
164  {
165  if ($a_node["child"] == $_GET["ref_id"] ||
166  ($_GET["ref_id"] == "" && $a_node["child"] == $this->getNodeId($this->getRootNode()))) {
167  return true;
168  }
169  return false;
170  }
171 
178  public function getNodeHref($a_node)
179  {
181  $objDefinition = $this->obj_definition;
182 
183  $class_name = $objDefinition->getClassName($a_node["type"]);
184  $class = strtolower("ilObj" . $class_name . "GUI");
185  $ilCtrl->setParameterByClass($class, "ref_id", $a_node["child"]);
186  $link = $ilCtrl->getLinkTargetByClass($class, "view");
187  $ilCtrl->setParameterByClass($class, "ref_id", $_GET["ref_id"]);
188 
189  return $link;
190  }
191 
198  public function isNodeVisible($a_node)
199  {
201 
202  $visible = $rbacsystem->checkAccess('visible', $a_node["child"]);
203  if ($a_node["type"] == "rolf" && $a_node["child"] != ROLE_FOLDER_ID) {
204  return false;
205  }
206  return $visible;
207  }
208 
217  public function sortChilds($a_childs, $a_parent_node_id)
218  {
219  $objDefinition = $this->obj_definition;
220 
221  $parent_obj_id = ilObject::_lookupObjId($a_parent_node_id);
222 
223  if ($parent_obj_id > 0) {
224  $parent_type = ilObject::_lookupType($parent_obj_id);
225  } else {
226  $parent_type = "dummy";
227  $this->type_grps["dummy"] = array("root" => "dummy");
228  }
229 
230  if (empty($this->type_grps[$parent_type])) {
231  $this->type_grps[$parent_type] =
232  $objDefinition->getGroupedRepositoryObjectTypes($parent_type);
233  }
234  $group = array();
235 
236  foreach ($a_childs as $child) {
237  $g = $objDefinition->getGroupOfObj($child["type"]);
238  if ($g == "") {
239  $g = $child["type"];
240  }
241  $group[$g][] = $child;
242  }
243 
244  $childs = array();
245  foreach ($this->type_grps[$parent_type] as $t => $g) {
246  if (is_array($group[$t])) {
247  // do we have to sort this group??
248  include_once("./Services/Container/classes/class.ilContainer.php");
249  include_once("./Services/Container/classes/class.ilContainerSorting.php");
250  $sort = ilContainerSorting::_getInstance($parent_obj_id);
251  $group = $sort->sortItems($group);
252 
253  // need extra session sorting here
254  if ($t == "sess") {
255  }
256 
257  foreach ($group[$t] as $k => $item) {
258  $childs[] = $item;
259  }
260  }
261  }
262 
263  return $childs;
264  }
265 
272  public function getChildsOfNode($a_parent_node_id)
273  {
275 
276  if (!$rbacsystem->checkAccess("read", $a_parent_node_id)) {
277  return array();
278  }
279 
280  return parent::getChildsOfNode($a_parent_node_id);
281  }
282 
289  public function isNodeClickable($a_node)
290  {
292  $tree = $this->tree;
293  $ilDB = $this->db;
295  $ilAccess = $this->access;
296 
297  return $rbacsystem->checkAccess('read', $a_node["child"]);
298  }
299 }
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
global $DIC
Definition: saml.php:7
$_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.
user()
Definition: user.php:4
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?
$ilUser
Definition: imgupload.php:18
Administration explorer GUI class.
getNodeId($a_node)
Get id for node.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
getRootNode()
Get root node.
settings()
Definition: settings.php:2
$white
Definition: example_030.php:84
global $ilSetting
Definition: privfeed.php:17
Explorer class that works on tree objects (Services/Tree)
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
global $ilDB
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.