ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 */
3require_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 $DIC;
45 $lng = $DIC['lng'];
46 if ($node["title"] == "__OrgUnitAdministration") {
47 $node["title"] = $lng->txt("objs_orgu");
48 }
49 if ($node["child"] == $_GET["ref_id"]) {
50 return "<span class='ilExp2NodeContent ilHighlighted'>" . $node["title"] . "</span>";
51 } else {
52 return $node["title"];
53 }
54 }
55
56
60 public function getRootNode() {
61 return $this->getTree()->getNodeData(ilObjOrgUnit::getRootOrgRefId());
62 }
63
64
73 public function getNodeIcon($a_node) {
74 global $DIC;
75 $ilias = $DIC['ilias'];
76 if ($ilias->getSetting('custom_icons')) {
77 $icons_cache = ilObjOrgUnit::getIconsCache();
78 $obj_id = ilObject::_lookupObjId($a_node["child"]);
79 if (isset($icons_cache[$obj_id])) {
80 return $icons_cache[$obj_id];
81 }
82 }
83
84 return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
85 }
86
87
93 public function getNodeHref($node) {
94 global $DIC;
95 $ilCtrl = $DIC['ilCtrl'];
96 if ($ilCtrl->getCmd() == "performPaste") {
97 $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "target_node", $node["child"]);
98 }
99 $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $node["child"]);
100 $ilCtrl->setParameterByClass("ilObjPluginDispatchGUI", "ref_id", $node["child"]);
101
102 return ($node['type'] == "orgu") ? $this->getLinkTarget() : $this->getPluginLinkTarget();
103 }
104
105
109 protected function getLinkTarget() {
110 global $DIC;
111 $ilCtrl = $DIC['ilCtrl'];
112
113 if ($ilCtrl->getCmdClass() == "ilobjorgunitgui" AND in_array($ilCtrl->getCmd(), $this->stay_with_command)) {
114 return $ilCtrl->getLinkTargetByClass(array( "ilAdministrationGUI", $ilCtrl->getCmdClass() ), $ilCtrl->getCmd());
115 } else {
116 return $ilCtrl->getLinkTargetByClass(array( "ilAdministrationGUI", "ilobjorgunitgui" ), "view");
117 }
118 }
119
120
121 protected function getPluginLinkTarget() {
122 global $DIC;
123 $ilCtrl = $DIC['ilCtrl'];
124
125 return $ilCtrl->getLinkTargetByClass("ilObjPluginDispatchGUI", "forward");
126 }
127
128
138 public function getChildsOfNode($a_parent_node_id) {
139 global $DIC;
140 $ilAccess = $DIC['ilAccess'];
141
142 $wl = $this->getTypeWhiteList();
143 if (is_array($wl) && count($wl) > 0) {
144 $childs = $this->tree->getChildsByTypeFilter($a_parent_node_id, $wl, $this->getOrderField());
145 } else {
146 $childs = $this->tree->getChilds($a_parent_node_id, $this->getOrderField());
147 }
148
149 // apply black list filter
150 $bl = $this->getTypeBlackList();
151 if (is_array($bl) && count($bl) > 0) {
152 $bl_childs = array();
153 foreach ($childs as $k => $c) {
154 if (!in_array($c["type"], $bl)) {
155 $bl_childs[$k] = $c;
156 }
157 }
158
159 return $bl_childs;
160 }
161
162 //Check Access
163 foreach ($childs as $key => $child) {
164 if (!$ilAccess->checkAccess('visible', '', $child['ref_id'])) {
165 unset($childs[$key]);
166 }
167 }
168
169 return $childs;
170 }
171
172
183 public function sortChilds($a_childs, $a_parent_node_id) {
184 usort($a_childs, array( __CLASS__, "sortbyTitle" ));
185
186 return $a_childs;
187 }
188
189
196 public function sortbyTitle($a, $b) {
197 return strcmp($a["title"], $b["title"]);
198 }
199
200
209 public function isNodeClickable($a_node) {
210 global $DIC;
211 $ilAccess = $DIC['ilAccess'];
212
213 if ($ilAccess->checkAccess('read', '', $a_node['ref_id'])) {
214 return true;
215 }
216
217 return false;
218 }
219}
220
221?>
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
static getRootOrgRefId()
static _lookupObjId($a_id)
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
Class ilOrgUnitExplorerGUI.
isNodeClickable($a_node)
Is node clickable?
getNodeIcon($a_node)
Get node icon Return custom icon of OrgUnit type if existing.
__construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree)
getChildsOfNode($a_parent_node_id)
Get childs of node.
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
Explorer class that works on tree objects (Services/Tree)
setTypeWhiteList($a_val)
Set type white list.
getTypeWhiteList()
Get type white list.
getTypeBlackList()
Get type black list.
getOrderField()
Get order field.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
global $DIC