ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 isNodeOnclickEnabled ()
 
 setNodeOnclickEnabled ($nodeOnclickEnabled)
 
 isEnableDnd ()
 
 setEnableDnd ($enable_dnd)
 Enable Drag & Drop functionality. 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

 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

 $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
 

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"
 

Private Attributes

 $nodeOnclickEnabled
 

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

References array.

35  {
36  $this->id = $a_expl_id;
37  $this->parent_obj = $a_parent_obj;
38  $this->parent_cmd = $a_parent_cmd;
39 
40  // get open nodes
41  include_once("./Services/Authentication/classes/class.ilSessionIStorage.php");
42  $this->store = new ilSessionIStorage("expl2");
43  $open_nodes = $this->store->get("on_".$this->id);
44  $this->open_nodes = unserialize($open_nodes);
45  if (!is_array($this->open_nodes))
46  {
47  $this->open_nodes = array();
48  }
49 
50  $this->nodeOnclickEnabled = true;
51  }
Create styles array
The data for the language used.
Session based immediate storage.

Member Function Documentation

◆ beforeRendering()

ilExplorerBaseGUI::beforeRendering ( )

Before rendering.

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

Referenced by getHTML(), and getNodeAsync().

522  {
523 
524  }
+ Here is the caller graph for this function:

◆ closeNode()

ilExplorerBaseGUI::closeNode ( )

Close node.

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

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

483  {
484  global $ilLog;
485 
486  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
487  if (in_array($id, $this->open_nodes))
488  {
489  $k = array_search($id, $this->open_nodes);
490  unset($this->open_nodes[$k]);
491  }
492  $this->store->set("on_".$this->id, serialize($this->open_nodes));
493  exit;
494  }
$_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 74 of file class.ilExplorerBaseGUI.php.

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

Referenced by ilObjContentObject\exportHTML().

75  {
76  ilUtil::makeDirParents($a_target_dir."/Services/UIComponent/Explorer2/lib/jstree-v.pre1.0");
77  ilUtil::makeDirParents($a_target_dir."/Services/UIComponent/Explorer2/js");
78  }
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 316 of file class.ilExplorerBaseGUI.php.

References $ajax.

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

317  {
318  return $this->ajax;
319  }
+ 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(), ilKSDocumentationExplorerGUI\getRootNode(), nodeHasVisibleChilds(), and renderChilds().

+ Here is the caller graph for this function:

◆ getContainerId()

ilExplorerBaseGUI::getContainerId ( )

Get container id.

Parameters

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

Referenced by ilForumExplorerGUI\getHTML(), ilObjStudyProgrammeTreeExplorerGUI\getHTML(), getHTML(), getOnLoadCode(), and handleCommand().

459  {
460  return "il_expl2_jstree_cont_".$this->getId();
461  }
+ 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 816 of file class.ilExplorerBaseGUI.php.

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

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

◆ getHTML()

ilExplorerBaseGUI::getHTML ( )

Get HTML.

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

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

628  {
629  global $tpl, $ilCtrl;
630 
631  $this->beforeRendering();
632 
633  self::init();
634  $container_id = $this->getContainerId();
635  $container_outer_id = "il_expl2_jstree_cont_out_".$this->getId();
636 
637  if (!$ilCtrl->isAsynch())
638  {
639  $tpl->addOnLoadCode($this->getOnLoadCode());
640  }
641 
642  $etpl = new ilTemplate("tpl.explorer2.html", true, true, "Services/UIComponent/Explorer2");
643 
644  // render childs
645  $root_node = $this->getRootNode();
646 
647  if (!$this->getSkipRootNode() &&
648  $this->isNodeVisible($this->getRootNode()))
649  {
650  $this->listStart($etpl);
651  $this->renderNode($this->getRootNode(), $etpl);
652  $this->listEnd($etpl);
653  }
654  else
655  {
656  $childs = $this->getChildsOfNode($this->getNodeId($root_node));
657  $childs = $this->sortChilds($childs, $this->getNodeId($root_node));
658  $any = false;
659  foreach ($childs as $child_node)
660  {
661  if ($this->isNodeVisible($child_node))
662  {
663  if (!$any)
664  {
665  $this->listStart($etpl);
666  $any = true;
667  }
668  $this->renderNode($child_node, $etpl);
669  }
670  }
671  if ($any)
672  {
673  $this->listEnd($etpl);
674  }
675  }
676 
677  $etpl->setVariable("CONTAINER_ID", $container_id);
678  $etpl->setVariable("CONTAINER_OUTER_ID", $container_outer_id);
679 
680  $add = "";
681  if ($ilCtrl->isAsynch())
682  {
683  $add = "<script>".$this->getOnLoadCode()."</script>";
684  }
685 
686  return $etpl->get().$add;
687  }
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 274 of file class.ilExplorerBaseGUI.php.

Referenced by getNodeIdForDomNodeId().

275  {
276  return $this->id;
277  }
+ Here is the caller graph for this function:

◆ getJSTreePlugins()

ilExplorerBaseGUI::getJSTreePlugins ( )
protected

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

References array, and isEnableDnd().

Referenced by getOnLoadCode().

599  {
600  $plugins = array("html_data", "themes", "json_data");
601  if($this->isEnableDnd()) {
602  $plugins[] = "crrm";
603  $plugins[] = "dnd";
604  }
605  return $plugins;
606  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocalExplorerJsPath()

static ilExplorerBaseGUI::getLocalExplorerJsPath ( )
static

Get local path of explorer js.

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

Referenced by ilObjContentObject\getSupplyingExportFiles().

57  {
58  return self::$js_expl_path;
59  }
+ Here is the caller graph for this function:

◆ getLocalJsTreeJsPath()

static ilExplorerBaseGUI::getLocalJsTreeJsPath ( )
static

Get local path of jsTree js.

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

Referenced by ilObjContentObject\getSupplyingExportFiles().

65  {
66  return self::$js_tree_path;
67  }
+ Here is the caller graph for this function:

◆ getNodeAsync()

ilExplorerBaseGUI::getNodeAsync ( )

Get node asynchronously.

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

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

500  {
501  $this->beforeRendering();
502 
503  if ($_GET["node_id"] != "")
504  {
505  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
506  }
507  else
508  {
509  $id = $this->getNodeId($this->getRootNode());
510  }
511 
512  $etpl = new ilTemplate("tpl.explorer2.html", true, true, "Services/UIComponent/Explorer2");
513  $this->renderChilds($id, $etpl);
514  echo $etpl->get("tag");
515  exit;
516  }
$_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 131 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

132  {
133  return "#";
134  }
+ 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 178 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

179  {
180  return "";
181  }
+ 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 189 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

190  {
191  return "";
192  }
+ 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 827 of file class.ilExplorerBaseGUI.php.

References getId().

Referenced by closeNode(), getNodeAsync(), ilObjStudyProgrammeTreeExplorerGUI\openCertainNode(), and openNode().

828  {
829  $i = strlen("exp_node_".$this->getId()."_");
830  return substr($a_dom_node_id, $i);
831  }
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 211 of file class.ilExplorerBaseGUI.php.

References getSelectOnClick().

Referenced by renderNode().

212  {
213  if ($this->select_postvar != "")
214  {
215  return $this->getSelectOnClick($a_node);
216  }
217  return "";
218  }
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 200 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

201  {
202  return "";
203  }
+ Here is the caller graph for this function:

◆ getNodeToggleOnClick()

ilExplorerBaseGUI::getNodeToggleOnClick (   $a_node)
finalprotected

Get onclick attribute for node toggling.

Parameters

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

References getDomNodeIdForNodeId(), and getNodeId().

Referenced by ilBookmarkBlockExplorerGUI\getNodeOnClick().

362  {
363  return "$('#".$this->getContainerId()."').jstree('toggle_node' , '#".
364  $this->getDomNodeIdForNodeId($this->getNodeId($a_node))."'); return false;";
365  }
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 532 of file class.ilExplorerBaseGUI.php.

References $config, $ilCtrl, $url, array, getAjax(), getContainerId(), getDomNodeIdForNodeId(), getJSTreePlugins(), getNodeId(), getOfflineMode(), and getRootNode().

Referenced by getHTML().

533  {
534  global $ilCtrl;
535 
536  $container_id = $this->getContainerId();
537  $container_outer_id = "il_expl2_jstree_cont_out_".$this->getId();
538 
539  // collect open nodes
540  $open_nodes = array($this->getDomNodeIdForNodeId($this->getNodeId($this->getRootNode())));
541  foreach ($this->open_nodes as $nid)
542  {
543  $open_nodes[] = $this->getDomNodeIdForNodeId($nid);
544  }
545  foreach ($this->custom_open_nodes as $nid)
546  {
547  $dnode = $this->getDomNodeIdForNodeId($nid);
548  if (!in_array($dnode, $open_nodes))
549  {
550  $open_nodes[] = $dnode;
551  }
552  }
553 
554  // ilias config options
555  $url = "";
556  if (!$this->getOfflineMode())
557  {
558  if (is_object($this->parent_obj))
559  {
560  $url = $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd, "", true);
561  }
562  else
563  {
564  $url = $ilCtrl->getLinkTargetByClass($this->parent_obj, $this->parent_cmd, "", true);
565  }
566  }
567 
568  // secondary highlighted nodes
569  $shn = array();
570  foreach ($this->sec_highl_nodes as $sh)
571  {
572  $shn[] = $this->getDomNodeIdForNodeId($sh);
573  }
574  $config = array(
575  "container_id" => $container_id,
576  "container_outer_id" => $container_outer_id,
577  "url" => $url,
578  "second_hnodes" => $shn,
579  "ajax" => $this->getAjax(),
580  );
581 
582 
583  // jstree config options
584  $js_tree_config = array(
585  "core" => array(
586  "animation" => 300,
587  "initially_open" => $open_nodes,
588  "open_parents" => false,
589  "strings" => array("loading" => "Loading ...", "new_node" => "New node")
590  ),
591  "plugins" => $this->getJSTreePlugins(),
592  "themes" => array("dots" => false, "icons" => false, "theme" => ""),
593  "html_data" => array()
594  );
595 
596  return 'il.Explorer2.init('.json_encode($config).', '.json_encode($js_tree_config).');';
597  }
$url
Definition: shib_logout.php:72
global $ilCtrl
Definition: ilias.php:18
getRootNode()
Get root node.
getNodeId($a_node)
Get id of a node.
Create styles array
The data for the language used.
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 336 of file class.ilExplorerBaseGUI.php.

References $sec_highl_nodes.

337  {
338  return $this->sec_highl_nodes;
339  }

◆ getSelectOnClick()

ilExplorerBaseGUI::getSelectOnClick (   $a_node)
finalprotected

Get onclick attribute for selecting radio/checkbox.

Parameters

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

References getDomNodeIdForNodeId(), and getNodeId().

Referenced by getNodeOnClick().

374  {
375  $dn_id = $this->getDomNodeIdForNodeId($this->getNodeId($a_node));
376  $oc = "il.Explorer2.selectOnClick('".$dn_id."'); return false;";
377  return $oc;
378  }
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 296 of file class.ilExplorerBaseGUI.php.

References $skip_root_node.

Referenced by getHTML().

297  {
298  return $this->skip_root_node;
299  }
+ 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 436 of file class.ilExplorerBaseGUI.php.

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

437  {
438  if ($_GET["exp_cmd"] != "" &&
439  $_GET["exp_cont"] == $this->getContainerId())
440  {
441  $cmd = $_GET["exp_cmd"];
442  if (in_array($cmd, array("openNode", "closeNode", "getNodeAsync")))
443  {
444  $this->$cmd();
445  }
446 
447  return true;
448  }
449  return false;
450  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
Create styles array
The data for the language used.
getContainerId()
Get container id.
+ Here is the call graph for this function:

◆ init()

static ilExplorerBaseGUI::init ( )
static

Init JS.

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

References $tpl, and iljQueryUtil\initjQuery().

Referenced by ilInternalLinkGUI\getInitHTML().

613  {
614  global $tpl;
615 
616  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
618 
619  $tpl->addJavascript(self::getLocalExplorerJsPath());
620  $tpl->addJavascript(self::getLocalJsTreeJsPath());
621  }
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:

◆ isEnableDnd()

ilExplorerBaseGUI::isEnableDnd ( )

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

References $enable_dnd.

Referenced by getJSTreePlugins().

904  {
905  return $this->enable_dnd;
906  }
+ 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 248 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

249  {
250  return true;
251  }
+ 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 237 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

238  {
239  return false;
240  }
+ Here is the caller graph for this function:

◆ isNodeOnclickEnabled()

ilExplorerBaseGUI::isNodeOnclickEnabled ( )
Returns
boolean

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

References $nodeOnclickEnabled.

Referenced by renderNode().

892  {
894  }
+ Here is the caller graph for this function:

◆ isNodeSelectable()

ilExplorerBaseGUI::isNodeSelectable (   $a_node)
protected

Is node selectable?

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

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

Referenced by renderNode().

260  {
261  return true;
262  }
+ 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 226 of file class.ilExplorerBaseGUI.php.

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

227  {
228  return true;
229  }
+ Here is the caller graph for this function:

◆ listEnd()

ilExplorerBaseGUI::listEnd (   $tpl)

List end.

Parameters

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

References $tpl.

Referenced by getHTML(), and renderChilds().

883  {
884  $tpl->touchBlock("list_end");
885  $tpl->touchBlock("tag");
886  }
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 858 of file class.ilExplorerBaseGUI.php.

References $tpl.

Referenced by renderNode().

859  {
860  $tpl->touchBlock("list_item_end");
861  $tpl->touchBlock("tag");
862  }
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 839 of file class.ilExplorerBaseGUI.php.

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

Referenced by renderNode().

840  {
841  $tpl->setCurrentBlock("list_item_start");
842  if ($this->getAjax() && $this->nodeHasVisibleChilds($a_node))
843  {
844  $tpl->touchBlock("li_closed");
845  }
846  $tpl->setVariable("DOM_NODE_ID",
847  $this->getDomNodeIdForNodeId($this->getNodeId($a_node)));
848  $tpl->parseCurrentBlock();
849  $tpl->touchBlock("tag");
850  }
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 870 of file class.ilExplorerBaseGUI.php.

References $tpl.

Referenced by getHTML(), and renderChilds().

871  {
872  $tpl->touchBlock("list_start");
873  $tpl->touchBlock("tag");
874  }
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 145 of file class.ilExplorerBaseGUI.php.

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

Referenced by ilObjStudyProgrammeTreeExplorerGUI\listItemStart(), and listItemStart().

146  {
147  $childs = $this->getChildsOfNode($this->getNodeId($a_node));
148 
149  foreach ($childs as $child)
150  {
151  if ($this->isNodeVisible($child))
152  {
153  return true;
154  }
155  }
156  return false;
157  }
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 466 of file class.ilExplorerBaseGUI.php.

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

467  {
468  global $ilLog;
469 
470  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
471  if (!in_array($id, $this->open_nodes))
472  {
473  $this->open_nodes[] = $id;
474  }
475  $this->store->set("on_".$this->id, serialize($this->open_nodes));
476  exit;
477  }
$_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 783 of file class.ilExplorerBaseGUI.php.

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

Referenced by getNodeAsync(), and renderNode().

784  {
785  $childs = $this->getChildsOfNode($a_node_id);
786  $childs = $this->sortChilds($childs, $a_node_id);
787 
788  if (count($childs) > 0)
789  {
790  $any = false;
791  foreach ($childs as $child)
792  {
793  if ($this->isNodeVisible($child))
794  {
795  if (!$any)
796  {
797  $this->listStart($tpl);
798  $any = true;
799  }
800  $this->renderNode($child, $tpl);
801  }
802  }
803  if ($any)
804  {
805  $this->listEnd($tpl);
806  }
807  }
808  }
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 695 of file class.ilExplorerBaseGUI.php.

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

Referenced by getHTML(), and renderChilds().

696  {
697  $this->listItemStart($tpl, $a_node);
698 
699  // select mode?
700  if ($this->select_postvar != "" && $this->isNodeSelectable($a_node))
701  {
702  if ($this->select_multi)
703  {
704  $tpl->setCurrentBlock("cb");
705  if (in_array($this->getNodeId($a_node), $this->selected_nodes))
706  {
707  $tpl->setVariable("CHECKED", 'checked="checked"');
708  }
709  $tpl->setVariable("CB_VAL", $this->getNodeId($a_node));
710  $tpl->setVariable("CB_NAME", $this->select_postvar."[]");
711  $tpl->parseCurrentBlock();
712  }
713  else
714  {
715  $tpl->setCurrentBlock("rd");
716  if (in_array($this->getNodeId($a_node), $this->selected_nodes))
717  {
718  $tpl->setVariable("SELECTED", 'checked="checked"');
719  }
720  $tpl->setVariable("RD_VAL", $this->getNodeId($a_node));
721  $tpl->setVariable("RD_NAME", $this->select_postvar);
722  $tpl->parseCurrentBlock();
723  }
724  }
725 
726 
727  if ($this->isNodeHighlighted($a_node))
728  {
729  $tpl->touchBlock("hl");
730  }
731  $tpl->setCurrentBlock("content");
732  if ($this->getNodeIcon($a_node) != "")
733  {
734  $tpl->setVariable("ICON", ilUtil::img($this->getNodeIcon($a_node), $this->getNodeIconAlt($a_node))." ");
735  }
736  $tpl->setVariable("CONTENT", $this->getNodeContent($a_node));
737  $tpl->setVariable("HREF", $this->getNodeHref($a_node));
738  $target = $this->getNodeTarget($a_node);
739  if ($target != "")
740  {
741  $targetRelatedParams = array(
742  'target="' . $target . '"'
743  );
744 
745  if ('_blank' === $target) {
746  $targetRelatedParams[] = 'rel="noopener"';
747  }
748 
749  $tpl->setVariable('TARGET', implode(' ', $targetRelatedParams));
750  }
751  if (!$this->isNodeOnclickEnabled() || !$this->isNodeClickable($a_node))
752  {
753  $tpl->setVariable("ONCLICK", 'onclick="return false;"');
754  $tpl->setVariable("A_CLASS", 'class="disabled"');
755  }
756  else
757  {
758  $onclick = $this->getNodeOnClick($a_node);
759  if ($onclick != "")
760  {
761  $tpl->setVariable("ONCLICK", 'onclick="'.$onclick.'"');
762  }
763  }
764  $tpl->parseCurrentBlock();
765 
766  $tpl->touchBlock("tag");
767 
768  if (!$this->getAjax() || in_array($this->getNodeId($a_node), $this->open_nodes)
769  || in_array($this->getNodeId($a_node), $this->custom_open_nodes))
770  {
771  $this->renderChilds($this->getNodeId($a_node), $tpl);
772  }
773 
774  $this->listItemEnd($tpl);
775  }
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.
isNodeSelectable($a_node)
Is node selectable?
isNodeHighlighted($a_node)
Is node highlighted?
global $tpl
Definition: ilias.php:8
getNodeId($a_node)
Get id of a node.
Create styles array
The data for the language used.
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()

◆ setEnableDnd()

ilExplorerBaseGUI::setEnableDnd (   $enable_dnd)

Enable Drag & Drop functionality.

Parameters
boolean$enable_dnd

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

References $enable_dnd.

Referenced by ilObjStudyProgrammeTreeExplorerGUI\__construct().

912  {
913  $this->enable_dnd = $enable_dnd;
914  }
+ Here is the caller graph for this function:

◆ setNodeOnclickEnabled()

ilExplorerBaseGUI::setNodeOnclickEnabled (   $nodeOnclickEnabled)
Parameters
boolean$nodeOnclickEnabled

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

References $nodeOnclickEnabled.

900  {
901  $this->nodeOnclickEnabled = $nodeOnclickEnabled;
902  }

◆ setNodeOpen()

ilExplorerBaseGUI::setNodeOpen (   $a_id)

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

Parameters

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

Referenced by ilLMTableOfContentsExplorerGUI\__construct(), ilPublicSectionExplorerGUI\beforeRendering(), ilForumExplorerGUI\getHTML(), ilKSDocumentationExplorerGUI\openNodesRecursively(), and ilTreeExplorerGUI\setPathOpen().

348  {
349  if (!in_array($a_id, $this->custom_open_nodes))
350  {
351  $this->custom_open_nodes[] = $a_id;
352  }
353  }
+ 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 399 of file class.ilExplorerBaseGUI.php.

Referenced by ilPublicSectionExplorerGUI\beforeRendering(), and ilSkillSelectorGUI\setSkillSelected().

400  {
401  if (!in_array($a_id, $this->selected_nodes))
402  {
403  $this->selected_nodes[] = $a_id;
404  }
405  }
+ Here is the caller graph for this function:

◆ setOfflineMode()

ilExplorerBaseGUI::setOfflineMode (   $a_val)

Set offline mode.

Parameters
bool$a_valoffline mode

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

Referenced by ilKSDocumentationExplorerGUI\__construct().

413  {
414  $this->offline_mode = $a_val;
415  }
+ Here is the caller graph for this function:

◆ setSecondaryHighlightedNodes()

ilExplorerBaseGUI::setSecondaryHighlightedNodes (   $a_val)

Set secondary (background) highlighted nodes.

Parameters
array$a_valarray of node ids

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

Referenced by ilLMTOCExplorerGUI\__construct().

327  {
328  $this->sec_highl_nodes = $a_val;
329  }
+ 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 387 of file class.ilExplorerBaseGUI.php.

Referenced by ilForumMoveTopicsExplorer\__construct().

388  {
389  $this->select_postvar = $a_postvar;
390  $this->select_multi = $a_multi;
391  }
+ 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 167 of file class.ilExplorerBaseGUI.php.

Referenced by getHTML(), and renderChilds().

168  {
169  return $a_childs;
170  }
+ 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.

◆ $enable_dnd

ilExplorerBaseGUI::$enable_dnd = false
protected

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

Referenced by isEnableDnd(), and setEnableDnd().

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

◆ $nodeOnclickEnabled

ilExplorerBaseGUI::$nodeOnclickEnabled
private

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

Referenced by isNodeOnclickEnabled(), and setNodeOnclickEnabled().

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

Referenced by ilSkillSelectorGUI\getSelectedSkills().

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