ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
PageContentProvider.php
Go to the documentation of this file.
1 <?php
17 namespace ILIAS\UICore;
18 
19 use ILIAS\Data\URI;
31 
40 {
41 
45  private static $content = "";
49  private static $perma_link = "";
53  private static $title = "";
57  private static $short_title = "";
61  private static $view_title = "";
62 
66  public static function setContent(string $content) : void
67  {
68  self::$content = $content;
69  }
70 
74  public static function setTitle(string $title) : void
75  {
76  self::$title = $title;
77  }
78 
82  public static function setShortTitle(string $short_title) : void
83  {
84  self::$short_title = $short_title;
85  }
86 
90  public static function setViewTitle(string $view_title) : void
91  {
92  self::$view_title = $view_title;
93  }
94 
95 
99  public static function setPermaLink(string $perma_link) : void
100  {
101  self::$perma_link = $perma_link;
102  }
103 
104 
109  {
110  return $this->context_collection->main();
111  }
112 
113 
117  public function getContentModification(CalledContexts $screen_context_stack) : ?ContentModification
118  {
119  return $this->globalScreen()->layout()->factory()->content()->withModification(function (?Legacy $content) : ?Legacy {
120  if ($content === null) {
121  return null;
122  }
123  $ui = $this->dic->ui();
124  return $ui->factory()->legacy(
125  $ui->renderer()->render($content) . self::$content
126  );
127  })->withLowPriority();
128  }
129 
130 
131  public function getTitleModification(CalledContexts $screen_context_stack) : ?TitleModification
132  {
133  return $this->globalScreen()->layout()->factory()->title()->withModification(
134  function (?string $content) : string {
135  return self::$title;
136  }
137  )->withLowPriority();
138  }
139 
140  public function getShortTitleModification(CalledContexts $screen_context_stack) : ?ShortTitleModification
141  {
142  return $this->globalScreen()->layout()->factory()->short_title()->withModification(
143  function (?string $content) : string {
144  return self::$short_title;
145  }
146  )->withLowPriority();
147  }
148 
149  public function getViewTitleModification(CalledContexts $screen_context_stack) : ?ViewTitleModification
150  {
151  return $this->globalScreen()->layout()->factory()->view_title()->withModification(
152  function (?string $content) : string {
153  return self::$view_title;
154  }
155  )->withLowPriority();
156  }
157 
161  public function getFooterModification(CalledContexts $screen_context_stack) : ?FooterModification
162  {
163  return $this->globalScreen()->layout()->factory()->footer()->withModification(function (?Footer $footer = null) : ?Footer {
164  $f = $this->dic->ui()->factory();
165 
166  $links = [];
167  // ILIAS Version and Text
168  $ilias_version = $this->dic->settings()->get('ilias_version');
169  $text = "powered by ILIAS (v{$ilias_version})";
170 
171  // Imprint
172  if ($_REQUEST["baseClass"] !== "ilImprintGUI" && \ilImprint::isActive()) {
173  $imprint_title = $this->dic->language()->txt("imprint");
174  $imprint_url = \ilLink::_getStaticLink(0, "impr");
175  $links[] = $f->link()->standard($imprint_title, $imprint_url);
176  }
177 
178  // system support contacts
179  if (($system_support_url = \ilSystemSupportContactsGUI::getFooterLink()) !== '') {
180  $system_support_title = \ilSystemSupportContactsGUI::getFooterText();
181  $links[] = $f->link()->standard($system_support_title, $system_support_url);
182  }
183 
184  // output translation link
186  $translation_url = \ilObjLanguageAccess::_getTranslationLink();
187  $translation_title = $this->dic->language()->txt('translation');
188  $links[] = $f->link()->standard($translation_title, $translation_url)->withOpenInNewViewport(true);
189  }
190 
191  // accessibility control concept
192  if (($accessibility_control_url = \ilAccessibilityControlConceptGUI::getFooterLink()) !== '') {
193  $accessibility_control_title = \ilAccessibilityControlConceptGUI::getFooterText();
194  $links[] = $f->link()->standard($accessibility_control_title, $accessibility_control_url);
195  }
196 
197  // report accessibility issue
198  if (($accessibility_report_url = \ilAccessibilitySupportContactsGUI::getFooterLink()) !== '') {
199  $accessibility_report_title = \ilAccessibilitySupportContactsGUI::getFooterText();
200  $links[] = $f->link()->standard($accessibility_report_title, $accessibility_report_url);
201  }
202 
203  $footer = $f->mainControls()->footer($links, $text);
204 
205  $tosWithdrawalGui = new \ilTermsOfServiceWithdrawalGUIHelper($this->dic->user());
206  $footer = $tosWithdrawalGui->modifyFooter($footer);
207 
208  if (self::$perma_link !== "") {
209  $footer = $footer->withPermanentURL(new URI(self::$perma_link));
210  }
211 
212  return $footer;
213  });
214  }
215 }
static setViewTitle(string $view_title)
static _isPageTranslation()
Check if the current request is a page translation.
getFooterModification(CalledContexts $screen_context_stack)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getContentModification(CalledContexts $screen_context_stack)
getViewTitleModification(CalledContexts $screen_context_stack)
static _getTranslationLink()
Get the link to translate the current page.
getTitleModification(CalledContexts $screen_context_stack)
The scope of this class is split ilias-conform URI&#39;s into components.
Definition: URI.php:17
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getShortTitleModification(CalledContexts $screen_context_stack)
static setContent(string $content)
static setShortTitle(string $short_title)
static setPermaLink(string $perma_link)
This describes the Footer.
Definition: Footer.php:15
static _checkTranslate()
Permission check for translations.
static isActive()
Class ilPageContentProvider.