ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 setMainTemplate (ilTemplate $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...
 

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

 $lng
 
 $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
 $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
 

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 ($a_main_tpl=null)
 Init JS. More...
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static $js_tree_path = "./libs/bower/bower_components/jstree/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 35 of file class.ilTreeExplorerGUI.php.

References $DIC.

36  {
37  global $DIC;
38 
39  $this->lng = $DIC->language();
40  parent::__construct($a_expl_id, $a_parent_obj, $a_parent_cmd);
41  $this->tree = $a_tree;
42  }
global $DIC
Definition: saml.php:7

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

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

Referenced by ilPublicSectionExplorerGUI\getAllNodes().

214  {
215  if ($this->preloaded) {
216  if (is_array($this->childs[$a_parent_node_id])) {
217  return $this->childs[$a_parent_node_id];
218  }
219  return array();
220  }
221 
222  $wl = $this->getTypeWhiteList();
223  if (is_array($wl) && count($wl) > 0) {
224  $childs = $this->tree->getChildsByTypeFilter($a_parent_node_id, $wl, $this->getOrderField());
225  } else {
226  $childs = $this->tree->getChilds($a_parent_node_id, $this->getOrderField());
227  }
228 
229  // apply black list filter
230  $bl = $this->getTypeBlackList();
231  if (is_array($bl) && count($bl) > 0) {
232  $bl_childs = array();
233  foreach ($childs as $k => $c) {
234  if (!in_array($c["type"], $bl)) {
235  $bl_childs[$k] = $c;
236  }
237  }
238  return $bl_childs;
239  }
240 
241  return $childs;
242  }
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 311 of file class.ilTreeExplorerGUI.php.

References getPreloadChilds(), and preloadChilds().

312  {
313  if ($this->getPreloadChilds()) {
314  $this->preloadChilds();
315  }
316  return parent::getHTML();
317  }
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 261 of file class.ilTreeExplorerGUI.php.

References $lng.

262  {
263  $lng = $this->lng;
264 
265  return $lng->txt("icon") . " " . $lng->txt("obj_" . $a_node["type"]);
266  }

◆ getNodeId()

ilTreeExplorerGUI::getNodeId (   $a_node)

◆ getOrderField()

ilTreeExplorerGUI::getOrderField ( )

Get order field.

Returns
string order field key

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

References $order_field.

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

71  {
72  return $this->order_field;
73  }
+ Here is the caller graph for this function:

◆ getPreloadChilds()

ilTreeExplorerGUI::getPreloadChilds ( )

Get preload childs.

Returns
boolean preload childs

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

References $preload_childs.

Referenced by getHTML().

131  {
132  return $this->preload_childs;
133  }
+ Here is the caller graph for this function:

◆ getRootId()

ilTreeExplorerGUI::getRootId ( )
protected

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

References getTree().

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

287  {
288  return $this->root_id
289  ? $this->root_id
290  : $this->getTree()->readRootId();
291  }
+ 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 273 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(), ilLMExplorerGUI\getNodeContent(), ilAdministrationExplorerGUI\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(), ilMailExplorer\isNodeHighlighted(), ilSCORM2004EditorExplorerGUI\isNodeHighlighted(), ilBookmarkExplorerGUI\isNodeHighlighted(), ilLMExplorerGUI\isNodeHighlighted(), ilAdministrationExplorerGUI\isNodeHighlighted(), ilRepositorySelectorExplorerGUI\isNodeHighlighted(), and preloadChilds().

274  {
275  if (!isset($this->root_node_data)) {
276  $this->root_node_data = $this->getTree()->getNodeData($this->getRootId());
277  }
278  return $this->root_node_data;
279  }
+ 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  die("ilTreeExplorerGUI::getSuccessorNode not implemented for order field " . $this->order_field);
191  }
192 
193  if ($this->preloaded) {
194  $next_id = $a_node_id;
195  while (($next_id = $this->all_childs[$next_id]["next_node_id"]) && $a_type != "" &&
196  $this->all_childs[$next_id]["type"] != $a_type);
197  if ($next_id) {
198  return $this->all_childs[$next_id];
199  }
200  return false;
201  }
202  return $this->getTree()->fetchSuccessorNode($a_node_id, $a_type);
203  }
$a_type
Definition: workflow.php:92
+ 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 110 of file class.ilTreeExplorerGUI.php.

References $type_black_list.

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

111  {
112  return $this->type_black_list;
113  }
+ 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 90 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 138 of file class.ilTreeExplorerGUI.php.

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

Referenced by getHTML().

139  {
140  $subtree = $this->tree->getSubTree($this->getRootNode());
141  foreach ($subtree as $s) {
142  $wl = $this->getTypeWhiteList();
143  if (is_array($wl) && count($wl) > 0 && !in_array($s["type"], $wl)) {
144  continue;
145  }
146  $bl = $this->getTypeBlackList();
147  if (is_array($bl) && count($bl) > 0 && in_array($s["type"], $bl)) {
148  continue;
149  }
150  $this->childs[$s["parent"]][] = $s;
151  $this->all_childs[$s["child"]] = $s;
152  }
153 
154  if ($this->order_field != "") {
155  foreach ($this->childs as $k => $childs) {
156  $this->childs[$k] = ilUtil::sortArray($childs, $this->order_field, "asc", $this->order_field_numeric);
157  }
158  }
159 
160  // sort childs and store prev/next reference
161  if ($this->order_field == "") {
162  $this->all_childs =
163  ilUtil::sortArray($this->all_childs, "lft", "asc", true, true);
164  $prev = false;
165  foreach ($this->all_childs as $k => $c) {
166  if ($prev) {
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  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
getTypeBlackList()
Get type black list.
$s
Definition: pwgen.php:45
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 59 of file class.ilTreeExplorerGUI.php.

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

60  {
61  $this->order_field = $a_val;
62  $this->order_field_numeric = $a_numeric;
63  }
+ 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 298 of file class.ilTreeExplorerGUI.php.

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

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

299  {
300  $path = $this->getTree()->getPathId($a_id);
301  foreach ($path as $id) {
302  $this->setNodeOpen($id);
303  }
304  }
if(!array_key_exists('StateId', $_REQUEST)) $id
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 120 of file class.ilTreeExplorerGUI.php.

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

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

◆ setRootId()

ilTreeExplorerGUI::setRootId (   $a_root)

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

282  {
283  $this->root_id = $a_root;
284  }

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

101  {
102  $this->type_black_list = $a_val;
103  }

◆ setTypeWhiteList()

Field Documentation

◆ $all_childs

ilTreeExplorerGUI::$all_childs = array()
protected

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

◆ $childs

◆ $lng

◆ $order_field

ilTreeExplorerGUI::$order_field = ""
protected

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

Referenced by getOrderField().

◆ $order_field_numeric

ilTreeExplorerGUI::$order_field_numeric = false
protected

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

◆ $preload_childs

ilTreeExplorerGUI::$preload_childs = false
protected

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

Referenced by getPreloadChilds().

◆ $preloaded

ilTreeExplorerGUI::$preloaded = false
protected

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

◆ $root_node_data

ilTreeExplorerGUI::$root_node_data = null
protected

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

Referenced by getRootNode().

◆ $tree

◆ $type_black_list

ilTreeExplorerGUI::$type_black_list = array()
protected

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

Referenced by getTypeBlackList().

◆ $type_white_list

ilTreeExplorerGUI::$type_white_list = array()
protected

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

Referenced by getTypeWhiteList().


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