ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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" );
18
19
26 public function __construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree) {
27 parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree);
28 $this->setAjax(true);
29 $this->setTypeWhiteList(array( "orgu" ));
30 }
31
32
38 public function getNodeContent($node) {
39 global $lng;
40 if ($node["title"] == "__OrgUnitAdministration") {
41 $node["title"] = $lng->txt("objs_orgu");
42 }
43 if ($node["child"] == $_GET["ref_id"]) {
44 return "<span class='ilExp2NodeContent ilHighlighted'>" . $node["title"] . "</span>";
45 } else {
46 return $node["title"];
47 }
48 }
49
50
54 public function getRootNode() {
55 return $this->getTree()->getNodeData(ilObjOrgUnit::getRootOrgRefId());
56 }
57
58
67 public function getNodeIcon($a_node) {
68 global $ilias;
69 if ($ilias->getSetting('custom_icons')) {
70 $icons_cache = ilObjOrgUnit::getIconsCache();
71 $obj_id = ilObject::_lookupObjId($a_node["child"]);
72 if (isset($icons_cache[$obj_id])) {
73 return $icons_cache[$obj_id];
74 }
75 }
76
77 return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
78 }
79
80
86 public function getNodeHref($node) {
87 global $ilCtrl;
88 if ($ilCtrl->getCmd() == "performPaste") {
89 $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "target_node", $node["child"]);
90 }
91 $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $node["child"]);
92
93 return $this->getLinkTarget();
94 }
95
96
100 protected function getLinkTarget() {
101 global $ilCtrl;
102
103 if ($ilCtrl->getCmdClass() == "ilobjorgunitgui" AND in_array($ilCtrl->getCmd(), $this->stay_with_command)) {
104 return $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(), $ilCtrl->getCmd());
105 } else {
106 return $ilCtrl->getLinkTargetByClass("ilobjorgunitgui", "view");
107 }
108 }
109
110
120 public function getChildsOfNode($a_parent_node_id) {
121 global $ilAccess;
122
123 $wl = $this->getTypeWhiteList();
124 if (is_array($wl) && count($wl) > 0) {
125 $childs = $this->tree->getChildsByTypeFilter($a_parent_node_id, $wl, $this->getOrderField());
126 } else {
127 $childs = $this->tree->getChilds($a_parent_node_id, $this->getOrderField());
128 }
129
130 // apply black list filter
131 $bl = $this->getTypeBlackList();
132 if (is_array($bl) && count($bl) > 0) {
133 $bl_childs = array();
134 foreach ($childs as $k => $c) {
135 if (!in_array($c["type"], $bl)) {
136 $bl_childs[$k] = $c;
137 }
138 }
139
140 return $bl_childs;
141 }
142
143 //Check Access
144 foreach ($childs as $key => $child) {
145 if (!$ilAccess->checkAccess('visible', '', $child['ref_id'])) {
146 unset($childs[$key]);
147 }
148 }
149
150 return $childs;
151 }
152
153
164 public function sortChilds($a_childs, $a_parent_node_id) {
165 usort($a_childs, array( __CLASS__, "sortbyTitle" ));
166
167 return $a_childs;
168 }
169
170
177 public function sortbyTitle($a, $b) {
178 return strcmp($a["title"], $b["title"]);
179 }
180
181
190 public function isNodeClickable($a_node) {
191 global $ilAccess;
192
193 if ($ilAccess->checkAccess('read', '', $a_node['ref_id'])) {
194 return true;
195 }
196
197 return false;
198 }
199}
200
201?>
$_GET["client_id"]
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:40