ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilRepositoryExplorerGUI Class Reference

Repository explorer GUI class. More...

+ Inheritance diagram for ilRepositoryExplorerGUI:
+ Collaboration diagram for ilRepositoryExplorerGUI:

Public Member Functions

 getRootNode ()
 Get root node. More...
 
 getNodeContent ($a_node)
 Get content of a node. More...
 
 getNodeIcon ($a_node)
 Get node icon path. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
 isNodeVisible ($a_node)
 Is node visible? More...
 
 sortChilds (array $a_childs, $a_parent_node_id)
 Sort childs. More...
 
 nodeHasVisibleChilds ($a_node)
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 isNodeClickable ($a_node)
 Is node clickable? More...
 
- Public Member Functions inherited from ilTreeExplorerGUI
 __construct (string $a_expl_id, $a_parent_obj, string $a_parent_cmd, ilTree $a_tree, string $a_node_parameter_name="node_id")
 
 getTree ()
 
 setOrderField (string $a_val, bool $a_numeric=false)
 
 getOrderField ()
 
 setTypeWhiteList (array $a_val)
 Set type white list. More...
 
 getTypeWhiteList ()
 Get type white list. More...
 
 setTypeBlackList (array $a_val)
 Set type black list. More...
 
 getTypeBlackList ()
 Get type black list. More...
 
 setPreloadChilds (bool $a_val)
 
 getPreloadChilds ()
 
 getSuccessorNode ( $a_node_id, string $a_type="")
 Get successor node (currently only(!) based on lft/rgt tree values) More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 getNodeId ($a_node)
 Get id for node. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getRootNode ()
 Get root node. More...
 
 setRootId ($a_root)
 
 setPathOpen ($a_id)
 Set node path to be opened. More...
 
 getHTML ($new=false)
 Get HTML. More...
 
 getChildren ($record, $environment=null)
 Get a list of records (that list can also be empty). More...
 
 build (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record, $environment=null)
 
 getTreeLabel ()
 
 getTreeComponent ()
 
 toggleExplorerNodeState ()
 Should be called by an ilCtrl-enabled command class if a tree node toggle action should be processed. More...
 
- Public Member Functions inherited from ilExplorerBaseGUI
 setChildLimit (int $a_val)
 
 getChildLimit ()
 
 setSearchTerm (string $a_val)
 
 getSearchTerm ()
 
 setMainTemplate (?ilGlobalTemplateInterface $a_main_tpl=null)
 
 getRootNode ()
 Get root node. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get children of node. More...
 
 getNodeContent ($a_node)
 Get content of a node. More...
 
 getNodeId ($a_node)
 Get id of a node. More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
 nodeHasVisibleChilds ($a_node)
 Node has children Please note that this standard method may not be optimal depending on what a derived class does in isNodeVisible. More...
 
 sortChilds (array $a_childs, $a_parent_node_id)
 Sort childs. More...
 
 getNodeIcon ($a_node)
 Get node icon path. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getNodeTarget ($a_node)
 Get node target (frame) attribute. More...
 
 getNodeOnClick ($a_node)
 Get node onclick attribute. More...
 
 isNodeVisible ($a_node)
 Is node visible? More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
 isNodeClickable ($a_node)
 Is node clickable? More...
 
 getId ()
 Get id of explorer element. More...
 
 setSkipRootNode (bool $a_val)
 
 getSkipRootNode ()
 
 setAjax (bool $a_val)
 
 getAjax ()
 
 setSecondaryHighlightedNodes (array $a_val)
 Set secondary (background) highlighted nodes. More...
 
 getSecondaryHighlightedNodes ()
 Get secondary (background) highlighted nodes. More...
 
 setNodeOpen ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setSelectMode (string $a_postvar, bool $a_multi=false)
 Set select mode (to deactivate, pass an empty string as postvar) More...
 
 setNodeSelected ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setOfflineMode (bool $a_val)
 
 getOfflineMode ()
 
 handleCommand ()
 Handle explorer internal command. More...
 
 getContainerId ()
 
 openNode ()
 Open node. More...
 
 closeNode ()
 Close node. More...
 
 getNodeAsync ()
 Get node asynchronously. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getOnLoadCode ()
 Get on load code. More...
 
 getHTML ()
 
 renderNode ($a_node, ilTemplate $tpl)
 Render node. More...
 
 renderChilds ($a_node_id, ilTemplate $tpl)
 Render childs. More...
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id. More...
 
 getNodeIdForDomNodeId (string $a_dom_node_id)
 Get node id for dom node id. More...
 
 listItemStart (ilTemplate $tpl, $a_node)
 List item start. More...
 
 listItemEnd (ilTemplate $tpl)
 
 listStart (ilTemplate $tpl)
 
 listEnd (ilTemplate $tpl)
 
 isNodeOnclickEnabled ()
 
 setNodeOnclickEnabled (bool $nodeOnclickEnabled)
 
 isEnableDnd ()
 
 setEnableDnd (bool $enable_dnd)
 
- Public Member Functions inherited from ILIAS\UI\Component\Tree\TreeRecursion
 getChildren ( $record, $environment=null)
 Get a list of records (that list can also be empty). More...
 
 build (Node\Factory $factory, $record, $environment=null)
 Build and return a Node. More...
 

Static Public Member Functions

static getTopNodeForRefId (int $ref_id)
 
- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 
static getLocalJsTreeJsPath ()
 
static getLocalJsTreeCssPath ()
 
static createHTMLExportDirs (string $a_target_dir)
 
static init (?ilGlobalTemplateInterface $a_main_tpl=null)
 

Protected Member Functions

 getParentCourseOrGroup (int $node_id)
 
- Protected Member Functions inherited from ilTreeExplorerGUI
 preloadChilds ()
 
 matches ($node)
 Does a node match a search term (or is search term empty) More...
 
 getRootId ()
 
 createNode (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record)
 Creates at tree node, can be overwritten in derivatives if another node type should be used. More...
 
 getNodeStateToggleCmdClasses ($record)
 Should return an array of ilCtrl-enabled command classes which should be used to build the URL for the expand/collapse actions applied on a tree node. More...
 
 render ()
 
- Protected Member Functions inherited from ilExplorerBaseGUI
 isNodeSelectable ($a_node)
 Is node selectable? More...
 
 getNodeToggleOnClick ($a_node)
 Get onclick attribute for node toggling. More...
 
 getSelectOnClick ($a_node)
 Get onclick attribute for selecting radio/checkbox. More...
 
 isNodeOpen ($node_id)
 Get all open nodes. More...
 
 getJSTreePlugins ()
 
 isNodeRequested (string $a_node_id)
 

Protected Attributes

ilSetting $settings
 
ilObjectDefinition $obj_definition
 
ilAccessHandler $access
 
ilRbacSystem $rbacsystem
 
ilDBInterface $db
 
ilObjUser $user
 
array $type_grps = []
 
array $session_materials = []
 
array $parent_node_id = []
 
array $node_data = []
 
StandardGUIRequest $request
 
int $cur_ref_id = 0
 
int $top_node_id
 
- Protected Attributes inherited from ilTreeExplorerGUI
ilLanguage $lng
 
Psr Http Message ServerRequestInterface $httpRequest
 
ilTree $tree = null
 
string $tree_label = ""
 
string $order_field = ""
 
bool $order_field_numeric = false
 
array $type_white_list = array()
 
array $type_black_list = array()
 
array $childs = array()
 
bool $preloaded = false
 
bool $preload_childs = false
 
array $root_node_data = null
 
array $all_childs = array()
 
 $root_id = 0
 
ILIAS DI UIServices $ui
 
- Protected Attributes inherited from ilExplorerBaseGUI
string $node_parameter_name
 
ilLogger $log
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
bool $skip_root_node = false
 
bool $ajax = false
 
array $custom_open_nodes = array()
 
array $selected_nodes = array()
 
string $select_postvar = ""
 
bool $offline_mode = false
 
array $sec_highl_nodes = array()
 
bool $enable_dnd = false
 
string $search_term = ""
 
array $open_nodes = []
 
ilSessionIStorage $store
 
bool $select_multi = false
 
 $parent_obj
 
int $child_limit = 0
 
string $parent_cmd = ''
 
string $requested_exp_cmd = ""
 
string $requested_exp_cont = ""
 
string $requested_searchterm = ""
 
string $requested_node_id = ""
 
string $id
 

Additional Inherited Members

- Static Protected Attributes inherited from ilExplorerBaseGUI
static string $js_tree_path = "./node_modules/jstree/dist/jstree.js"
 
static string $js_tree_path_css = "./node_modules/jstree/dist/themes/default/style.min.css"
 
static string $js_expl_path = "assets/js/Explorer2.js"
 

Detailed Description

Repository explorer GUI class.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Todo:
: isClickable, top node id

Definition at line 27 of file class.ilRepositoryExplorerGUI.php.

Member Function Documentation

◆ getChildsOfNode()

ilRepositoryExplorerGUI::getChildsOfNode (   $a_parent_node_id)

Get childs of node.

Parameters
int | string$a_parent_node_idparent id
Returns
array childs

Reimplemented from ilTreeExplorerGUI.

Definition at line 423 of file class.ilRepositoryExplorerGUI.php.

423 : array
424 {
426
427 if (!$rbacsystem->checkAccess("read", $a_parent_node_id)) {
428 return [];
429 }
430
431 $childs = parent::getChildsOfNode($a_parent_node_id);
432
433 foreach ($childs as $c) {
434 $this->parent_node_id[$c["child"]] = $a_parent_node_id;
435 $this->node_data[$c["child"]] = $c;
436 }
437
438 return $childs;
439 }
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 ...

References Vendor\Package\$c, ilTreeExplorerGUI\$childs, $rbacsystem, and ilRbacSystem\checkAccess().

+ Here is the call graph for this function:

◆ getNodeContent()

ilRepositoryExplorerGUI::getNodeContent (   $a_node)

Get content of a node.

Parameters
object | array$a_nodenode array or object
Returns
string content of the node

Reimplemented from ilExplorerBaseGUI.

Definition at line 107 of file class.ilRepositoryExplorerGUI.php.

107 : string
108 {
110
111 $title = $a_node["title"];
112
113 if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
114 if ($title === "ILIAS") {
115 $title = $lng->txt("repository");
116 }
117 } elseif ($a_node["type"] === "sess" &&
118 !trim($title)) {
119 // #14367 - see ilObjSessionListGUI
120 $app_info = ilSessionAppointment::_lookupAppointment($a_node["obj_id"]);
121 $title = ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'], (bool) $app_info['fullday']);
122 }
123 return $title;
124 }
txt(string|LanguageIdentifier $a_topic, ?int $n=null)
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupAppointment(int $a_obj_id)
static _appointmentToString(int $start, int $end, bool $fulltime)
getNodeId($a_node)
Get id for node.

References ilTreeExplorerGUI\$lng, ilSessionAppointment\_appointmentToString(), ilSessionAppointment\_lookupAppointment(), ilTreeExplorerGUI\getNodeId(), getRootNode(), and ilLanguage\txt().

Referenced by getNodeIconAlt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNodeHref()

ilRepositoryExplorerGUI::getNodeHref (   $a_node)

Get href for node.

Parameters
object | array$a_node
Returns
string href attribute

Reimplemented from ilExplorerBaseGUI.

Definition at line 157 of file class.ilRepositoryExplorerGUI.php.

157 : string
158 {
159 $ilCtrl = $this->ctrl;
160
161 switch ($a_node["type"]) {
162 case "cat":
163 case "root":
164 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $a_node["child"]);
165 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
166 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->cur_ref_id);
167 return $link;
168
169 case "grpr":
170 case "crsr":
171 case "prgr":
172 case "catr":
173 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $a_node["child"]);
174 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "redirect");
175 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->cur_ref_id);
176 return $link;
177
178 case "grp":
179 $ilCtrl->setParameterByClass("ilobjgroupgui", "ref_id", $a_node["child"]);
180 $link = $ilCtrl->getLinkTargetByClass(["ilrepositorygui", "ilobjgroupgui"], "");
181 $ilCtrl->setParameterByClass("ilobjgroupgui", "ref_id", $this->cur_ref_id);
182 return $link;
183
184 case "crs":
185 $ilCtrl->setParameterByClass("ilobjcoursegui", "ref_id", $a_node["child"]);
186 $link = $ilCtrl->getLinkTargetByClass(["ilrepositorygui", "ilobjcoursegui"], "view");
187 $ilCtrl->setParameterByClass("ilobjcoursegui", "ref_id", $this->cur_ref_id);
188 return $link;
189
190 case 'rcrs':
191 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $a_node["child"]);
192 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
193 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->cur_ref_id);
194 return $link;
195
196 case 'prg':
197 $ilCtrl->setParameterByClass("ilobjstudyprogrammegui", "ref_id", $a_node["child"]);
198 $link = $ilCtrl->getLinkTargetByClass(["ilrepositorygui", "ilobjstudyprogrammegui"], "view");
199 $ilCtrl->setParameterByClass("ilobjstudyprogrammegui", "ref_id", $this->cur_ref_id);
200 return $link;
201
202 default:
203 return ilLink::_getStaticLink($a_node["child"], $a_node["type"], true);
204 }
205 }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc

References ilExplorerBaseGUI\$ctrl, ilLink\_getStaticLink(), and ilCtrl\setParameterByClass().

+ Here is the call graph for this function:

◆ getNodeIcon()

ilRepositoryExplorerGUI::getNodeIcon (   $a_node)

Get node icon path.

Parameters
object | array$a_node
Returns
string image file path

Reimplemented from ilExplorerBaseGUI.

Definition at line 126 of file class.ilRepositoryExplorerGUI.php.

126 : string
127 {
128 $obj_id = ilObject::_lookupObjId((int) $a_node["child"]);
129 return ilObject::_getIcon($obj_id, "tiny", $a_node["type"]);
130 }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)

References ilObject\_getIcon(), and ilObject\_lookupObjId().

+ Here is the call graph for this function:

◆ getNodeIconAlt()

ilRepositoryExplorerGUI::getNodeIconAlt (   $a_node)

Get node icon alt attribute.

Parameters
object | array$a_nodenode
Returns
string image alt attribute

Reimplemented from ilTreeExplorerGUI.

Definition at line 132 of file class.ilRepositoryExplorerGUI.php.

132 : string
133 {
135
136 if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
137 $title = $a_node["title"];
138 if ($title === "ILIAS") {
139 $title = $lng->txt("repository");
140 }
141 return $title;
142 }
143
145 return $lng->txt("obj_" . $a_node["type"]) . ": " . $this->getNodeContent($a_node);
146 }
getNodeContent($a_node)
Get content of a node.

References ilTreeExplorerGUI\$lng, getNodeContent(), ilTreeExplorerGUI\getNodeId(), getRootNode(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getParentCourseOrGroup()

ilRepositoryExplorerGUI::getParentCourseOrGroup ( int  $node_id)
protected

Definition at line 241 of file class.ilRepositoryExplorerGUI.php.

241 : int
242 {
243 $current_node_id = $node_id;
244 while (isset($this->parent_node_id[$current_node_id])) {
245 $parent_node_id = $this->parent_node_id[$current_node_id];
246 if (isset($this->node_data[$parent_node_id]) && in_array($this->node_data[$parent_node_id]["type"], ["grp", "crs"])) {
247 return $parent_node_id;
248 }
249 $current_node_id = $parent_node_id;
250 }
251 return 0;
252 }

References $parent_node_id.

Referenced by isNodeVisible().

+ Here is the caller graph for this function:

◆ getRootNode()

ilRepositoryExplorerGUI::getRootNode ( )

Get root node.

Returns
object|array node

Reimplemented from ilTreeExplorerGUI.

Definition at line 96 of file class.ilRepositoryExplorerGUI.php.

96 : array|null|object
97 {
98 if ($this->top_node_id > 0) {
99 $root_node = $this->getTree()->getNodeData($this->top_node_id);
100 } else {
101 $root_node = parent::getRootNode();
102 }
103 $this->node_data[$root_node["child"]] = $root_node;
104 return $root_node;
105 }

References ilTreeExplorerGUI\getTree().

Referenced by getNodeContent(), getNodeIconAlt(), and isNodeHighlighted().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTopNodeForRefId()

static ilRepositoryExplorerGUI::getTopNodeForRefId ( int  $ref_id)
static

Definition at line 452 of file class.ilRepositoryExplorerGUI.php.

452 : int
453 {
454 global $DIC;
455
456 $setting = $DIC->settings();
457 $tree = $DIC->repositoryTree();
458
459 $top_node = 0;
460 if ($ref_id > 0 && $setting->get("rep_tree_limit_grp_crs")) {
461 $path = $tree->getPathId($ref_id);
462 foreach ($path as $n) {
463 if ($top_node > 0) {
464 break;
465 }
466 if (in_array(
468 ["crs", "grp"]
469 )) {
470 $top_node = $n;
471 }
472 }
473 }
474 return $top_node;
475 }
static _lookupType(int $id, bool $reference=false)
getPathId(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
global $DIC
Definition: shib_login.php:26

References $DIC, ilTreeExplorerGUI\$tree, ilObject\_lookupObjId(), ilObject\_lookupType(), and ilTree\getPathId().

Referenced by ILIAS\Repository\Provider\RepositoryMainBarProvider\getStaticSubItems().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isNodeClickable()

ilRepositoryExplorerGUI::isNodeClickable (   $a_node)

Is node clickable?

Parameters
object | array$a_nodenode
Returns
bool node clickable true/false

Reimplemented from ilExplorerBaseGUI.

Definition at line 441 of file class.ilRepositoryExplorerGUI.php.

441 : bool
442 {
443 if (in_array($a_node['type'], ['grpr', 'crsr', 'catr'], true)) {
444 return ilContainerReferenceAccess::_isAccessible($a_node['child']);
445 }
446
447 return
448 $this->access->checkAccess("read", "", (int) $a_node["child"]) ||
449 $this->access->checkAccess("join", "", (int) $a_node["child"]);
450 }
static _isAccessible(int $a_ref_id)
Check if target is accessible and not deleted.

References ilContainerReferenceAccess\_isAccessible(), and ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ isNodeHighlighted()

ilRepositoryExplorerGUI::isNodeHighlighted (   $a_node)

Is node highlighted?

Parameters
object | array$a_nodenode
Returns
bool node highlighted true/false

Reimplemented from ilExplorerBaseGUI.

Definition at line 148 of file class.ilRepositoryExplorerGUI.php.

148 : bool
149 {
150 if ((int) $a_node["child"] === $this->cur_ref_id ||
151 ($this->cur_ref_id === 0 && (int) $a_node["child"] === (int) $this->getNodeId($this->getRootNode()))) {
152 return true;
153 }
154 return false;
155 }

References ilTreeExplorerGUI\getNodeId(), and getRootNode().

+ Here is the call graph for this function:

◆ isNodeVisible()

ilRepositoryExplorerGUI::isNodeVisible (   $a_node)

Is node visible?

Parameters
object | array$a_nodenode
Returns
bool node visible true/false

Reimplemented from ilExplorerBaseGUI.

Definition at line 207 of file class.ilRepositoryExplorerGUI.php.

207 : bool
208 {
209 $ilAccess = $this->access;
212
213 if (!$ilAccess->checkAccess('visible', '', $a_node["child"])) {
214 return false;
215 }
216
217 if ($ilSetting->get("repository_tree_pres") === "all_types") {
218 /*$container_parent_id = $tree->checkForParentType($a_node["child"], 'grp');
219 if (!$container_parent_id) {
220 $container_parent_id = $tree->checkForParentType($a_node["child"], 'crs');
221 }*/
222 // see #21215
223 $container_parent_id = $this->getParentCourseOrGroup($a_node["child"]);
224 if ($container_parent_id > 0) {
225 // do not display session materials for container course/group
226 if ($container_parent_id !== (int) $a_node["child"]) {
227 // get container event items only once
228 if (!isset($this->session_materials[$container_parent_id])) {
229 $this->session_materials[$container_parent_id] = ilEventItems::_getItemsOfContainer($container_parent_id);
230 }
231 if (in_array($a_node["child"], $this->session_materials[$container_parent_id])) {
232 return false;
233 }
234 }
235 }
236 }
237
238 return true;
239 }
static _getItemsOfContainer(int $a_ref_id)
global $ilSetting
Definition: privfeed.php:26

References $access, $ilSetting, $settings, ilTreeExplorerGUI\$tree, ilEventItems\_getItemsOfContainer(), and getParentCourseOrGroup().

+ Here is the call graph for this function:

◆ nodeHasVisibleChilds()

ilRepositoryExplorerGUI::nodeHasVisibleChilds (   $a_node)
Parameters
object | array$a_node
Returns
bool

Reimplemented from ilExplorerBaseGUI.

Definition at line 415 of file class.ilRepositoryExplorerGUI.php.

415 : bool
416 {
417 if (!$this->obj_definition->isContainer($a_node["type"] ?? "")) {
418 return false;
419 }
420 return parent::nodeHasVisibleChilds($a_node);
421 }

◆ sortChilds()

ilRepositoryExplorerGUI::sortChilds ( array  $a_childs,
  $a_parent_node_id 
)

Sort childs.

Parameters
array$a_childsarray of child nodes
string$a_parent_node_idparent node
Returns
array array of childs nodes

Reimplemented from ilExplorerBaseGUI.

Definition at line 255 of file class.ilRepositoryExplorerGUI.php.

255 : array
256 {
257 $objDefinition = $this->obj_definition;
258 $ilAccess = $this->access;
259
260 $parent_obj_id = ilObject::_lookupObjId((int) $a_parent_node_id);
261 if ($parent_obj_id > 0) {
262 $parent_type = ilObject::_lookupType($parent_obj_id);
263 } else {
264 $parent_type = "dummy";
265 $this->type_grps["dummy"] = ["root" => "dummy"];
266 }
267
268 // alex: if this is not initialized, things are messed up
269 // see bug 0015978
270 $this->type_grps = [];
271
272 $this->type_grps[$parent_type] =
273 $objDefinition::getGroupedRepositoryObjectTypes($parent_type);
274
275 // #14465 - object groups
277 $group = [];
278 $ogroup = []; // used for object groups, see bug #0015978
279 $in_any_group = [];
280 foreach ($a_childs as $child) {
281 // object group: get childs
282 if ($child["type"] === "obgr") {
283 $g = $child["child"];
285 if ($items) {
286 // add object group ref id to object group block
287 $this->type_grps[$parent_type]["obgr"]["ref_ids"][] = $g;
288
289 // #16697 - check object group permissions
290 $may_read = $ilAccess->checkAccess('read', '', $g);
291
292 // see bug #0015978
293 if ($may_read) {
294 $items = ilContainerSorting::_getInstance($parent_obj_id)->sortSubItems('obgr', $child["obj_id"], $items);
295 }
296
297 foreach ($items as $item) {
298 if (count($type_white_list) > 0 && !in_array($item["type"], $type_white_list, true)) {
299 continue;
300 }
301 $in_any_group[] = $item["child"];
302
303 if ($may_read) {
304 $ogroup[$g][] = $item;
305 $group[$g][] = $item;
306 }
307 }
308 }
309 }
310 // type group
311 else {
312 $g = $objDefinition->getGroupOfObj($child["type"]);
313 if ($g == "") {
314 $g = $child["type"];
315 }
316 $group[$g][] = $child;
317 }
318 }
319
320 $in_any_group = array_unique($in_any_group);
321
322 // custom block sorting?
323 $sort = ilContainerSorting::_getInstance($parent_obj_id);
324 $block_pos = $sort->getBlockPositions();
325 if (is_array($block_pos) && count($block_pos) > 0) {
326 $tmp = $this->type_grps[$parent_type];
327
328 $this->type_grps[$parent_type] = [];
329 foreach ($block_pos as $block_type) {
330 // type group
331 if (!is_numeric($block_type) &&
332 array_key_exists($block_type, $tmp)) {
333 $this->type_grps[$parent_type][$block_type] = $tmp[$block_type];
334 unset($tmp[$block_type]);
335 }
336 // object group
337 else {
338 // using object group ref id directly
339 $this->type_grps[$parent_type][$block_type] = [];
340 }
341 }
342
343 // append missing
344 if (count($tmp)) {
345 foreach ($tmp as $block_type => $grp) {
346 $this->type_grps[$parent_type][$block_type] = $grp;
347 }
348 }
349
350 unset($tmp);
351 }
352
353 $childs = [];
354 $done = [];
355
356 foreach ($this->type_grps[$parent_type] as $t => $g) {
357 // type group
358 if (isset($group[$t]) && is_array($group[$t])) {
359 // see bug #0015978
360 // custom sorted object groups
361 if (isset($ogroup[$t]) && is_array($ogroup[$t])) {
362 foreach ($ogroup[$t] as $k => $item) {
363 if (!in_array($item["child"], $done)) {
364 $childs[] = $item;
365 $done[] = $item["child"];
366 }
367 }
368 } else {
369 // do we have to sort this group??
370 $sort = ilContainerSorting::_getInstance($parent_obj_id);
371 $group = $sort->sortItems($group);
372
373 // need extra session sorting here
374 if ($t === "sess") {
375 foreach ($group[$t] as $k => $v) {
376 $app_info = ilSessionAppointment::_lookupAppointment($v["obj_id"]);
377 $group[$t][$k]["start"] = $app_info["start"];
378 }
379 $group[$t] = ilArrayUtil::sortArray($group[$t], 'start', 'asc', true, false);
380 }
381
382 foreach ($group[$t] as $k => $item) {
383 if (!in_array($item["child"], $done) &&
384 !in_array($item["child"], $in_any_group)) { // #16697
385 $childs[] = $item;
386 $done[] = $item["child"];
387 }
388 }
389 }
390 }
391 // object groups (if not custom block sorting)
392 elseif ($t === "obgr" &&
393 isset($g["ref_ids"]) &&
394 is_array($g["ref_ids"])) {
395 foreach ($g["ref_ids"] as $ref_id) {
396 if (isset($group[$ref_id])) {
397 foreach ($group[$ref_id] as $k => $item) {
398 if (!in_array($item["child"], $done)) {
399 $childs[] = $item;
400 $done[] = $item["child"];
401 }
402 }
403 }
404 }
405 }
406 }
407
408 return $childs;
409 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _getInstance(int $a_obj_id)
static getItemsByObjectGroup(int $object_group_ref_id)
Get materials of object group.
getTypeWhiteList()
Get type white list.

References $access, ilTreeExplorerGUI\$childs, $obj_definition, ilTreeExplorerGUI\$type_white_list, ilContainerSorting\_getInstance(), ilSessionAppointment\_lookupAppointment(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilObjectActivation\getItemsByObjectGroup(), ilTreeExplorerGUI\getTypeWhiteList(), and ilArrayUtil\sortArray().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilRepositoryExplorerGUI::$access
protected

Definition at line 31 of file class.ilRepositoryExplorerGUI.php.

Referenced by isNodeVisible(), and sortChilds().

◆ $cur_ref_id

int ilRepositoryExplorerGUI::$cur_ref_id = 0
protected

Definition at line 40 of file class.ilRepositoryExplorerGUI.php.

◆ $db

ilDBInterface ilRepositoryExplorerGUI::$db
protected

Definition at line 33 of file class.ilRepositoryExplorerGUI.php.

◆ $node_data

array ilRepositoryExplorerGUI::$node_data = []
protected

Definition at line 38 of file class.ilRepositoryExplorerGUI.php.

◆ $obj_definition

ilObjectDefinition ilRepositoryExplorerGUI::$obj_definition
protected

Definition at line 30 of file class.ilRepositoryExplorerGUI.php.

Referenced by sortChilds().

◆ $parent_node_id

array ilRepositoryExplorerGUI::$parent_node_id = []
protected

Definition at line 37 of file class.ilRepositoryExplorerGUI.php.

Referenced by getParentCourseOrGroup().

◆ $rbacsystem

ilRbacSystem ilRepositoryExplorerGUI::$rbacsystem
protected

Definition at line 32 of file class.ilRepositoryExplorerGUI.php.

Referenced by getChildsOfNode().

◆ $request

StandardGUIRequest ilRepositoryExplorerGUI::$request
protected

Definition at line 39 of file class.ilRepositoryExplorerGUI.php.

◆ $session_materials

array ilRepositoryExplorerGUI::$session_materials = []
protected

Definition at line 36 of file class.ilRepositoryExplorerGUI.php.

◆ $settings

ilSetting ilRepositoryExplorerGUI::$settings
protected

Definition at line 29 of file class.ilRepositoryExplorerGUI.php.

Referenced by isNodeVisible().

◆ $top_node_id

int ilRepositoryExplorerGUI::$top_node_id
protected

Definition at line 41 of file class.ilRepositoryExplorerGUI.php.

◆ $type_grps

array ilRepositoryExplorerGUI::$type_grps = []
protected

Definition at line 35 of file class.ilRepositoryExplorerGUI.php.

◆ $user

ilObjUser ilRepositoryExplorerGUI::$user
protected

Definition at line 34 of file class.ilRepositoryExplorerGUI.php.


The documentation for this class was generated from the following file: