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.

Reimplemented in ilForumExplorerGUI, ilVirtualSkillTreeExplorerGUI, ilLinkTargetObjectExplorerGUI, ilPublicSectionExplorerGUI, ilMediaPoolExplorerGUI, ilGroupActionTargetExplorerGUI, ilMaterialExplorer, ilSCORM2004EditorExplorerGUI, ilMailExplorer, ilBookmarkBlockExplorerGUI, ilBookmarkExplorerGUI, ilBookmarkMoveExplorerGUI, and ilTestQuestionPoolSelectorExplorer.

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

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 }
Session based immediate storage.
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ beforeRendering()

ilExplorerBaseGUI::beforeRendering ( )

Before rendering.

Reimplemented in ilLMExplorerGUI, and ilPublicSectionExplorerGUI.

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

540 {
541 }

Referenced by getHTML(), and getNodeAsync().

+ Here is the caller graph for this function:

◆ closeNode()

ilExplorerBaseGUI::closeNode ( )

Close node.

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

505 {
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"]
getNodeIdForDomNodeId($a_dom_node_id)
Get node id for dom node id.
if(!array_key_exists('StateId', $_REQUEST)) $id

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

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

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.

References ilUtil\makeDirParents().

Referenced by ilObjContentObject\exportHTML().

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

344 {
345 return $this->ajax;
346 }

References $ajax.

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

+ Here is the caller graph for this function:

◆ getChildsOfNode()

ilExplorerBaseGUI::getChildsOfNode (   $a_parent_node_id)
abstract

◆ getContainerId()

ilExplorerBaseGUI::getContainerId ( )

Get container id.

Parameters

return

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

482 {
483 return "il_expl2_jstree_cont_" . $this->getId();
484 }
getId()
Get id of explorer element.

References getId().

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

+ 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

return

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

811 {
812 return "exp_node_" . $this->getId() . "_" . $a_node_id;
813 }

References getId().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilExplorerBaseGUI::getHTML ( )

Get HTML.

Reimplemented in ilForumExplorerGUI, ilObjStudyProgrammeTreeExplorerGUI, and ilTreeExplorerGUI.

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

644 {
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
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 }
getContainerId()
Get container id.
static init($a_main_tpl=null)
Init JS.
beforeRendering()
Before rendering.
getOnLoadCode()
Get on load code.
renderNode($a_node, $tpl)
Render node.
getChildsOfNode($a_parent_node_id)
Get childs of node.
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
getNodeId($a_node)
Get id of a node.
getSkipRootNode()
Get skip root node.
getRootNode()
Get root node.
isNodeVisible($a_node)
Is node visible?
special template class to simplify handling of ITX/PEAR
global $ilCtrl
Definition: ilias.php:18

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

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

302 {
303 return $this->id;
304 }

References $id.

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

+ Here is the caller graph for this function:

◆ getJSTreePlugins()

ilExplorerBaseGUI::getJSTreePlugins ( )
protected

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

609 {
610 $plugins = array("html_data", "themes", "json_data");
611 if ($this->isEnableDnd()) {
612 $plugins[] = "crrm";
613 $plugins[] = "dnd";
614 }
615 return $plugins;
616 }

References isEnableDnd().

Referenced by getOnLoadCode().

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

87 {
89 }

References $js_expl_path.

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

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

95 {
97 }

References $js_tree_path.

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

+ Here is the caller graph for this function:

◆ getNodeAsync()

ilExplorerBaseGUI::getNodeAsync ( )

Get node asynchronously.

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

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 }
renderChilds($a_node_id, $tpl)
Render childs.

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

+ Here is the call graph for this function:

◆ getNodeContent()

◆ getNodeHref()

◆ getNodeIcon()

◆ getNodeIconAlt()

ilExplorerBaseGUI::getNodeIconAlt (   $a_node)

Get node icon alt attribute.

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

Reimplemented in ilLMEditorExplorerGUI, ilLMTOCExplorerGUI, ilSCORM2004EditorExplorerGUI, ilAdministrationExplorerGUI, ilBookmarkExplorerGUI, ilMailExplorer, ilRepositoryExplorerGUI, ilRepositorySelectorExplorerGUI, and ilTreeExplorerGUI.

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

218 {
219 return "";
220 }

Referenced by renderNode().

+ 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

Reimplemented in ilForumExplorerGUI, ilObjStudyProgrammeTreeExplorerGUI, ilVirtualSkillTreeExplorerGUI, ilTreeExplorerGUI, and ilKSDocumentationExplorerGUI.

Referenced by 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

return

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

822 {
823 $i = strlen("exp_node_" . $this->getId() . "_");
824 return substr($a_dom_node_id, $i);
825 }
$i
Definition: disco.tpl.php:19

References $i, and getId().

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

+ 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

Reimplemented in ilGroupActionTargetExplorerGUI, ilBookmarkBlockExplorerGUI, ilIntLinkRepItemExplorerGUI, ilLinkTargetObjectExplorerGUI, and ilTaxonomyExplorerGUI.

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

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.

References getSelectOnClick().

Referenced by renderNode().

+ 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

Reimplemented in ilBookmarkBlockExplorerGUI.

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

229 {
230 return "";
231 }

Referenced by renderNode().

+ Here is the caller graph for this function:

◆ getNodeToggleOnClick()

ilExplorerBaseGUI::getNodeToggleOnClick (   $a_node)
finalprotected

Get onclick attribute for node toggling.

Parameters

return

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

388 {
389 return "$('#" . $this->getContainerId() . "').jstree('toggle_node' , '#" .
390 $this->getDomNodeIdForNodeId($this->getNodeId($a_node)) . "'); return false;";
391 }
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.

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

Referenced by ilBookmarkBlockExplorerGUI\getNodeOnClick().

+ 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

return

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

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 }
getOfflineMode()
Get offline mode.
$url

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

Referenced by getHTML().

+ 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

Reimplemented in ilForumExplorerGUI, ilLMTOCExplorerGUI, ilOrgUnitExplorerGUI, ilObjStudyProgrammeTreeExplorerGUI, ilRepositoryExplorerGUI, ilSkillTemplateTreeExplorerGUI, ilVirtualSkillTreeExplorerGUI, ilKSDocumentationExplorerGUI, and ilTreeExplorerGUI.

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

◆ getSelectOnClick()

ilExplorerBaseGUI::getSelectOnClick (   $a_node)
finalprotected

Get onclick attribute for selecting radio/checkbox.

Parameters

return

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

400 {
401 $dn_id = $this->getDomNodeIdForNodeId($this->getNodeId($a_node));
402 $oc = "il.Explorer2.selectOnClick('" . $dn_id . "'); return false;";
403 return $oc;
404 }

References getDomNodeIdForNodeId(), and getNodeId().

Referenced by getNodeOnClick().

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

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

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 }

References $_GET, and getContainerId().

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

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 }
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template

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

Referenced by getHTML(), and ilInternalLinkGUI\getInitHTML().

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

+ Here is the caller graph for this function:

◆ isNodeClickable()

◆ isNodeHighlighted()

ilExplorerBaseGUI::isNodeHighlighted (   $a_node)

◆ isNodeOnclickEnabled()

ilExplorerBaseGUI::isNodeOnclickEnabled ( )
Returns
boolean

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

References $nodeOnclickEnabled.

Referenced by renderNode().

+ 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

Reimplemented in ilForumMoveTopicsExplorer, ilWorkspaceExplorerGUI, ilRepositorySelectorExplorerGUI, and ilSkillSelectorGUI.

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

287 {
288 return true;
289 }

Referenced by renderNode().

+ 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

Reimplemented in ilForumMoveTopicsExplorer, ilLMTOCExplorerGUI, ilConditionSelector, ilAdministrationExplorerGUI, ilPoolSelectorGUI, ilRepositoryExplorerGUI, ilRepositorySelectorExplorerGUI, and ilTestQuestionPoolSelectorExplorer.

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

254 {
255 return true;
256 }

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

+ Here is the caller graph for this function:

◆ listEnd()

ilExplorerBaseGUI::listEnd (   $tpl)

List end.

Parameters

return

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

878 {
879 $tpl->touchBlock("list_end");
880 $tpl->touchBlock("tag");
881 }

References $tpl.

Referenced by getHTML(), and renderChilds().

+ Here is the caller graph for this function:

◆ listItemEnd()

ilExplorerBaseGUI::listItemEnd (   $tpl)

List item end.

Parameters

return

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

854 {
855 $tpl->touchBlock("list_item_end");
856 $tpl->touchBlock("tag");
857 }

References $tpl.

Referenced by renderNode().

+ Here is the caller graph for this function:

◆ listItemStart()

ilExplorerBaseGUI::listItemStart (   $tpl,
  $a_node 
)

List item start.

Parameters

return

Reimplemented in ilObjStudyProgrammeTreeExplorerGUI.

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

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 }
nodeHasVisibleChilds($a_node)
Node has childs?

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

Referenced by renderNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listStart()

ilExplorerBaseGUI::listStart (   $tpl)

List start.

Parameters

return

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

866 {
867 $tpl->touchBlock("list_start");
868 $tpl->touchBlock("tag");
869 }

References $tpl.

Referenced by getHTML(), and renderChilds().

+ 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

return

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

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 }

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

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

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

490 {
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 }

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

+ Here is the call graph for this function:

◆ renderChilds()

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

Render childs.

Parameters

return

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

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 }

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

Referenced by getNodeAsync(), and renderNode().

+ 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

return

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

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 }
getNodeIcon($a_node)
Get node icon path.
getNodeContent($a_node)
Get content of a node.
isNodeSelectable($a_node)
Is node selectable?
getNodeIconAlt($a_node)
Get node icon alt attribute.
getNodeOnClick($a_node)
Get node onclick attribute.
isNodeClickable($a_node)
Is node clickable?
getNodeTarget($a_node)
Get node target (frame) attribute.
getNodeHref($a_node)
Get href for node.
isNodeHighlighted($a_node)
Is node highlighted?
listItemEnd($tpl)
List item end.
listItemStart($tpl, $a_node)
List item start.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.

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

Referenced by getHTML(), and renderChilds().

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

909 {
910 $this->enable_dnd = $enable_dnd;
911 }

References $enable_dnd.

Referenced by ilObjStudyProgrammeTreeExplorerGUI\__construct().

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

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

References $nodeOnclickEnabled.

◆ setNodeOpen()

ilExplorerBaseGUI::setNodeOpen (   $a_id)

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

Parameters

return

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

375 {
376 if (!in_array($a_id, $this->custom_open_nodes)) {
377 $this->custom_open_nodes[] = $a_id;
378 }
379 }

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

+ 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

return

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

426 {
427 if (!in_array($a_id, $this->selected_nodes)) {
428 $this->selected_nodes[] = $a_id;
429 }
430 }

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

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

438 {
439 $this->offline_mode = $a_val;
440 }

Referenced by ilKSDocumentationExplorerGUI\__construct().

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

354 {
355 $this->sec_highl_nodes = $a_val;
356 }

Referenced by ilLMTOCExplorerGUI\__construct().

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

414 {
415 $this->select_postvar = $a_postvar;
416 $this->select_multi = $a_multi;
417 }

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

+ 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

Reimplemented in ilOrgUnitExplorerGUI, ilAdministrationExplorerGUI, ilRepositoryExplorerGUI, and ilRepositorySelectorExplorerGUI.

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

196 {
197 return $a_childs;
198 }

Referenced by getHTML(), and renderChilds().

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

Referenced by getLocalExplorerJsPath().

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

Referenced by getLocalJsTreeJsPath().

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