ILIAS  release_7 Revision v7.30-3-g800a261c036
Standard.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2017 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
5
16
20class Standard implements Page\Standard
21{
24
28 private $mode_info;
32 private $content;
36 private $metabar;
40 private $mainbar;
44 private $breadcrumbs;
48 private $logo;
56 private $footer;
60 private $short_title;
64 private $view_title;
68 private $title;
72 private $with_headers = true;
76 private $ui_demo = false;
80 protected $system_infos = [];
84 protected $text_direction = "ltr";
88 protected $meta_data = [];
89
99 public function __construct(
100 array $content,
101 MetaBar $metabar = null,
102 MainBar $mainbar = null,
103 Breadcrumbs $locator = null,
104 Image $logo = null,
105 Footer $footer = null,
106 string $title = '',
107 string $short_title = '',
108 string $view_title = ''
109 ) {
110 $allowed = [\ILIAS\UI\Component\Component::class];
111 $this->checkArgListElements("content", $content, $allowed);
112
113 $this->content = $content;
114 $this->metabar = $metabar;
115 $this->mainbar = $mainbar;
116 $this->breadcrumbs = $locator;
117 $this->logo = $logo;
118 $this->footer = $footer;
119 $this->title = $title;
120 $this->short_title = $short_title;
121 $this->view_title = $view_title;
122 }
123
124 public function withMetabar(MetaBar $meta_bar) : Page\Standard
125 {
126 $clone = clone $this;
127 $clone->metabar = $meta_bar;
128 return $clone;
129 }
130
131 public function withMainbar(MainBar $main_bar) : Page\Standard
132 {
133 $clone = clone $this;
134 $clone->mainbar = $main_bar;
135 return $clone;
136 }
137
138 public function withLogo(Image $logo) : Page\Standard
139 {
140 $clone = clone $this;
141 $clone->logo = $logo;
142 return $clone;
143 }
144
145 public function withResponsiveLogo(Image $logo) : Page\Standard
146 {
147 $clone = clone $this;
148 $clone->responsive_logo = $logo;
149 return $clone;
150 }
151
155 public function withFooter(Footer $footer) : Page\Standard
156 {
157 $clone = clone $this;
158 $clone->footer = $footer;
159 return $clone;
160 }
161
162 public function hasMetabar() : bool
163 {
164 return ($this->metabar instanceof MetaBar);
165 }
166
167 public function hasMainbar() : bool
168 {
169 return ($this->mainbar instanceof MainBar);
170 }
171
172 public function hasLogo() : bool
173 {
174 return ($this->logo instanceof Image);
175 }
176
177 public function hasResponsiveLogo() : bool
178 {
179 return ($this->responsive_logo instanceof Image);
180 }
181
182 public function hasFooter() : bool
183 {
184 return ($this->footer instanceof Footer);
185 }
186
187 public function getContent()
188 {
189 return $this->content;
190 }
191
192 public function getMetabar() : ?Metabar
193 {
194 return $this->metabar;
195 }
196
197 public function getMainbar() : ?Mainbar
198 {
199 return $this->mainbar;
200 }
201
202 public function getBreadcrumbs() : ?Breadcrumbs
203 {
204 return $this->breadcrumbs;
205 }
206
207 public function getLogo() : ?Image
208 {
209 return $this->logo;
210 }
211
212 public function getResponsiveLogo() : ?Image
213 {
214 return $this->responsive_logo;
215 }
216
217 public function getFooter() : ?Footer
218 {
219 return $this->footer;
220 }
221
225 public function withHeaders($use_headers) : Page\Standard
226 {
227 $clone = clone $this;
228 $clone->with_headers = $use_headers;
229 return $clone;
230 }
231
232 public function getWithHeaders() : bool
233 {
234 return $this->with_headers;
235 }
236
237 public function getIsUIDemo() : bool
238 {
239 return $this->ui_demo;
240 }
241
242 public function withUIDemo(bool $switch = true) : Standard
243 {
244 $clone = clone $this;
245 $clone->ui_demo = $switch;
246 return $clone;
247 }
248
249 public function withTitle(string $title) : Page\Standard
250 {
251 $clone = clone $this;
252 $clone->title = $title;
253 return $clone;
254 }
255
256 public function getTitle() : string
257 {
258 return $this->title;
259 }
260
261 public function withShortTitle(string $title) : Page\Standard
262 {
263 $clone = clone $this;
264 $clone->short_title = $title;
265 return $clone;
266 }
267
268 public function getShortTitle() : string
269 {
270 return $this->short_title;
271 }
272
273 public function withViewTitle(string $title) : Page\Standard
274 {
275 $clone = clone $this;
276 $clone->view_title = $title;
277 return $clone;
278 }
279
280 public function getViewTitle() : string
281 {
282 return $this->view_title;
283 }
284
285 public function withModeInfo(ModeInfo $mode_info) : \ILIAS\UI\Component\Layout\Page\Standard
286 {
287 $clone = clone $this;
288 $clone->mode_info = $mode_info;
289 return $clone;
290 }
291
292 public function getModeInfo() : ?ModeInfo
293 {
294 return $this->mode_info;
295 }
296
297 public function hasModeInfo() : bool
298 {
299 return $this->mode_info instanceof ModeInfo;
300 }
301
302 public function withNoFooter() : Standard
303 {
304 $clone = clone $this;
305 $clone->footer = null;
306 return $clone;
307 }
308
309 public function withSystemInfos(array $system_infos) : \ILIAS\UI\Component\Layout\Page\Standard
310 {
311 $this->checkArgListElements("system_infos", $system_infos, [SystemInfo::class]);
312 $clone = clone $this;
313 $clone->system_infos = $system_infos;
314 return $clone;
315 }
316
317 public function getSystemInfos() : array
318 {
319 return $this->system_infos;
320 }
321
322 public function hasSystemInfos() : bool
323 {
324 return count($this->system_infos) > 0;
325 }
326
327
328 public function withTextDirection(string $text_direction) : \ILIAS\UI\Component\Layout\Page\Standard
329 {
330 $this->checkArgIsElement(
331 "Text Direction",
332 $text_direction,
333 [self::LTR,self::RTL],
334 implode('/', [self::LTR,self::RTL])
335 );
336 $clone = clone $this;
337 $clone->text_direction = $text_direction;
338 return $clone;
339 }
340
341 public function getTextDirection() : string
342 {
343 return $this->text_direction;
344 }
345
346 public function withAdditionalMetaDatum(string $key, string $value) : \ILIAS\UI\Component\Layout\Page\Standard
347 {
348 $clone = clone $this;
349 $clone->meta_data[$key] = $value;
350 return $clone;
351 }
352
353 public function getMetaData() : array
354 {
355 return $this->meta_data;
356 }
357
358}
breadcrumbs()
Definition: breadcrumbs.php:2
An exception for terminatinating execution or to throw for unit testing.
__construct(array $content, MetaBar $metabar=null, MainBar $mainbar=null, Breadcrumbs $locator=null, Image $logo=null, Footer $footer=null, string $title='', string $short_title='', string $view_title='')
Standard constructor.
Definition: Standard.php:99
withAdditionalMetaDatum(string $key, string $value)
Definition: Standard.php:346
footer()
Definition: footer.php:3
This describes a standard button.
Definition: Standard.php:13
A component is the most general form of an entity in the UI.
Definition: Component.php:14
This describes the Page.
Definition: Page.php:14
This describes the Footer.
Definition: Footer.php:16
This describes the MainBar.
Definition: MainBar.php:17
This describes the MetaBar.
Definition: MetaBar.php:15
mainbar()
Definition: mainbar.php:2
metabar()
Definition: metabar.php:2
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
checkArgListElements($which, array &$values, $classes)
Check every element of the list if it is an instance of one of the given classes.
trait ComponentHelper
Provides common functionality for component implementations.
checkArgIsElement($which, $value, $array, $name)
Throw an InvalidArgumentException if $value is not an element of array.
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.