ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilExplorerBaseGUI Class Reference

Explorer base GUI class. More...

+ Inheritance diagram for ilExplorerBaseGUI:
+ Collaboration diagram for ilExplorerBaseGUI:

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

 getNodeToggleOnClick ($a_node)
 Get onclick attribute for node toggling. More...
 
 getSelectOnClick ($a_node)
 Get onclick attribute for selecting radio/checkbox. More...
 

Protected Attributes

 $skip_root_node = false
 
 $ajax = false
 
 $custom_open_nodes = array()
 
 $selected_nodes = array()
 
 $select_postvar = ""
 
 $offline_mode = false
 
 $sec_highl_nodes = array()
 

Static Protected Attributes

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 base GUI class.

The class is supposed to work on a hierarchie of nodes that are identified by IDs. Whether nodes are represented by associative arrays or objects is not defined by this abstract class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 16 of file class.ilExplorerBaseGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilExplorerBaseGUI::__construct (   $a_expl_id,
  $a_parent_obj,
  $a_parent_cmd 
)

Constructor.

Definition at line 31 of file class.ilExplorerBaseGUI.php.

32  {
33  $this->id = $a_expl_id;
34  $this->parent_obj = $a_parent_obj;
35  $this->parent_cmd = $a_parent_cmd;
36 
37  // get open nodes
38  include_once("./Services/Authentication/classes/class.ilSessionIStorage.php");
39  $this->store = new ilSessionIStorage("expl2");
40  $open_nodes = $this->store->get("on_".$this->id);
41  $this->open_nodes = unserialize($open_nodes);
42  if (!is_array($this->open_nodes))
43  {
44  $this->open_nodes = array();
45  }
46 
47  }
Session based immediate storage.

Member Function Documentation

◆ beforeRendering()

ilExplorerBaseGUI::beforeRendering ( )

Before rendering.

Definition at line 506 of file class.ilExplorerBaseGUI.php.

Referenced by getHTML(), and getNodeAsync().

507  {
508 
509  }
+ Here is the caller graph for this function:

◆ closeNode()

ilExplorerBaseGUI::closeNode ( )

Close node.

Definition at line 467 of file class.ilExplorerBaseGUI.php.

References $_GET, $ilLog, exit, and getNodeIdForDomNodeId().

468  {
469  global $ilLog;
470 
471  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
472  if (in_array($id, $this->open_nodes))
473  {
474  $k = array_search($id, $this->open_nodes);
475  unset($this->open_nodes[$k]);
476  }
477  $this->store->set("on_".$this->id, serialize($this->open_nodes));
478  exit;
479  }
exit
Definition: login.php:54
$_GET["client_id"]
getNodeIdForDomNodeId($a_dom_node_id)
Get node id for dom node id.
+ Here is the call graph for this function:

◆ createHTMLExportDirs()

static ilExplorerBaseGUI::createHTMLExportDirs (   $a_target_dir)
static

Create html export directories.

Parameters
string$a_target_dirtarget directory

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

References getChildsOfNode(), getNodeContent(), getNodeId(), getRootNode(), and ilUtil\makeDirParents().

Referenced by ilObjContentObject\exportHTML().

71  {
72  ilUtil::makeDirParents($a_target_dir."/Services/UIComponent/Explorer2/lib/jstree-v.pre1.0");
73  ilUtil::makeDirParents($a_target_dir."/Services/UIComponent/Explorer2/js");
74  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAjax()

ilExplorerBaseGUI::getAjax ( )

Get ajax.

Returns
boolean ajax

Definition at line 301 of file class.ilExplorerBaseGUI.php.

References $ajax.

Referenced by getOnLoadCode(), listItemStart(), and renderNode().

302  {
303  return $this->ajax;
304  }
+ Here is the caller graph for this function:

◆ getChildsOfNode()

ilExplorerBaseGUI::getChildsOfNode (   $a_parent_node_id)
abstract

Get childs of node.

Parameters
string$a_parent_idparent node id
Returns
array childs

Referenced by createHTMLExportDirs(), getHTML(), nodeHasVisibleChilds(), and renderChilds().

+ Here is the caller graph for this function:

◆ getContainerId()

ilExplorerBaseGUI::getContainerId ( )

Get container id.

Parameters

Definition at line 443 of file class.ilExplorerBaseGUI.php.

Referenced by getHTML(), getOnLoadCode(), and handleCommand().

444  {
445  return "il_expl2_jstree_cont_".$this->getId();
446  }
+ Here is the caller graph for this function:

◆ getDomNodeIdForNodeId()

ilExplorerBaseGUI::getDomNodeIdForNodeId (   $a_node_id)

Get DOM node id for node id.

Parameters

Definition at line 775 of file class.ilExplorerBaseGUI.php.

Referenced by getNodeToggleOnClick(), getOnLoadCode(), getSelectOnClick(), and listItemStart().

776  {
777  return "exp_node_".$this->getId()."_".$a_node_id;
778  }
+ Here is the caller graph for this function:

◆ getHTML()

ilExplorerBaseGUI::getHTML ( )

Get HTML.

Definition at line 603 of file class.ilExplorerBaseGUI.php.

References $ilCtrl, $tpl, beforeRendering(), getChildsOfNode(), getContainerId(), getNodeId(), getOnLoadCode(), getRootNode(), getSkipRootNode(), isNodeVisible(), listEnd(), listStart(), renderNode(), and sortChilds().

604  {
605  global $tpl, $ilCtrl;
606 
607  $this->beforeRendering();
608 
609  self::init();
610  $container_id = $this->getContainerId();
611  $container_outer_id = "il_expl2_jstree_cont_out_".$this->getId();
612 
613  $tpl->addOnLoadCode($this->getOnLoadCode());
614 
615  $etpl = new ilTemplate("tpl.explorer2.html", true, true, "Services/UIComponent/Explorer2");
616 
617  // render childs
618  $root_node = $this->getRootNode();
619 
620  if (!$this->getSkipRootNode() &&
621  $this->isNodeVisible($this->getRootNode()))
622  {
623  $this->listStart($etpl);
624  $this->renderNode($this->getRootNode(), $etpl);
625  $this->listEnd($etpl);
626  }
627  else
628  {
629  $childs = $this->getChildsOfNode($this->getNodeId($root_node));
630  $childs = $this->sortChilds($childs, $this->getNodeId($root_node));
631  $any = false;
632  foreach ($childs as $child_node)
633  {
634  if ($this->isNodeVisible($child_node))
635  {
636  if (!$any)
637  {
638  $this->listStart($etpl);
639  $any = true;
640  }
641  $this->renderNode($child_node, $etpl);
642  }
643  }
644  if ($any)
645  {
646  $this->listEnd($etpl);
647  }
648  }
649 
650  $etpl->setVariable("CONTAINER_ID", $container_id);
651  $etpl->setVariable("CONTAINER_OUTER_ID", $container_outer_id);
652 
653  return $etpl->get();
654  }
renderNode($a_node, $tpl)
Render node.
isNodeVisible($a_node)
Is node visible?
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
getSkipRootNode()
Get skip root node.
getOnLoadCode()
Get on load code.
getRootNode()
Get root node.
getNodeId($a_node)
Get id of a node.
special template class to simplify handling of ITX/PEAR
beforeRendering()
Before rendering.
listStart($tpl)
List start.
getChildsOfNode($a_parent_node_id)
Get childs of node.
getContainerId()
Get container id.
+ Here is the call graph for this function:

◆ getId()

ilExplorerBaseGUI::getId ( )

Get id of explorer element.

Returns
integer id

Definition at line 259 of file class.ilExplorerBaseGUI.php.

Referenced by getNodeIdForDomNodeId().

260  {
261  return $this->id;
262  }
+ Here is the caller graph for this function:

◆ getLocalExplorerJsPath()

static ilExplorerBaseGUI::getLocalExplorerJsPath ( )
static

Get local path of explorer js.

Definition at line 52 of file class.ilExplorerBaseGUI.php.

Referenced by ilObjContentObject\getSupplyingExportFiles().

53  {
54  return self::$js_expl_path;
55  }
+ Here is the caller graph for this function:

◆ getLocalJsTreeJsPath()

static ilExplorerBaseGUI::getLocalJsTreeJsPath ( )
static

Get local path of jsTree js.

Definition at line 60 of file class.ilExplorerBaseGUI.php.

Referenced by ilObjContentObject\getSupplyingExportFiles().

61  {
62  return self::$js_tree_path;
63  }
+ Here is the caller graph for this function:

◆ getNodeAsync()

ilExplorerBaseGUI::getNodeAsync ( )

Get node asynchronously.

Definition at line 484 of file class.ilExplorerBaseGUI.php.

References $_GET, beforeRendering(), exit, getNodeId(), getNodeIdForDomNodeId(), getRootNode(), and renderChilds().

485  {
486  $this->beforeRendering();
487 
488  if ($_GET["node_id"] != "")
489  {
490  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
491  }
492  else
493  {
494  $id = $this->getNodeId($this->getRootNode());
495  }
496 
497  $etpl = new ilTemplate("tpl.explorer2.html", true, true, "Services/UIComponent/Explorer2");
498  $this->renderChilds($id, $etpl);
499  echo $etpl->get("tag");
500  exit;
501  }
exit
Definition: login.php:54
$_GET["client_id"]
renderChilds($a_node_id, $tpl)
Render childs.
getRootNode()
Get root node.
getNodeId($a_node)
Get id of a node.
special template class to simplify handling of ITX/PEAR
beforeRendering()
Before rendering.
getNodeIdForDomNodeId($a_dom_node_id)
Get node id for dom node id.
+ Here is the call graph for this function:

◆ getNodeContent()

ilExplorerBaseGUI::getNodeContent (   $a_node)
abstract

Get content of a node.

Parameters
mixed$a_nodenode array or object
Returns
string content of the node

Referenced by createHTMLExportDirs(), and renderNode().

+ Here is the caller graph for this function:

◆ getNodeHref()

ilExplorerBaseGUI::getNodeHref (   $a_node)

Get href for node.

Parameters
mixed$a_nodenode object/array
Returns
string href attribute

Definition at line 127 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

128  {
129  return "#";
130  }
+ Here is the caller graph for this function:

◆ getNodeIcon()

ilExplorerBaseGUI::getNodeIcon (   $a_node)

Get node icon path.

Parameters
mixed$a_nodenode object/array
Returns
string image file path

Definition at line 174 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

175  {
176  return "";
177  }
+ Here is the caller graph for this function:

◆ getNodeIconAlt()

ilExplorerBaseGUI::getNodeIconAlt (   $a_node)

Get node icon alt attribute.

Parameters
mixed$a_nodenode object/array
Returns
string image alt attribute

Definition at line 185 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

186  {
187  return "";
188  }
+ Here is the caller graph for this function:

◆ getNodeId()

ilExplorerBaseGUI::getNodeId (   $a_node)
abstract

Get id of a node.

Parameters
mixed$a_nodenode array or object
Returns
string id of node

Referenced by createHTMLExportDirs(), getHTML(), getNodeAsync(), getNodeToggleOnClick(), getOnLoadCode(), getSelectOnClick(), listItemStart(), nodeHasVisibleChilds(), and renderNode().

+ Here is the caller graph for this function:

◆ getNodeIdForDomNodeId()

ilExplorerBaseGUI::getNodeIdForDomNodeId (   $a_dom_node_id)

Get node id for dom node id.

Parameters

Definition at line 786 of file class.ilExplorerBaseGUI.php.

References getId().

Referenced by closeNode(), getNodeAsync(), and openNode().

787  {
788  $i = strlen("exp_node_".$this->getId()."_");
789  return substr($a_dom_node_id, $i);
790  }
getId()
Get id of explorer element.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNodeOnClick()

ilExplorerBaseGUI::getNodeOnClick (   $a_node)

Get node onclick attribute.

Parameters
mixed$a_nodenode object/array
Returns
string onclick value

Definition at line 207 of file class.ilExplorerBaseGUI.php.

References getSelectOnClick().

Referenced by renderNode().

208  {
209  if ($this->select_postvar != "")
210  {
211  return $this->getSelectOnClick($a_node);
212  }
213  return "";
214  }
getSelectOnClick($a_node)
Get onclick attribute for selecting radio/checkbox.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNodeTarget()

ilExplorerBaseGUI::getNodeTarget (   $a_node)

Get node target (frame) attribute.

Parameters
mixed$a_nodenode object/array
Returns
string target

Definition at line 196 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

197  {
198  return "";
199  }
+ Here is the caller graph for this function:

◆ getNodeToggleOnClick()

ilExplorerBaseGUI::getNodeToggleOnClick (   $a_node)
finalprotected

Get onclick attribute for node toggling.

Parameters

Definition at line 346 of file class.ilExplorerBaseGUI.php.

References getDomNodeIdForNodeId(), and getNodeId().

Referenced by ilBookmarkBlockExplorerGUI\getNodeOnClick().

347  {
348  return "$('#".$this->getContainerId()."').jstree('toggle_node' , '#".
349  $this->getDomNodeIdForNodeId($this->getNodeId($a_node))."'); return false;";
350  }
getNodeId($a_node)
Get id of a node.
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOfflineMode()

ilExplorerBaseGUI::getOfflineMode ( )

◆ getOnLoadCode()

ilExplorerBaseGUI::getOnLoadCode ( )

Get on load code.

Parameters

Definition at line 517 of file class.ilExplorerBaseGUI.php.

References $ilCtrl, getAjax(), getContainerId(), getDomNodeIdForNodeId(), getNodeId(), getOfflineMode(), and getRootNode().

Referenced by getHTML().

518  {
519  global $ilCtrl;
520 
521  $container_id = $this->getContainerId();
522  $container_outer_id = "il_expl2_jstree_cont_out_".$this->getId();
523 
524  // collect open nodes
525  $open_nodes = array($this->getDomNodeIdForNodeId($this->getNodeId($this->getRootNode())));
526  foreach ($this->open_nodes as $nid)
527  {
528  $open_nodes[] = $this->getDomNodeIdForNodeId($nid);
529  }
530  foreach ($this->custom_open_nodes as $nid)
531  {
532  $dnode = $this->getDomNodeIdForNodeId($nid);
533  if (!in_array($dnode, $open_nodes))
534  {
535  $open_nodes[] = $dnode;
536  }
537  }
538 
539  // ilias config options
540  $url = "";
541  if (!$this->getOfflineMode())
542  {
543  if (is_object($this->parent_obj))
544  {
545  $url = $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd, "", true);
546  }
547  else
548  {
549  $url = $ilCtrl->getLinkTargetByClass($this->parent_obj, $this->parent_cmd, "", true);
550  }
551  }
552 
553  // secondary highlighted nodes
554  $shn = array();
555  foreach ($this->sec_highl_nodes as $sh)
556  {
557  $shn[] = $this->getDomNodeIdForNodeId($sh);
558  }
559  $config = array(
560  "container_id" => $container_id,
561  "container_outer_id" => $container_outer_id,
562  "url" => $url,
563  "second_hnodes" => $shn,
564  "ajax" => $this->getAjax(),
565  );
566 
567 
568  // jstree config options
569  $js_tree_config = array(
570  "core" => array(
571  "animation" => 300,
572  "initially_open" => $open_nodes,
573  "open_parents" => false,
574  "strings" => array("loading" => "Loading ...", "new_node" => "New node")
575  ),
576  "plugins" => array("html_data", "themes"),
577  "themes" => array("dots" => false, "icons" => false, "theme" => ""),
578  "html_data" => array()
579  );
580 
581  return 'il.Explorer2.init('.json_encode($config).', '.json_encode($js_tree_config).');';
582  }
global $ilCtrl
Definition: ilias.php:18
getRootNode()
Get root node.
getNodeId($a_node)
Get id of a node.
getOfflineMode()
Get offline mode.
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
getContainerId()
Get container id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRootNode()

ilExplorerBaseGUI::getRootNode ( )
abstract

Get root node.

Please note that the class does not make any requirements how nodes are represented (array or object)

Returns
mixed root node object/array

Referenced by createHTMLExportDirs(), getHTML(), getNodeAsync(), and getOnLoadCode().

+ Here is the caller graph for this function:

◆ getSecondaryHighlightedNodes()

ilExplorerBaseGUI::getSecondaryHighlightedNodes ( )

Get secondary (background) highlighted nodes.

Returns
array array of node ids

Definition at line 321 of file class.ilExplorerBaseGUI.php.

References $sec_highl_nodes.

322  {
323  return $this->sec_highl_nodes;
324  }

◆ getSelectOnClick()

ilExplorerBaseGUI::getSelectOnClick (   $a_node)
finalprotected

Get onclick attribute for selecting radio/checkbox.

Parameters

Definition at line 358 of file class.ilExplorerBaseGUI.php.

References getDomNodeIdForNodeId(), and getNodeId().

Referenced by getNodeOnClick().

359  {
360  $dn_id = $this->getDomNodeIdForNodeId($this->getNodeId($a_node));
361  $oc = "il.Explorer2.selectOnClick('".$dn_id."'); return false;";
362  return $oc;
363  }
getNodeId($a_node)
Get id of a node.
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSkipRootNode()

ilExplorerBaseGUI::getSkipRootNode ( )

Get skip root node.

Returns
boolean skip root node

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

References $skip_root_node.

Referenced by getHTML().

282  {
283  return $this->skip_root_node;
284  }
+ Here is the caller graph for this function:

◆ handleCommand()

ilExplorerBaseGUI::handleCommand ( )

Handle explorer internal command.

Returns
boolean true, if an internal command has been performed.

Definition at line 421 of file class.ilExplorerBaseGUI.php.

References $_GET, $cmd, and getContainerId().

422  {
423  if ($_GET["exp_cmd"] != "" &&
424  $_GET["exp_cont"] == $this->getContainerId())
425  {
426  $cmd = $_GET["exp_cmd"];
427  if (in_array($cmd, array("openNode", "closeNode", "getNodeAsync")))
428  {
429  $this->$cmd();
430  }
431 
432  return true;
433  }
434  return false;
435  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
getContainerId()
Get container id.
+ Here is the call graph for this function:

◆ init()

static ilExplorerBaseGUI::init ( )
static

Init JS.

Definition at line 588 of file class.ilExplorerBaseGUI.php.

References $tpl, and iljQueryUtil\initjQuery().

Referenced by ilInternalLinkGUI\getInitHTML().

589  {
590  global $tpl;
591 
592  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
594 
595  $tpl->addJavascript(self::getLocalExplorerJsPath());
596  $tpl->addJavascript(self::getLocalJsTreeJsPath());
597  }
global $tpl
Definition: ilias.php:8
static initjQuery($a_tpl=null)
Init jQuery.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isNodeClickable()

ilExplorerBaseGUI::isNodeClickable (   $a_node)

Is node clickable?

Parameters
mixed$a_nodenode object/array
Returns
boolean node clickable true/false

Definition at line 244 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

245  {
246  return true;
247  }
+ Here is the caller graph for this function:

◆ isNodeHighlighted()

ilExplorerBaseGUI::isNodeHighlighted (   $a_node)

Is node highlighted?

Parameters
mixed$a_nodenode object/array
Returns
boolean node highlighted true/false

Definition at line 233 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

234  {
235  return false;
236  }
+ Here is the caller graph for this function:

◆ isNodeVisible()

ilExplorerBaseGUI::isNodeVisible (   $a_node)

Is node visible?

Parameters
mixed$a_nodenode object/array
Returns
boolean node visible true/false

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

Referenced by getHTML(), nodeHasVisibleChilds(), and renderChilds().

223  {
224  return true;
225  }
+ Here is the caller graph for this function:

◆ listEnd()

ilExplorerBaseGUI::listEnd (   $tpl)

List end.

Parameters

Definition at line 841 of file class.ilExplorerBaseGUI.php.

References $tpl.

Referenced by getHTML(), and renderChilds().

842  {
843  $tpl->touchBlock("list_end");
844  $tpl->touchBlock("tag");
845  }
global $tpl
Definition: ilias.php:8
+ Here is the caller graph for this function:

◆ listItemEnd()

ilExplorerBaseGUI::listItemEnd (   $tpl)

List item end.

Parameters

Definition at line 817 of file class.ilExplorerBaseGUI.php.

References $tpl.

Referenced by renderNode().

818  {
819  $tpl->touchBlock("list_item_end");
820  $tpl->touchBlock("tag");
821  }
global $tpl
Definition: ilias.php:8
+ Here is the caller graph for this function:

◆ listItemStart()

ilExplorerBaseGUI::listItemStart (   $tpl,
  $a_node 
)

List item start.

Parameters

Definition at line 798 of file class.ilExplorerBaseGUI.php.

References $tpl, getAjax(), getDomNodeIdForNodeId(), getNodeId(), and nodeHasVisibleChilds().

Referenced by renderNode().

799  {
800  $tpl->setCurrentBlock("list_item_start");
801  if ($this->getAjax() && $this->nodeHasVisibleChilds($a_node))
802  {
803  $tpl->touchBlock("li_closed");
804  }
805  $tpl->setVariable("DOM_NODE_ID",
806  $this->getDomNodeIdForNodeId($this->getNodeId($a_node)));
807  $tpl->parseCurrentBlock();
808  $tpl->touchBlock("tag");
809  }
global $tpl
Definition: ilias.php:8
getNodeId($a_node)
Get id of a node.
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
nodeHasVisibleChilds($a_node)
Node has childs?
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listStart()

ilExplorerBaseGUI::listStart (   $tpl)

List start.

Parameters

Definition at line 829 of file class.ilExplorerBaseGUI.php.

References $tpl.

Referenced by getHTML(), and renderChilds().

830  {
831  $tpl->touchBlock("list_start");
832  $tpl->touchBlock("tag");
833  }
global $tpl
Definition: ilias.php:8
+ Here is the caller graph for this function:

◆ nodeHasVisibleChilds()

ilExplorerBaseGUI::nodeHasVisibleChilds (   $a_node)

Node has childs?

Please note that this standard method may not be optimal depending on what a derived class does in isNodeVisible.

Parameters

Definition at line 141 of file class.ilExplorerBaseGUI.php.

References getChildsOfNode(), getNodeId(), and isNodeVisible().

Referenced by listItemStart().

142  {
143  $childs = $this->getChildsOfNode($this->getNodeId($a_node));
144 
145  foreach ($childs as $child)
146  {
147  if ($this->isNodeVisible($child))
148  {
149  return true;
150  }
151  }
152  return false;
153  }
isNodeVisible($a_node)
Is node visible?
getNodeId($a_node)
Get id of a node.
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:

◆ openNode()

ilExplorerBaseGUI::openNode ( )

Open node.

Definition at line 451 of file class.ilExplorerBaseGUI.php.

References $_GET, $ilLog, exit, and getNodeIdForDomNodeId().

452  {
453  global $ilLog;
454 
455  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
456  if (!in_array($id, $this->open_nodes))
457  {
458  $this->open_nodes[] = $id;
459  }
460  $this->store->set("on_".$this->id, serialize($this->open_nodes));
461  exit;
462  }
exit
Definition: login.php:54
$_GET["client_id"]
getNodeIdForDomNodeId($a_dom_node_id)
Get node id for dom node id.
+ Here is the call graph for this function:

◆ renderChilds()

ilExplorerBaseGUI::renderChilds (   $a_node_id,
  $tpl 
)
final

Render childs.

Parameters

Definition at line 742 of file class.ilExplorerBaseGUI.php.

References $tpl, getChildsOfNode(), isNodeVisible(), listEnd(), listStart(), renderNode(), and sortChilds().

Referenced by getNodeAsync(), and renderNode().

743  {
744  $childs = $this->getChildsOfNode($a_node_id);
745  $childs = $this->sortChilds($childs, $a_node_id);
746 
747  if (count($childs) > 0)
748  {
749  $any = false;
750  foreach ($childs as $child)
751  {
752  if ($this->isNodeVisible($child))
753  {
754  if (!$any)
755  {
756  $this->listStart($tpl);
757  $any = true;
758  }
759  $this->renderNode($child, $tpl);
760  }
761  }
762  if ($any)
763  {
764  $this->listEnd($tpl);
765  }
766  }
767  }
renderNode($a_node, $tpl)
Render node.
isNodeVisible($a_node)
Is node visible?
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
global $tpl
Definition: ilias.php:8
listStart($tpl)
List start.
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:

◆ renderNode()

ilExplorerBaseGUI::renderNode (   $a_node,
  $tpl 
)

Render node.

Parameters

Definition at line 662 of file class.ilExplorerBaseGUI.php.

References $tpl, getAjax(), getNodeContent(), getNodeHref(), getNodeIcon(), getNodeIconAlt(), getNodeId(), getNodeOnClick(), getNodeTarget(), ilUtil\img(), isNodeClickable(), isNodeHighlighted(), listItemEnd(), listItemStart(), and renderChilds().

Referenced by getHTML(), and renderChilds().

663  {
664  $this->listItemStart($tpl, $a_node);
665 
666  // select mode?
667  if ($this->select_postvar != "" && $this->isNodeClickable($a_node))
668  {
669  if ($this->select_multi)
670  {
671  $tpl->setCurrentBlock("cb");
672  if (in_array($this->getNodeId($a_node), $this->selected_nodes))
673  {
674  $tpl->setVariable("CHECKED", 'checked="checked"');
675  }
676  $tpl->setVariable("CB_VAL", $this->getNodeId($a_node));
677  $tpl->setVariable("CB_NAME", $this->select_postvar."[]");
678  $tpl->parseCurrentBlock();
679  }
680  else
681  {
682  $tpl->setCurrentBlock("rd");
683  if (in_array($this->getNodeId($a_node), $this->selected_nodes))
684  {
685  $tpl->setVariable("SELECTED", 'checked="checked"');
686  }
687  $tpl->setVariable("RD_VAL", $this->getNodeId($a_node));
688  $tpl->setVariable("RD_NAME", $this->select_postvar);
689  $tpl->parseCurrentBlock();
690  }
691  }
692 
693 
694  if ($this->isNodeHighlighted($a_node))
695  {
696  $tpl->touchBlock("hl");
697  }
698  $tpl->setCurrentBlock("content");
699  if ($this->getNodeIcon($a_node) != "")
700  {
701  $tpl->setVariable("ICON", ilUtil::img($this->getNodeIcon($a_node), $this->getNodeIconAlt($a_node))." ");
702  }
703  $tpl->setVariable("CONTENT", $this->getNodeContent($a_node));
704  $tpl->setVariable("HREF", $this->getNodeHref($a_node));
705  $target = $this->getNodeTarget($a_node);
706  if ($target != "")
707  {
708  $tpl->setVariable("TARGET", 'target="'.$target.'"');
709  }
710  if (!$this->isNodeClickable($a_node))
711  {
712  $tpl->setVariable("ONCLICK", 'onclick="return false;"');
713  $tpl->setVariable("A_CLASS", 'class="disabled"');
714  }
715  else
716  {
717  $onclick = $this->getNodeOnClick($a_node);
718  if ($onclick != "")
719  {
720  $tpl->setVariable("ONCLICK", 'onclick="'.$onclick.'"');
721  }
722  }
723  $tpl->parseCurrentBlock();
724 
725  $tpl->touchBlock("tag");
726 
727  if (!$this->getAjax() || in_array($this->getNodeId($a_node), $this->open_nodes)
728  || in_array($this->getNodeId($a_node), $this->custom_open_nodes))
729  {
730  $this->renderChilds($this->getNodeId($a_node), $tpl);
731  }
732 
733  $this->listItemEnd($tpl);
734  }
getNodeOnClick($a_node)
Get node onclick attribute.
isNodeClickable($a_node)
Is node clickable?
renderChilds($a_node_id, $tpl)
Render childs.
getNodeIcon($a_node)
Get node icon path.
getNodeIconAlt($a_node)
Get node icon alt attribute.
isNodeHighlighted($a_node)
Is node highlighted?
global $tpl
Definition: ilias.php:8
getNodeId($a_node)
Get id of a node.
getNodeContent($a_node)
Get content of a node.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
getNodeTarget($a_node)
Get node target (frame) attribute.
listItemStart($tpl, $a_node)
List item start.
listItemEnd($tpl)
List item end.
getNodeHref($a_node)
Get href for node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAjax()

◆ setNodeOpen()

ilExplorerBaseGUI::setNodeOpen (   $a_id)

Set node to be opened (additional custom opened node, not standard expand behaviour)

Parameters

Definition at line 332 of file class.ilExplorerBaseGUI.php.

Referenced by ilLMTableOfContentsExplorerGUI\__construct(), ilPublicSectionExplorerGUI\beforeRendering(), and ilTreeExplorerGUI\setPathOpen().

333  {
334  if (!in_array($a_id, $this->custom_open_nodes))
335  {
336  $this->custom_open_nodes[] = $a_id;
337  }
338  }
+ Here is the caller graph for this function:

◆ setNodeSelected()

ilExplorerBaseGUI::setNodeSelected (   $a_id)

Set node to be opened (additional custom opened node, not standard expand behaviour)

Parameters

Definition at line 384 of file class.ilExplorerBaseGUI.php.

Referenced by ilPublicSectionExplorerGUI\beforeRendering().

385  {
386  if (!in_array($a_id, $this->selected_nodes))
387  {
388  $this->selected_nodes[] = $a_id;
389  }
390  }
+ Here is the caller graph for this function:

◆ setOfflineMode()

ilExplorerBaseGUI::setOfflineMode (   $a_val)

Set offline mode.

Parameters
bool$a_valoffline mode

Definition at line 397 of file class.ilExplorerBaseGUI.php.

398  {
399  $this->offline_mode = $a_val;
400  }

◆ setSecondaryHighlightedNodes()

ilExplorerBaseGUI::setSecondaryHighlightedNodes (   $a_val)

Set secondary (background) highlighted nodes.

Parameters
array$a_valarray of node ids

Definition at line 311 of file class.ilExplorerBaseGUI.php.

Referenced by ilLMTOCExplorerGUI\__construct().

312  {
313  $this->sec_highl_nodes = $a_val;
314  }
+ Here is the caller graph for this function:

◆ setSelectMode()

ilExplorerBaseGUI::setSelectMode (   $a_postvar,
  $a_multi = false 
)

Set select mode (to deactivate, pass an empty string as postvar)

Parameters
string$a_postvarvariable used for post, a "[]" is added automatically
boolean$a_multimulti select (checkboxes) or not (radio)
Returns

Definition at line 372 of file class.ilExplorerBaseGUI.php.

Referenced by ilForumMoveTopicsExplorer\__construct().

373  {
374  $this->select_postvar = $a_postvar;
375  $this->select_multi = $a_multi;
376  }
+ Here is the caller graph for this function:

◆ setSkipRootNode()

◆ sortChilds()

ilExplorerBaseGUI::sortChilds (   $a_childs,
  $a_parent_node_id 
)

Sort childs.

Parameters
array$a_childsarray of child nodes
mixed$a_parent_nodeparent node
Returns
array array of childs nodes

Definition at line 163 of file class.ilExplorerBaseGUI.php.

Referenced by getHTML(), and renderChilds().

164  {
165  return $a_childs;
166  }
+ Here is the caller graph for this function:

Field Documentation

◆ $ajax

ilExplorerBaseGUI::$ajax = false
protected

Definition at line 21 of file class.ilExplorerBaseGUI.php.

Referenced by getAjax().

◆ $custom_open_nodes

ilExplorerBaseGUI::$custom_open_nodes = array()
protected

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

◆ $js_expl_path

ilExplorerBaseGUI::$js_expl_path = "./Services/UIComponent/Explorer2/js/Explorer2.js"
staticprotected

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

◆ $js_tree_path

ilExplorerBaseGUI::$js_tree_path = "./Services/UIComponent/Explorer2/lib/jstree-v.pre1.0/jquery.jstree.js"
staticprotected

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

◆ $offline_mode

ilExplorerBaseGUI::$offline_mode = false
protected

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

Referenced by getOfflineMode().

◆ $sec_highl_nodes

ilExplorerBaseGUI::$sec_highl_nodes = array()
protected

Definition at line 26 of file class.ilExplorerBaseGUI.php.

Referenced by getSecondaryHighlightedNodes().

◆ $select_postvar

ilExplorerBaseGUI::$select_postvar = ""
protected

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

◆ $selected_nodes

ilExplorerBaseGUI::$selected_nodes = array()
protected

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

◆ $skip_root_node

ilExplorerBaseGUI::$skip_root_node = false
protected

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

Referenced by getSkipRootNode().


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