ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilFooterStandardGroupsProvider.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 use ILIAS\Data\URI;
28 
33 {
34  private readonly Translator $translator;
35 
36  public function __construct(Container $dic)
37  {
38  parent::__construct($dic);
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  /*$base_class = ($this->dic->http()->wrapper()->query()->has(\ilCtrlInterface::PARAM_BASE_CLASS)) ?
76  $this->dic->http()->wrapper()->query()->retrieve(
77  \ilCtrlInterface::PARAM_BASE_CLASS,
78  $this->dic->refinery()->kindlyTo()->string()
79  ) : null;*/
80 
81  // there was another check $base_class !== \ilImprintGUI::class &&
82  if (\ilImprint::isActive()) {
83  $imprint_title = $this->dic->language()->txt("imprint");
84 
85  $entries[] = $this->item_factory
86  ->link(
87  $this->id_factory->identifier('imprint'),
88  $imprint_title
89  )
90  ->withAction(new URI(\ilLink::_getStaticLink(0, "impr")))
91  ->withParent($this->getIdentificationFor(ilFooterStandardGroups::LEGAL_INFORMATION));
92  }
93 
94  // system support contacts
95  if (($system_support_url = \ilSystemSupportContactsGUI::getFooterLink()) !== '') {
96  $system_support_title = \ilSystemSupportContactsGUI::getFooterText();
97  $entries[] = $this->item_factory
98  ->link(
99  $this->id_factory->identifier('system_support'),
100  $system_support_title
101  )
102  ->withAction($this->buildURI($system_support_url))
103  ->withParent($this->getIdentificationFor(ilFooterStandardGroups::SUPPORT));
104  }
105 
106  // output translation link
108  $translation_url = \ilObjLanguageAccess::_getTranslationLink();
109  $translation_title = $this->dic->language()->txt('translation');
110  $entries[] = $this->item_factory
111  ->link(
112  $this->id_factory->identifier('translation'),
113  $translation_title
114  )
115  ->withAction($this->buildURI($translation_url))
116  ->withOpenInNewViewport(true)
118  }
119 
120  return $entries;
121  }
122 
123  #[\Override]
124  public function getAdditionalTexts(): array
125  {
126  $ilias_version = ILIAS_VERSION;
127  $text = "powered by ILIAS (v{$ilias_version})";
128 
129  return [
130  $this->item_factory->text(
131  $this->id_factory->identifier('ilias_version'),
132  $text
133  )
134  ];
135  }
136 
137  public function getPermanentURI(): ?Permanent
138  {
139  $permanant_link = PageContentProvider::getPermaLink();
140  if (empty($permanant_link)) {
141  return null;
142  }
143 
144  return $this->item_factory->permanent(
145  $this->id_factory->identifier('permanent'),
146  $this->translator->translate('permanent'),
147  new URI($permanant_link)
148  );
149  }
150 
151 }
withAction(URI|Signal|string $action)
static _isPageTranslation()
Check if the current request is a page translation.
getIdentificationFor(ilFooterStandardGroups $group)
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const ILIAS_VERSION
static _getTranslationLink()
Get the link to translate the current page.
withParent(IdentificationInterface $identification)
__construct(Container $dic, ilPlugin $plugin)
$dic
Definition: result.php:31
static _checkTranslate()
Permission check for translations.
static isActive()