ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 Get HTML. More...
 
- Public Member Functions inherited from ilExplorerBaseGUI
 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd)
 Constructor. 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...
 

Protected Member Functions

 preloadChilds ()
 Preload childs. More...
 
 getRootId ()
 
- 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...
 
 getJSTreePlugins ()
 

Protected Attributes

 $tree = null
 
 $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()
 
- Protected Attributes inherited from ilExplorerBaseGUI
 $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
 

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 createHTMLExportDirs ($a_target_dir)
 Create html export directories. More...
 
static init ()
 Init JS. More...
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static $js_tree_path = "./Services/UIComponent/Explorer2/lib/jstree-v.pre1.0/jquery.jstree.js"
 
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 30 of file class.ilTreeExplorerGUI.php.

31  {
32  parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd);
33  $this->tree = $a_tree;
34  }

Member Function Documentation

◆ getChildsOfNode()

ilTreeExplorerGUI::getChildsOfNode (   $a_parent_node_id)

Get childs of node.

Parameters
int$a_parent_node_idparent id
Returns
array childs

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

References $childs, array, getOrderField(), getTypeBlackList(), and getTypeWhiteList().

Referenced by ilPublicSectionExplorerGUI\getAllNodes().

217  {
218  if ($this->preloaded)
219  {
220  if (is_array($this->childs[$a_parent_node_id]))
221  {
222  return $this->childs[$a_parent_node_id];
223  }
224  return array();
225  }
226 
227  $wl = $this->getTypeWhiteList();
228  if (is_array($wl) && count($wl) > 0)
229  {
230  $childs = $this->tree->getChildsByTypeFilter($a_parent_node_id, $wl, $this->getOrderField());
231  }
232  else
233  {
234  $childs = $this->tree->getChilds($a_parent_node_id, $this->getOrderField());
235  }
236 
237  // apply black list filter
238  $bl = $this->getTypeBlackList();
239  if (is_array($bl) && count($bl) > 0)
240  {
241  $bl_childs = array();
242  foreach($childs as $k => $c)
243  {
244  if (!in_array($c["type"], $bl))
245  {
246  $bl_childs[$k] = $c;
247  }
248  }
249  return $bl_childs;
250  }
251 
252  return $childs;
253  }
getTypeBlackList()
Get type black list.
Create styles array
The data for the language used.
getOrderField()
Get order field.
getTypeWhiteList()
Get type white list.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilTreeExplorerGUI::getHTML ( )

Get HTML.

Returns
string html

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

References getPreloadChilds(), and preloadChilds().

325  {
326  if ($this->getPreloadChilds())
327  {
328  $this->preloadChilds();
329  }
330  return parent::getHTML();
331  }
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 272 of file class.ilTreeExplorerGUI.php.

References $lng.

273  {
274  global $lng;
275 
276  return $lng->txt("icon")." ".$lng->txt("obj_".$a_node["type"]);
277  }
global $lng
Definition: privfeed.php:17

◆ getNodeId()

ilTreeExplorerGUI::getNodeId (   $a_node)

◆ getOrderField()

ilTreeExplorerGUI::getOrderField ( )

Get order field.

Returns
string order field key

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

References $order_field.

Referenced by ilOrgUnitExplorerGUI\getChildsOfNode(), and getChildsOfNode().

63  {
64  return $this->order_field;
65  }
+ Here is the caller graph for this function:

◆ getPreloadChilds()

ilTreeExplorerGUI::getPreloadChilds ( )

Get preload childs.

Returns
boolean preload childs

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

References $preload_childs.

Referenced by getHTML().

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

◆ getRootId()

ilTreeExplorerGUI::getRootId ( )
protected

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

References getTree().

Referenced by getRootNode().

299  {
300  return $this->root_id
301  ? $this->root_id
302  : $this->getTree()->readRootId();
303  }
+ 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 284 of file class.ilTreeExplorerGUI.php.

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

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

285  {
286  if (!isset($this->root_node_data))
287  {
288  $this->root_node_data = $this->getTree()->getNodeData($this->getRootId());
289  }
290  return $this->root_node_data;
291  }
+ 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 187 of file class.ilTreeExplorerGUI.php.

References $a_type, and getTree().

Referenced by ilLMTOCExplorerGUI\isNodeClickable().

188  {
189  if ($this->order_field != "")
190  {
191  die("ilTreeExplorerGUI::getSuccessorNode not implemented for order field ".$this->order_field);
192  }
193 
194  if ($this->preloaded)
195  {
196  $next_id = $a_node_id;
197  while (($next_id = $this->all_childs[$next_id]["next_node_id"]) && $a_type != "" &&
198  $this->all_childs[$next_id]["type"] != $a_type);
199  if ($next_id)
200  {
201  return $this->all_childs[$next_id];
202  }
203  return false;
204  }
205  return $this->getTree()->fetchSuccessorNode($a_node_id, $a_type);
206  }
$a_type
Definition: workflow.php:93
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTree()

◆ getTypeBlackList()

ilTreeExplorerGUI::getTypeBlackList ( )

Get type black list.

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

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

References $type_black_list.

Referenced by ilOrgUnitExplorerGUI\getChildsOfNode(), getChildsOfNode(), and preloadChilds().

103  {
104  return $this->type_black_list;
105  }
+ 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 82 of file class.ilTreeExplorerGUI.php.

References $type_white_list.

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

+ Here is the caller graph for this function:

◆ preloadChilds()

ilTreeExplorerGUI::preloadChilds ( )
protected

Preload childs.

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

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

Referenced by getHTML().

131  {
132  $subtree = $this->tree->getSubTree($this->getRootNode());
133  foreach ($subtree as $s)
134  {
135  $wl = $this->getTypeWhiteList();
136  if (is_array($wl) && count($wl) > 0 && !in_array($s["type"], $wl))
137  {
138  continue;
139  }
140  $bl = $this->getTypeBlackList();
141  if (is_array($bl) && count($bl) > 0 && in_array($s["type"], $bl))
142  {
143  continue;
144  }
145  $this->childs[$s["parent"]][] = $s;
146  $this->all_childs[$s["child"]] = $s;
147  }
148 
149  if ($this->order_field != "")
150  {
151  foreach ($this->childs as $k => $childs)
152  {
153  $this->childs[$k] = ilUtil::sortArray($childs, $this->order_field, "asc", $this->order_field_numeric);
154  }
155  }
156 
157  // sort childs and store prev/next reference
158  if ($this->order_field == "")
159  {
160  $this->all_childs =
161  ilUtil::sortArray($this->all_childs, "lft", "asc", true, true);
162  $prev = false;
163  foreach ($this->all_childs as $k => $c)
164  {
165  if ($prev)
166  {
167  $this->all_childs[$prev]["next_node_id"] = $k;
168  }
169  $this->all_childs[$k]["prev_node_id"] = $prev;
170  $this->all_childs[$k]["next_node_id"] = false;
171  $prev = $k;
172  }
173  }
174 
175  $this->preloaded = true;
176  }
getTypeBlackList()
Get type black list.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
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:

◆ setOrderField()

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

Set order field.

Parameters
string$a_valorder field key

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

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

52  {
53  $this->order_field = $a_val;
54  $this->order_field_numeric = $a_numeric;
55  }
+ 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 310 of file class.ilTreeExplorerGUI.php.

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

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

311  {
312  $path = $this->getTree()->getPathId($a_id);
313  foreach ($path as $id)
314  {
315  $this->setNodeOpen($id);
316  }
317  }
$path
Definition: aliased.php:25
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 112 of file class.ilTreeExplorerGUI.php.

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

113  {
114  $this->preload_childs = $a_val;
115  }
+ Here is the caller graph for this function:

◆ setRootId()

ilTreeExplorerGUI::setRootId (   $a_root)

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

294  {
295  $this->root_id = $a_root;
296  }

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

93  {
94  $this->type_black_list = $a_val;
95  }

◆ setTypeWhiteList()

Field Documentation

◆ $all_childs

ilTreeExplorerGUI::$all_childs = array()
protected

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

◆ $childs

◆ $order_field

ilTreeExplorerGUI::$order_field = ""
protected

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

Referenced by getOrderField().

◆ $order_field_numeric

ilTreeExplorerGUI::$order_field_numeric = false
protected

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

◆ $preload_childs

ilTreeExplorerGUI::$preload_childs = false
protected

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

Referenced by getPreloadChilds().

◆ $preloaded

ilTreeExplorerGUI::$preloaded = false
protected

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

◆ $root_node_data

ilTreeExplorerGUI::$root_node_data = null
protected

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

Referenced by getRootNode().

◆ $tree

◆ $type_black_list

ilTreeExplorerGUI::$type_black_list = array()
protected

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

Referenced by getTypeBlackList().

◆ $type_white_list

ilTreeExplorerGUI::$type_white_list = array()
protected

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

Referenced by getTypeWhiteList().


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