ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
TopParentItemDrilldownRenderer.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
32 
38 {
39  public function getComponentWithContent(isItem $item): Component
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 }
$type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
getComponentWithContent(isItem $item)
This is called in cases when the Full Item with it&#39;s content is needed, e.g.