ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilTreeExplorerGUI Class Reference

Explorer class that works on tree objects (Services/Tree) More...

+ Inheritance diagram for ilTreeExplorerGUI:
+ Collaboration diagram for ilTreeExplorerGUI:

Public Member Functions

 __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
 build (Node\Factory $factory, $record, $environment=null)
 Build and return a Node. More...
 

Protected Member Functions

 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

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 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)
 
- 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

Explorer class that works on tree objects (Services/Tree)

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Deprecated:
10

Definition at line 28 of file class.ilTreeExplorerGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTreeExplorerGUI::__construct ( string  $a_expl_id,
  $a_parent_obj,
string  $a_parent_cmd,
ilTree  $a_tree,
string  $a_node_parameter_name = "node_id" 
)

Definition at line 46 of file class.ilTreeExplorerGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

52  {
53  global $DIC;
54 
55  $this->httpRequest = $DIC->http()->request();
56  $this->ui = $DIC->ui();
57  $this->lng = $DIC->language();
58  parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_node_parameter_name);
59  $this->tree = $a_tree;
60  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ build()

ilTreeExplorerGUI::build ( \ILIAS\UI\Component\Tree\Node\Factory  $factory,
  $record,
  $environment = null 
)

Definition at line 378 of file class.ilTreeExplorerGUI.php.

References ilExplorerBaseGUI\$id, $url, createNode(), ILIAS\Repository\ctrl(), ilExplorerBaseGUI\getNodeHref(), getNodeId(), getNodeStateToggleCmdClasses(), ilExplorerBaseGUI\isNodeClickable(), ilExplorerBaseGUI\isNodeOpen(), and null.

382  : \ILIAS\UI\Component\Tree\Node\Node {
383  $node = $this->createNode($factory, $record);
384 
385  $href = $this->getNodeHref($record);
386  if ($href !== '' && '#' !== $href && $this->isNodeClickable($record)) {
387  $node = $node->withLink(new \ILIAS\Data\URI(ILIAS_HTTP_PATH . '/' . $href));
388  }
389 
390  if ($this->isNodeOpen((int) $this->getNodeId($record))) {
391  $node = $node->withExpanded(true);
392  }
393 
394  $nodeStateToggleCmdClasses = $this->getNodeStateToggleCmdClasses($record);
395  $cmdClass = end($nodeStateToggleCmdClasses);
396 
397  if (is_string($cmdClass) && $cmdClass !== '') {
398  $node = $node->withAdditionalOnLoadCode(function ($id) use ($record, $nodeStateToggleCmdClasses, $cmdClass): string {
399  $serverNodeId = $this->getNodeId($record);
400 
401  $this->ctrl->setParameterByClass($cmdClass, $this->node_parameter_name, $serverNodeId);
402  $url = $this->ctrl->getLinkTargetByClass($nodeStateToggleCmdClasses, 'toggleExplorerNodeState', '', true, false);
403  $this->ctrl->setParameterByClass($cmdClass, $this->node_parameter_name, null);
404 
405  $javascript = "il.UI.tree.registerToggleNodeAsyncAction('$id', '$url', 'prior_state');";
406 
407  return $javascript;
408  });
409  }
410 
411  return $node;
412  }
isNodeClickable($a_node)
Is node clickable?
Interface Observer Contains several chained tasks and infos about them.
$url
Definition: shib_logout.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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...
getNodeId($a_node)
Get id for node.
getNodeStateToggleCmdClasses($record)
Should return an array of ilCtrl-enabled command classes which should be used to build the URL for th...
isNodeOpen($node_id)
Get all open nodes.
getNodeHref($a_node)
Get href for node.
+ Here is the call graph for this function:

◆ createNode()

ilTreeExplorerGUI::createNode ( \ILIAS\UI\Component\Tree\Node\Factory  $factory,
  $record 
)
protected

Creates at tree node, can be overwritten in derivatives if another node type should be used.

Definition at line 349 of file class.ilTreeExplorerGUI.php.

References ilExplorerBaseGUI\getNodeContent(), ilExplorerBaseGUI\getNodeIcon(), getNodeIconAlt(), null, and ILIAS\Repository\ui().

Referenced by build().

352  : \ILIAS\UI\Component\Tree\Node\Node {
353  $nodeIconPath = $this->getNodeIcon($record);
354 
355  $icon = null;
356  if ($nodeIconPath !== '') {
357  $icon = $this->ui
358  ->factory()
359  ->symbol()
360  ->icon()
361  ->custom($nodeIconPath, $this->getNodeIconAlt($record));
362  }
363 
364  return $factory->simple($this->getNodeContent($record), $icon);
365  }
getNodeIcon($a_node)
Get node icon path.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getNodeIconAlt($a_node)
Get node icon alt attribute.
getNodeContent($a_node)
Get content of a node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChildren()

ilTreeExplorerGUI::getChildren (   $record,
  $environment = null 
)

Get a list of records (that list can also be empty).

Each record will be relayed to $this->build to retrieve a Node. Also, each record will be asked for Sub-Nodes using this function.

Implements ILIAS\UI\Component\Tree\TreeRecursion.

Definition at line 341 of file class.ilTreeExplorerGUI.php.

References getChildsOfNode().

Referenced by ilLMTOCExplorerGUI\renderLSTocNode().

341  : array
342  {
343  return $this->getChildsOfNode($record["child"]);
344  }
getChildsOfNode($a_parent_node_id)
Get childs of node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChildsOfNode()

ilTreeExplorerGUI::getChildsOfNode (   $a_parent_node_id)

Get childs of node.

Parameters
int | string$a_parent_node_idparent id
Returns
array childs

Definition at line 208 of file class.ilTreeExplorerGUI.php.

References $c, getOrderField(), ilExplorerBaseGUI\getSearchTerm(), getTypeBlackList(), getTypeWhiteList(), ilExplorerBaseGUI\isNodeRequested(), ilExplorerBaseGUI\isNodeVisible(), and matches().

Referenced by getChildren().

208  : array
209  {
210  if ($this->preloaded && $this->getSearchTerm() === "") {
211  if (isset($this->childs[$a_parent_node_id]) && is_array($this->childs[$a_parent_node_id])) {
212  return $this->childs[$a_parent_node_id];
213  }
214  return array();
215  }
216 
217  $wl = $this->getTypeWhiteList();
218  if (count($wl) > 0) {
219  $childs = $this->tree->getChildsByTypeFilter($a_parent_node_id, $wl, $this->getOrderField());
220  } else {
221  $childs = $this->tree->getChilds($a_parent_node_id, $this->getOrderField());
222  }
223 
224  // apply black list filter
225  $bl = $this->getTypeBlackList();
226  if (is_array($bl) && count($bl) > 0) {
227  $bl_childs = array();
228  foreach ($childs as $k => $c) {
229  if (!in_array($c["type"], $bl, true) && ($this->matches($c) || !$this->isNodeRequested($a_parent_node_id))) {
230  $bl_childs[$k] = $c;
231  }
232  }
233  return $bl_childs;
234  }
235 
236  $final_childs = [];
237  foreach ($childs as $k => $c) {
238  if ($this->isNodeVisible($c)
239  && ($this->matches($c) || !$this->isNodeRequested($a_parent_node_id))) {
240  $final_childs[$k] = $c;
241  }
242  }
243  return $final_childs;
244  }
isNodeRequested(string $a_node_id)
getTypeBlackList()
Get type black list.
matches($node)
Does a node match a search term (or is search term empty)
$c
Definition: deliver.php:25
isNodeVisible($a_node)
Is node visible?
getTypeWhiteList()
Get type white list.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilTreeExplorerGUI::getHTML (   $new = false)

Get HTML.

Returns
string html

Definition at line 328 of file class.ilTreeExplorerGUI.php.

References getPreloadChilds(), preloadChilds(), and render().

328  : string
329  {
330  if ($this->getPreloadChilds()) {
331  $this->preloadChilds();
332  }
333  if (!$new) {
334  return parent::getHTML();
335  }
336  return $this->render();
337  }
+ Here is the call graph for this function:

◆ getNodeIconAlt()

ilTreeExplorerGUI::getNodeIconAlt (   $a_node)

Get node icon alt attribute.

Parameters
object | array$a_nodenode
Returns
string image alt attribute

Definition at line 276 of file class.ilTreeExplorerGUI.php.

References $lng, and ilLanguage\txt().

Referenced by ilTaxonomyClassificationExplorerGUI\createNode(), ilForumExplorerGUI\createNode(), and createNode().

276  : string
277  {
278  $lng = $this->lng;
279 
280  return $lng->txt("icon") . " " . $lng->txt("obj_" . ($a_node["type"] ?? ''));
281  }
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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNodeId()

◆ getNodeStateToggleCmdClasses()

ilTreeExplorerGUI::getNodeStateToggleCmdClasses (   $record)
protected

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.

Parameters
$record
Returns
array

Definition at line 373 of file class.ilTreeExplorerGUI.php.

Referenced by build().

373  : array
374  {
375  return [];
376  }
+ Here is the caller graph for this function:

◆ getOrderField()

ilTreeExplorerGUI::getOrderField ( )

Definition at line 75 of file class.ilTreeExplorerGUI.php.

References $order_field.

Referenced by getChildsOfNode().

75  : string
76  {
77  return $this->order_field;
78  }
+ Here is the caller graph for this function:

◆ getPreloadChilds()

ilTreeExplorerGUI::getPreloadChilds ( )

Definition at line 121 of file class.ilTreeExplorerGUI.php.

References $preload_childs.

Referenced by getHTML().

121  : bool
122  {
123  return $this->preload_childs;
124  }
+ Here is the caller graph for this function:

◆ getRootId()

ilTreeExplorerGUI::getRootId ( )
protected

Definition at line 304 of file class.ilTreeExplorerGUI.php.

References getTree().

Referenced by getRootNode(), and ilWorkspaceExplorerGUI\isNodeHighlighted().

304  : int
305  {
306  return $this->root_id
307  ?: $this->getTree()->readRootId();
308  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRootNode()

◆ getSuccessorNode()

ilTreeExplorerGUI::getSuccessorNode (   $a_node_id,
string  $a_type = "" 
)

Get successor node (currently only(!) based on lft/rgt tree values)

Parameters
int | string$a_node_idnode id
Returns
mixed node id or false

Definition at line 179 of file class.ilTreeExplorerGUI.php.

References getTree().

Referenced by ilLMTOCExplorerGUI\isNodeClickable().

182  {
183  if ($this->order_field !== "") {
184  die("ilTreeExplorerGUI::getSuccessorNode not implemented for order field " . $this->order_field);
185  }
186 
187  if ($this->preloaded) {
188  $next_id = $a_node_id;
189  while (($next_id = $this->all_childs[$next_id]["next_node_id"]) && $a_type !== "" &&
190  $this->all_childs[$next_id]["type"] !== $a_type) {
191  // do nothing
192  }
193  if ($next_id) {
194  return $this->all_childs[$next_id];
195  }
196  return false;
197  }
198  return $this->getTree()->fetchSuccessorNode($a_node_id, $a_type);
199  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTree()

◆ getTreeComponent()

ilTreeExplorerGUI::getTreeComponent ( )

Definition at line 419 of file class.ilTreeExplorerGUI.php.

References $data, Vendor\Package\$f, $tree, ilTree\getChilds(), ilExplorerBaseGUI\getNodeContent(), ilTree\getNodeData(), getRootNode(), ilExplorerBaseGUI\getSkipRootNode(), getTree(), getTreeLabel(), ilTree\readRootId(), and ILIAS\Repository\ui().

Referenced by render().

419  : Tree
420  {
421  $f = $this->ui->factory();
422  $tree = $this->getTree();
423 
424  if (!$this->getSkipRootNode()) {
425  $data = array(
427  );
428  } else {
430  }
431 
432  $label = $this->getTreeLabel();
433  if ($this->getTreeLabel() === "" && $this->getNodeContent($this->getRootNode())) {
434  $label = $this->getNodeContent($this->getRootNode());
435  }
436 
437  $tree = $f->tree()->expandable($label, $this)
438  ->withData($data)
439  ->withHighlightOnNodeClick(true);
440 
441  return $tree;
442  }
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
get child nodes of given node
getNodeContent($a_node)
Get content of a node.
getRootNode()
Get root node.
This describes a Tree Control.
Definition: Tree.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTreeLabel()

ilTreeExplorerGUI::getTreeLabel ( )

Definition at line 414 of file class.ilTreeExplorerGUI.php.

References $tree_label.

Referenced by getTreeComponent().

414  : string
415  {
416  return $this->tree_label;
417  }
+ Here is the caller graph for this function:

◆ getTypeBlackList()

ilTreeExplorerGUI::getTypeBlackList ( )

Get type black list.

Returns
array array of strings of node types that should be filtered out

Definition at line 111 of file class.ilTreeExplorerGUI.php.

References $type_black_list.

Referenced by getChildsOfNode(), and preloadChilds().

111  : array
112  {
113  return $this->type_black_list;
114  }
+ Here is the caller graph for this function:

◆ getTypeWhiteList()

ilTreeExplorerGUI::getTypeWhiteList ( )

Get type white list.

Returns
array array of strings of node types that should be retrieved

Definition at line 93 of file class.ilTreeExplorerGUI.php.

References $type_white_list.

Referenced by ilIntLinkRepItemExplorerGUI\__construct(), getChildsOfNode(), preloadChilds(), ilConditionSelector\setRefId(), and ilRepositorySelectorExplorerGUI\sortChilds().

93  : array
94  {
96  }
+ Here is the caller graph for this function:

◆ matches()

ilTreeExplorerGUI::matches (   $node)
protected

Does a node match a search term (or is search term empty)

Parameters
object | array$node
Returns
bool

Definition at line 251 of file class.ilTreeExplorerGUI.php.

References ilExplorerBaseGUI\getNodeContent(), and ilExplorerBaseGUI\getSearchTerm().

Referenced by getChildsOfNode().

251  : bool
252  {
253  return (
254  $this->getSearchTerm() === "" ||
255  is_int(ilStr::striPos($this->getNodeContent($node), $this->getSearchTerm()))
256  );
257  }
getNodeContent($a_node)
Get content of a node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preloadChilds()

ilTreeExplorerGUI::preloadChilds ( )
protected

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

References $c, getRootNode(), getTypeBlackList(), getTypeWhiteList(), and ilArrayUtil\sortArray().

Referenced by getHTML().

126  : void
127  {
128  $subtree = $this->tree->getSubTree($this->getRootNode());
129  foreach ($subtree as $s) {
130  $wl = $this->getTypeWhiteList();
131  if (is_array($wl) && count($wl) > 0 && !in_array($s["type"], $wl)) {
132  continue;
133  }
134  $bl = $this->getTypeBlackList();
135  if (is_array($bl) && count($bl) > 0 && in_array($s["type"], $bl)) {
136  continue;
137  }
138  $this->childs[$s["parent"]][] = $s;
139  $this->all_childs[$s["child"]] = $s;
140  }
141 
142  if ($this->order_field !== "") {
143  foreach ($this->childs as $k => $childs) {
144  $this->childs[$k] = ilArrayUtil::sortArray(
145  $childs,
146  $this->order_field,
147  "asc",
148  $this->order_field_numeric
149  );
150  }
151  }
152 
153  // sort childs and store prev/next reference
154  if ($this->order_field === "") {
155  $this->all_childs =
156  ilArrayUtil::sortArray($this->all_childs, "lft", "asc", true, true);
157  $prev = false;
158  foreach ($this->all_childs as $k => $c) {
159  if ($prev) {
160  $this->all_childs[$prev]["next_node_id"] = $k;
161  }
162  $this->all_childs[$k]["prev_node_id"] = $prev;
163  $this->all_childs[$k]["next_node_id"] = false;
164  $prev = $k;
165  }
166  }
167 
168  $this->preloaded = true;
169  }
getTypeBlackList()
Get type black list.
$c
Definition: deliver.php:25
getRootNode()
Get root node.
getTypeWhiteList()
Get type white list.
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ilTreeExplorerGUI::render ( )
protected

Definition at line 465 of file class.ilTreeExplorerGUI.php.

References $r, getTreeComponent(), and ILIAS\Repository\ui().

Referenced by getHTML().

465  : string
466  {
467  $r = $this->ui->renderer();
468 
469  return $r->render([
470  $this->getTreeComponent()
471  ]);
472  }
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOrderField()

ilTreeExplorerGUI::setOrderField ( string  $a_val,
bool  $a_numeric = false 
)

Definition at line 67 of file class.ilTreeExplorerGUI.php.

Referenced by ilMediaPoolExplorerGUI\__construct(), ilMailExplorer\__construct(), ilTaxonomyExplorerGUI\__construct(), ilAdministrationExplorerGUI\__construct(), and ilSkillTemplateTreeExplorerGUI\__construct().

70  : void {
71  $this->order_field = $a_val;
72  $this->order_field_numeric = $a_numeric;
73  }
+ Here is the caller graph for this function:

◆ setPathOpen()

ilTreeExplorerGUI::setPathOpen (   $a_id)

Set node path to be opened.

Parameters
string$a_idnode id

Definition at line 315 of file class.ilTreeExplorerGUI.php.

References ilExplorerBaseGUI\$id, $path, getTree(), and ilExplorerBaseGUI\setNodeOpen().

Referenced by ilGroupActionTargetExplorerGUI\__construct(), ilLMExplorerGUI\__construct(), ilAdministrationExplorerGUI\__construct(), and ilWorkspaceExplorerGUI\__construct().

315  : void
316  {
317  $path = $this->getTree()->getPathId($a_id);
318  foreach ($path as $id) {
319  $this->setNodeOpen($id);
320  }
321  }
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
$path
Definition: ltiservices.php:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPreloadChilds()

ilTreeExplorerGUI::setPreloadChilds ( bool  $a_val)

Definition at line 116 of file class.ilTreeExplorerGUI.php.

Referenced by ilLMExplorerGUI\__construct(), ilForumExplorerGUI\__construct(), and ilTaxonomyExplorerGUI\__construct().

116  : void
117  {
118  $this->preload_childs = $a_val;
119  }
+ Here is the caller graph for this function:

◆ setRootId()

ilTreeExplorerGUI::setRootId (   $a_root)
Parameters
int | string$a_root

Definition at line 299 of file class.ilTreeExplorerGUI.php.

299  : void
300  {
301  $this->root_id = $a_root;
302  }

◆ setTypeBlackList()

ilTreeExplorerGUI::setTypeBlackList ( array  $a_val)

Set type black list.

Parameters
array$a_valarray of strings of node types that should be filtered out

Definition at line 102 of file class.ilTreeExplorerGUI.php.

102  : void
103  {
104  $this->type_black_list = $a_val;
105  }

◆ setTypeWhiteList()

◆ toggleExplorerNodeState()

ilTreeExplorerGUI::toggleExplorerNodeState ( )

Should be called by an ilCtrl-enabled command class if a tree node toggle action should be processed.

Definition at line 447 of file class.ilTreeExplorerGUI.php.

References ilExplorerBaseGUI\$node_parameter_name, exit, and ILIAS\Repository\int().

Referenced by ilObjForumGUI\toggleExplorerNodeStateObject().

447  : void
448  {
449  $nodeId = (int) ($this->httpRequest->getQueryParams()[$this->node_parameter_name] ?? 0);
450  $priorState = (int) ($this->httpRequest->getQueryParams()['prior_state'] ?? 0);
451 
452  if ($nodeId > 0) {
453  if (0 === $priorState && !in_array($nodeId, $this->open_nodes)) {
454  $this->open_nodes[] = $nodeId;
455  } elseif (1 === $priorState && in_array($nodeId, $this->open_nodes)) {
456  $key = array_search($nodeId, $this->open_nodes);
457  unset($this->open_nodes[$key]);
458  }
459 
460  $this->store->set('on_' . $this->id, serialize($this->open_nodes));
461  }
462  exit();
463  }
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $all_childs

array ilTreeExplorerGUI::$all_childs = array()
protected

Definition at line 42 of file class.ilTreeExplorerGUI.php.

◆ $childs

◆ $httpRequest

Psr Http Message ServerRequestInterface ilTreeExplorerGUI::$httpRequest
protected

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

◆ $lng

◆ $order_field

string ilTreeExplorerGUI::$order_field = ""
protected

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

Referenced by getOrderField().

◆ $order_field_numeric

bool ilTreeExplorerGUI::$order_field_numeric = false
protected

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

◆ $preload_childs

bool ilTreeExplorerGUI::$preload_childs = false
protected

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

Referenced by getPreloadChilds().

◆ $preloaded

bool ilTreeExplorerGUI::$preloaded = false
protected

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

◆ $root_id

ilTreeExplorerGUI::$root_id = 0
protected

Definition at line 43 of file class.ilTreeExplorerGUI.php.

Referenced by ilLMTOCExplorerGUI\getRootNode().

◆ $root_node_data

array ilTreeExplorerGUI::$root_node_data = null
protected

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

Referenced by getRootNode().

◆ $tree

◆ $tree_label

string ilTreeExplorerGUI::$tree_label = ""
protected

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

Referenced by getTreeLabel().

◆ $type_black_list

array ilTreeExplorerGUI::$type_black_list = array()
protected

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

Referenced by getTypeBlackList().

◆ $type_white_list

array ilTreeExplorerGUI::$type_white_list = array()
protected

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

Referenced by getTypeWhiteList().

◆ $ui

ILIAS DI UIServices ilTreeExplorerGUI::$ui
protected

Definition at line 44 of file class.ilTreeExplorerGUI.php.


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