ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAdministrationExplorerGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29{
33 protected ilDBInterface $db;
34 protected ilObjUser $user;
36 protected array $type_grps = array();
37 protected array $session_materials = array();
39 protected int $cur_ref_id;
40 protected int $top_node_id;
41
42 public function __construct(
43 string $a_parent_obj,
44 string $a_parent_cmd
45 ) {
46 global $DIC;
47
48 $this->tree = $DIC->repositoryTree();
49 $this->settings = $DIC->settings();
50 $this->obj_definition = $DIC["objDefinition"];
51 $this->lng = $DIC->language();
52 $this->ctrl = $DIC->ctrl();
53 $this->rbacsystem = $DIC->rbac()->system();
54 $this->db = $DIC->database();
55 $this->user = $DIC->user();
56 $this->access = $DIC->access();
57 $tree = $DIC->repositoryTree();
58 $objDefinition = $DIC["objDefinition"];
59 $this->request = new AdminGUIRequest(
60 $DIC->http(),
61 $DIC->refinery()
62 );
63
64 $this->cur_ref_id = $this->request->getRefId();
65
66 $this->top_node_id = 0;
67 parent::__construct("adm_exp", $a_parent_obj, $a_parent_cmd, $tree);
68
69 $this->setSkipRootNode(false);
70 $this->setAjax(true);
71 $this->setOrderField("title");
72
73 $white = array();
74 foreach ($objDefinition->getSubObjectsRecursively("root") as $rtype) {
75 if ($rtype["name"] !== "itgr" && !$objDefinition->isSideBlock($rtype["name"])) {
76 $white[] = $rtype["name"];
77 }
78 }
79 $this->setTypeWhiteList($white);
80
81 if ($this->cur_ref_id > 0) {
82 $this->setPathOpen($this->cur_ref_id);
83 }
84 }
85
89 public function getNodeContent($a_node): string
90 {
92
93 $title = $a_node["title"];
94 if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
95 if ($title === "ILIAS") {
96 $title = $lng->txt("repository");
97 }
98 }
99
100 return $title;
101 }
102
106 public function getNodeIcon($a_node): string
107 {
108 $obj_id = ilObject::_lookupObjId((int) $a_node["child"]);
109 return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
110 }
111
115 public function getNodeIconAlt($a_node): string
116 {
118
119 if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
120 $title = $a_node["title"];
121 if ($title === "ILIAS") {
122 $title = $lng->txt("repository");
123 }
124 return $lng->txt("icon") . " " . $title;
125 }
126
127
128 return parent::getNodeIconAlt($a_node);
129 }
130
134 public function isNodeHighlighted($a_node): bool
135 {
136 return $a_node["child"] == $this->cur_ref_id ||
137 ($this->cur_ref_id === 0 && $a_node["child"] == $this->getNodeId($this->getRootNode()));
138 }
139
143 public function getNodeHref($a_node): string
144 {
145 $ilCtrl = $this->ctrl;
146 $objDefinition = $this->obj_definition;
147
148 $class_name = $objDefinition->getClassName($a_node["type"]);
149 $class = strtolower("ilObj" . $class_name . "GUI");
150 $ilCtrl->setParameterByClass($class, "ref_id", $a_node["child"]);
151 $link = $ilCtrl->getLinkTargetByClass($class, "view");
152 $ilCtrl->setParameterByClass($class, "ref_id", $this->cur_ref_id);
153
154 return $link;
155 }
156
160 public function isNodeVisible($a_node): bool
161 {
163
164 $visible = $rbacsystem->checkAccess('visible', (int) $a_node["child"]);
165 if ($a_node["type"] === "rolf" && $a_node["child"] != ROLE_FOLDER_ID) {
166 return false;
167 }
168 return $visible;
169 }
170
175 public function sortChilds(array $a_childs, $a_parent_node_id): array
176 {
177 $objDefinition = $this->obj_definition;
178
179 $parent_obj_id = ilObject::_lookupObjId((int) $a_parent_node_id);
180
181 if ($parent_obj_id > 0) {
182 $parent_type = ilObject::_lookupType($parent_obj_id);
183 } else {
184 $parent_type = "dummy";
185 $this->type_grps["dummy"] = array("root" => "dummy");
186 }
187
188 if (empty($this->type_grps[$parent_type])) {
189 $this->type_grps[$parent_type] =
190 $objDefinition::getGroupedRepositoryObjectTypes($parent_type);
191 }
192 $group = array();
193
194 foreach ($a_childs as $child) {
195 $g = $objDefinition->getGroupOfObj($child["type"]);
196 if ($g === null || $g === "") {
197 $g = $child["type"];
198 }
199 $group[$g][] = $child;
200 }
201
202 $childs = array();
203 foreach ($this->type_grps[$parent_type] as $t => $g) {
204 if (isset($group[$t])) {
205 // do we have to sort this group??
206 $sort = ilContainerSorting::_getInstance($parent_obj_id);
207 $group = $sort->sortItems($group);
208
209 // need extra session sorting here
210 if ($t === "sess") {
211 }
212
213 foreach ($group[$t] as $k => $item) {
214 $childs[] = $item;
215 }
216 }
217 }
218
219 return $childs;
220 }
221
225 public function getChildsOfNode($a_parent_node_id): array
226 {
228
229 if (!$rbacsystem->checkAccess("read", (int) $a_parent_node_id)) {
230 return array();
231 }
232
233 return parent::getChildsOfNode($a_parent_node_id);
234 }
235
239 public function isNodeClickable($a_node): bool
240 {
241 return $this->rbacsystem->checkAccess('read', (int) $a_node["child"]);
242 }
243}
Administration explorer GUI class.
sortChilds(array $a_childs, $a_parent_node_id)
Sort childs.
__construct(string $a_parent_obj, string $a_parent_cmd)
static _getInstance(int $a_obj_id)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
User class.
parses the objects.xml it handles the xml-description of all ilias objects
getClassName(string $obj_name)
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
ILIAS Setting Class.
Explorer class that works on tree objects (Services/Tree)
setOrderField(string $a_val, bool $a_numeric=false)
setPathOpen($a_id)
Set node path to be opened.
getNodeId($a_node)
Get id for node.
setTypeWhiteList(array $a_val)
Set type white list.
const ROLE_FOLDER_ID
Definition: constants.php:34
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
Interface ilDBInterface.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26