ILIAS  release_7 Revision v7.30-3-g800a261c036
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
5
14{
15 protected const ORGU = "orgu";
19 protected $stay_with_command = array('', 'render', 'view', 'infoScreen', 'showStaff', 'performPaste', 'cut');
23 protected $tree;
24
25
32 public function __construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree)
33 {
34 parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree);
35 $this->setAjax(true);
36 $this->setTypeWhiteList(array(self::ORGU));
37 $this->tree->initLangCode();
38 }
39
40
46 public function getNodeContent($node) : ?string
47 {
48 global $DIC;
49 if ($node['title'] === '__OrgUnitAdministration') {
50 $node['title'] = $DIC->language()->txt('objs_orgu');
51 }
52 if ((int) $node['child'] === (int) $_GET['ref_id']) {
53 return "<span class='ilExp2NodeContent ilHighlighted'>" . $node['title'] . '</span>';
54 }
55
56 return ilUtil::secureString($node['title']);
57 }
58
59
63 public function getRootNode() : array
64 {
65 return $this->getTree()->getNodeData(ilObjOrgUnit::getRootOrgRefId());
66 }
67
68
77 public function getNodeIcon($a_node) : string
78 {
79 global $DIC;
80 $ilias = $DIC['ilias'];
81 if ($ilias->getSetting('custom_icons')) {
82 $icons_cache = ilObjOrgUnit::getIconsCache();
83 $obj_id = ilObject::_lookupObjId($a_node["child"]);
84 if (isset($icons_cache[$obj_id])) {
85 return $icons_cache[$obj_id];
86 }
87 }
88
89 return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
90 }
91
92
98 public function getNodeHref($node) : string
99 {
100 global $DIC;
101
102 if ($this->select_postvar) {
103 return '#';
104 }
105
106 if ($DIC->ctrl()->getCmd() === 'performPaste') {
107 $DIC->ctrl()->setParameterByClass(ilObjOrgUnitGUI::class, 'target_node', $node['child']);
108 }
109 $array = $DIC->ctrl()->getParameterArrayByClass(ilObjOrgUnitGUI::class);
110 $temp = $array['ref_id'];
111
112 $DIC->ctrl()->setParameterByClass(ilObjOrgUnitGUI::class, 'ref_id', $node['child']);
113 $DIC->ctrl()->setParameterByClass(ilObjPluginDispatchGUI::class, 'ref_id', $node['child']);
114
115 $link_target = ($node['type'] === self::ORGU) ? $this->getLinkTarget() : $this->getPluginLinkTarget();
116 $DIC->ctrl()->setParameterByClass(ilObjOrgUnitGUI::class, 'ref_id', $temp);
117
118 return $link_target;
119 }
120
121
125 protected function getLinkTarget() : string
126 {
127 global $DIC;
128 if ($DIC->ctrl()->getCmdClass() === strtolower(ilObjOrgUnitGUI::class) && in_array($DIC->ctrl()->getCmd(), $this->stay_with_command, true)) {
129 return $DIC->ctrl()->getLinkTargetByClass(array(ilAdministrationGUI::class, $DIC->ctrl()->getCmdClass()), $DIC->ctrl()->getCmd());
130 }
131
132 return $DIC->ctrl()->getLinkTargetByClass(array(ilAdministrationGUI::class, ilObjOrgUnitGUI::class), 'view');
133 }
134
135
139 protected function getPluginLinkTarget() : string
140 {
141 global $DIC;
142
143 return $DIC->ctrl()->getLinkTargetByClass(ilObjPluginDispatchGUI::class, 'forward');
144 }
145
146
152 public function isNodeClickable($a_node) : bool
153 {
154 global $DIC;
155 $ilAccess = $DIC->access();
156
157 if ($ilAccess->checkAccess('read', '', $a_node['ref_id'])) {
158 return true;
159 }
160
161 return false;
162 }
163
164
170 public function isNodeSelectable($a_node) : bool
171 {
172 $current_node = filter_input(INPUT_GET, 'item_ref_id') ?? ilObjOrgUnit::getRootOrgRefId();
173
174 return !($a_node['child'] === $current_node || $this->tree->isGrandChild($current_node, $a_node['child']));
175 }
176}
$_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.
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)
Explorer class that works on tree objects (Services/Tree)
setTypeWhiteList($a_val)
Set type white list.
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
global $DIC
Definition: goto.php:24
Interface for mapping data-structures to the Tree.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc