ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
class.ilFooterStandardGroupsProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27use ILIAS\GlobalScreen_\UI\Translator;
28
33{
34 private readonly Translator $translator;
35
36 public function __construct(Container $dic)
37 {
39 $this->translator = new Translator($dic);
40 }
41
43 {
44 return $this->id_factory->identifier($group->value);
45 }
46
47 public function getGroups(): array
48 {
49 return [
50 $this->item_factory->group(
51 $this->getIdentificationFor(ilFooterStandardGroups::LEGAL_INFORMATION),
52 $this->translator->translate('legal_information')
53 )->withPosition(20),
54 $this->item_factory->group(
55 $this->getIdentificationFor(ilFooterStandardGroups::SUPPORT),
56 $this->translator->translate('support')
57 )->withPosition(30),
58 $this->item_factory->group(
60 $this->translator->translate('services')
61 )->withPosition(40),
62 ];
63 }
64
65 private function buildURI(string $from_path): URI
66 {
67 return new URI(rtrim(ILIAS_HTTP_PATH, '/') . '/' . ltrim($from_path, '/'));
68 }
69
70 public function getEntries(): array
71 {
72 $entries = [];
73 // Imprint
74
75 // there was another check $base_class !== \ilImprintGUI::class &&
76
77 $imprint_title = $this->dic->language()->txt("imprint");
78
79 $entries[] = $this->item_factory
80 ->link(
81 $this->id_factory->identifier('imprint'),
82 $imprint_title
83 )
84 ->withAvailableCallable(
85 fn() => \ilImprint::isActive()
86 )
87 ->withAction(new URI(\ilLink::_getStaticLink(0, "impr")))
88 ->withParent($this->getIdentificationFor(ilFooterStandardGroups::LEGAL_INFORMATION));
89
90 // system support contacts
91 if (($system_support_url = \ilSystemSupportContactsGUI::getFooterLink()) !== null) {
92 $system_support_title = \ilSystemSupportContactsGUI::getFooterText();
93 $entries[] = $this->item_factory
94 ->link(
95 $this->id_factory->identifier('system_support'),
96 $system_support_title
97 )
98 ->withAction($system_support_url)
99 ->withParent($this->getIdentificationFor(ilFooterStandardGroups::SUPPORT));
100 }
101
102 // output translation link
104 $translation_title = $this->dic->language()->txt('translation');
105 $entries[] = $this->item_factory
106 ->link(
107 $this->id_factory->identifier('translation'),
108 $translation_title
109 )
110 ->withAvailableCallable(
112 )
113 ->withAction($this->buildURI($translation_url))
114 ->withOpenInNewViewport(true)
116
117 return $entries;
118 }
119
120 #[\Override]
121 public function getAdditionalTexts(): array
122 {
123 $ilias_version = ILIAS_VERSION;
124 $text = "powered by ILIAS (v{$ilias_version})";
125
126 return [
127 $this->item_factory->text(
128 $this->id_factory->identifier('ilias_version'),
129 $text
130 )
131 ];
132 }
133
134 public function getPermanentURI(): ?Permanent
135 {
136 $permanant_link = PageContentProvider::getPermaLink();
137 if (empty($permanant_link)) {
138 return null;
139 }
140
141 return $this->item_factory->permanent(
142 $this->id_factory->identifier('permanent'),
143 $this->translator->translate('permanent'),
144 new URI($permanant_link)
145 );
146 }
147
148}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
getIdentificationFor(ilFooterStandardGroups $group)
static isActive()
static _checkTranslate()
Permission check for translations.
static _isPageTranslation()
Check if the current request is a page translation.
static _getTranslationLink()
Get the link to translate the current page.
static getFooterLink()
Get a contact link to be shown in the footer.
static getFooterText()
Get the text for a contact link to be shown in the footer.
const ILIAS_VERSION
$dic
Definition: ltiresult.php:33
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$text
Definition: xapiexit.php:21