ILIAS  release_8 Revision v8.24
TopParentItemDrilldownRenderer.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
32
38{
40 {
41 $entries = [];
42 foreach ($item->getChildren() as $child) {
43 if (!$child->isVisible()) {
44 continue;
45 }
46 $component = $this->buildEntry($child, $item);
47 if ($component === null) {
48 continue;
49 }
50 $entries[] = $component;
51 }
52
53 $dd = $this->ui_factory->menu()->drilldown($item->getTitle(), $entries);
54
55 return $this->ui_factory->mainControls()->slate()->drilldown(
56 $item->getTitle(),
57 $this->getStandardSymbol($item),
58 $dd
59 );
60 }
61
62 protected function buildEntry(AbstractChildItem $item, isTopItem $parent): ?Component
63 {
64 $title = $item->getTitle();
65 $symbol = $this->getStandardSymbol($item);
66 $type = get_class($item);
67
68 switch ($type) {
69 case RepositoryLink::class:
70 case Link::class:
71 $act = $this->getDataFactory()->uri(
72 $this->getBaseURL()
73 . '/'
74 . $item->getAction()
75 );
76 $entry = $this->ui_factory->link()->bulky($symbol, $title, $act);
77 break;
78
79 case LinkList::class:
80 $links = [];
81 foreach ($item->getLinks() as $child) {
82 if (!$child->isVisible()) {
83 continue;
84 }
85 $links[] = $this->buildEntry($child, $parent);
86 }
87 $entry = $this->ui_factory->menu()->sub($title, $links);
88 break;
89 case Separator::class:
90 $entry = $this->ui_factory->divider()->horizontal()->withLabel($title);
91 break;
92
93 default:
94 $entry = $this->ui_factory->divider()->horizontal()->withLabel(
95 sprintf($this->txt('unable_to_render'), $title, $parent->getTitle())
96 );
97 }
98
99 return $entry;
100 }
101
102 protected function getDataFactory(): Factory
103 {
104 return new Factory();
105 }
106
107 private function getBaseURL(): string
108 {
109 return ILIAS_HTTP_PATH;
110 }
111
112 private function txt(string $key): string
113 {
114 return $this->lng->txt($key);
115 }
116}
Builds data types.
Definition: Factory.php:21
A component is the most general form of an entity in the UI.
Definition: Component.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $key
Consumer key/client ID value.
Definition: System.php:193
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$type