ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilTestPlayerLayoutProvider.php
Go to the documentation of this file.
1<?php
2
29
34
43{
44 const TEST_PLAYER_KIOSK_MODE_ENABLED = 'test_player_kiosk_mode_enabled';
45 const TEST_PLAYER_TITLE = 'test_player_kiosk_mode_title';
46 const TEST_PLAYER_SHORT_TITLE = 'test_player_kiosk_mode_instance_name';
47
48
50 {
51 return $this->context_collection->repository();
52 }
53
54
55 public function getLogoModification(CalledContexts $called_contexts) : ?LogoModification
56 {
57 if ($this->isKioskModeEnabled($called_contexts)) {
58 $logo = $this->globalScreen()->layout()->factory()->logo();
59
60 $logo = $logo->withModification(function (?Image $current) : ?Image {
61 return null;
62 });
63
64 return $logo->withHighPriority();
65 }
66
67 return null;
68 }
70 {
71 if ($this->isKioskModeEnabled($called_contexts)) {
72 $logo = $this->globalScreen()->layout()->factory()->logo();
73
74 $logo = $logo->withModification(function (?Image $current) : ?Image {
75 return null;
76 });
77
78 return $logo->withHighPriority();
79 }
80
81 return null;
82 }
83
84
85 public function getMainBarModification(CalledContexts $called_contexts) : ?MainBarModification
86 {
87 if ($this->isKioskModeEnabled($called_contexts)) {
88 $mainBar = $this->globalScreen()->layout()->factory()->mainbar();
89
90 $mainBar = $mainBar->withModification(function (?MainBar $current) : ?MainBar {
91 return null;
92 });
93
94 return $mainBar->withHighPriority();
95 }
96
97 return null;
98 }
99
100
101 public function getMetaBarModification(CalledContexts $called_contexts) : ?MetaBarModification
102 {
103 if ($this->isKioskModeEnabled($called_contexts)) {
104 $metaBar = $this->globalScreen()->layout()->factory()->metabar();
105
106 $metaBar = $metaBar->withModification(function (?MetaBar $current) : ?MetaBar {
107 return null;
108 });
109
110 return $metaBar->withHighPriority();
111 }
112
113 return null;
114 }
115
116
117 public function getFooterModification(CalledContexts $called_contexts) : ?FooterModification
118 {
119 if ($this->isKioskModeEnabled($called_contexts)) {
120 $footer = $this->globalScreen()->layout()->factory()->footer();
121
122 $footer = $footer->withModification(function (?Footer $current) : ?Footer {
123 return null;
124 });
125
126 return $footer->withHighPriority();
127 }
128
129 return null;
130 }
131
132
138 protected function isKioskModeEnabled(CalledContexts $called_contexts) : bool
139 {
140 $additionalData = $called_contexts->current()->getAdditionalData();
141 $isKioskModeEnabled = $additionalData->is(self::TEST_PLAYER_KIOSK_MODE_ENABLED, true);
142
143 return $isKioskModeEnabled;
144 }
145
146
148 {
149 if ($this->isKioskModeEnabled($called_contexts)) {
150 $title = $called_contexts->current()->getAdditionalData()->get(self::TEST_PLAYER_SHORT_TITLE);
151 if ($title === null) {
152 $title = '';
153 }
154 return $this->globalScreen()->layout()->factory()->short_title()
155 ->withModification(
156 function (?string $content) use ($title) : ?string {
157 return $title;
158 }
159 )
160 ->withHighPriority();
161 }
162 return null;
163 }
164
166 {
167 if ($this->isKioskModeEnabled($called_contexts)) {
168 $title = $called_contexts->current()->getAdditionalData()->get(self::TEST_PLAYER_TITLE);
169 if ($title === null) {
170 $title = '';
171 }
172 return $this->globalScreen()->layout()->factory()->view_title()
173 ->withModification(
174 function (?string $content) use ($title) : ?string {
175 return $title;
176 }
177 )
178 ->withHighPriority();
179 }
180 return null;
181 }
182}
An exception for terminatinating execution or to throw for unit testing.
getFooterModification(CalledContexts $called_contexts)
@inheritDoc
getMetaBarModification(CalledContexts $called_contexts)
@inheritDoc
getMainBarModification(CalledContexts $called_contexts)
@inheritDoc
isKioskModeEnabled(CalledContexts $called_contexts)
getResponsiveLogoModification(CalledContexts $called_contexts)
getViewTitleModification(CalledContexts $called_contexts)
@inheritDoc
getShortTitleModification(CalledContexts $called_contexts)
@inheritDoc
getLogoModification(CalledContexts $called_contexts)
@inheritDoc
This describes the Footer.
Definition: Footer.php:16
This describes the MainBar.
Definition: MainBar.php:17
This describes the MetaBar.
Definition: MetaBar.php:15