ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 setMainTemplate (ilTemplate $a_main_tpl=null)
 Set main template (that is responsible for adding js/css) 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 ($a_main_tpl=null)
 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

 $log
 
 $ctrl
 
 $tpl
 
 $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 = "./libs/bower/bower_components/jstree/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 49 of file class.ilExplorerBaseGUI.php.

References $DIC, and array.

50  {
51  global $DIC;
52 
53  $this->log = $DIC["ilLog"];
54  $this->ctrl = $DIC->ctrl();
55  $this->tpl = $DIC["tpl"];
56  $this->id = $a_expl_id;
57  $this->parent_obj = $a_parent_obj;
58  $this->parent_cmd = $a_parent_cmd;
59 
60  // get open nodes
61  include_once("./Services/Authentication/classes/class.ilSessionIStorage.php");
62  $this->store = new ilSessionIStorage("expl2");
63  $open_nodes = $this->store->get("on_" . $this->id);
64  $this->open_nodes = unserialize($open_nodes);
65  if (!is_array($this->open_nodes)) {
66  $this->open_nodes = array();
67  }
68 
69  $this->nodeOnclickEnabled = true;
70  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
Session based immediate storage.

Member Function Documentation

◆ beforeRendering()

ilExplorerBaseGUI::beforeRendering ( )

Before rendering.

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

Referenced by getHTML(), and getNodeAsync().

540  {
541  }
+ Here is the caller graph for this function:

◆ closeNode()

ilExplorerBaseGUI::closeNode ( )

Close node.

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

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

505  {
506  $ilLog = $this->log;
507 
508  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
509  if (in_array($id, $this->open_nodes)) {
510  $k = array_search($id, $this->open_nodes);
511  unset($this->open_nodes[$k]);
512  }
513  $this->store->set("on_" . $this->id, serialize($this->open_nodes));
514  exit;
515  }
$_GET["client_id"]
if(!array_key_exists('StateId', $_REQUEST)) $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 104 of file class.ilExplorerBaseGUI.php.

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

Referenced by ilObjContentObject\exportHTML().

105  {
106  ilUtil::makeDirParents($a_target_dir . "/Services/UIComponent/Explorer2/lib/jstree-v.pre1.0");
107  ilUtil::makeDirParents($a_target_dir . "/Services/UIComponent/Explorer2/js");
108  }
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 343 of file class.ilExplorerBaseGUI.php.

References $ajax.

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

344  {
345  return $this->ajax;
346  }
+ 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 481 of file class.ilExplorerBaseGUI.php.

References getId().

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

482  {
483  return "il_expl2_jstree_cont_" . $this->getId();
484  }
getId()
Get id of explorer element.
+ Here is the call graph for this function:
+ 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 810 of file class.ilExplorerBaseGUI.php.

References getId().

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

811  {
812  return "exp_node_" . $this->getId() . "_" . $a_node_id;
813  }
getId()
Get id of explorer element.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilExplorerBaseGUI::getHTML ( )

Get HTML.

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

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

644  {
645  $tpl = $this->tpl;
647 
648  $root = $this->getNodeId($this->getRootNode());
649  if (!in_array($root, $this->open_nodes)) {
650  $this->open_nodes[] = $root;
651  }
652 
653  $this->beforeRendering();
654 
655  self::init($tpl);
656  $container_id = $this->getContainerId();
657  $container_outer_id = "il_expl2_jstree_cont_out_" . $this->getId();
658 
659  if (!$ilCtrl->isAsynch()) {
660  $tpl->addOnLoadCode($this->getOnLoadCode());
661  }
662 
663  $etpl = new ilTemplate("tpl.explorer2.html", true, true, "Services/UIComponent/Explorer2");
664 
665  // render childs
666  $root_node = $this->getRootNode();
667 
668  if (!$this->getSkipRootNode() &&
669  $this->isNodeVisible($this->getRootNode())) {
670  $this->listStart($etpl);
671  $this->renderNode($this->getRootNode(), $etpl);
672  $this->listEnd($etpl);
673  } else {
674  $childs = $this->getChildsOfNode($this->getNodeId($root_node));
675  $childs = $this->sortChilds($childs, $this->getNodeId($root_node));
676  $any = false;
677  foreach ($childs as $child_node) {
678  if ($this->isNodeVisible($child_node)) {
679  if (!$any) {
680  $this->listStart($etpl);
681  $any = true;
682  }
683  $this->renderNode($child_node, $etpl);
684  }
685  }
686  if ($any) {
687  $this->listEnd($etpl);
688  }
689  }
690 
691  $etpl->setVariable("CONTAINER_ID", $container_id);
692  $etpl->setVariable("CONTAINER_OUTER_ID", $container_outer_id);
693 
694  $add = "";
695  if ($ilCtrl->isAsynch()) {
696  $add = "<script>" . $this->getOnLoadCode() . "</script>";
697  }
698 
699  return $etpl->get() . $add;
700  }
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.
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.
getId()
Get id of explorer element.
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 301 of file class.ilExplorerBaseGUI.php.

References $id.

Referenced by getContainerId(), getDomNodeIdForNodeId(), getHTML(), getNodeIdForDomNodeId(), and getOnLoadCode().

302  {
303  return $this->id;
304  }
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the caller graph for this function:

◆ getJSTreePlugins()

ilExplorerBaseGUI::getJSTreePlugins ( )
protected

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

References array, and isEnableDnd().

Referenced by getOnLoadCode().

609  {
610  $plugins = array("html_data", "themes", "json_data");
611  if ($this->isEnableDnd()) {
612  $plugins[] = "crrm";
613  $plugins[] = "dnd";
614  }
615  return $plugins;
616  }
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 86 of file class.ilExplorerBaseGUI.php.

Referenced by ilGroupUserActionProvider\getJsScripts(), and ilObjContentObject\getSupplyingExportFiles().

87  {
88  return self::$js_expl_path;
89  }
+ Here is the caller graph for this function:

◆ getLocalJsTreeJsPath()

static ilExplorerBaseGUI::getLocalJsTreeJsPath ( )
static

Get local path of jsTree js.

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

Referenced by ilGroupUserActionProvider\getJsScripts(), and ilObjContentObject\getSupplyingExportFiles().

95  {
96  return self::$js_tree_path;
97  }
+ Here is the caller graph for this function:

◆ getNodeAsync()

ilExplorerBaseGUI::getNodeAsync ( )

Get node asynchronously.

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

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

521  {
522  $this->beforeRendering();
523 
524  if ($_GET["node_id"] != "") {
525  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
526  } else {
527  $id = $this->getNodeId($this->getRootNode());
528  }
529 
530  $etpl = new ilTemplate("tpl.explorer2.html", true, true, "Services/UIComponent/Explorer2");
531  $this->renderChilds($id, $etpl);
532  echo $etpl->get("tag");
533  exit;
534  }
$_GET["client_id"]
renderChilds($a_node_id, $tpl)
Render childs.
if(!array_key_exists('StateId', $_REQUEST)) $id
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 161 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

162  {
163  return "#";
164  }
+ 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 206 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

207  {
208  return "";
209  }
+ 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 217 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

218  {
219  return "";
220  }
+ 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 821 of file class.ilExplorerBaseGUI.php.

References $i, and getId().

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

822  {
823  $i = strlen("exp_node_" . $this->getId() . "_");
824  return substr($a_dom_node_id, $i);
825  }
$i
Definition: disco.tpl.php:19
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 239 of file class.ilExplorerBaseGUI.php.

References getSelectOnClick().

Referenced by renderNode().

240  {
241  if ($this->select_postvar != "") {
242  return $this->getSelectOnClick($a_node);
243  }
244  return "";
245  }
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 228 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

229  {
230  return "";
231  }
+ Here is the caller graph for this function:

◆ getNodeToggleOnClick()

ilExplorerBaseGUI::getNodeToggleOnClick (   $a_node)
finalprotected

Get onclick attribute for node toggling.

Parameters

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

References getContainerId(), getDomNodeIdForNodeId(), and getNodeId().

Referenced by ilBookmarkBlockExplorerGUI\getNodeOnClick().

388  {
389  return "$('#" . $this->getContainerId() . "').jstree('toggle_node' , '#" .
390  $this->getDomNodeIdForNodeId($this->getNodeId($a_node)) . "'); return false;";
391  }
getNodeId($a_node)
Get id of a node.
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:

◆ getOfflineMode()

ilExplorerBaseGUI::getOfflineMode ( )

◆ getOnLoadCode()

ilExplorerBaseGUI::getOnLoadCode ( )

Get on load code.

Parameters

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

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

Referenced by getHTML().

550  {
552 
553  $container_id = $this->getContainerId();
554  $container_outer_id = "il_expl2_jstree_cont_out_" . $this->getId();
555 
556  // collect open nodes
557  $open_nodes = array($this->getDomNodeIdForNodeId($this->getNodeId($this->getRootNode())));
558  foreach ($this->open_nodes as $nid) {
559  $open_nodes[] = $this->getDomNodeIdForNodeId($nid);
560  }
561  foreach ($this->custom_open_nodes as $nid) {
562  $dnode = $this->getDomNodeIdForNodeId($nid);
563  if (!in_array($dnode, $open_nodes)) {
564  $open_nodes[] = $dnode;
565  }
566  }
567 
568  // ilias config options
569  $url = "";
570  if (!$this->getOfflineMode()) {
571  if (is_object($this->parent_obj)) {
572  $url = $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd, "", true);
573  } else {
574  $url = $ilCtrl->getLinkTargetByClass($this->parent_obj, $this->parent_cmd, "", true);
575  }
576  }
577 
578  // secondary highlighted nodes
579  $shn = array();
580  foreach ($this->sec_highl_nodes as $sh) {
581  $shn[] = $this->getDomNodeIdForNodeId($sh);
582  }
583  $config = array(
584  "container_id" => $container_id,
585  "container_outer_id" => $container_outer_id,
586  "url" => $url,
587  "second_hnodes" => $shn,
588  "ajax" => $this->getAjax(),
589  );
590 
591 
592  // jstree config options
593  $js_tree_config = array(
594  "core" => array(
595  "animation" => 300,
596  "initially_open" => $open_nodes,
597  "open_parents" => false,
598  "strings" => array("loading" => "Loading ...", "new_node" => "New node")
599  ),
600  "plugins" => $this->getJSTreePlugins(),
601  "themes" => array("dots" => false, "icons" => false, "theme" => ""),
602  "html_data" => array()
603  );
604 
605  return 'il.Explorer2.init(' . json_encode($config) . ', ' . json_encode($js_tree_config) . ');';
606  }
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.
$url
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
getId()
Get id of explorer element.
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 363 of file class.ilExplorerBaseGUI.php.

References $sec_highl_nodes.

364  {
365  return $this->sec_highl_nodes;
366  }

◆ getSelectOnClick()

ilExplorerBaseGUI::getSelectOnClick (   $a_node)
finalprotected

Get onclick attribute for selecting radio/checkbox.

Parameters

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

References getDomNodeIdForNodeId(), and getNodeId().

Referenced by getNodeOnClick().

400  {
401  $dn_id = $this->getDomNodeIdForNodeId($this->getNodeId($a_node));
402  $oc = "il.Explorer2.selectOnClick('" . $dn_id . "'); return false;";
403  return $oc;
404  }
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 323 of file class.ilExplorerBaseGUI.php.

References $skip_root_node.

Referenced by getHTML().

324  {
325  return $this->skip_root_node;
326  }
+ 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 461 of file class.ilExplorerBaseGUI.php.

References $_GET, array, and getContainerId().

462  {
463  if ($_GET["exp_cmd"] != "" &&
464  $_GET["exp_cont"] == $this->getContainerId()) {
465  $cmd = $_GET["exp_cmd"];
466  if (in_array($cmd, array("openNode", "closeNode", "getNodeAsync"))) {
467  $this->$cmd();
468  }
469 
470  return true;
471  }
472  return false;
473  }
$_GET["client_id"]
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 (   $a_main_tpl = null)
static

Init JS.

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

References $DIC, $tpl, and iljQueryUtil\initjQuery().

Referenced by ilInternalLinkGUI\getInitHTML().

623  {
624  global $DIC;
625 
626  if ($a_main_tpl == null) {
627  $tpl = $DIC["tpl"];
628  } else {
629  $tpl = $a_main_tpl;
630  }
631 
632  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
634 
635  $tpl->addJavascript(self::getLocalExplorerJsPath());
636  $tpl->addJavascript(self::getLocalJsTreeJsPath());
637  }
global $DIC
Definition: saml.php:7
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEnableDnd()

ilExplorerBaseGUI::isEnableDnd ( )

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

References $enable_dnd.

Referenced by getJSTreePlugins().

900  {
901  return $this->enable_dnd;
902  }
+ 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 275 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

276  {
277  return true;
278  }
+ 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 264 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

265  {
266  return false;
267  }
+ Here is the caller graph for this function:

◆ isNodeOnclickEnabled()

ilExplorerBaseGUI::isNodeOnclickEnabled ( )
Returns
boolean

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

References $nodeOnclickEnabled.

Referenced by renderNode().

887  {
889  }
+ 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 286 of file class.ilExplorerBaseGUI.php.

Referenced by renderNode().

287  {
288  return true;
289  }
+ 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 253 of file class.ilExplorerBaseGUI.php.

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

254  {
255  return true;
256  }
+ Here is the caller graph for this function:

◆ listEnd()

ilExplorerBaseGUI::listEnd (   $tpl)

List end.

Parameters

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

References $tpl.

Referenced by getHTML(), and renderChilds().

878  {
879  $tpl->touchBlock("list_end");
880  $tpl->touchBlock("tag");
881  }
+ Here is the caller graph for this function:

◆ listItemEnd()

ilExplorerBaseGUI::listItemEnd (   $tpl)

List item end.

Parameters

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

References $tpl.

Referenced by renderNode().

854  {
855  $tpl->touchBlock("list_item_end");
856  $tpl->touchBlock("tag");
857  }
+ Here is the caller graph for this function:

◆ listItemStart()

ilExplorerBaseGUI::listItemStart (   $tpl,
  $a_node 
)

List item start.

Parameters

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

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

Referenced by renderNode().

834  {
835  $tpl->setCurrentBlock("list_item_start");
836  if ($this->getAjax() && $this->nodeHasVisibleChilds($a_node)) {
837  $tpl->touchBlock("li_closed");
838  }
839  $tpl->setVariable(
840  "DOM_NODE_ID",
841  $this->getDomNodeIdForNodeId($this->getNodeId($a_node))
842  );
843  $tpl->parseCurrentBlock();
844  $tpl->touchBlock("tag");
845  }
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 865 of file class.ilExplorerBaseGUI.php.

References $tpl.

Referenced by getHTML(), and renderChilds().

866  {
867  $tpl->touchBlock("list_start");
868  $tpl->touchBlock("tag");
869  }
+ 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 175 of file class.ilExplorerBaseGUI.php.

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

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

176  {
177  $childs = $this->getChildsOfNode($this->getNodeId($a_node));
178 
179  foreach ($childs as $child) {
180  if ($this->isNodeVisible($child)) {
181  return true;
182  }
183  }
184  return false;
185  }
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 489 of file class.ilExplorerBaseGUI.php.

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

490  {
491  $ilLog = $this->log;
492 
493  $id = $this->getNodeIdForDomNodeId($_GET["node_id"]);
494  if (!in_array($id, $this->open_nodes)) {
495  $this->open_nodes[] = $id;
496  }
497  $this->store->set("on_" . $this->id, serialize($this->open_nodes));
498  exit;
499  }
$_GET["client_id"]
if(!array_key_exists('StateId', $_REQUEST)) $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 782 of file class.ilExplorerBaseGUI.php.

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

Referenced by getNodeAsync(), and renderNode().

783  {
784  $childs = $this->getChildsOfNode($a_node_id);
785  $childs = $this->sortChilds($childs, $a_node_id);
786 
787  if (count($childs) > 0) {
788  $any = false;
789  foreach ($childs as $child) {
790  if ($this->isNodeVisible($child)) {
791  if (!$any) {
792  $this->listStart($tpl);
793  $any = true;
794  }
795  $this->renderNode($child, $tpl);
796  }
797  }
798  if ($any) {
799  $this->listEnd($tpl);
800  }
801  }
802  }
renderNode($a_node, $tpl)
Render node.
isNodeVisible($a_node)
Is node visible?
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
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 708 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().

709  {
710  $this->listItemStart($tpl, $a_node);
711 
712  // select mode?
713  if ($this->select_postvar != "" && $this->isNodeSelectable($a_node)) {
714  if ($this->select_multi) {
715  $tpl->setCurrentBlock("cb");
716  if (in_array($this->getNodeId($a_node), $this->selected_nodes)) {
717  $tpl->setVariable("CHECKED", 'checked="checked"');
718  }
719  $tpl->setVariable("CB_VAL", $this->getNodeId($a_node));
720  $tpl->setVariable("CB_NAME", $this->select_postvar . "[]");
721  $tpl->parseCurrentBlock();
722  } else {
723  $tpl->setCurrentBlock("rd");
724  if (in_array($this->getNodeId($a_node), $this->selected_nodes)) {
725  $tpl->setVariable("SELECTED", 'checked="checked"');
726  }
727  $tpl->setVariable("RD_VAL", $this->getNodeId($a_node));
728  $tpl->setVariable("RD_NAME", $this->select_postvar);
729  $tpl->parseCurrentBlock();
730  }
731  }
732 
733 
734  if ($this->isNodeHighlighted($a_node)) {
735  $tpl->touchBlock("hl");
736  }
737  $tpl->setCurrentBlock("content");
738  if ($this->getNodeIcon($a_node) != "") {
739  $tpl->setVariable("ICON", ilUtil::img($this->getNodeIcon($a_node), $this->getNodeIconAlt($a_node)) . " ");
740  }
741  $tpl->setVariable("CONTENT", $this->getNodeContent($a_node));
742  $tpl->setVariable("HREF", $this->getNodeHref($a_node));
743  $target = $this->getNodeTarget($a_node);
744  if ($target != "") {
745  $targetRelatedParams = array(
746  'target="' . $target . '"'
747  );
748 
749  if ('_blank' === $target) {
750  $targetRelatedParams[] = 'rel="noopener"';
751  }
752 
753  $tpl->setVariable('TARGET', implode(' ', $targetRelatedParams));
754  }
755  if (!$this->isNodeOnclickEnabled() || !$this->isNodeClickable($a_node)) {
756  $tpl->setVariable("ONCLICK", 'onclick="return false;"');
757  $tpl->setVariable("A_CLASS", 'class="disabled"');
758  } else {
759  $onclick = $this->getNodeOnClick($a_node);
760  if ($onclick != "") {
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  $this->renderChilds($this->getNodeId($a_node), $tpl);
771  }
772 
773  $this->listItemEnd($tpl);
774  }
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?
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 908 of file class.ilExplorerBaseGUI.php.

References $enable_dnd.

Referenced by ilObjStudyProgrammeTreeExplorerGUI\__construct().

909  {
910  $this->enable_dnd = $enable_dnd;
911  }
+ Here is the caller graph for this function:

◆ setMainTemplate()

ilExplorerBaseGUI::setMainTemplate ( ilTemplate  $a_main_tpl = null)

Set main template (that is responsible for adding js/css)

Parameters
ilTemplate | null$a_main_tpl

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

78  {
79  $this->tpl = $a_main_tpl;
80  }

◆ setNodeOnclickEnabled()

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

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

References $nodeOnclickEnabled.

895  {
896  $this->nodeOnclickEnabled = $nodeOnclickEnabled;
897  }

◆ setNodeOpen()

ilExplorerBaseGUI::setNodeOpen (   $a_id)

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

Parameters

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

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

375  {
376  if (!in_array($a_id, $this->custom_open_nodes)) {
377  $this->custom_open_nodes[] = $a_id;
378  }
379  }
+ 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 425 of file class.ilExplorerBaseGUI.php.

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

426  {
427  if (!in_array($a_id, $this->selected_nodes)) {
428  $this->selected_nodes[] = $a_id;
429  }
430  }
+ Here is the caller graph for this function:

◆ setOfflineMode()

ilExplorerBaseGUI::setOfflineMode (   $a_val)

Set offline mode.

Parameters
bool$a_valoffline mode

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

Referenced by ilKSDocumentationExplorerGUI\__construct().

438  {
439  $this->offline_mode = $a_val;
440  }
+ 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 353 of file class.ilExplorerBaseGUI.php.

Referenced by ilLMTOCExplorerGUI\__construct().

354  {
355  $this->sec_highl_nodes = $a_val;
356  }
+ 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 413 of file class.ilExplorerBaseGUI.php.

Referenced by ilTestQuestionPoolSelectorExplorer\__construct(), and ilForumMoveTopicsExplorer\__construct().

414  {
415  $this->select_postvar = $a_postvar;
416  $this->select_multi = $a_multi;
417  }
+ 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 195 of file class.ilExplorerBaseGUI.php.

Referenced by getHTML(), and renderChilds().

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

Field Documentation

◆ $ajax

ilExplorerBaseGUI::$ajax = false
protected

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

Referenced by getAjax().

◆ $ctrl

◆ $custom_open_nodes

ilExplorerBaseGUI::$custom_open_nodes = array()
protected

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

◆ $enable_dnd

ilExplorerBaseGUI::$enable_dnd = false
protected

Definition at line 42 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 34 of file class.ilExplorerBaseGUI.php.

◆ $js_tree_path

ilExplorerBaseGUI::$js_tree_path = "./libs/bower/bower_components/jstree/jquery.jstree.js"
staticprotected

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

◆ $log

ilExplorerBaseGUI::$log
protected

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

Referenced by closeNode(), and openNode().

◆ $nodeOnclickEnabled

ilExplorerBaseGUI::$nodeOnclickEnabled
private

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

Referenced by isNodeOnclickEnabled(), and setNodeOnclickEnabled().

◆ $offline_mode

ilExplorerBaseGUI::$offline_mode = false
protected

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

Referenced by getOfflineMode().

◆ $sec_highl_nodes

ilExplorerBaseGUI::$sec_highl_nodes = array()
protected

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

Referenced by getSecondaryHighlightedNodes().

◆ $select_postvar

ilExplorerBaseGUI::$select_postvar = ""
protected

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

Referenced by ilSkillSelectorGUI\getSelectedSkills().

◆ $selected_nodes

ilExplorerBaseGUI::$selected_nodes = array()
protected

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

◆ $skip_root_node

ilExplorerBaseGUI::$skip_root_node = false
protected

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

Referenced by getSkipRootNode().

◆ $tpl

ilExplorerBaseGUI::$tpl
protected

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