18        protected static $js_tree_path = 
"./Services/UIComponent/Explorer2/lib/jstree-v.pre1.0/jquery.jstree.js";
 
   19        protected static $js_expl_path = 
"./Services/UIComponent/Explorer2/js/Explorer2.js";
 
   31        public function __construct($a_expl_id, $a_parent_obj, $a_parent_cmd)
 
   33                $this->
id = $a_expl_id;
 
   34                $this->parent_obj = $a_parent_obj;
 
   35                $this->parent_cmd = $a_parent_cmd;
 
   38                include_once(
"./Services/Authentication/classes/class.ilSessionIStorage.php");
 
   40                $open_nodes = $this->store->get(
"on_".$this->
id);
 
   41                $this->open_nodes = unserialize($open_nodes);
 
   42                if (!is_array($this->open_nodes))
 
   44                        $this->open_nodes = array();
 
  145                foreach ($childs as $child)
 
  209                if ($this->select_postvar != 
"")
 
  273                $this->skip_root_node = $a_val;
 
  293                $this->ajax = $a_val;
 
  313                $this->sec_highl_nodes = $a_val;
 
  334                if (!in_array($a_id, $this->custom_open_nodes))
 
  336                        $this->custom_open_nodes[] = $a_id;
 
  348                return "$('#".$this->getContainerId().
"').jstree('toggle_node' , '#".
 
  361                $oc = 
"il.Explorer2.selectOnClick('".$dn_id.
"'); return false;";
 
  374                $this->select_postvar = $a_postvar;
 
  375                $this->select_multi = $a_multi;
 
  386                if (!in_array($a_id, $this->selected_nodes))
 
  388                        $this->selected_nodes[] = $a_id;
 
  399                $this->offline_mode = $a_val;
 
  423                if (
$_GET[
"exp_cmd"] != 
"" &&
 
  427                        if (in_array(
$cmd, array(
"openNode", 
"closeNode", 
"getNodeAsync")))
 
  445                return "il_expl2_jstree_cont_".$this->getId();
 
  456                if (!in_array($id, $this->open_nodes))
 
  458                        $this->open_nodes[] = $id;
 
  460                $this->store->set(
"on_".$this->
id, serialize($this->open_nodes));
 
  472                if (in_array($id, $this->open_nodes))
 
  474                        $k = array_search($id, $this->open_nodes);
 
  475                        unset($this->open_nodes[$k]);
 
  477                $this->store->set(
"on_".$this->
id, serialize($this->open_nodes));
 
  488                if (
$_GET[
"node_id"] != 
"")
 
  497                $etpl = 
new ilTemplate(
"tpl.explorer2.html", 
true, 
true, 
"Services/UIComponent/Explorer2");
 
  499                echo $etpl->get(
"tag");
 
  522                $container_outer_id = 
"il_expl2_jstree_cont_out_".$this->getId();
 
  526                foreach ($this->open_nodes as $nid)
 
  530                foreach ($this->custom_open_nodes as $nid)
 
  533                        if (!in_array($dnode, $open_nodes))
 
  535                                $open_nodes[] = $dnode;
 
  543                        if (is_object($this->parent_obj))
 
  545                                $url = 
$ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd, 
"", 
true);
 
  549                                $url = 
$ilCtrl->getLinkTargetByClass($this->parent_obj, $this->parent_cmd, 
"", 
true);
 
  555                foreach ($this->sec_highl_nodes as $sh)
 
  560                        "container_id" => $container_id,
 
  561                        "container_outer_id" => $container_outer_id,
 
  563                        "second_hnodes" => $shn,
 
  569                $js_tree_config = array(
 
  572                                "initially_open" => $open_nodes,
 
  573                                "open_parents" => 
false,
 
  574                                "strings" => array(
"loading" => 
"Loading ...", 
"new_node" => 
"New node")
 
  576                        "plugins" => array(
"html_data", 
"themes"),
 
  577                        "themes" => array(
"dots" => 
false, 
"icons" => 
false, 
"theme" => 
""),
 
  578                        "html_data" => array()
 
  581                return 'il.Explorer2.init('.json_encode($config).
', '.json_encode($js_tree_config).
');';
 
  592                include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
 
  595                $tpl->addJavascript(self::getLocalExplorerJsPath());
 
  596                $tpl->addJavascript(self::getLocalJsTreeJsPath());
 
  611                $container_outer_id = 
"il_expl2_jstree_cont_out_".$this->getId();
 
  615                $etpl = 
new ilTemplate(
"tpl.explorer2.html", 
true, 
true, 
"Services/UIComponent/Explorer2");
 
  632                        foreach ($childs as $child_node)
 
  650                $etpl->setVariable(
"CONTAINER_ID", $container_id);
 
  651                $etpl->setVariable(
"CONTAINER_OUTER_ID", $container_outer_id);
 
  669                        if ($this->select_multi)
 
  671                                $tpl->setCurrentBlock(
"cb");
 
  672                                if (in_array($this->
getNodeId($a_node), $this->selected_nodes))
 
  674                                        $tpl->setVariable(
"CHECKED", 
'checked="checked"');
 
  677                                $tpl->setVariable(
"CB_NAME", $this->select_postvar.
"[]");
 
  678                                $tpl->parseCurrentBlock();
 
  682                                $tpl->setCurrentBlock(
"rd");
 
  683                                if (in_array($this->
getNodeId($a_node), $this->selected_nodes))
 
  685                                        $tpl->setVariable(
"SELECTED", 
'checked="checked"');
 
  688                                $tpl->setVariable(
"RD_NAME", $this->select_postvar);
 
  689                                $tpl->parseCurrentBlock();
 
  696                        $tpl->touchBlock(
"hl");
 
  698                $tpl->setCurrentBlock(
"content");
 
  708                        $tpl->setVariable(
"TARGET", 
'target="'.$target.
'"');
 
  712                        $tpl->setVariable(
"ONCLICK", 
'onclick="return false;"');
 
  713                        $tpl->setVariable(
"A_CLASS", 
'class="disabled"');
 
  720                                $tpl->setVariable(
"ONCLICK", 
'onclick="'.$onclick.
'"');
 
  723                $tpl->parseCurrentBlock();
 
  725                $tpl->touchBlock(
"tag");
 
  727                if (!$this->
getAjax() || in_array($this->
getNodeId($a_node), $this->open_nodes)
 
  728                        || in_array($this->
getNodeId($a_node), $this->custom_open_nodes))
 
  745                $childs = $this->
sortChilds($childs, $a_node_id);
 
  747                if (count($childs) > 0)
 
  750                        foreach ($childs as $child)
 
  777                return "exp_node_".$this->getId().
"_".$a_node_id;
 
  788                $i = strlen(
"exp_node_".$this->
getId().
"_");
 
  789                return substr($a_dom_node_id, $i);
 
  800                $tpl->setCurrentBlock(
"list_item_start");
 
  803                        $tpl->touchBlock(
"li_closed");
 
  805                $tpl->setVariable(
"DOM_NODE_ID",
 
  807                $tpl->parseCurrentBlock();
 
  808                $tpl->touchBlock(
"tag");
 
  819                $tpl->touchBlock(
"list_item_end");
 
  820                $tpl->touchBlock(
"tag");
 
  831                $tpl->touchBlock(
"list_start");
 
  832                $tpl->touchBlock(
"tag");
 
  843                $tpl->touchBlock(
"list_end");
 
  844                $tpl->touchBlock(
"tag");
 
setNodeSelected($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour)
getNodeIcon($a_node)
Get node icon path.
getNodeContent($a_node)
Get content of a node.
getId()
Get id of explorer element.
getContainerId()
Get container id.
getNodeIconAlt($a_node)
Get node icon alt attribute.
getNodeAsync()
Get node asynchronously.
getNodeOnClick($a_node)
Get node onclick attribute.
setSecondaryHighlightedNodes($a_val)
Set secondary (background) highlighted nodes.
beforeRendering()
Before rendering.
getOnLoadCode()
Get on load code.
renderChilds($a_node_id, $tpl)
Render childs.
static getLocalExplorerJsPath()
Get local path of explorer js.
renderNode($a_node, $tpl)
Render node.
getChildsOfNode($a_parent_node_id)
Get childs of node.
isNodeClickable($a_node)
Is node clickable?
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
getNodeTarget($a_node)
Get node target (frame) attribute.
getNodeIdForDomNodeId($a_dom_node_id)
Get node id for dom node id.
static getLocalJsTreeJsPath()
Get local path of jsTree js.
handleCommand()
Handle explorer internal command.
nodeHasVisibleChilds($a_node)
Node has childs?
getSecondaryHighlightedNodes()
Get secondary (background) highlighted nodes.
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
getNodeId($a_node)
Get id of a node.
getSkipRootNode()
Get skip root node.
getNodeToggleOnClick($a_node)
Get onclick attribute for node toggling.
getOfflineMode()
Get offline mode.
setSkipRootNode($a_val)
Set skip root node.
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour)
__construct($a_expl_id, $a_parent_obj, $a_parent_cmd)
Constructor.
getNodeHref($a_node)
Get href for node.
isNodeHighlighted($a_node)
Is node highlighted?
static createHTMLExportDirs($a_target_dir)
Create html export directories.
listItemEnd($tpl)
List item end.
setSelectMode($a_postvar, $a_multi=false)
Set select mode (to deactivate, pass an empty string as postvar)
listStart($tpl)
List start.
getRootNode()
Get root node.
setOfflineMode($a_val)
Set offline mode.
isNodeVisible($a_node)
Is node visible?
getSelectOnClick($a_node)
Get onclick attribute for selecting radio/checkbox.
listItemStart($tpl, $a_node)
List item start.
Session based immediate storage.
special template class to simplify handling of ITX/PEAR
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static initjQuery($a_tpl=null)
Init jQuery.