ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
Standard.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
35 
36 class Standard implements Page\Standard
37 {
38  use ComponentHelper;
40 
44  private $content;
45  private ?ModeInfo $mode_info = null;
46  private ?MetaBar $metabar;
47  private ?MainBar $mainbar;
49  private ?Image $logo;
51  private string $favicon_path;
52  private ?Container $overlay;
53  private ?Footer $footer;
54  private string $short_title;
55  private string $view_title;
56  private string $title;
57  private bool $with_headers = true;
58  private bool $ui_demo = false;
59  protected array $system_infos = [];
60  protected string $text_direction = "ltr";
61  protected array $meta_data = [];
62 
63  public function __construct(
64  array $content,
65  ?MetaBar $metabar = null,
66  ?MainBar $mainbar = null,
67  ?Breadcrumbs $locator = null,
68  ?Image $logo = null,
69  ?Image $responsive_logo = null,
70  string $favicon_path = '',
71  ?Container $overlay = null,
72  ?Footer $footer = null,
73  string $title = '',
74  string $short_title = '',
75  string $view_title = ''
76  ) {
77  $allowed = [Component::class];
78  $this->checkArgListElements("content", $content, $allowed);
79 
80  $this->content = $content;
81  $this->metabar = $metabar;
82  $this->mainbar = $mainbar;
83  $this->breadcrumbs = $locator;
84  $this->logo = $logo;
85  $this->responsive_logo = $responsive_logo;
86  $this->favicon_path = $favicon_path;
87  $this->overlay = $overlay;
88  $this->footer = $footer;
89  $this->title = $title;
90  $this->short_title = $short_title;
91  $this->view_title = $view_title;
92  }
93 
97  public function withMetabar(MetaBar $meta_bar): Page\Standard
98  {
99  $clone = clone $this;
100  $clone->metabar = $meta_bar;
101  return $clone;
102  }
103 
107  public function withMainbar(MainBar $main_bar): Page\Standard
108  {
109  $clone = clone $this;
110  $clone->mainbar = $main_bar;
111  return $clone;
112  }
113 
114  public function withLogo(Image $logo): Page\Standard
115  {
116  $clone = clone $this;
117  $clone->logo = $logo;
118  return $clone;
119  }
120 
121  public function withResponsiveLogo(Image $logo): Page\Standard
122  {
123  $clone = clone $this;
124  $clone->responsive_logo = $logo;
125  return $clone;
126  }
127 
128  public function withFaviconPath(string $path): Standard
129  {
130  $clone = clone $this;
131  $clone->favicon_path = $path;
132  return $clone;
133  }
134 
138  public function withFooter(Footer $footer): Page\Standard
139  {
140  $clone = clone $this;
141  $clone->footer = $footer;
142  return $clone;
143  }
144 
148  public function hasMetabar(): bool
149  {
150  return ($this->metabar instanceof MetaBar);
151  }
152 
156  public function hasMainbar(): bool
157  {
158  return ($this->mainbar instanceof MainBar);
159  }
160 
164  public function hasLogo(): bool
165  {
166  return ($this->logo instanceof Image);
167  }
168 
169  public function hasResponsiveLogo(): bool
170  {
171  return ($this->responsive_logo instanceof Image);
172  }
173 
174  public function hasFooter(): bool
175  {
176  return ($this->footer instanceof Footer);
177  }
178 
182  public function getContent(): array
183  {
184  return $this->content;
185  }
186 
190  public function getMetabar(): ?MetaBar
191  {
192  return $this->metabar;
193  }
194 
198  public function getMainbar(): ?MainBar
199  {
200  return $this->mainbar;
201  }
202 
206  public function getBreadcrumbs(): ?Breadcrumbs
207  {
208  return $this->breadcrumbs;
209  }
210 
214  public function getLogo(): ?Image
215  {
216  return $this->logo;
217  }
218 
219  public function getResponsiveLogo(): ?Image
220  {
221  return $this->responsive_logo;
222  }
223 
224  public function getFaviconPath(): string
225  {
226  return $this->favicon_path;
227  }
228 
229  public function getFooter(): ?Footer
230  {
231  return $this->footer;
232  }
233 
234  public function withHeaders(bool $use_headers): Page\Standard
235  {
236  $clone = clone $this;
237  $clone->with_headers = $use_headers;
238  return $clone;
239  }
240 
241  public function getWithHeaders(): bool
242  {
243  return $this->with_headers;
244  }
245 
246  public function getIsUIDemo(): bool
247  {
248  return $this->ui_demo;
249  }
250 
251  public function withUIDemo(bool $switch = true): Page\Standard
252  {
253  $clone = clone $this;
254  $clone->ui_demo = $switch;
255  return $clone;
256  }
257 
258  public function withTitle(string $title): Page\Standard
259  {
260  $clone = clone $this;
261  $clone->title = $title;
262  return $clone;
263  }
264 
265  public function getTitle(): string
266  {
267  return $this->title;
268  }
269 
270  public function withShortTitle(string $title): Page\Standard
271  {
272  $clone = clone $this;
273  $clone->short_title = $title;
274  return $clone;
275  }
276 
277  public function getShortTitle(): string
278  {
279  return $this->short_title;
280  }
281 
282  public function withViewTitle(string $title): Page\Standard
283  {
284  $clone = clone $this;
285  $clone->view_title = $title;
286  return $clone;
287  }
288 
289  public function getViewTitle(): string
290  {
291  return $this->view_title;
292  }
293 
294  public function withModeInfo(ModeInfo $mode_info): Page\Standard
295  {
296  $clone = clone $this;
297  $clone->mode_info = $mode_info;
298  return $clone;
299  }
300 
301  public function getModeInfo(): ?ModeInfo
302  {
303  return $this->mode_info;
304  }
305 
306  public function hasModeInfo(): bool
307  {
308  return $this->mode_info instanceof ModeInfo;
309  }
310 
311  public function withNoFooter(): Page\Standard
312  {
313  $clone = clone $this;
314  $clone->footer = null;
315  return $clone;
316  }
317 
318  public function withAdditionalMetaDatum(string $key, string $value): Page\Standard
319  {
320  $clone = clone $this;
321  $clone->meta_data[$key] = $value;
322  return $clone;
323  }
324 
325  public function getMetaData(): array
326  {
327  return $this->meta_data;
328  }
329 
330  public function withSystemInfos(array $system_infos): Page\Standard
331  {
332  $this->checkArgListElements("system_infos", $system_infos, [SystemInfo::class]);
333  $clone = clone $this;
334  $clone->system_infos = $system_infos;
335  return $clone;
336  }
337 
338  public function getSystemInfos(): array
339  {
340  return $this->system_infos;
341  }
342 
343  public function hasSystemInfos(): bool
344  {
345  return count($this->system_infos) > 0;
346  }
347 
348 
349  public function withTextDirection(string $text_direction): Page\Standard
350  {
351  $this->checkArgIsElement(
352  "Text Direction",
353  $text_direction,
354  [self::LTR,self::RTL],
355  implode('/', [self::LTR,self::RTL])
356  );
357  $clone = clone $this;
358  $clone->text_direction = $text_direction;
359  return $clone;
360  }
361 
362  public function getTextDirection(): string
363  {
364  return $this->text_direction;
365  }
366 
367  public function hasOverlay(): bool
368  {
369  return $this->overlay instanceof Container;
370  }
371 
372  public function getOverlay(): ?Container
373  {
374  return $this->overlay;
375  }
376 }
This describes the MainBar.
Definition: MainBar.php:33
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
withAdditionalMetaDatum(string $key, string $value)
Definition: Standard.php:318
$path
Definition: ltiservices.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
string $key
Consumer key/client ID value.
Definition: System.php:193
This describes a standard button.
Definition: Standard.php:26
This describes the Page.
Definition: Page.php:30
This describes the MetaBar.
Definition: MetaBar.php:32
__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:63
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
This describes the Footer.
Definition: Footer.php:32