ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables 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 ($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree)
 Constructor. More...
 
 getTree ()
 Get tree. More...
 
 setOrderField ($a_val, $a_numeric=false)
 Set order field. More...
 
 getOrderField ()
 Get order field. More...
 
 setTypeWhiteList ($a_val)
 Set type white list. More...
 
 getTypeWhiteList ()
 Get type white list. More...
 
 setTypeBlackList ($a_val)
 Set type black list. More...
 
 getTypeBlackList ()
 Get type black list. More...
 
 setPreloadChilds ($a_val)
 Set preload childs. More...
 
 getPreloadChilds ()
 Get preload childs. More...
 
 getSuccessorNode ($a_node_id, $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 ($node, $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.
Returns
array
More...
 
 build (\ILIAS\UI\Component\Tree\Node\Factory $factory, $record, $environment=null)
 
 getTreeLabel ()
 
 getTreeComponent ()
 Get Tree UI. More...
 
 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
 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd)
 Constructor. More...
 
 setChildLimit ($a_val)
 Set child limit. More...
 
 getChildLimit ()
 Get child limit. More...
 
 setSearchTerm ($a_val)
 Set search term. More...
 
 getSearchTerm ()
 Get search term. More...
 
 setMainTemplate ($a_main_tpl=null)
 Set main template (that is responsible for adding js/css) More...
 
 getRootNode ()
 Get root node. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs 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 childs? More...
 
 sortChilds ($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 ($a_val)
 Set skip root node. More...
 
 getSkipRootNode ()
 Get skip root node. More...
 
 setAjax ($a_val)
 Set ajax. More...
 
 getAjax ()
 Get ajax. More...
 
 setSecondaryHighlightedNodes ($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 ($a_postvar, $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 ($a_val)
 Set offline mode. More...
 
 getOfflineMode ()
 Get offline mode. More...
 
 handleCommand ()
 Handle explorer internal command. More...
 
 getContainerId ()
 Get container id. More...
 
 openNode ()
 Open node. More...
 
 closeNode ()
 Close node. More...
 
 getNodeAsync ()
 Get node asynchronously. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getOnLoadCode ()
 Get on load code. More...
 
 getHTML ()
 Get HTML. More...
 
 renderNode ($a_node, $tpl)
 Render node. More...
 
 renderChilds ($a_node_id, $tpl)
 Render childs. More...
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id. More...
 
 getNodeIdForDomNodeId ($a_dom_node_id)
 Get node id for dom node id. More...
 
 listItemStart ($tpl, $a_node)
 List item start. More...
 
 listItemEnd ($tpl)
 List item end. More...
 
 listStart ($tpl)
 List start. More...
 
 listEnd ($tpl)
 List end. More...
 
 isNodeOnclickEnabled ()
 
 setNodeOnclickEnabled ($nodeOnclickEnabled)
 
 isEnableDnd ()
 
 setEnableDnd ($enable_dnd)
 Enable Drag & Drop functionality. More...
 
- 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 ()
 Preload childs. More...
 
 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 ()
 Render tree. More...
 
- 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 ()
 

Protected Attributes

 $lng
 
 $httpRequest
 
 $tree = null
 
 $tree_label = ""
 
 $order_field = ""
 
 $order_field_numeric = false
 
 $type_white_list = array()
 
 $type_black_list = array()
 
 $childs = array()
 
 $preloaded = false
 
 $preload_childs = false
 
 $root_node_data = null
 
 $all_childs = array()
 
 $ui
 
- Protected Attributes inherited from ilExplorerBaseGUI
 $log
 
 $ctrl
 
 $tpl
 
 $skip_root_node = false
 
 $ajax = false
 
 $custom_open_nodes = array()
 
 $selected_nodes = array()
 
 $select_postvar = ""
 
 $offline_mode = false
 
 $sec_highl_nodes = array()
 
 $enable_dnd = false
 
 $search_term = ""
 
 $open_nodes = []
 
 $store
 
 $parent_obj
 
 $child_limit = 0
 
 $parent_cmd = ''
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 Get local path of explorer js. More...
 
static getLocalJsTreeJsPath ()
 Get local path of jsTree js. More...
 
static getLocalJsTreeCssPath ()
 Get local path of jsTree js. More...
 
static createHTMLExportDirs ($a_target_dir)
 Create html export directories. More...
 
static init ($a_main_tpl=null)
 Init JS. More...
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static $js_tree_path = "./libs/bower/bower_components/jstree/dist/jstree.js"
 
static $js_tree_path_css = "./libs/bower/bower_components/jstree/dist/themes/default/style.min.css"
 
static $js_expl_path = "./Services/UIComponent/Explorer2/js/Explorer2.js"
 

Detailed Description

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

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilTreeExplorerGUI::__construct (   $a_expl_id,
  $a_parent_obj,
  $a_parent_cmd,
  $a_tree 
)

Constructor.

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

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

43  {
44  global $DIC;
45 
46  $this->httpRequest = $DIC->http()->request();
47  $this->ui = $DIC->ui();
48  $this->lng = $DIC->language();
49  parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd);
50  $this->tree = $a_tree;
51  }
ui()
Definition: ui.php:5
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ 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 399 of file class.ilTreeExplorerGUI.php.

References $url, createNode(), ilExplorerBaseGUI\getNodeHref(), getNodeId(), getNodeStateToggleCmdClasses(), ILIAS_HTTP_PATH, and ilExplorerBaseGUI\isNodeOpen().

404  $node = $this->createNode($factory, $record);
405 
406  $href = $this->getNodeHref($record);
407  if (is_string($href) && strlen($href) > 0 && '#' !== $href) {
408  $node = $node->withLink(new \ILIAS\Data\URI(ILIAS_HTTP_PATH . '/' . $href));
409  }
410 
411  if ($this->isNodeOpen((int) $this->getNodeId($record))) {
412  $node = $node->withExpanded(true);
413  }
414 
415  $nodeStateToggleCmdClasses = $this->getNodeStateToggleCmdClasses($record);
416  $cmdClass = end($nodeStateToggleCmdClasses);
417 
418  if (is_string($cmdClass) && strlen($cmdClass) > 0) {
419  $node = $node->withAdditionalOnLoadCode(function ($id) use ($record, $nodeStateToggleCmdClasses, $cmdClass) {
420  $serverNodeId = $this->getNodeId($record);
421 
422  $this->ctrl->setParameterByClass($cmdClass, 'node_id', $serverNodeId);
423  $url = $this->ctrl->getLinkTargetByClass($nodeStateToggleCmdClasses, 'toggleExplorerNodeState', '', true, false);
424  $this->ctrl->setParameterByClass($cmdClass, 'node_id', null);
425 
426  $javascript = "$('#$id').on('click', function(event) {
427  let node = $(this);
428 
429  if (node.hasClass('expandable')) {
430  il.UI.tree.toggleNodeState(event, '$url', 'prior_state', node.hasClass('expanded'));
431  event.preventDefault();
432  event.stopPropagation();
433  }
434  });";
435 
436  return $javascript;
437  });
438  }
439 
440  return $node;
441  }
Class ChatMainBarProvider .
This describes a Tree Node.
Definition: Node.php:15
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...
$url
isNodeOpen($node_id)
Get all open nodes.
getNodeHref($a_node)
Get href for node.
$factory
Definition: metadata.php:58
+ 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 367 of file class.ilTreeExplorerGUI.php.

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

Referenced by build().

371  $nodeIconPath = $this->getNodeIcon($record);
372 
373  $icon = null;
374  if (is_string($nodeIconPath) && strlen($nodeIconPath) > 0) {
375  $icon = $this->ui
376  ->factory()
377  ->symbol()
378  ->icon()
379  ->custom($nodeIconPath, $this->getNodeIconAlt($record));
380  }
381 
382  return $factory->simple($this->getNodeContent($record), $icon);
383  }
getNodeIcon($a_node)
Get node icon path.
This describes a Tree Node.
Definition: Node.php:15
getNodeIconAlt($a_node)
Get node icon alt attribute.
ui()
Definition: ui.php:5
getNodeContent($a_node)
Get content of a node.
$factory
Definition: metadata.php:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChildren()

ilTreeExplorerGUI::getChildren (   $node,
  $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.

Returns
array

Implements ILIAS\UI\Component\Tree\TreeRecursion.

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

References getChildsOfNode().

359  : array
360  {
361  return $this->getChildsOfNode($node["child"]);
362  }
getChildsOfNode($a_parent_node_id)
Get childs of node.
+ Here is the call graph for this function:

◆ getChildsOfNode()

ilTreeExplorerGUI::getChildsOfNode (   $a_parent_node_id)

Get childs of node.

Parameters
int$a_parent_node_idparent id
Returns
array childs

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

References Vendor\Package\$c, $childs, ilExplorerBaseGUI\getDomNodeIdForNodeId(), getOrderField(), ilExplorerBaseGUI\getSearchTerm(), getTypeBlackList(), getTypeWhiteList(), and matches().

Referenced by ilPublicSectionExplorerGUI\getAllNodes(), and getChildren().

223  {
224  if ($this->preloaded && $this->getSearchTerm() == "") {
225  if (is_array($this->childs[$a_parent_node_id])) {
226  return $this->childs[$a_parent_node_id];
227  }
228  return array();
229  }
230 
231  $wl = $this->getTypeWhiteList();
232  if (is_array($wl) && count($wl) > 0) {
233  $childs = $this->tree->getChildsByTypeFilter($a_parent_node_id, $wl, $this->getOrderField());
234  } else {
235  $childs = $this->tree->getChilds($a_parent_node_id, $this->getOrderField());
236  }
237 
238  // apply black list filter
239  $bl = $this->getTypeBlackList();
240  if (is_array($bl) && count($bl) > 0) {
241  $bl_childs = array();
242  foreach ($childs as $k => $c) {
243  if (!in_array($c["type"], $bl) && ($this->matches($c) || $this->requested_node_id != $this->getDomNodeIdForNodeId($a_parent_node_id))) {
244  $bl_childs[$k] = $c;
245  }
246  }
247  return $bl_childs;
248  }
249 
250  $final_childs = [];
251  foreach ($childs as $k => $c) {
252  if ($this->matches($c) || $this->requested_node_id != $this->getDomNodeIdForNodeId($a_parent_node_id)) {
253  $final_childs[$k] = $c;
254  }
255  }
256 
257  return $final_childs;
258  }
getTypeBlackList()
Get type black list.
matches($node)
Does a node match a search term (or is search term empty)
getSearchTerm()
Get search term.
getOrderField()
Get order field.
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
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 343 of file class.ilTreeExplorerGUI.php.

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

344  {
345  if ($this->getPreloadChilds()) {
346  $this->preloadChilds();
347  }
348  if (!$new) {
349  return parent::getHTML();
350  }
351  return $this->render();
352  }
preloadChilds()
Preload childs.
getPreloadChilds()
Get preload childs.
+ Here is the call graph for this function:

◆ getNodeIconAlt()

ilTreeExplorerGUI::getNodeIconAlt (   $a_node)

Get node icon alt attribute.

Parameters
mixed$a_nodenode object/array
Returns
string image alt attribute

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

References $lng.

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

294  {
295  $lng = $this->lng;
296 
297  return $lng->txt("icon") . " " . $lng->txt("obj_" . $a_node["type"]);
298  }
+ 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 391 of file class.ilTreeExplorerGUI.php.

Referenced by build().

391  : array
392  {
393  return [];
394  }
+ Here is the caller graph for this function:

◆ getOrderField()

ilTreeExplorerGUI::getOrderField ( )

Get order field.

Returns
string order field key

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

References $order_field.

Referenced by getChildsOfNode().

80  {
81  return $this->order_field;
82  }
+ Here is the caller graph for this function:

◆ getPreloadChilds()

ilTreeExplorerGUI::getPreloadChilds ( )

Get preload childs.

Returns
boolean preload childs

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

References $preload_childs.

Referenced by getHTML().

140  {
141  return $this->preload_childs;
142  }
+ Here is the caller graph for this function:

◆ getRootId()

ilTreeExplorerGUI::getRootId ( )
protected

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

References getTree().

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

319  {
320  return $this->root_id
321  ? $this->root_id
322  : $this->getTree()->readRootId();
323  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRootNode()

ilTreeExplorerGUI::getRootNode ( )

Get root node.

Returns
mixed node object/array

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

References $root_node_data, getRootId(), and getTree().

Referenced by ilPublicSectionExplorerGUI\getAllNodes(), ilMediaPoolExplorerGUI\getNodeContent(), ilSCORM2004EditorExplorerGUI\getNodeContent(), ilTaxonomyExplorerGUI\getNodeContent(), ilLMExplorerGUI\getNodeContent(), ilMailExplorer\getNodeContent(), ilAdministrationExplorerGUI\getNodeContent(), ilRepositorySelectorExplorerGUI\getNodeContent(), ilSCORM2004EditorExplorerGUI\getNodeHref(), ilMailExplorer\getNodeHref(), ilLMEditorExplorerGUI\getNodeIcon(), ilPublicSectionExplorerGUI\getNodeIcon(), ilMediaPoolExplorerGUI\getNodeIcon(), ilSCORM2004EditorExplorerGUI\getNodeIcon(), ilMailExplorer\getNodeIcon(), ilSCORM2004EditorExplorerGUI\getNodeIconAlt(), ilMailExplorer\getNodeIconAlt(), ilAdministrationExplorerGUI\getNodeIconAlt(), ilRepositorySelectorExplorerGUI\getNodeIconAlt(), getTreeComponent(), ilMediaPoolExplorerGUI\isNodeHighlighted(), ilSCORM2004EditorExplorerGUI\isNodeHighlighted(), ilLMExplorerGUI\isNodeHighlighted(), ilAdministrationExplorerGUI\isNodeHighlighted(), ilRepositorySelectorExplorerGUI\isNodeHighlighted(), and preloadChilds().

306  {
307  if (!isset($this->root_node_data)) {
308  $this->root_node_data = $this->getTree()->getNodeData($this->getRootId());
309  }
310  return $this->root_node_data;
311  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuccessorNode()

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

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

Parameters
integer$a_node_idnode id
string$a_typenode type
Returns
mixed node id or false

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

References $a_type, and getTree().

Referenced by ilLMTOCExplorerGUI\isNodeClickable().

197  {
198  if ($this->order_field != "") {
199  die("ilTreeExplorerGUI::getSuccessorNode not implemented for order field " . $this->order_field);
200  }
201 
202  if ($this->preloaded) {
203  $next_id = $a_node_id;
204  while (($next_id = $this->all_childs[$next_id]["next_node_id"]) && $a_type != "" &&
205  $this->all_childs[$next_id]["type"] != $a_type);
206  if ($next_id) {
207  return $this->all_childs[$next_id];
208  }
209  return false;
210  }
211  return $this->getTree()->fetchSuccessorNode($a_node_id, $a_type);
212  }
$a_type
Definition: workflow.php:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTree()

◆ getTreeComponent()

ilTreeExplorerGUI::getTreeComponent ( )

Get Tree UI.

Returns
|object

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

References $data, Vendor\Package\$f, $tree, ilExplorerBaseGUI\getNodeContent(), getRootNode(), getTree(), getTreeLabel(), and ui().

Referenced by render().

457  {
458  $f = $this->ui->factory();
459  $tree = $this->getTree();
460 
461  $data = array(
462  $tree->getNodeData($tree->readRootId())
463  );
464 
465  $label = $this->getTreeLabel();
466  if ($this->getTreeLabel() == "" && $this->getNodeContent($this->getRootNode())) {
467  $label = $this->getNodeContent($this->getRootNode());
468  }
469 
470  $tree = $f->tree()->expandable($label, $this)
471  ->withData($data)
472  ->withHighlightOnNodeClick(true);
473 
474  return $tree;
475  }
$data
Definition: storeScorm.php:23
ui()
Definition: ui.php:5
getNodeContent($a_node)
Get content of a node.
getRootNode()
Get root node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTreeLabel()

ilTreeExplorerGUI::getTreeLabel ( )
Returns
string

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

References $tree_label.

Referenced by getTreeComponent().

447  {
448  return $this->tree_label;
449  }
+ 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 119 of file class.ilTreeExplorerGUI.php.

References $type_black_list.

Referenced by getChildsOfNode(), and preloadChilds().

120  {
121  return $this->type_black_list;
122  }
+ 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 99 of file class.ilTreeExplorerGUI.php.

References $type_white_list.

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

100  {
101  return $this->type_white_list;
102  }
+ 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
array
Returns
bool

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

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

Referenced by getChildsOfNode().

266  : bool
267  {
268  if ($this->getSearchTerm() == "" ||
269  is_int(stripos($this->getNodeContent($node), $this->getSearchTerm()))) {
270  return true;
271  }
272  return false;
273  }
getSearchTerm()
Get search term.
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

Preload childs.

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

References Vendor\Package\$c, $childs, getRootNode(), getTypeBlackList(), getTypeWhiteList(), and ilUtil\sortArray().

Referenced by getHTML().

148  {
149  $subtree = $this->tree->getSubTree($this->getRootNode());
150  foreach ($subtree as $s) {
151  $wl = $this->getTypeWhiteList();
152  if (is_array($wl) && count($wl) > 0 && !in_array($s["type"], $wl)) {
153  continue;
154  }
155  $bl = $this->getTypeBlackList();
156  if (is_array($bl) && count($bl) > 0 && in_array($s["type"], $bl)) {
157  continue;
158  }
159  $this->childs[$s["parent"]][] = $s;
160  $this->all_childs[$s["child"]] = $s;
161  }
162 
163  if ($this->order_field != "") {
164  foreach ($this->childs as $k => $childs) {
165  $this->childs[$k] = ilUtil::sortArray($childs, $this->order_field, "asc", $this->order_field_numeric);
166  }
167  }
168 
169  // sort childs and store prev/next reference
170  if ($this->order_field == "") {
171  $this->all_childs =
172  ilUtil::sortArray($this->all_childs, "lft", "asc", true, true);
173  $prev = false;
174  foreach ($this->all_childs as $k => $c) {
175  if ($prev) {
176  $this->all_childs[$prev]["next_node_id"] = $k;
177  }
178  $this->all_childs[$k]["prev_node_id"] = $prev;
179  $this->all_childs[$k]["next_node_id"] = false;
180  $prev = $k;
181  }
182  }
183 
184  $this->preloaded = true;
185  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
getTypeBlackList()
Get type black list.
getRootNode()
Get root node.
getTypeWhiteList()
Get type white list.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ilTreeExplorerGUI::render ( )
protected

Render tree.

Returns
string

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

References getTreeComponent(), and ui().

Referenced by getHTML().

504  {
505  $r = $this->ui->renderer();
506 
507  return $r->render([
508  $this->getTreeComponent()
509  ]);
510  }
ui()
Definition: ui.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOrderField()

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

Set order field.

Parameters
string$a_valorder field key

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

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

69  {
70  $this->order_field = $a_val;
71  $this->order_field_numeric = $a_numeric;
72  }
+ 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 330 of file class.ilTreeExplorerGUI.php.

References getTree(), and ilExplorerBaseGUI\setNodeOpen().

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

331  {
332  $path = $this->getTree()->getPathId($a_id);
333  foreach ($path as $id) {
334  $this->setNodeOpen($id);
335  }
336  }
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPreloadChilds()

ilTreeExplorerGUI::setPreloadChilds (   $a_val)

Set preload childs.

Parameters
boolean$a_valpreload childs

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

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

130  {
131  $this->preload_childs = $a_val;
132  }
+ Here is the caller graph for this function:

◆ setRootId()

ilTreeExplorerGUI::setRootId (   $a_root)

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

314  {
315  $this->root_id = $a_root;
316  }

◆ setTypeBlackList()

ilTreeExplorerGUI::setTypeBlackList (   $a_val)

Set type black list.

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

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

110  {
111  $this->type_black_list = $a_val;
112  }

◆ 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 480 of file class.ilTreeExplorerGUI.php.

References exit.

Referenced by ilMailGUI\toggleExplorerNodeState(), and ilObjForumGUI\toggleExplorerNodeStateObject().

480  : void
481  {
482  $nodeId = (int) ($this->httpRequest->getQueryParams()['node_id'] ?? 0);
483  $priorState = (int) ($this->httpRequest->getQueryParams()['prior_state'] ?? 0);
484 
485  if ($nodeId > 0) {
486  if (0 === $priorState && !in_array($nodeId, $this->open_nodes)) {
487  $this->open_nodes[] = $nodeId;
488  } elseif (1 === $priorState && in_array($nodeId, $this->open_nodes)) {
489  $key = array_search($nodeId, $this->open_nodes);
490  unset($this->open_nodes[$key]);
491  }
492 
493  $this->store->set('on_' . $this->id, serialize($this->open_nodes));
494  }
495  exit();
496  }
exit
Definition: login.php:29
+ Here is the caller graph for this function:

Field Documentation

◆ $all_childs

ilTreeExplorerGUI::$all_childs = array()
protected

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

◆ $childs

◆ $httpRequest

ilTreeExplorerGUI::$httpRequest
protected

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

◆ $lng

◆ $order_field

ilTreeExplorerGUI::$order_field = ""
protected

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

Referenced by getOrderField().

◆ $order_field_numeric

ilTreeExplorerGUI::$order_field_numeric = false
protected

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

◆ $preload_childs

ilTreeExplorerGUI::$preload_childs = false
protected

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

Referenced by getPreloadChilds().

◆ $preloaded

ilTreeExplorerGUI::$preloaded = false
protected

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

◆ $root_node_data

ilTreeExplorerGUI::$root_node_data = null
protected

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

Referenced by getRootNode().

◆ $tree

◆ $tree_label

ilTreeExplorerGUI::$tree_label = ""
protected

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

Referenced by getTreeLabel().

◆ $type_black_list

ilTreeExplorerGUI::$type_black_list = array()
protected

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

Referenced by getTypeBlackList().

◆ $type_white_list

ilTreeExplorerGUI::$type_white_list = array()
protected

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

Referenced by getTypeWhiteList().

◆ $ui

ilTreeExplorerGUI::$ui
protected

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


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