ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
Tree.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
4/* Copyright (c) 2019 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
5
7
10
14abstract class Tree implements ITree\Tree
15{
17
21 protected $environment;
22
26 protected $data;
27
31 protected $label;
32
36 protected $recursion;
37
41 protected $highlight_nodes_on_click = false;
42
43
44 public function __construct(string $label, ITree\TreeRecursion $recursion)
45 {
46 $this->label = $label;
47 $this->recursion = $recursion;
48 }
49
53 public function getLabel() : string
54 {
55 return $this->label;
56 }
57
61 public function withEnvironment($environment) : ITree\Tree
62 {
63 $clone = clone $this;
64 $clone->environment = $environment;
65 return $clone;
66 }
67
71 public function withData($data) : ITree\Tree
72 {
73 $clone = clone $this;
74 $clone->data = $data;
75 return $clone;
76 }
77
81 public function getEnvironment()
82 {
83 return $this->environment;
84 }
85
89 public function getData()
90 {
91 return $this->data;
92 }
93
97 public function getRecursion() : ITree\TreeRecursion
98 {
99 return $this->recursion;
100 }
101
102
106 public function withHighlightOnNodeClick(bool $highlight_nodes_on_click) : ITree\Tree
107 {
108 $clone = clone $this;
109 $clone->highlight_nodes_on_click = $highlight_nodes_on_click;
110 return $clone;
111 }
112
116 public function getHighlightOnNodeClick() : bool
117 {
118 return $this->highlight_nodes_on_click;
119 }
120}
An exception for terminatinating execution or to throw for unit testing.
getEnvironment()
Get the environment.
Definition: Tree.php:81
withHighlightOnNodeClick(bool $highlight_nodes_on_click)
Should a clicked node be highlighted?
Definition: Tree.php:106
withEnvironment($environment)
Configure the Tree with additional information that will be relayed to TreeRecursion.
Definition: Tree.php:61
__construct(string $label, ITree\TreeRecursion $recursion)
Definition: Tree.php:44
getHighlightOnNodeClick()
Is the tree configured to highlight a clicked node?
Definition: Tree.php:116
withData($data)
Apply data to the Tree.
Definition: Tree.php:71
getRecursion()
Get the mapping-class.
Definition: Tree.php:97
Interface for mapping data-structures to the Tree.
This describes a Tree Control.
Definition: Tree.php:14
trait ComponentHelper
Provides common functionality for component implementations.
$data
Definition: storeScorm.php:23