3 declare(strict_types=1);
13 protected $id =
'ls_toc';
26 $this->ctrl = $il_ctrl;
34 $clone->structure = $clone->addIds(
35 json_decode($json_structure,
true)
37 $clone->buildLookup($clone->structure);
38 $clone->open_nodes = array_keys($clone->nodes);
43 protected function addIds(array $node) : array
47 if (array_key_exists(
'childs', $node)) {
48 foreach ($node[
'childs'] as $idx => $child) {
49 $node[
'childs'][$idx] = $this->
addIds($child);
57 $this->nodes[$node[
'_id']] = $node;
58 if (array_key_exists(
'childs', $node)) {
59 foreach ($node[
'childs'] as $child) {
70 return reset($this->nodes);
78 $parent_node = $this->nodes[$a_parent_node_id];
79 return $parent_node[
'childs'];
87 return $a_node[
'label'];
95 return $a_node[
'_id'];
103 return $this->url_builder->getHref($a_node[
'command'], $a_node[
'parameter']);
111 return !is_null($a_node[
'parameter']);
This class provides processing control methods.
__construct(LSUrlBuilder $url_builder, ilCtrl $il_ctrl)
setSkipRootNode($a_val)
Set skip root node.
getChildsOfNode($a_parent_node_id)
setNodeOnclickEnabled($nodeOnclickEnabled)
withStructure(string $json_structure)