4 include_once(
"./Services/UIComponent/Explorer2/classes/class.ilExplorerBaseGUI.php");
42 public function __construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree)
46 $this->httpRequest = $DIC->http()->request();
47 $this->
ui = $DIC->ui();
48 $this->lng = $DIC->language();
50 $this->tree = $a_tree;
70 $this->order_field = $a_val;
71 $this->order_field_numeric = $a_numeric;
91 $this->type_white_list = $a_val;
111 $this->type_black_list = $a_val;
131 $this->preload_childs = $a_val;
149 $subtree = $this->tree->getSubTree($this->
getRootNode());
150 foreach ($subtree as $s) {
152 if (is_array($wl) && count($wl) > 0 && !in_array($s[
"type"], $wl)) {
156 if (is_array($bl) && count($bl) > 0 && in_array($s[
"type"], $bl)) {
159 $this->childs[$s[
"parent"]][] = $s;
160 $this->all_childs[$s[
"child"]] = $s;
163 if ($this->order_field !=
"") {
164 foreach ($this->childs as $k =>
$childs) {
170 if ($this->order_field ==
"") {
174 foreach ($this->all_childs as $k =>
$c) {
176 $this->all_childs[$prev][
"next_node_id"] = $k;
178 $this->all_childs[$k][
"prev_node_id"] = $prev;
179 $this->all_childs[$k][
"next_node_id"] =
false;
184 $this->preloaded =
true;
198 if ($this->order_field !=
"") {
199 die(
"ilTreeExplorerGUI::getSuccessorNode not implemented for order field " . $this->order_field);
202 if ($this->preloaded) {
203 $next_id = $a_node_id;
204 while (($next_id = $this->all_childs[$next_id][
"next_node_id"]) &&
$a_type !=
"" &&
205 $this->all_childs[$next_id][
"type"] !=
$a_type);
207 return $this->all_childs[$next_id];
225 if (is_array($this->childs[$a_parent_node_id])) {
226 return $this->childs[$a_parent_node_id];
232 if (is_array($wl) && count($wl) > 0) {
240 if (is_array($bl) && count($bl) > 0) {
241 $bl_childs = array();
253 $final_childs[$k] =
$c;
257 return $final_childs;
284 return $a_node[
"child"];
297 return $lng->txt(
"icon") .
" " .
$lng->txt(
"obj_" . $a_node[
"type"]);
307 if (!isset($this->root_node_data)) {
315 $this->root_id = $a_root;
320 return $this->root_id
322 : $this->
getTree()->readRootId();
332 $path = $this->
getTree()->getPathId($a_id);
333 foreach ($path as $id) {
349 return parent::getHTML();
374 if (is_string($nodeIconPath) && strlen($nodeIconPath) > 0) {
407 if (is_string($href) && strlen($href) > 0 &&
'#' !== $href) {
412 $node = $node->withExpanded(
true);
416 $cmdClass = end($nodeStateToggleCmdClasses);
418 if (is_string($cmdClass) && strlen($cmdClass) > 0) {
419 $node = $node->withAdditionalOnLoadCode(
function ($id) use ($record, $nodeStateToggleCmdClasses, $cmdClass) {
420 $serverNodeId = $this->
getNodeId($record);
422 $this->ctrl->setParameterByClass($cmdClass,
'node_id', $serverNodeId);
423 $url = $this->ctrl->getLinkTargetByClass($nodeStateToggleCmdClasses,
'toggleExplorerNodeState',
'',
true,
false);
424 $this->ctrl->setParameterByClass($cmdClass,
'node_id', null);
426 $javascript =
"$('#$id').on('click', function(event) { 429 if (node.hasClass('expandable')) { 430 il.UI.tree.toggleNodeState(event, '$url', 'prior_state', node.hasClass('expanded')); 431 event.preventDefault(); 432 event.stopPropagation(); 458 $f = $this->
ui->factory();
470 $tree =
$f->tree()->expandable($label, $this)
472 ->withHighlightOnNodeClick(
true);
482 $nodeId = (int) ($this->httpRequest->getQueryParams()[
'node_id'] ?? 0);
483 $priorState = (int) ($this->httpRequest->getQueryParams()[
'prior_state'] ?? 0);
486 if (0 === $priorState && !in_array($nodeId, $this->open_nodes)) {
487 $this->open_nodes[] = $nodeId;
488 } elseif (1 === $priorState && in_array($nodeId, $this->open_nodes)) {
489 $key = array_search($nodeId, $this->open_nodes);
490 unset($this->open_nodes[$key]);
493 $this->store->set(
'on_' . $this->
id, serialize($this->open_nodes));
505 $r = $this->
ui->renderer();
getSuccessorNode($a_node_id, $a_type="")
Get successor node (currently only(!) based on lft/rgt tree values)
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
preloadChilds()
Preload childs.
getPreloadChilds()
Get preload childs.
__construct($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree)
Constructor.
getTypeBlackList()
Get type black list.
build(\ILIAS\UI\Component\Tree\Node\Factory $factory, $record, $environment=null)
Class ChatMainBarProvider .
getNodeIcon($a_node)
Get node icon path.
matches($node)
Does a node match a search term (or is search term empty)
getSearchTerm()
Get search term.
setPathOpen($a_id)
Set node path to be opened.
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
setTypeWhiteList($a_val)
Set type white list.
setPreloadChilds($a_val)
Set preload childs.
setTypeBlackList($a_val)
Set type black list.
getNodeIconAlt($a_node)
Get node icon alt attribute.
createNode(\ILIAS\UI\Component\Tree\Node\Factory $factory, $record)
Creates at tree node, can be overwritten in derivatives if another node type should be used...
getNodeId($a_node)
Get id for node.
getNodeContent($a_node)
Get content of a node.
getRootNode()
Get root node.
getNodeStateToggleCmdClasses($record)
Should return an array of ilCtrl-enabled command classes which should be used to build the URL for th...
getOrderField()
Get order field.
Explorer class that works on tree objects (Services/Tree)
__construct(Container $dic, ilPlugin $plugin)
Interface for mapping data-structures to the Tree.
toggleExplorerNodeState()
Should be called by an ilCtrl-enabled command class if a tree node toggle action should be processed...
setOrderField($a_val, $a_numeric=false)
Set order field.
getHTML($new=false)
Get HTML.
getChildren($node, $environment=null)
Get a list of records (that list can also be empty).Each record will be relayed to $this->build to re...
isNodeOpen($node_id)
Get all open nodes.
getDomNodeIdForNodeId($a_node_id)
Get DOM node id for node id.
getChildsOfNode($a_parent_node_id)
Get childs of node.
getNodeHref($a_node)
Get href for node.
getTreeComponent()
Get Tree UI.
getTypeWhiteList()
Get type white list.