ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups 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.
 getTree ()
 Get tree.
 setOrderField ($a_val, $a_numeric=false)
 Set order field.
 getOrderField ()
 Get order field.
 setTypeWhiteList ($a_val)
 Set type white list.
 getTypeWhiteList ()
 Get type white list.
 setTypeBlackList ($a_val)
 Set type black list.
 getTypeBlackList ()
 Get type black list.
 setPreloadChilds ($a_val)
 Set preload childs.
 getPreloadChilds ()
 Get preload childs.
 getSuccessorNode ($a_node_id, $a_type="")
 Get successor node (currently only(!) based on lft/rgt tree values)
 getChildsOfNode ($a_parent_node_id)
 Get childs of node.
 getNodeId ($a_node)
 Get id for node.
 getNodeIconAlt ($a_node)
 Get node icon alt attribute.
 getRootNode ()
 Get root node.
 setPathOpen ($a_id)
 Set node path to be opened.
 getHTML ()
 Get HTML.
- Public Member Functions inherited from ilExplorerBaseGUI
 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd)
 Constructor.
 getNodeContent ($a_node)
 Get content of a node.
 getNodeHref ($a_node)
 Get href for node.
 nodeHasVisibleChilds ($a_node)
 Node has childs?
 sortChilds ($a_childs, $a_parent_node_id)
 Sort childs.
 getNodeIcon ($a_node)
 Get node icon path.
 getNodeTarget ($a_node)
 Get node target (frame) attribute.
 getNodeOnClick ($a_node)
 Get node onclick attribute.
 isNodeVisible ($a_node)
 Is node visible?
 isNodeHighlighted ($a_node)
 Is node highlighted?
 isNodeClickable ($a_node)
 Is node clickable?
 getId ()
 Get id of explorer element.
 setSkipRootNode ($a_val)
 Set skip root node.
 getSkipRootNode ()
 Get skip root node.
 setAjax ($a_val)
 Set ajax.
 getAjax ()
 Get ajax.
 setNodeOpen ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour)
 setSelectMode ($a_postvar, $a_multi=false)
 Set select mode (to deactivate, pass an empty string as postvar)
 setNodeSelected ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour)
 setOfflineMode ($a_val)
 Set offline mode.
 getOfflineMode ()
 Get offline mode.
 handleCommand ()
 Handle explorer internal command.
 getContainerId ()
 Get container id.
 openNode ()
 Open node.
 closeNode ()
 Close node.
 getNodeAsync ()
 Get node asynchronously.
 beforeRendering ()
 Before rendering.
 renderNode ($a_node, $tpl)
 Render node.
 renderChilds ($a_node_id, $tpl)
 Render childs.
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id.
 getNodeIdForDomNodeId ($a_dom_node_id)
 Get node id for dom node id.
 listItemStart ($tpl, $a_node)
 List item start.
 listItemEnd ($tpl)
 List item end.
 listStart ($tpl)
 List start.
 listEnd ($tpl)
 List end.

Protected Member Functions

 preloadChilds ()
 Preload childs.
- Protected Member Functions inherited from ilExplorerBaseGUI
 getNodeToggleOnClick ($a_node)
 Get onclick attribute for node toggling.
 getSelectOnClick ($a_node)
 Get onclick attribute for selecting radio/checkbox.

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

Additional Inherited Members

- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 Get local path of explorer js.
static getLocalJsTreeJsPath ()
 Get local path of jsTree js.
static createHTMLExportDirs ($a_target_dir)
 Create html export directories.
- 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

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.

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

Member Function Documentation

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 ilRepositoryExplorerGUI, ilRepositorySelectorExplorerGUI, ilAdministrationExplorerGUI, ilPersonalSkillExplorerGUI, ilOrgUnitExplorerGUI, and ilSkillTemplateTreeExplorerGUI.

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

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

{
if ($this->preloaded)
{
if (is_array($this->childs[$a_parent_node_id]))
{
return $this->childs[$a_parent_node_id];
}
return array();
}
$wl = $this->getTypeWhiteList();
if (is_array($wl) && count($wl) > 0)
{
$childs = $this->tree->getChildsByTypeFilter($a_parent_node_id, $wl, $this->getOrderField());
}
else
{
$childs = $this->tree->getChilds($a_parent_node_id, $this->getOrderField());
}
// apply black list filter
$bl = $this->getTypeBlackList();
if (is_array($bl) && count($bl) > 0)
{
$bl_childs = array();
foreach($childs as $k => $c)
{
if (!in_array($c["type"], $bl))
{
$bl_childs[$k] = $c;
}
}
return $bl_childs;
}
return $childs;
}

+ Here is the call graph for this function:

ilTreeExplorerGUI::getHTML ( )

Get HTML.

Returns
string html

Reimplemented from ilExplorerBaseGUI.

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

References getPreloadChilds(), and preloadChilds().

{
if ($this->getPreloadChilds())
{
$this->preloadChilds();
}
return parent::getHTML();
}

+ Here is the call graph for this function:

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 ilLMTOCExplorerGUI, ilRepositoryExplorerGUI, ilRepositorySelectorExplorerGUI, ilAdministrationExplorerGUI, ilSCORM2004EditorExplorerGUI, ilBookmarkExplorerGUI, ilLMEditorExplorerGUI, and ilMailExplorer.

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

References $lng.

{
global $lng;
return $lng->txt("icon")." ".$lng->txt("obj_".$a_node["type"]);
}
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:

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:

ilTreeExplorerGUI::getRootNode ( )

Get root node.

Returns
mixed node object/array

Reimplemented from ilExplorerBaseGUI.

Reimplemented in ilRepositoryExplorerGUI, ilSkillTemplateTreeExplorerGUI, and ilOrgUnitExplorerGUI.

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

References $root_node_data, and getTree().

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

{
if (isset($this->root_node_data))
{
}
$root_id = $this->getTree()->readRootId();
$this->root_node_data = $this->getTree()->getNodeData($root_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Referenced by ilLMTOCExplorerGUI\isNodeClickable().

{
if ($this->order_field != "")
{
die("ilTreeExplorerGUI::getSuccessorNode not implemented for order field ".$this->order_field);
}
if ($this->preloaded)
{
$next_id = $a_node_id;
while (($next_id = $this->all_childs[$next_id]["next_node_id"]) && $a_type != "" &&
$this->all_childs[$next_id]["type"] != $a_type);
if ($next_id)
{
return $this->all_childs[$next_id];
}
return false;
}
return $this->getTree()->fetchSuccessorNode($a_node_id, $a_type);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTreeExplorerGUI::getTree ( )
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:

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 ilOrgUnitExplorerGUI\getChildsOfNode(), getChildsOfNode(), and preloadChilds().

+ Here is the caller graph for this function:

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

{
$subtree = $this->tree->getSubTree($this->getRootNode());
foreach ($subtree as $s)
{
$wl = $this->getTypeWhiteList();
if (is_array($wl) && count($wl) > 0 && !in_array($s["type"], $wl))
{
continue;
}
$bl = $this->getTypeBlackList();
if (is_array($bl) && count($bl) > 0 && in_array($s["type"], $bl))
{
continue;
}
$this->childs[$s["parent"]][] = $s;
$this->all_childs[$s["child"]] = $s;
}
if ($this->order_field != "")
{
foreach ($this->childs as $k => $childs)
{
$this->childs[$k] = ilUtil::sortArray($childs, $this->order_field, "asc", $this->order_field_numeric);
}
}
// sort childs and store prev/next reference
if ($this->order_field == "")
{
$this->all_childs =
ilUtil::sortArray($this->all_childs, "lft", "asc", true, true);
$prev = false;
foreach ($this->all_childs as $k => $c)
{
if ($prev)
{
$this->all_childs[$prev]["next_node_id"] = $k;
}
$this->all_childs[$k]["prev_node_id"] = $prev;
$this->all_childs[$k]["next_node_id"] = false;
$prev = $k;
}
}
$this->preloaded = true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Set node path to be opened.

Parameters
string$a_idnode id

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

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

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

{
$path = $this->getTree()->getPathId($a_id);
foreach ($path as $id)
{
$this->setNodeOpen($id);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

{
$this->preload_childs = $a_val;
}

+ Here is the caller graph for this function:

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.

{
$this->type_black_list = $a_val;
}
ilTreeExplorerGUI::setTypeWhiteList (   $a_val)

Field Documentation

ilTreeExplorerGUI::$all_childs = array()
protected

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

ilTreeExplorerGUI::$order_field = ""
protected

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

Referenced by getOrderField().

ilTreeExplorerGUI::$order_field_numeric = false
protected

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

ilTreeExplorerGUI::$preload_childs = false
protected

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

Referenced by getPreloadChilds().

ilTreeExplorerGUI::$preloaded = false
protected

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

ilTreeExplorerGUI::$root_node_data = null
protected

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

Referenced by getRootNode().

ilTreeExplorerGUI::$type_black_list = array()
protected

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

Referenced by getTypeBlackList().

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: