ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Standard.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
32use ILIAS\UI\Implementation\Component\ComponentHelper;
36
37class Standard implements Page\Standard
38{
39 use ComponentHelper;
41
45 private $content;
46 private ?ModeInfo $mode_info = null;
47 private ?MetaBar $metabar;
48 private ?MainBar $mainbar;
50 private ?Image $logo;
52 private string $favicon_path;
54 private ?Footer $footer;
55 private string $short_title;
56 private string $view_title;
57 private string $title;
58 private bool $with_headers = true;
59 private bool $ui_demo = false;
60 protected array $system_infos = [];
61 protected string $text_direction = "ltr";
65 protected array $meta_data = [];
66
67 public function __construct(
68 array $content,
69 ?MetaBar $metabar = null,
70 ?MainBar $mainbar = null,
71 ?Breadcrumbs $locator = null,
72 ?Image $logo = null,
73 ?Image $responsive_logo = null,
74 string $favicon_path = '',
75 ?Container $overlay = null,
76 ?Footer $footer = null,
77 string $title = '',
78 string $short_title = '',
79 string $view_title = ''
80 ) {
81 $allowed = [Component::class];
82 $this->checkArgListElements("content", $content, $allowed);
83
84 $this->content = $content;
85 $this->metabar = $metabar;
86 $this->mainbar = $mainbar;
87 $this->breadcrumbs = $locator;
88 $this->logo = $logo;
89 $this->responsive_logo = $responsive_logo;
90 $this->favicon_path = $favicon_path;
91 $this->overlay = $overlay;
92 $this->footer = $footer;
93 $this->title = $title;
94 $this->short_title = $short_title;
95 $this->view_title = $view_title;
96 }
97
101 public function withMetabar(MetaBar $meta_bar): Page\Standard
102 {
103 $clone = clone $this;
104 $clone->metabar = $meta_bar;
105 return $clone;
106 }
107
111 public function withMainbar(MainBar $main_bar): Page\Standard
112 {
113 $clone = clone $this;
114 $clone->mainbar = $main_bar;
115 return $clone;
116 }
117
118 public function withLogo(Image $logo): Page\Standard
119 {
120 $clone = clone $this;
121 $clone->logo = $logo;
122 return $clone;
123 }
124
125 public function withResponsiveLogo(Image $logo): Page\Standard
126 {
127 $clone = clone $this;
128 $clone->responsive_logo = $logo;
129 return $clone;
130 }
131
132 public function withFaviconPath(string $path): Standard
133 {
134 $clone = clone $this;
135 $clone->favicon_path = $path;
136 return $clone;
137 }
138
142 public function withFooter(Footer $footer): Page\Standard
143 {
144 $clone = clone $this;
145 $clone->footer = $footer;
146 return $clone;
147 }
148
152 public function hasMetabar(): bool
153 {
154 return ($this->metabar instanceof MetaBar);
155 }
156
160 public function hasMainbar(): bool
161 {
162 return ($this->mainbar instanceof MainBar);
163 }
164
168 public function hasLogo(): bool
169 {
170 return ($this->logo instanceof Image);
171 }
172
173 public function hasResponsiveLogo(): bool
174 {
175 return ($this->responsive_logo instanceof Image);
176 }
177
178 public function hasFooter(): bool
179 {
180 return ($this->footer instanceof Footer);
181 }
182
186 public function getContent(): array
187 {
188 return $this->content;
189 }
190
194 public function getMetabar(): ?MetaBar
195 {
196 return $this->metabar;
197 }
198
202 public function getMainbar(): ?MainBar
203 {
204 return $this->mainbar;
205 }
206
210 public function getBreadcrumbs(): ?Breadcrumbs
211 {
212 return $this->breadcrumbs;
213 }
214
218 public function getLogo(): ?Image
219 {
220 return $this->logo;
221 }
222
223 public function getResponsiveLogo(): ?Image
224 {
225 return $this->responsive_logo;
226 }
227
228 public function getFaviconPath(): string
229 {
230 return $this->favicon_path;
231 }
232
233 public function getFooter(): ?Footer
234 {
235 return $this->footer;
236 }
237
238 public function withHeaders(bool $use_headers): Page\Standard
239 {
240 $clone = clone $this;
241 $clone->with_headers = $use_headers;
242 return $clone;
243 }
244
245 public function getWithHeaders(): bool
246 {
247 return $this->with_headers;
248 }
249
250 public function getIsUIDemo(): bool
251 {
252 return $this->ui_demo;
253 }
254
255 public function withUIDemo(bool $switch = true): Page\Standard
256 {
257 $clone = clone $this;
258 $clone->ui_demo = $switch;
259 return $clone;
260 }
261
262 public function withTitle(string $title): Page\Standard
263 {
264 $clone = clone $this;
265 $clone->title = $title;
266 return $clone;
267 }
268
269 public function getTitle(): string
270 {
271 return $this->title;
272 }
273
274 public function withShortTitle(string $title): Page\Standard
275 {
276 $clone = clone $this;
277 $clone->short_title = $title;
278 return $clone;
279 }
280
281 public function getShortTitle(): string
282 {
283 return $this->short_title;
284 }
285
286 public function withViewTitle(string $title): Page\Standard
287 {
288 $clone = clone $this;
289 $clone->view_title = $title;
290 return $clone;
291 }
292
293 public function getViewTitle(): string
294 {
295 return $this->view_title;
296 }
297
298 public function withModeInfo(ModeInfo $mode_info): Page\Standard
299 {
300 $clone = clone $this;
301 $clone->mode_info = $mode_info;
302 return $clone;
303 }
304
305 public function getModeInfo(): ?ModeInfo
306 {
307 return $this->mode_info;
308 }
309
310 public function hasModeInfo(): bool
311 {
312 return $this->mode_info instanceof ModeInfo;
313 }
314
315 public function withNoFooter(): Page\Standard
316 {
317 $clone = clone $this;
318 $clone->footer = null;
319 return $clone;
320 }
321
322 public function withAdditionalMetaDatum(Html\Tag $tag): Page\Standard
323 {
324 $clone = clone $this;
325 $clone->meta_data[] = $tag;
326 return $clone;
327 }
328
332 public function getMetaData(): array
333 {
334 return $this->meta_data;
335 }
336
337 public function withSystemInfos(array $system_infos): Page\Standard
338 {
339 $this->checkArgListElements("system_infos", $system_infos, [SystemInfo::class]);
340 $clone = clone $this;
341 $clone->system_infos = $system_infos;
342 return $clone;
343 }
344
345 public function getSystemInfos(): array
346 {
347 return $this->system_infos;
348 }
349
350 public function hasSystemInfos(): bool
351 {
352 return count($this->system_infos) > 0;
353 }
354
355
356 public function withTextDirection(string $text_direction): Page\Standard
357 {
358 $this->checkArgIsElement(
359 "Text Direction",
360 $text_direction,
361 [self::LTR,self::RTL],
362 implode('/', [self::LTR,self::RTL])
363 );
364 $clone = clone $this;
365 $clone->text_direction = $text_direction;
366 return $clone;
367 }
368
369 public function getTextDirection(): string
370 {
371 return $this->text_direction;
372 }
373
374 public function hasOverlay(): bool
375 {
376 return $this->overlay instanceof Container;
377 }
378
379 public function getOverlay(): ?Container
380 {
381 return $this->overlay;
382 }
383}
__construct(array $content, ?MetaBar $metabar=null, ?MainBar $mainbar=null, ?Breadcrumbs $locator=null, ?Image $logo=null, ?Image $responsive_logo=null, string $favicon_path='', ?Container $overlay=null, ?Footer $footer=null, string $title='', string $short_title='', string $view_title='')
Definition: Standard.php:67
A component is the most general form of an entity in the UI.
Definition: Component.php:28
This describes the Page.
Definition: Page.php:31
This describes the MainBar.
Definition: MainBar.php:34
This describes the MetaBar.
Definition: MetaBar.php:33
$path
Definition: ltiservices.php:30
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.