ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
 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...
 
- 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.

Reimplemented in ilOrgUnitExplorerGUI.

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

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilPersonalSkillExplorerGUI, ilSkillTemplateTreeExplorerGUI, ilOrgUnitExplorerGUI, ilAdministrationExplorerGUI, ilRepositoryExplorerGUI, and ilRepositorySelectorExplorerGUI.

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

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 }
getTypeWhiteList()
Get type white list.
getTypeBlackList()
Get type black list.
getOrderField()
Get order field.

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

Referenced by ilPublicSectionExplorerGUI\getAllNodes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilTreeExplorerGUI::getHTML ( )

Get HTML.

Returns
string html

Reimplemented from ilExplorerBaseGUI.

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

315 {
316 if ($this->getPreloadChilds())
317 {
318 $this->preloadChilds();
319 }
320 return parent::getHTML();
321 }
preloadChilds()
Preload childs.
getPreloadChilds()
Get preload childs.

References getPreloadChilds(), and preloadChilds().

+ 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

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilLMEditorExplorerGUI, ilLMTOCExplorerGUI, ilSCORM2004EditorExplorerGUI, ilAdministrationExplorerGUI, ilBookmarkExplorerGUI, ilMailExplorer, ilRepositoryExplorerGUI, and ilRepositorySelectorExplorerGUI.

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

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

References $lng.

◆ getNodeId()

ilTreeExplorerGUI::getNodeId (   $a_node)

Get id for node.

Parameters
mixed$a_nodenode object/array
Returns
string id

Reimplemented from ilExplorerBaseGUI.

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

262 {
263 return $a_node["child"];
264 }

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

+ Here is the caller graph for this function:

◆ 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().

+ 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().

+ Here is the caller graph for this function:

◆ getRootNode()

ilTreeExplorerGUI::getRootNode ( )

Get root node.

Returns
mixed node object/array

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilLMTOCExplorerGUI, ilOrgUnitExplorerGUI, ilRepositoryExplorerGUI, and ilSkillTemplateTreeExplorerGUI.

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

285 {
286 if (isset($this->root_node_data))
287 {
289 }
290 $root_id = $this->getTree()->readRootId();
291 $this->root_node_data = $this->getTree()->getNodeData($root_id);
293 }

References $root_node_data, and getTree().

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

+ 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.

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 }

References getTree().

Referenced by ilLMTOCExplorerGUI\isNodeClickable().

+ 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().

+ 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.

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 }
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray

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

Referenced by getHTML().

+ 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.

52 {
53 $this->order_field = $a_val;
54 $this->order_field_numeric = $a_numeric;
55 }

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

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

301 {
302 $path = $this->getTree()->getPathId($a_id);
303 foreach ($path as $id)
304 {
305 $this->setNodeOpen($id);
306 }
307 }
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour)
$path
Definition: index.php:22

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

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

+ 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.

113 {
114 $this->preload_childs = $a_val;
115 }

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

+ Here is the caller graph for this function:

◆ 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: