ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLSViewLayoutProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
39
46{
47 protected ?Collection $data_collection = null;
48
53 {
54 return $this->context_collection->main();
55 }
56
57 protected function isKioskModeEnabled(CalledContexts $screen_context_stack): bool
58 {
59 $this->data_collection = $screen_context_stack->current()->getAdditionalData();
60 return $this->data_collection->is(ilLSPlayer::GS_DATA_LS_KIOSK_MODE, true);
61 }
62
63 public function getMainBarModification(CalledContexts $screen_context_stack): ?MainBarModification
64 {
65 if (!$this->isKioskModeEnabled($screen_context_stack)) {
66 return null;
67 }
68 return $this->globalScreen()->layout()->factory()->mainbar()
69 ->withModification(
70 function (?MainBar $mainbar): ?MainBar {
71 if ($mainbar === null) {
72 $ui = $this->dic->ui();
73 $mainbar = $ui->factory()->mainControls()->mainbar();
74 }
75 $entries = $this->data_collection->get(ilLSPlayer::GS_DATA_LS_MAINBARCONTROLS);
76 $tools = $mainbar->getToolEntries();
77 $mainbar = $mainbar->withClearedEntries();
78
79 foreach ($entries as $key => $entry) {
80 $mainbar = $mainbar->withAdditionalEntry($key, $entry);
81 }
82 foreach ($tools as $key => $entry) {
83 $mainbar = $mainbar->withAdditionalToolEntry($key, $entry);
84 }
85 return $mainbar;
86 }
87 )
88 ->withHighPriority();
89 }
90
91 public function getMetaBarModification(CalledContexts $screen_context_stack): ?MetaBarModification
92 {
93 if (!$this->isKioskModeEnabled($screen_context_stack)) {
94 return null;
95 }
96 return $this->globalScreen()->layout()->factory()->metabar()
97 ->withModification(
98 fn(?MetaBar $metabar): ?Metabar => $metabar !== null ? $metabar->withClearedEntries() : null
99 )
100 ->withHighPriority();
101 }
102
104 {
105 if (!$this->isKioskModeEnabled($screen_context_stack)) {
106 return null;
107 }
108
109 return $this->globalScreen()->layout()->factory()->breadcrumbs()
110 ->withModification(
111 fn(?Breadcrumbs $current): ?Breadcrumbs => null
112 )
113 ->withHighPriority();
114 }
115
116 public function getContentModification(CalledContexts $screen_context_stack): ?ContentModification
117 {
118 if (!$this->isKioskModeEnabled($screen_context_stack)) {
119 return null;
120 }
121 $html = $this->data_collection->get(ilLSPlayer::GS_DATA_LS_CONTENT);
122 // TODO: Once we have more control over the content, we could just setContent
123 // in ilObjLearningSequenceLearnerGUI like any other object and later strip
124 // away the header here.
125 return $this->globalScreen()->layout()->factory()->content()
126 ->withModification(
127 function (?Content $content) use ($html): ?Content {
128 $ui = $this->dic->ui();
129 return $ui->factory()->legacy()->content($html);
130 }
131 )
132 ->withHighPriority();
133 }
134
135 public function getPageBuilderDecorator(CalledContexts $screen_context_stack): ?PageBuilderModification
136 {
137 if (!$this->isKioskModeEnabled($screen_context_stack)) {
138 return null;
139 }
140
141 $exit = $this->data_collection->get(\ilLSPlayer::GS_DATA_LS_METABARCONTROLS)['exit'];
142 $label = $this->dic['lng']->txt('lso_player_viewmodelabel');
143
144 $lnk = new URI($exit->getAction());
145
147 return $this->factory->page()->withModification(
148 function (PagePartProvider $parts) use ($label, $lnk): Page {
149 $p = new StandardPageBuilder();
150 $f = $this->dic['ui.factory'];
151 $page = $p->build($parts);
152 $modeinfo = $f->mainControls()->modeInfo($label, $lnk);
153 return $page->withModeInfo($modeinfo);
154 }
155 )->withHighPriority();
156 }
157}
factory()
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.
withAdditionalToolEntry(string $id, Slate\Slate $entry, bool $initially_hidden=false, ?Button\Close $close_button=null)
Append a tool-entry.
withAdditionalEntry(string $id, $entry)
Append an 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:61