ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Tree.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\UI\Implementation\Component\ComponentHelper;
25
29abstract class Tree implements ITree\Tree
30{
31 use ComponentHelper;
32
36 protected $environment;
37
41 protected $data;
42
43 protected string $label;
45 protected bool $highlight_nodes_on_click = false;
46 protected bool $is_sub = false;
47
48
49 public function __construct(string $label, ITree\TreeRecursion $recursion)
50 {
51 $this->label = $label;
52 $this->recursion = $recursion;
53 }
54
58 public function getLabel(): string
59 {
60 return $this->label;
61 }
62
66 public function withEnvironment($environment): ITree\Tree
67 {
68 $clone = clone $this;
69 $clone->environment = $environment;
70 return $clone;
71 }
72
76 public function withData($data): ITree\Tree
77 {
78 $clone = clone $this;
79 $clone->data = $data;
80 return $clone;
81 }
82
86 public function getEnvironment()
87 {
88 return $this->environment;
89 }
90
94 public function getData()
95 {
96 return $this->data;
97 }
98
103 {
104 return $this->recursion;
105 }
106
110 public function withHighlightOnNodeClick(bool $highlight_nodes_on_click): ITree\Tree
111 {
112 $clone = clone $this;
113 $clone->highlight_nodes_on_click = $highlight_nodes_on_click;
114 return $clone;
115 }
116
120 public function getHighlightOnNodeClick(): bool
121 {
122 return $this->highlight_nodes_on_click;
123 }
124
128 public function isSubTree(): bool
129 {
130 return $this->is_sub;
131 }
132
136 public function withIsSubTree(bool $is_sub): ITree\Tree
137 {
138 $clone = clone $this;
139 $clone->is_sub = $is_sub;
140 return $clone;
141 }
142}
getEnvironment()
Get the environment.
Definition: Tree.php:86
withIsSubTree(bool $is_sub)
Set this tree to be a part of a tree.Needed if parts are loaded async.
Definition: Tree.php:136
withHighlightOnNodeClick(bool $highlight_nodes_on_click)
Should a clicked node be highlighted?
Definition: Tree.php:110
withEnvironment($environment)
Configure the Tree with additional information that will be relayed to TreeRecursion.
Definition: Tree.php:66
__construct(string $label, ITree\TreeRecursion $recursion)
Definition: Tree.php:49
getHighlightOnNodeClick()
Is the tree configured to highlight a clicked node?
Definition: Tree.php:120
isSubTree()
Is this only a part of a tree? Needed if parts are loaded async.
Definition: Tree.php:128
withData($data)
Apply data to the Tree.
Definition: Tree.php:76
getRecursion()
Get the mapping-class.
Definition: Tree.php:102
Interface for mapping data-structures to the Tree.
This describes a Tree Control.
Definition: Tree.php:29