ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
PageContentProvider.php
Go to the documentation of this file.
1<?php namespace ILIAS\UICore;
2
15
22{
23
27 private static $content = "";
31 private static $perma_link = "";
35 private static $title = "";
39 private static $short_title = "";
43 private static $view_title = "";
44
48 public static function setContent(string $content) : void
49 {
50 self::$content = $content;
51 }
52
56 public static function setTitle(string $title) : void
57 {
58 self::$title = $title;
59 }
60
64 public static function setShortTitle(string $short_title) : void
65 {
66 self::$short_title = $short_title;
67 }
68
72 public static function setViewTitle(string $view_title) : void
73 {
74 self::$view_title = $view_title;
75 }
76
77
81 public static function setPermaLink(string $perma_link) : void
82 {
83 self::$perma_link = $perma_link;
84 }
85
86
91 {
92 return $this->context_collection->main();
93 }
94
95
99 public function getContentModification(CalledContexts $screen_context_stack) : ?ContentModification
100 {
101 return $this->globalScreen()->layout()->factory()->content()->withModification(function (Legacy $content) : Legacy {
102 $ui = $this->dic->ui();
103 return $ui->factory()->legacy(
104 $ui->renderer()->render($content) . self::$content
105 );
106 })->withLowPriority();
107 }
108
109
110 public function getTitleModification(CalledContexts $screen_context_stack) : ?TitleModification
111 {
112 return $this->globalScreen()->layout()->factory()->title()->withModification(
113 function (string $content) : string {
114 return self::$title;
115 }
116 )->withLowPriority();
117 }
118
119 public function getShortTitleModification(CalledContexts $screen_context_stack) : ?ShortTitleModification
120 {
121 return $this->globalScreen()->layout()->factory()->short_title()->withModification(
122 function (string $content) : string {
123 return self::$short_title;
124 }
125 )->withLowPriority();
126 }
127
128 public function getViewTitleModification(CalledContexts $screen_context_stack) : ?ViewTitleModification
129 {
130 return $this->globalScreen()->layout()->factory()->view_title()->withModification(
131 function (string $content) : string {
132 return self::$view_title;
133 }
134 )->withLowPriority();
135 }
136
140 public function getFooterModification(CalledContexts $screen_context_stack) : ?FooterModification
141 {
142 return $this->globalScreen()->layout()->factory()->footer()->withModification(function () : Footer {
143 $f = $this->dic->ui()->factory();
144
145 $links = [];
146 // ILIAS Version and Text
147 $ilias_version = $this->dic->settings()->get('ilias_version');
148 $text = "powered by ILIAS (v{$ilias_version})";
149
150 // Imprint
151 if ($_REQUEST["baseClass"] !== "ilImprintGUI" && \ilImprint::isActive()) {
152 $imprint_title = $this->dic->language()->txt("imprint");
153 $imprint_url = \ilLink::_getStaticLink(0, "impr");
154 $links[] = $f->link()->standard($imprint_title, $imprint_url);
155 }
156
157 // system support contacts
158 if (($system_support_url = \ilSystemSupportContactsGUI::getFooterLink()) !== '') {
159 $system_support_title = \ilSystemSupportContactsGUI::getFooterText();
160 $links[] = $f->link()->standard($system_support_title, $system_support_url);
161 }
162
163 // output translation link
166 $translation_title = $this->dic->language()->txt('translation');
167 $links[] = $f->link()->standard($translation_title, $translation_url)->withOpenInNewViewport(true);
168 }
169
170 // accessibility control concept
171 if (($accessibility_control_url = \ilAccessibilityControlConceptGUI::getFooterLink()) !== '') {
172 $accessibility_control_title = \ilAccessibilityControlConceptGUI::getFooterText();
173 $links[] = $f->link()->standard($accessibility_control_title, $accessibility_control_url);
174 }
175
176 // report accessibility issue
177 if (($accessibility_report_url = \ilAccessibilitySupportContactsGUI::getFooterLink()) !== '') {
178 $accessibility_report_title = \ilAccessibilitySupportContactsGUI::getFooterText();
179 $links[] = $f->link()->standard($accessibility_report_title, $accessibility_report_url);
180 }
181
182 $footer = $f->mainControls()->footer($links, $text);
183
184 if (self::$perma_link !== "") {
185 $footer = $footer->withPermanentURL(new URI(self::$perma_link));
186 }
187
188 return $footer;
189 });
190 }
191}
An exception for terminatinating execution or to throw for unit testing.
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:18
Class ilPageContentProvider.
static setPermaLink(string $perma_link)
static setContent(string $content)
static setViewTitle(string $view_title)
getContentModification(CalledContexts $screen_context_stack)
@inheritDoc
getFooterModification(CalledContexts $screen_context_stack)
@inheritDoc
getViewTitleModification(CalledContexts $screen_context_stack)
@inheritDoc
getShortTitleModification(CalledContexts $screen_context_stack)
@inheritDoc
getTitleModification(CalledContexts $screen_context_stack)
@inheritDoc
static setShortTitle(string $short_title)
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.
This describes the Footer.
Definition: Footer.php:12
legacy()
Definition: legacy.php:3