ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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 $request = $this->dic->http()->request()->getUri();
68 return new URI($request->getScheme() . '://' . $request->getHost() . '/' . ltrim($from_path, '/'));
69 }
70
71 public function getEntries(): array
72 {
73 $entries = [];
74 // Imprint
75
76 // there was another check $base_class !== \ilImprintGUI::class &&
77
78 $imprint_title = $this->dic->language()->txt("imprint");
79
80 $entries[] = $this->item_factory
81 ->link(
82 $this->id_factory->identifier('imprint'),
83 $imprint_title
84 )
85 ->withAvailableCallable(
86 fn() => \ilImprint::isActive()
87 )
88 ->withAction(new URI(\ilLink::_getStaticLink(0, "impr")))
89 ->withParent($this->getIdentificationFor(ilFooterStandardGroups::LEGAL_INFORMATION));
90
91 // system support contacts
92 if (($system_support_url = \ilSystemSupportContactsGUI::getFooterLink()) !== null) {
93 $system_support_title = \ilSystemSupportContactsGUI::getFooterText();
94 $entries[] = $this->item_factory
95 ->link(
96 $this->id_factory->identifier('system_support'),
97 $system_support_title
98 )
99 ->withAction($system_support_url)
100 ->withParent($this->getIdentificationFor(ilFooterStandardGroups::SUPPORT));
101 }
102
103 // output translation link
105 $translation_title = $this->dic->language()->txt('translation');
106 $entries[] = $this->item_factory
107 ->link(
108 $this->id_factory->identifier('translation'),
109 $translation_title
110 )
111 ->withAvailableCallable(
113 )
114 ->withAction($this->buildURI($translation_url))
115 ->withOpenInNewViewport(true)
117
118 return $entries;
119 }
120
121 #[\Override]
122 public function getAdditionalTexts(): array
123 {
124 $ilias_version = ILIAS_VERSION;
125 $text = "powered by ILIAS (v{$ilias_version})";
126
127 return [
128 $this->item_factory->text(
129 $this->id_factory->identifier('ilias_version'),
130 $text
131 )
132 ];
133 }
134
135 public function getPermanentURI(): ?Permanent
136 {
137 $permanant_link = PageContentProvider::getPermaLink();
138 if (empty($permanant_link)) {
139 return null;
140 }
141
142 return $this->item_factory->permanent(
143 $this->id_factory->identifier('permanent'),
144 $this->translator->translate('permanent'),
145 new URI($permanant_link)
146 );
147 }
148
149}
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