ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\UICore\PageContentProvider Class Reference
+ Inheritance diagram for ILIAS\UICore\PageContentProvider:
+ Collaboration diagram for ILIAS\UICore\PageContentProvider:

Public Member Functions

 isInterestedInContexts ()
 
 getContentModification (CalledContexts $screen_context_stack)
 
 getFooterModification (CalledContexts $screen_context_stack)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider
 __construct (Container $dic)
 
 getContentModification (CalledContexts $screen_context_stack)
 
 getLogoModification (CalledContexts $screen_context_stack)
 
 getResponsiveLogoModification (CalledContexts $screen_context_stack)
 
 getMainBarModification (CalledContexts $screen_context_stack)
 
 getMetaBarModification (CalledContexts $screen_context_stack)
 
 getBreadCrumbsModification (CalledContexts $screen_context_stack)
 
 getFooterModification (CalledContexts $screen_context_stack)
 
 getPageBuilderDecorator (CalledContexts $screen_context_stack)
 
 getTitleModification (CalledContexts $screen_context_stack)
 
 getShortTitleModification (CalledContexts $screen_context_stack)
 
 getViewTitleModification (CalledContexts $screen_context_stack)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 

Static Public Member Functions

static setContent (string $content)
 
static setTitle (string $title)
 
static setShortTitle (string $short_title)
 
static setViewTitle (string $view_title)
 
static setPermaLink (string $perma_link)
 

Private Member Functions

 buildTabTitle ()
 This method was introduced due to A11y problems, see https://mantis.ilias.de/view.php?id=31534. More...
 

Static Private Attributes

static string $content = ""
 
static string $perma_link = ""
 
static string $title = ""
 
static string $short_title = ""
 
static string $view_title = ""
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider
ContextCollection $context_collection
 
ILIAS GlobalScreen Scope Layout Factory ModificationFactory $factory
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
Container $dic
 

Detailed Description

Member Function Documentation

◆ buildTabTitle()

ILIAS\UICore\PageContentProvider::buildTabTitle ( )
private

This method was introduced due to A11y problems, see https://mantis.ilias.de/view.php?id=31534.

This is definitely only a workaround, but since this is currently the only way to implement it, it is just introduced... We keep all the logic within this method because we don't want this to become common or even used elsewhere. Hence certain things as anonymous functions...

Definition at line 126 of file PageContentProvider.php.

Referenced by ILIAS\UICore\PageContentProvider\getContentModification().

126  : string
127  {
128  // This anonymous function generates a translated title from a "tab" array.
129  // in some cases the tabs are already translated (dir_text = true), in others not...
130  $tab_title_generator = function (array $tab): string {
131  if (($tab['dir_text'] ?? false) === false) {
132  $tab_title = $this->dic->language()->txt($tab['text']);
133  } else {
134  $tab_title = $tab['text'] ?? '';
135  }
136  $tab_title .= ': ';
137  return $tab_title;
138  };
139 
140  // we only know the 'id' of the active tab and don't want to rely on the array index, so we
141  // loop over tabs or subtabs to find the "right" one
142  $tab_looper = static function (array $tabs, string $active_tab) use ($tab_title_generator): string {
143  $tab_title = '';
144  foreach ($tabs as $tab) {
145  if ($tab['id'] === $active_tab) {
146  $tab_title = $tab_title_generator($tab);
147  break;
148  }
149  }
150  return $tab_title;
151  };
152 
153  // TABS
154  $tabs = $this->dic->tabs()->target; // this only works because target is currently public...
155  $active_tab = $this->dic->tabs()->getActiveTab();
156  if ($active_tab === '' && isset($tabs[0])) {
157  $active_tab = $tabs[0]['id']; // if no tab is active, use the first one
158  }
159 
160  $tab_title = $tab_looper($tabs, $active_tab);
161 
162  // SUBTABS
163  $subtab_title = '';
164  $subtabs = $this->dic->tabs()->sub_target; // this only works because subtarget is currently public...
165  if (count($subtabs) > 1) { // we only need to do something if there are more than one subtabs
166  $active_subtab = array_values(
167  array_filter($subtabs, static function (array $subtab): bool {
168  return $subtab['activate'] ?? false;
169  })
170  )[0]['id'] ?? '';
171 
172  if ($active_subtab === '' && isset($subtabs[0])) {
173  $active_subtab = $subtabs[0]['id']; // if no tab is active, use the first one
174  }
175  $subtab_title = $tab_looper($subtabs, $active_subtab);
176  }
177 
178  return $subtab_title . $tab_title;
179  }
+ Here is the caller graph for this function:

◆ getContentModification()

ILIAS\UICore\PageContentProvider::getContentModification ( CalledContexts  $screen_context_stack)
Parameters
CalledContexts$screen_context_stack
Returns
ContentModification

Implements ILIAS\GlobalScreen\Scope\Layout\Provider\ModificationProvider.

Definition at line 78 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\buildTabTitle(), ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider\getShortTitleModification(), ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider\getTitleModification(), ILIAS\GlobalScreen\Scope\Layout\Provider\AbstractModificationProvider\getViewTitleModification(), and ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen().

78  : ?ContentModification
79  {
80  return $this->globalScreen()->layout()->factory()->content()->withModification(function (
81  ?Legacy $content
82  ): ?Legacy {
83  $ui = $this->dic->ui();
84  return $ui->factory()->legacy(
85  $ui->renderer()->render($content) . self::$content
86  );
87  })->withLowPriority();
88  }
+ Here is the call graph for this function:

◆ getFooterModification()

ILIAS\UICore\PageContentProvider::getFooterModification ( CalledContexts  $screen_context_stack)
Parameters
CalledContexts$screen_context_stack
Returns
FooterModification|null

Implements ILIAS\GlobalScreen\Scope\Layout\Provider\ModificationProvider.

Definition at line 182 of file PageContentProvider.php.

References Vendor\Package\$f, ilObjLanguageAccess\_checkTranslate(), ilLink\_getStaticLink(), ilObjLanguageAccess\_getTranslationLink(), ilObjLanguageAccess\_isPageTranslation(), ilAccessibilitySupportContactsGUI\getFooterLink(), ilSystemSupportContactsGUI\getFooterLink(), ilAccessibilityControlConceptGUI\getFooterLink(), ilSystemSupportContactsGUI\getFooterText(), ilAccessibilitySupportContactsGUI\getFooterText(), ilAccessibilityControlConceptGUI\getFooterText(), ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen(), ILIAS_VERSION, ilImprint\isActive(), ilCtrlInterface\PARAM_BASE_CLASS, and ILIAS\UI\Component\MainControls\Footer\withPermanentURL().

182  : ?FooterModification
183  {
184  return $this->globalScreen()->layout()->factory()->footer()->withModification(function (?Footer $footer): ?Footer {
185  $f = $this->dic->ui()->factory();
186 
187  $links = [];
188  // ILIAS Version and Text
189  $ilias_version = ILIAS_VERSION;
190  $text = "powered by ILIAS (v{$ilias_version})";
191 
192  // Imprint
193  $base_class = ($this->dic->http()->wrapper()->query()->has(\ilCtrlInterface::PARAM_BASE_CLASS)) ?
194  $this->dic->http()->wrapper()->query()->retrieve(
196  $this->dic->refinery()->kindlyTo()->string()
197  ) : null;
198 
199  if ($base_class !== \ilImprintGUI::class && \ilImprint::isActive()) {
200  $imprint_title = $this->dic->language()->txt("imprint");
201  $imprint_url = \ilLink::_getStaticLink(0, "impr");
202  $links[] = $f->link()->standard($imprint_title, $imprint_url);
203  }
204 
205  // system support contacts
206  if (($system_support_url = \ilSystemSupportContactsGUI::getFooterLink()) !== '') {
207  $system_support_title = \ilSystemSupportContactsGUI::getFooterText();
208  $links[] = $f->link()->standard($system_support_title, $system_support_url);
209  }
210 
211  // output translation link
213  $translation_url = \ilObjLanguageAccess::_getTranslationLink();
214  $translation_title = $this->dic->language()->txt('translation');
215  $links[] = $f->link()->standard($translation_title, $translation_url)->withOpenInNewViewport(true);
216  }
217 
218  // accessibility control concept
219  if (($accessibility_control_url = \ilAccessibilityControlConceptGUI::getFooterLink()) !== '') {
220  $accessibility_control_title = \ilAccessibilityControlConceptGUI::getFooterText();
221  $links[] = $f->link()->standard($accessibility_control_title, $accessibility_control_url);
222  }
223 
224  // report accessibility issue
225  if (($accessibility_report_url = \ilAccessibilitySupportContactsGUI::getFooterLink()) !== '') {
226  $accessibility_report_title = \ilAccessibilitySupportContactsGUI::getFooterText();
227  $links[] = $f->link()->standard($accessibility_report_title, $accessibility_report_url);
228  }
229 
230  $footer = $f->mainControls()->footer($links, $text);
231 
232  $tosWithdrawalGui = new \ilTermsOfServiceWithdrawalGUIHelper($this->dic->user());
233  $footer = $tosWithdrawalGui->modifyFooter($footer);
234 
235  if (self::$perma_link !== "") {
236  $footer = $footer->withPermanentURL(new URI(self::$perma_link));
237  }
238 
239  return $footer;
240  });
241  }
const ILIAS_VERSION
static _isPageTranslation()
Check if the current request is a page translation.
static _getTranslationLink()
Get the link to translate the current page.
static _checkTranslate()
Permission check for translations.
static isActive()
+ Here is the call graph for this function:

◆ isInterestedInContexts()

ILIAS\UICore\PageContentProvider::isInterestedInContexts ( )
Returns
ContextCollection

Implements ILIAS\GlobalScreen\ScreenContext\ScreenContextAwareProvider.

Definition at line 73 of file PageContentProvider.php.

References ILIAS\GlobalScreen\ScreenContext\Stack\ContextCollection\main().

73  : ContextCollection
74  {
75  return $this->context_collection->main();
76  }
+ Here is the call graph for this function:

◆ setContent()

static ILIAS\UICore\PageContentProvider::setContent ( string  $content)
static

Definition at line 48 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\$content.

48  : void
49  {
50  self::$content = $content;
51  }

◆ setPermaLink()

static ILIAS\UICore\PageContentProvider::setPermaLink ( string  $perma_link)
static

Definition at line 68 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\$perma_link.

68  : void
69  {
70  self::$perma_link = $perma_link;
71  }

◆ setShortTitle()

static ILIAS\UICore\PageContentProvider::setShortTitle ( string  $short_title)
static

Definition at line 58 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\$short_title.

58  : void
59  {
60  self::$short_title = $short_title;
61  }

◆ setTitle()

static ILIAS\UICore\PageContentProvider::setTitle ( string  $title)
static

Definition at line 53 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\$title.

53  : void
54  {
55  self::$title = $title;
56  }

◆ setViewTitle()

static ILIAS\UICore\PageContentProvider::setViewTitle ( string  $view_title)
static

Definition at line 63 of file PageContentProvider.php.

References ILIAS\UICore\PageContentProvider\$view_title.

63  : void
64  {
65  self::$view_title = $view_title;
66  }

Field Documentation

◆ $content

string ILIAS\UICore\PageContentProvider::$content = ""
staticprivate

Definition at line 42 of file PageContentProvider.php.

Referenced by ILIAS\UICore\PageContentProvider\setContent().

◆ $perma_link

string ILIAS\UICore\PageContentProvider::$perma_link = ""
staticprivate

◆ $short_title

string ILIAS\UICore\PageContentProvider::$short_title = ""
staticprivate

◆ $title

string ILIAS\UICore\PageContentProvider::$title = ""
staticprivate

Definition at line 44 of file PageContentProvider.php.

Referenced by ILIAS\UICore\PageContentProvider\setTitle().

◆ $view_title

string ILIAS\UICore\PageContentProvider::$view_title = ""
staticprivate

The documentation for this class was generated from the following file: