ILIAS  release_4-4 Revision
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...
 
 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...
 
 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...
 

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
 

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 30 of file class.ilExplorerBaseGUI.php.

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

Member Function Documentation

◆ beforeRendering()

ilExplorerBaseGUI::beforeRendering ( )

Before rendering.

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

Referenced by getHTML(), and getNodeAsync().

486  {
487 
488  }
+ Here is the caller graph for this function:

◆ closeNode()

ilExplorerBaseGUI::closeNode ( )

Close node.

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

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

447  {
448  global $ilLog;
449 
450  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
451  if (in_array($id, $this->open_nodes))
452  {
453  $k = array_search($id, $this->open_nodes);
454  unset($this->open_nodes[$k]);
455  }
456  $this->store->set("on_".$this->id, serialize($this->open_nodes));
457  exit;
458  }
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 69 of file class.ilExplorerBaseGUI.php.

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

Referenced by ilObjContentObject\exportHTML().

70  {
71  ilUtil::makeDirParents($a_target_dir."/Services/UIComponent/Explorer2/lib/jstree-v.pre1.0");
72  ilUtil::makeDirParents($a_target_dir."/Services/UIComponent/Explorer2/js");
73  }
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 300 of file class.ilExplorerBaseGUI.php.

References $ajax.

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

301  {
302  return $this->ajax;
303  }
+ 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 422 of file class.ilExplorerBaseGUI.php.

Referenced by getHTML(), and handleCommand().

423  {
424  return "il_expl2_jstree_cont_".$this->getId();
425  }
+ 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 716 of file class.ilExplorerBaseGUI.php.

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

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

◆ getHTML()

ilExplorerBaseGUI::getHTML ( )

Get HTML.

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

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

495  {
496  global $tpl, $ilCtrl;
497 
498  $this->beforeRendering();
499 
500  $tpl->addJavascript(self::getLocalExplorerJsPath());
501  $tpl->addJavascript(self::getLocalJsTreeJsPath());
502 
503  $container_id = $this->getContainerId();
504  $container_outer_id = "il_expl2_jstree_cont_out_".$this->getId();
505 
506  // collect open nodes
507  $open_nodes = array($this->getDomNodeIdForNodeId($this->getNodeId($this->getRootNode())));
508  foreach ($this->open_nodes as $nid)
509  {
510  $open_nodes[] = $this->getDomNodeIdForNodeId($nid);
511  }
512  foreach ($this->custom_open_nodes as $nid)
513  {
514  $dnode = $this->getDomNodeIdForNodeId($nid);
515  if (!in_array($dnode, $open_nodes))
516  {
517  $open_nodes[] = $dnode;
518  }
519  }
520 
521  // ilias config options
522  $url = "";
523  if (!$this->getOfflineMode())
524  {
525  if (is_object($this->parent_obj))
526  {
527  $url = $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd, "", true);
528  }
529  else
530  {
531  $url = $ilCtrl->getLinkTargetByClass($this->parent_obj, $this->parent_cmd, "", true);
532  }
533  }
534  $config = array(
535  "container_id" => $container_id,
536  "container_outer_id" => $container_outer_id,
537  "url" => $url,
538  "ajax" => $this->getAjax(),
539  );
540 
541 
542  // jstree config options
543  $js_tree_config = array(
544  "core" => array(
545  "animation" => 300,
546  "initially_open" => $open_nodes,
547  "open_parents" => false,
548  "strings" => array("loading" => "Loading ...", new_node => "New node")
549  ),
550  "plugins" => array("html_data", "themes"),
551  "themes" => array("dots" => false, "icons" => false, "theme" => ""),
552  "html_data" => array()
553  );
554 
555  $tpl->addOnLoadCode('il.Explorer2.init('.json_encode($config).', '.json_encode($js_tree_config).');');
556  $etpl = new ilTemplate("tpl.explorer2.html", true, true, "Services/UIComponent/Explorer2");
557 
558  // render childs
559  $root_node = $this->getRootNode();
560 
561  if (!$this->getSkipRootNode() &&
562  $this->isNodeVisible($this->getRootNode()))
563  {
564  $this->listStart($etpl);
565  $this->renderNode($this->getRootNode(), $etpl);
566  $this->listEnd($etpl);
567  }
568  else
569  {
570  $childs = $this->getChildsOfNode($this->getNodeId($root_node));
571  $childs = $this->sortChilds($childs, $this->getNodeId($root_node));
572  $any = false;
573  foreach ($childs as $child_node)
574  {
575  if ($this->isNodeVisible($child_node))
576  {
577  if (!$any)
578  {
579  $this->listStart($etpl);
580  $any = true;
581  }
582  $this->renderNode($child_node, $etpl);
583  }
584  }
585  if ($any)
586  {
587  $this->listEnd($etpl);
588  }
589  }
590 
591  $etpl->setVariable("CONTAINER_ID", $container_id);
592  $etpl->setVariable("CONTAINER_OUTER_ID", $container_outer_id);
593 
594  return $etpl->get();
595  }
renderNode($a_node, $tpl)
Render node.
isNodeVisible($a_node)
Is node visible?
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
global $ilCtrl
Definition: ilias.php:18
getSkipRootNode()
Get skip root node.
getRootNode()
Get root node.
getNodeId($a_node)
Get id of a node.
special template class to simplify handling of ITX/PEAR
beforeRendering()
Before rendering.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
getOfflineMode()
Get offline mode.
listStart($tpl)
List start.
getChildsOfNode($a_parent_node_id)
Get childs of node.
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
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 258 of file class.ilExplorerBaseGUI.php.

Referenced by getNodeIdForDomNodeId().

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

◆ getLocalExplorerJsPath()

static ilExplorerBaseGUI::getLocalExplorerJsPath ( )
static

Get local path of explorer js.

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

Referenced by ilObjContentObject\getSupplyingExportFiles().

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

◆ getLocalJsTreeJsPath()

static ilExplorerBaseGUI::getLocalJsTreeJsPath ( )
static

Get local path of jsTree js.

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

Referenced by ilObjContentObject\getSupplyingExportFiles().

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

◆ getNodeAsync()

ilExplorerBaseGUI::getNodeAsync ( )

Get node asynchronously.

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

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

464  {
465  $this->beforeRendering();
466 
467  if ($_GET["node_id"] != "")
468  {
469  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
470  }
471  else
472  {
473  $id = $this->getNodeId($this->getRootNode());
474  }
475 
476  $etpl = new ilTemplate("tpl.explorer2.html", true, true, "Services/UIComponent/Explorer2");
477  $this->renderChilds($id, $etpl);
478  echo $etpl->get("tag");
479  exit;
480  }
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 126 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

127  {
128  return "#";
129  }
+ 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 173 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

174  {
175  return "";
176  }
+ 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 184 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

185  {
186  return "";
187  }
+ 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(), 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 727 of file class.ilExplorerBaseGUI.php.

References getId().

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

728  {
729  $i = strlen("exp_node_".$this->getId()."_");
730  return substr($a_dom_node_id, $i);
731  }
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 206 of file class.ilExplorerBaseGUI.php.

References getSelectOnClick().

Referenced by renderNode().

207  {
208  if ($this->select_postvar != "")
209  {
210  return $this->getSelectOnClick($a_node);
211  }
212  return "";
213  }
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 195 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

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

◆ getNodeToggleOnClick()

ilExplorerBaseGUI::getNodeToggleOnClick (   $a_node)
finalprotected

Get onclick attribute for node toggling.

Parameters

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

References getDomNodeIdForNodeId(), and getNodeId().

Referenced by ilBookmarkBlockExplorerGUI\getNodeOnClick().

326  {
327  return "$('#".$this->getContainerId()."').jstree('toggle_node' , '#".
328  $this->getDomNodeIdForNodeId($this->getNodeId($a_node))."'); return false;";
329  }
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 ( )

Get offline mode.

Returns
bool offline mode

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

References $offline_mode.

Referenced by ilLMExplorerGUI\__construct(), ilLMExplorerGUI\beforeRendering(), getHTML(), ilLMTOCExplorerGUI\getNodeHref(), ilLMTOCExplorerGUI\getNodeIcon(), and ilLMTOCExplorerGUI\isNodeClickable().

387  {
388  return $this->offline_mode;
389  }
+ 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(), and getNodeAsync().

+ Here is the caller graph for this function:

◆ getSelectOnClick()

ilExplorerBaseGUI::getSelectOnClick (   $a_node)
finalprotected

Get onclick attribute for selecting radio/checkbox.

Parameters

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

References getDomNodeIdForNodeId(), and getNodeId().

Referenced by getNodeOnClick().

338  {
339  $dn_id = $this->getDomNodeIdForNodeId($this->getNodeId($a_node));
340  $oc = "il.Explorer2.selectOnClick('".$dn_id."'); return false;";
341  return $oc;
342  }
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 280 of file class.ilExplorerBaseGUI.php.

References $skip_root_node.

Referenced by getHTML().

281  {
282  return $this->skip_root_node;
283  }
+ 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 400 of file class.ilExplorerBaseGUI.php.

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

401  {
402  if ($_GET["exp_cmd"] != "" &&
403  $_GET["exp_cont"] == $this->getContainerId())
404  {
405  $cmd = $_GET["exp_cmd"];
406  if (in_array($cmd, array("openNode", "closeNode", "getNodeAsync")))
407  {
408  $this->$cmd();
409  }
410 
411  return true;
412  }
413  return false;
414  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
getContainerId()
Get container id.
+ Here is the call 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 243 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

244  {
245  return true;
246  }
+ 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 232 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

233  {
234  return false;
235  }
+ 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 221 of file class.ilExplorerBaseGUI.php.

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

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

◆ listEnd()

ilExplorerBaseGUI::listEnd (   $tpl)

List end.

Parameters

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

References $tpl.

Referenced by getHTML(), and renderChilds().

783  {
784  $tpl->touchBlock("list_end");
785  $tpl->touchBlock("tag");
786  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the caller graph for this function:

◆ listItemEnd()

ilExplorerBaseGUI::listItemEnd (   $tpl)

List item end.

Parameters

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

References $tpl.

Referenced by renderNode().

759  {
760  $tpl->touchBlock("list_item_end");
761  $tpl->touchBlock("tag");
762  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the caller graph for this function:

◆ listItemStart()

ilExplorerBaseGUI::listItemStart (   $tpl,
  $a_node 
)

List item start.

Parameters

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

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

Referenced by renderNode().

740  {
741  $tpl->setCurrentBlock("list_item_start");
742  if ($this->getAjax() && $this->nodeHasVisibleChilds($a_node))
743  {
744  $tpl->touchBlock("li_closed");
745  }
746  $tpl->setVariable("DOM_NODE_ID",
747  $this->getDomNodeIdForNodeId($this->getNodeId($a_node)));
748  $tpl->parseCurrentBlock();
749  $tpl->touchBlock("tag");
750  }
getNodeId($a_node)
Get id of a node.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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 770 of file class.ilExplorerBaseGUI.php.

References $tpl.

Referenced by getHTML(), and renderChilds().

771  {
772  $tpl->touchBlock("list_start");
773  $tpl->touchBlock("tag");
774  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ 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 140 of file class.ilExplorerBaseGUI.php.

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

Referenced by listItemStart().

141  {
142  $childs = $this->getChildsOfNode($this->getNodeId($a_node));
143 
144  foreach ($childs as $child)
145  {
146  if ($this->isNodeVisible($child))
147  {
148  return true;
149  }
150  }
151  return false;
152  }
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 430 of file class.ilExplorerBaseGUI.php.

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

431  {
432  global $ilLog;
433 
434  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
435  if (!in_array($id, $this->open_nodes))
436  {
437  $this->open_nodes[] = $id;
438  }
439  $this->store->set("on_".$this->id, serialize($this->open_nodes));
440  exit;
441  }
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 683 of file class.ilExplorerBaseGUI.php.

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

Referenced by getNodeAsync(), and renderNode().

684  {
685  $childs = $this->getChildsOfNode($a_node_id);
686  $childs = $this->sortChilds($childs, $a_node_id);
687 
688  if (count($childs) > 0)
689  {
690  $any = false;
691  foreach ($childs as $child)
692  {
693  if ($this->isNodeVisible($child))
694  {
695  if (!$any)
696  {
697  $this->listStart($tpl);
698  $any = true;
699  }
700  $this->renderNode($child, $tpl);
701  }
702  }
703  if ($any)
704  {
705  $this->listEnd($tpl);
706  }
707  }
708  }
renderNode($a_node, $tpl)
Render node.
isNodeVisible($a_node)
Is node visible?
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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 603 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().

604  {
605  $this->listItemStart($tpl, $a_node);
606 
607  // select mode?
608  if ($this->select_postvar != "")
609  {
610  if ($this->select_multi)
611  {
612  $tpl->setCurrentBlock("cb");
613  if (in_array($this->getNodeId($a_node), $this->selected_nodes))
614  {
615  $tpl->setVariable("CHECKED", 'checked="checked"');
616  }
617  $tpl->setVariable("CB_VAL", $this->getNodeId($a_node));
618  $tpl->setVariable("CB_NAME", $this->select_postvar."[]");
619  $tpl->parseCurrentBlock();
620  }
621  else
622  {
623  $tpl->setCurrentBlock("rd");
624  if (in_array($this->getNodeId($a_node), $this->selected_nodes))
625  {
626  $tpl->setVariable("SELECTED", 'checked="checked"');
627  }
628  $tpl->setVariable("RD_VAL", $this->getNodeId($a_node));
629  $tpl->setVariable("RD_NAME", $this->select_postvar);
630  $tpl->parseCurrentBlock();
631  }
632  }
633 
634 
635  if ($this->isNodeHighlighted($a_node))
636  {
637  $tpl->touchBlock("hl");
638  }
639  $tpl->setCurrentBlock("content");
640  if ($this->getNodeIcon($a_node) != "")
641  {
642  $tpl->setVariable("ICON", ilUtil::img($this->getNodeIcon($a_node), $this->getNodeIconAlt($a_node))." ");
643  }
644  $tpl->setVariable("CONTENT", $this->getNodeContent($a_node));
645  $tpl->setVariable("HREF", $this->getNodeHref($a_node));
646  $target = $this->getNodeTarget($a_node);
647  if ($target != "")
648  {
649  $tpl->setVariable("TARGET", 'target="'.$target.'"');
650  }
651  if (!$this->isNodeClickable($a_node))
652  {
653  $tpl->setVariable("ONCLICK", 'onclick="return false;"');
654  $tpl->setVariable("A_CLASS", 'class="disabled"');
655  }
656  else
657  {
658  $onclick = $this->getNodeOnClick($a_node);
659  if ($onclick != "")
660  {
661  $tpl->setVariable("ONCLICK", 'onclick="'.$onclick.'"');
662  }
663  }
664  $tpl->parseCurrentBlock();
665 
666  $tpl->touchBlock("tag");
667 
668  if (!$this->getAjax() || in_array($this->getNodeId($a_node), $this->open_nodes)
669  || in_array($this->getNodeId($a_node), $this->custom_open_nodes))
670  {
671  $this->renderChilds($this->getNodeId($a_node), $tpl);
672  }
673 
674  $this->listItemEnd($tpl);
675  }
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="")
Build img tag.
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?
getNodeId($a_node)
Get id of a node.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
getNodeContent($a_node)
Get content of a node.
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 311 of file class.ilExplorerBaseGUI.php.

Referenced by ilTreeExplorerGUI\setPathOpen().

312  {
313  if (!in_array($a_id, $this->custom_open_nodes))
314  {
315  $this->custom_open_nodes[] = $a_id;
316  }
317  }
+ 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 363 of file class.ilExplorerBaseGUI.php.

364  {
365  if (!in_array($a_id, $this->selected_nodes))
366  {
367  $this->selected_nodes[] = $a_id;
368  }
369  }

◆ setOfflineMode()

ilExplorerBaseGUI::setOfflineMode (   $a_val)

Set offline mode.

Parameters
bool$a_valoffline mode

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

377  {
378  $this->offline_mode = $a_val;
379  }

◆ 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 351 of file class.ilExplorerBaseGUI.php.

Referenced by ilForumMoveTopicsExplorer\__construct().

352  {
353  $this->select_postvar = $a_postvar;
354  $this->select_multi = $a_multi;
355  }
+ 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 162 of file class.ilExplorerBaseGUI.php.

Referenced by getHTML(), and renderChilds().

163  {
164  return $a_childs;
165  }
+ 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().

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