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";
34 public function __construct($a_expl_id, $a_parent_obj, $a_parent_cmd)
36 $this->
id = $a_expl_id;
37 $this->parent_obj = $a_parent_obj;
38 $this->parent_cmd = $a_parent_cmd;
41 include_once(
"./Services/Authentication/classes/class.ilSessionIStorage.php");
43 $open_nodes = $this->store->get(
"on_".$this->
id);
44 $this->open_nodes = unserialize($open_nodes);
45 if (!is_array($this->open_nodes))
47 $this->open_nodes =
array();
50 $this->nodeOnclickEnabled =
true;
58 return self::$js_expl_path;
66 return self::$js_tree_path;
149 foreach ($childs as $child)
213 if ($this->select_postvar !=
"")
288 $this->skip_root_node = $a_val;
308 $this->ajax = $a_val;
328 $this->sec_highl_nodes = $a_val;
349 if (!in_array($a_id, $this->custom_open_nodes))
351 $this->custom_open_nodes[] = $a_id;
363 return "$('#".$this->getContainerId().
"').jstree('toggle_node' , '#".
376 $oc =
"il.Explorer2.selectOnClick('".$dn_id.
"'); return false;";
389 $this->select_postvar = $a_postvar;
390 $this->select_multi = $a_multi;
401 if (!in_array($a_id, $this->selected_nodes))
403 $this->selected_nodes[] = $a_id;
414 $this->offline_mode = $a_val;
438 if (
$_GET[
"exp_cmd"] !=
"" &&
442 if (in_array(
$cmd,
array(
"openNode",
"closeNode",
"getNodeAsync")))
460 return "il_expl2_jstree_cont_".$this->getId();
471 if (!in_array($id, $this->open_nodes))
473 $this->open_nodes[] = $id;
475 $this->store->set(
"on_".$this->
id, serialize($this->open_nodes));
487 if (in_array($id, $this->open_nodes))
489 $k = array_search($id, $this->open_nodes);
490 unset($this->open_nodes[$k]);
492 $this->store->set(
"on_".$this->
id, serialize($this->open_nodes));
503 if (
$_GET[
"node_id"] !=
"")
512 $etpl =
new ilTemplate(
"tpl.explorer2.html",
true,
true,
"Services/UIComponent/Explorer2");
514 echo $etpl->get(
"tag");
537 $container_outer_id =
"il_expl2_jstree_cont_out_".$this->getId();
541 foreach ($this->open_nodes as $nid)
545 foreach ($this->custom_open_nodes as $nid)
548 if (!in_array($dnode, $open_nodes))
550 $open_nodes[] = $dnode;
558 if (is_object($this->parent_obj))
560 $url = $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd,
"",
true);
564 $url = $ilCtrl->getLinkTargetByClass($this->parent_obj, $this->parent_cmd,
"",
true);
570 foreach ($this->sec_highl_nodes as $sh)
575 "container_id" => $container_id,
576 "container_outer_id" => $container_outer_id,
578 "second_hnodes" => $shn,
584 $js_tree_config =
array(
587 "initially_open" => $open_nodes,
588 "open_parents" =>
false,
589 "strings" =>
array(
"loading" =>
"Loading ...",
"new_node" =>
"New node")
592 "themes" =>
array(
"dots" =>
false,
"icons" =>
false,
"theme" =>
""),
593 "html_data" =>
array()
596 return 'il.Explorer2.init('.json_encode(
$config).
', '.json_encode($js_tree_config).
');';
600 $plugins =
array(
"html_data",
"themes",
"json_data");
616 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
619 $tpl->addJavascript(self::getLocalExplorerJsPath());
620 $tpl->addJavascript(self::getLocalJsTreeJsPath());
635 $container_outer_id =
"il_expl2_jstree_cont_out_".$this->getId();
637 if (!$ilCtrl->isAsynch())
642 $etpl =
new ilTemplate(
"tpl.explorer2.html",
true,
true,
"Services/UIComponent/Explorer2");
659 foreach ($childs as $child_node)
677 $etpl->setVariable(
"CONTAINER_ID", $container_id);
678 $etpl->setVariable(
"CONTAINER_OUTER_ID", $container_outer_id);
681 if ($ilCtrl->isAsynch())
683 $add =
"<script>".$this->getOnLoadCode().
"</script>";
686 return $etpl->get().$add;
702 if ($this->select_multi)
704 $tpl->setCurrentBlock(
"cb");
705 if (in_array($this->
getNodeId($a_node), $this->selected_nodes))
707 $tpl->setVariable(
"CHECKED",
'checked="checked"');
710 $tpl->setVariable(
"CB_NAME", $this->select_postvar.
"[]");
711 $tpl->parseCurrentBlock();
715 $tpl->setCurrentBlock(
"rd");
716 if (in_array($this->
getNodeId($a_node), $this->selected_nodes))
718 $tpl->setVariable(
"SELECTED",
'checked="checked"');
721 $tpl->setVariable(
"RD_NAME", $this->select_postvar);
722 $tpl->parseCurrentBlock();
729 $tpl->touchBlock(
"hl");
731 $tpl->setCurrentBlock(
"content");
741 $targetRelatedParams =
array(
746 $targetRelatedParams[] =
'rel="noopener"';
749 $tpl->setVariable(
'TARGET', implode(
' ', $targetRelatedParams));
753 $tpl->setVariable(
"ONCLICK",
'onclick="return false;"');
754 $tpl->setVariable(
"A_CLASS",
'class="disabled"');
761 $tpl->setVariable(
"ONCLICK",
'onclick="'.$onclick.
'"');
764 $tpl->parseCurrentBlock();
766 $tpl->touchBlock(
"tag");
768 if (!$this->
getAjax() || in_array($this->
getNodeId($a_node), $this->open_nodes)
769 || in_array($this->
getNodeId($a_node), $this->custom_open_nodes))
786 $childs = $this->
sortChilds($childs, $a_node_id);
788 if (count($childs) > 0)
791 foreach ($childs as $child)
818 return "exp_node_".$this->getId().
"_".$a_node_id;
829 $i = strlen(
"exp_node_".$this->
getId().
"_");
830 return substr($a_dom_node_id, $i);
841 $tpl->setCurrentBlock(
"list_item_start");
844 $tpl->touchBlock(
"li_closed");
846 $tpl->setVariable(
"DOM_NODE_ID",
848 $tpl->parseCurrentBlock();
849 $tpl->touchBlock(
"tag");
860 $tpl->touchBlock(
"list_item_end");
861 $tpl->touchBlock(
"tag");
872 $tpl->touchBlock(
"list_start");
873 $tpl->touchBlock(
"tag");
884 $tpl->touchBlock(
"list_end");
885 $tpl->touchBlock(
"tag");
static makeDirParents($a_dir)
Create a new directory and all parent directories.
setOfflineMode($a_val)
Set offline mode.
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.
setSkipRootNode($a_val)
Set skip root node.
setSelectMode($a_postvar, $a_multi=false)
Set select mode (to deactivate, pass an empty string as postvar)
getNodeToggleOnClick($a_node)
Get onclick attribute for node toggling.
__construct($a_expl_id, $a_parent_obj, $a_parent_cmd)
Constructor.
renderNode($a_node, $tpl)
Render node.
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
isNodeSelectable($a_node)
Is node selectable?
isNodeHighlighted($a_node)
Is node highlighted?
isNodeVisible($a_node)
Is node visible?
handleCommand()
Handle explorer internal command.
setSecondaryHighlightedNodes($a_val)
Set secondary (background) highlighted nodes.
static getLocalJsTreeJsPath()
Get local path of jsTree js.
sortChilds($a_childs, $a_parent_node_id)
Sort childs.
getSkipRootNode()
Get skip root node.
setNodeSelected($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
setEnableDnd($enable_dnd)
Enable Drag & Drop functionality.
getSecondaryHighlightedNodes()
Get secondary (background) highlighted nodes.
static createHTMLExportDirs($a_target_dir)
Create html export directories.
getOnLoadCode()
Get on load code.
getRootNode()
Get root node.
static getLocalExplorerJsPath()
Get local path of explorer js.
getNodeId($a_node)
Get id of a node.
special template class to simplify handling of ITX/PEAR
beforeRendering()
Before rendering.
getNodeAsync()
Get node asynchronously.
Create styles array
The data for the language used.
getOfflineMode()
Get offline mode.
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.
listStart($tpl)
List start.
getSelectOnClick($a_node)
Get onclick attribute for selecting radio/checkbox.
getNodeTarget($a_node)
Get node target (frame) attribute.
getChildsOfNode($a_parent_node_id)
Get childs of node.
Session based immediate storage.
static initjQuery($a_tpl=null)
Init jQuery.
listItemStart($tpl, $a_node)
List item start.
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
nodeHasVisibleChilds($a_node)
Node has childs?
listItemEnd($tpl)
List item end.
setNodeOnclickEnabled($nodeOnclickEnabled)
getNodeIdForDomNodeId($a_dom_node_id)
Get node id for dom node id.
getNodeHref($a_node)
Get href for node.
getId()
Get id of explorer element.
getContainerId()
Get container id.