ILIAS  release_7 Revision v7.30-3-g800a261c036
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 = "./node_modules/jstree/dist/jstree.js"
 
static $js_tree_path_css = "./node_modules/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  }
global $DIC
Definition: goto.php:24
ui()
Definition: ui.php:5
__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 398 of file class.ilTreeExplorerGUI.php.

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

403  $node = $this->createNode($factory, $record);
404 
405  $href = $this->getNodeHref($record);
406  if (is_string($href) && strlen($href) > 0 && '#' !== $href) {
407  $node = $node->withLink(new \ILIAS\Data\URI(ILIAS_HTTP_PATH . '/' . $href));
408  }
409 
410  if ($this->isNodeOpen((int) $this->getNodeId($record))) {
411  $node = $node->withExpanded(true);
412  }
413 
414  $nodeStateToggleCmdClasses = $this->getNodeStateToggleCmdClasses($record);
415  $cmdClass = end($nodeStateToggleCmdClasses);
416 
417  if (is_string($cmdClass) && strlen($cmdClass) > 0) {
418  $node = $node->withAdditionalOnLoadCode(function ($id) use ($record, $nodeStateToggleCmdClasses, $cmdClass) {
419  $serverNodeId = $this->getNodeId($record);
420 
421  $this->ctrl->setParameterByClass($cmdClass, 'node_id', $serverNodeId);
422  $url = $this->ctrl->getLinkTargetByClass($nodeStateToggleCmdClasses, 'toggleExplorerNodeState', '', true, false);
423  $this->ctrl->setParameterByClass($cmdClass, 'node_id', null);
424 
425  $javascript = "il.UI.tree.registerToggleNodeAsyncAction('$id', '$url', 'prior_state');";
426 
427  return $javascript;
428  });
429  }
430 
431  return $node;
432  }
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 366 of file class.ilTreeExplorerGUI.php.

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

Referenced by build().

370  $nodeIconPath = $this->getNodeIcon($record);
371 
372  $icon = null;
373  if (is_string($nodeIconPath) && strlen($nodeIconPath) > 0) {
374  $icon = $this->ui
375  ->factory()
376  ->symbol()
377  ->icon()
378  ->custom($nodeIconPath, $this->getNodeIconAlt($record));
379  }
380 
381  return $factory->simple($this->getNodeContent($record), $icon);
382  }
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 358 of file class.ilTreeExplorerGUI.php.

References getChildsOfNode().

Referenced by ilLMTOCExplorerGUI\renderLSTocNode().

358  : array
359  {
360  return $this->getChildsOfNode($node["child"]);
361  }
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$a_parent_node_idparent id
Returns
array childs

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

References $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  return $final_childs;
257  }
$c
Definition: cli.php:37
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 342 of file class.ilTreeExplorerGUI.php.

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

343  {
344  if ($this->getPreloadChilds()) {
345  $this->preloadChilds();
346  }
347  if (!$new) {
348  return parent::getHTML();
349  }
350  return $this->render();
351  }
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 292 of file class.ilTreeExplorerGUI.php.

References $lng.

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

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

Referenced by build().

390  : array
391  {
392  return [];
393  }
+ 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 317 of file class.ilTreeExplorerGUI.php.

References getTree().

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

318  {
319  return $this->root_id
320  ? $this->root_id
321  : $this->getTree()->readRootId();
322  }
+ 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 304 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().

305  {
306  if (!isset($this->root_node_data)) {
307  $this->root_node_data = $this->getTree()->getNodeData($this->getRootId());
308  }
309  return $this->root_node_data;
310  }
+ 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 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  }
+ 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 447 of file class.ilTreeExplorerGUI.php.

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

Referenced by render().

448  {
449  $f = $this->ui->factory();
450  $tree = $this->getTree();
451 
452  $data = array(
453  $tree->getNodeData($tree->readRootId())
454  );
455 
456  $label = $this->getTreeLabel();
457  if ($this->getTreeLabel() == "" && $this->getNodeContent($this->getRootNode())) {
458  $label = $this->getNodeContent($this->getRootNode());
459  }
460 
461  $tree = $f->tree()->expandable($label, $this)
462  ->withData($data)
463  ->withHighlightOnNodeClick(true);
464 
465  return $tree;
466  }
$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 437 of file class.ilTreeExplorerGUI.php.

References $tree_label.

Referenced by getTreeComponent().

438  {
439  return $this->tree_label;
440  }
+ 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 265 of file class.ilTreeExplorerGUI.php.

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

Referenced by getChildsOfNode().

265  : bool
266  {
267  if ($this->getSearchTerm() == "" ||
268  is_int(stripos($this->getNodeContent($node), $this->getSearchTerm()))) {
269  return true;
270  }
271  return false;
272  }
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 $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
$c
Definition: cli.php:37
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 494 of file class.ilTreeExplorerGUI.php.

References getTreeComponent(), and ui().

Referenced by getHTML().

495  {
496  $r = $this->ui->renderer();
497 
498  return $r->render([
499  $this->getTreeComponent()
500  ]);
501  }
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 329 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().

330  {
331  $path = $this->getTree()->getPathId($a_id);
332  foreach ($path as $id) {
333  $this->setNodeOpen($id);
334  }
335  }
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 312 of file class.ilTreeExplorerGUI.php.

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

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

References exit.

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

471  : void
472  {
473  $nodeId = (int) ($this->httpRequest->getQueryParams()['node_id'] ?? 0);
474  $priorState = (int) ($this->httpRequest->getQueryParams()['prior_state'] ?? 0);
475 
476  if ($nodeId > 0) {
477  if (0 === $priorState && !in_array($nodeId, $this->open_nodes)) {
478  $this->open_nodes[] = $nodeId;
479  } elseif (1 === $priorState && in_array($nodeId, $this->open_nodes)) {
480  $key = array_search($nodeId, $this->open_nodes);
481  unset($this->open_nodes[$key]);
482  }
483 
484  $this->store->set('on_' . $this->id, serialize($this->open_nodes));
485  }
486  exit();
487  }
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: