ILIAS  release_8 Revision v8.24
class.ilLSViewLayoutProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
34
40
47{
48 protected ?Collection $data_collection = null;
49
54 {
55 return $this->context_collection->main();
56 }
57
58 protected function isKioskModeEnabled(CalledContexts $screen_context_stack): bool
59 {
60 $this->data_collection = $screen_context_stack->current()->getAdditionalData();
61 return $this->data_collection->is(ilLSPlayer::GS_DATA_LS_KIOSK_MODE, true);
62 }
63
64 public function getMainBarModification(CalledContexts $screen_context_stack): ?MainBarModification
65 {
66 if (!$this->isKioskModeEnabled($screen_context_stack)) {
67 return null;
68 }
69 return $this->globalScreen()->layout()->factory()->mainbar()
70 ->withModification(
71 function (?MainBar $mainbar): ?MainBar {
72 if ($mainbar === null) {
73 $ui = $this->dic->ui();
74 $mainbar = $ui->factory()->mainControls()->mainbar();
75 }
76 $entries = $this->data_collection->get(ilLSPlayer::GS_DATA_LS_MAINBARCONTROLS);
77 $tools = $mainbar->getToolEntries();
78 $mainbar = $mainbar->withClearedEntries();
79
80 foreach ($entries as $key => $entry) {
81 $mainbar = $mainbar->withAdditionalEntry($key, $entry);
82 }
83 foreach ($tools as $key => $entry) {
84 $mainbar = $mainbar->withAdditionalToolEntry($key, $entry);
85 }
86 return $mainbar;
87 }
88 )
89 ->withHighPriority();
90 }
91
92 public function getMetaBarModification(CalledContexts $screen_context_stack): ?MetaBarModification
93 {
94 if (!$this->isKioskModeEnabled($screen_context_stack)) {
95 return null;
96 }
97 return $this->globalScreen()->layout()->factory()->metabar()
98 ->withModification(
99 fn (?MetaBar $metabar): ?Metabar => $metabar !== null ? $metabar->withClearedEntries() : null
100 )
101 ->withHighPriority();
102 }
103
105 {
106 if (!$this->isKioskModeEnabled($screen_context_stack)) {
107 return null;
108 }
109
110 return $this->globalScreen()->layout()->factory()->breadcrumbs()
111 ->withModification(
112 fn (?Breadcrumbs $current): ?Breadcrumbs => null
113 )
114 ->withHighPriority();
115 }
116
117 public function getContentModification(CalledContexts $screen_context_stack): ?ContentModification
118 {
119 if (!$this->isKioskModeEnabled($screen_context_stack)) {
120 return null;
121 }
122 $html = $this->data_collection->get(ilLSPlayer::GS_DATA_LS_CONTENT);
123 // TODO: Once we have more control over the content, we could just setContent
124 // in ilObjLearningSequenceLearnerGUI like any other object and later strip
125 // away the header here.
126 return $this->globalScreen()->layout()->factory()->content()
127 ->withModification(
128 function (?Legacy $content) use ($html): ?Legacy {
129 $ui = $this->dic->ui();
130 return $ui->factory()->legacy($html);
131 }
132 )
133 ->withHighPriority();
134 }
135
136 public function getPageBuilderDecorator(CalledContexts $screen_context_stack): ?PageBuilderModification
137 {
138 if (!$this->isKioskModeEnabled($screen_context_stack)) {
139 return null;
140 }
141
142 $exit = $this->data_collection->get(\ilLSPlayer::GS_DATA_LS_METABARCONTROLS)['exit'];
143 $label = $this->dic['lng']->txt('lso_player_viewmodelabel');
144
145 $lnk = new URI($exit->getAction());
146
148 return $this->factory->page()->withModification(
149 function (PagePartProvider $parts) use ($label, $lnk): Page {
150 $p = new StandardPageBuilder();
151 $f = $this->dic['ui.factory'];
152 $page = $p->build($parts);
153 $modeinfo = $f->mainControls()->modeInfo($label, $lnk);
154 return $page->withModeInfo($modeinfo);
155 }
156 )->withHighPriority();
157 }
158}
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
const GS_DATA_LS_KIOSK_MODE
const GS_DATA_LS_MAINBARCONTROLS
const GS_DATA_LS_METABARCONTROLS
const GS_DATA_LS_CONTENT
Class ilLSViewLayoutProvider.
getBreadCrumbsModification(CalledContexts $screen_context_stack)
@inheritDoc
getMetaBarModification(CalledContexts $screen_context_stack)
@inheritDoc
getPageBuilderDecorator(CalledContexts $screen_context_stack)
@inheritDoc
getContentModification(CalledContexts $screen_context_stack)
@inheritDoc
getMainBarModification(CalledContexts $screen_context_stack)
@inheritDoc
isKioskModeEnabled(CalledContexts $screen_context_stack)
This describes the Page.
Definition: Page.php:31
This describes the MainBar.
Definition: MainBar.php:34
withClearedEntries()
Get a copy of this MainBar without any entries.
withAdditionalEntry(string $id, $entry)
Append an entry.
withAdditionalToolEntry(string $id, Slate\Slate $entry, bool $initially_hidden=false, Button\Close $close_button=null)
Append a tool-entry.
This describes the MetaBar.
Definition: MetaBar.php:33
withClearedEntries()
Get a copy of this MetaBar without any entries.
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64
string $key
Consumer key/client ID value.
Definition: System.php:193