ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilFooterCustomGroupsProvider.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 use ILIAS\Data\URI;
28 
33 {
36 
37  public function __construct(Container $dic)
38  {
39  parent::__construct($dic);
40  $this->groups_repository = new GroupsRepositoryDB($dic->database(), $this);
41  $this->entries_repository = new EntriesRepositoryDB($dic->database(), $this);
42  }
43 
45  {
46  return $this->id_factory->identifier(uniqid('', true));
47  }
48 
50  {
52  }
53 
55  {
57  }
58 
59 
60 
61  public function getGroups(): array
62  {
63  $groups = [];
64 
65  foreach ($this->groups_repository->all() as $group) {
66  if ($group->isCore()) {
67  continue;
68  }
69  if (!$group->isActive()) {
70  continue;
71  }
72  $groups[] = $this->item_factory->group(
73  $this->dic->globalScreen()->identification()->fromSerializedIdentification($group->getId()),
74  $group->getTitle(),
75  );
76  }
77 
78  return $groups;
79  }
80 
81  public function getEntries(): array
82  {
83  $entries = [];
84 
85  foreach ($this->entries_repository->all() as $entry) {
86  if ($entry->isCore()) {
87  continue;
88  }
89  if (!$entry->isActive()) {
90  continue;
91  }
92  try {
93  $action = new URI($entry->getAction());
94  } catch (Throwable) {
95  continue;
96  }
97 
98  $entries[] = $this->item_factory->link(
99  $this->dic->globalScreen()->identification()->fromSerializedIdentification($entry->getId()),
100  $entry->getTitle(),
101  )->withParent(
102  $this->dic->globalScreen()->identification()->fromSerializedIdentification($entry->getParent())
103  )->withAction(
104  $action
105  )->withOpenInNewViewport($entry->isExternal());
106  }
107 
108  return $entries;
109  }
110 
111  private function buildURI(string $from_path): URI
112  {
113  $request = $this->dic->http()->request()->getUri();
114  return new URI($request->getScheme() . '://' . $request->getHost() . '/' . ltrim($from_path, '/'));
115  }
116 
117  #[\Override]
118  public function getAdditionalTexts(): array
119  {
120  return [];
121  }
122 
123  public function getPermanentURI(): ?Permanent
124  {
125  return null;
126  }
127 
128  private function txt(string $key): string
129  {
130  return $this->dic->language()->txt($key);
131  }
132 
133 }
database()
Get interface to the Database.
Definition: Container.php:42
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
readonly EntriesRepositoryDB $entries_repository
withParent(IdentificationInterface $identification)
__construct(Container $dic, ilPlugin $plugin)
$dic
Definition: result.php:31