ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilOrgUnitExplorerGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 require_once("./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
4 
13 
17  protected $stay_with_command = array( "", "render", "view", "infoScreen", "showStaff", "performPaste", "cut" );
21  protected $tree = null;
22 
23 
30  public function __construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree) {
31  parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree);
32  $this->setAjax(true);
33  $this->setTypeWhiteList(array( "orgu" ));
34  $this->tree->initLangCode();
35  }
36 
37 
43  public function getNodeContent($node) {
44  global $lng;
45  if ($node["title"] == "__OrgUnitAdministration") {
46  $node["title"] = $lng->txt("objs_orgu");
47  }
48  if ($node["child"] == $_GET["ref_id"]) {
49  return "<span class='ilExp2NodeContent ilHighlighted'>" . $node["title"] . "</span>";
50  } else {
51  return $node["title"];
52  }
53  }
54 
55 
59  public function getRootNode() {
60  return $this->getTree()->getNodeData(ilObjOrgUnit::getRootOrgRefId());
61  }
62 
63 
72  public function getNodeIcon($a_node) {
73  global $ilias;
74  if ($ilias->getSetting('custom_icons')) {
75  $icons_cache = ilObjOrgUnit::getIconsCache();
76  $obj_id = ilObject::_lookupObjId($a_node["child"]);
77  if (isset($icons_cache[$obj_id])) {
78  return $icons_cache[$obj_id];
79  }
80  }
81 
82  return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
83  }
84 
85 
91  public function getNodeHref($node) {
92  global $ilCtrl;
93  if ($ilCtrl->getCmd() == "performPaste") {
94  $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "target_node", $node["child"]);
95  }
96  $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $node["child"]);
97 
98  return $this->getLinkTarget();
99  }
100 
101 
105  protected function getLinkTarget() {
106  global $ilCtrl;
107 
108  if ($ilCtrl->getCmdClass() == "ilobjorgunitgui" AND in_array($ilCtrl->getCmd(), $this->stay_with_command)) {
109  return $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(), $ilCtrl->getCmd());
110  } else {
111  return $ilCtrl->getLinkTargetByClass("ilobjorgunitgui", "view");
112  }
113  }
114 
124  public function getChildsOfNode($a_parent_node_id) {
125  global $ilAccess;
126 
127  $wl = $this->getTypeWhiteList();
128  if (is_array($wl) && count($wl) > 0) {
129  $childs = $this->tree->getChildsByTypeFilter($a_parent_node_id, $wl, $this->getOrderField());
130  } else {
131  $childs = $this->tree->getChilds($a_parent_node_id, $this->getOrderField());
132  }
133 
134  // apply black list filter
135  $bl = $this->getTypeBlackList();
136  if (is_array($bl) && count($bl) > 0) {
137  $bl_childs = array();
138  foreach ($childs as $k => $c) {
139  if (!in_array($c["type"], $bl)) {
140  $bl_childs[$k] = $c;
141  }
142  }
143 
144  return $bl_childs;
145  }
146 
147  //Check Access
148  foreach ($childs as $key => $child) {
149  if (!$ilAccess->checkAccess('visible', '', $child['ref_id'])) {
150  unset($childs[$key]);
151  }
152  }
153 
154  return $childs;
155  }
156 
157 
168  public function sortChilds($a_childs, $a_parent_node_id) {
169  usort($a_childs, array( __CLASS__, "sortbyTitle" ));
170 
171  return $a_childs;
172  }
173 
174 
181  public function sortbyTitle($a, $b) {
182  return strcmp($a["title"], $b["title"]);
183  }
184 
185 
194  public function isNodeClickable($a_node) {
195  global $ilAccess;
196 
197  if ($ilAccess->checkAccess('read', '', $a_node['ref_id'])) {
198  return true;
199  }
200 
201  return false;
202  }
203 }
204 
205 ?>
isNodeClickable($a_node)
Is node clickable?
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
getTypeBlackList()
Get type black list.
$_GET["client_id"]
getNodeIcon($a_node)
Get node icon Return custom icon of OrgUnit type if existing.
setTypeWhiteList($a_val)
Set type white list.
global $ilCtrl
Definition: ilias.php:18
__construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree)
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
static _lookupObjId($a_id)
static getRootOrgRefId()
getOrderField()
Get order field.
Explorer class that works on tree objects (Services/Tree)
global $lng
Definition: privfeed.php:40
Class ilOrgUnitExplorerGUI.
getChildsOfNode($a_parent_node_id)
Get childs of node.
getTypeWhiteList()
Get type white list.