ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
15
19class Standard implements Page\Standard
20{
26 private $mode_info;
30 private $content;
34 private $metabar;
38 private $mainbar;
42 private $breadcrumbs;
46 private $logo;
54 private $footer;
58 private $short_title;
62 private $view_title;
66 private $title;
70 private $with_headers = true;
74 private $ui_demo = false;
78 protected $meta_data = [];
79
90 public function __construct(
91 array $content,
92 MetaBar $metabar = null,
93 MainBar $mainbar = null,
94 Breadcrumbs $locator = null,
95 Image $logo = null,
96 Footer $footer = null,
97 string $title = '',
98 string $short_title = '',
99 string $view_title = ''
100 ) {
101 $allowed = [\ILIAS\UI\Component\Component::class];
102 $this->checkArgListElements("content", $content, $allowed);
103
104 $this->content = $content;
105 $this->metabar = $metabar;
106 $this->mainbar = $mainbar;
107 $this->breadcrumbs = $locator;
108 $this->logo = $logo;
109 $this->footer = $footer;
110 $this->title = $title;
111 $this->short_title = $short_title;
112 $this->view_title = $view_title;
113 }
114
115 public function withMetabar(MetaBar $meta_bar) : Page\Standard
116 {
117 $clone = clone $this;
118 $clone->metabar = $meta_bar;
119 return $clone;
120 }
121
122 public function withMainbar(MainBar $main_bar) : Page\Standard
123 {
124 $clone = clone $this;
125 $clone->mainbar = $main_bar;
126 return $clone;
127 }
128
129 public function withLogo(Image $logo) : Page\Standard
130 {
131 $clone = clone $this;
132 $clone->logo = $logo;
133 return $clone;
134 }
135
136 public function withResponsiveLogo(Image $logo) : Page\Standard
137 {
138 $clone = clone $this;
139 $clone->responsive_logo = $logo;
140 return $clone;
141 }
142
146 public function withFooter(Footer $footer) : Page\Standard
147 {
148 $clone = clone $this;
149 $clone->footer = $footer;
150 return $clone;
151 }
152
153 public function hasMetabar() : bool
154 {
155 return ($this->metabar instanceof MetaBar);
156 }
157
158 public function hasMainbar() : bool
159 {
160 return ($this->mainbar instanceof MainBar);
161 }
162
163 public function hasLogo() : bool
164 {
165 return ($this->logo instanceof Image);
166 }
167
168 public function hasResponsiveLogo() : bool
169 {
170 return ($this->responsive_logo instanceof Image);
171 }
172
173 public function hasFooter() : bool
174 {
175 return ($this->footer instanceof Footer);
176 }
177
178 public function getContent()
179 {
180 return $this->content;
181 }
182
183 public function getMetabar() : ?Metabar
184 {
185 return $this->metabar;
186 }
187
188 public function getMainbar() : ?Mainbar
189 {
190 return $this->mainbar;
191 }
192
193 public function getBreadcrumbs() : ?Breadcrumbs
194 {
195 return $this->breadcrumbs;
196 }
197
198 public function getLogo() : ?Image
199 {
200 return $this->logo;
201 }
202
203 public function getResponsiveLogo() : ?Image
204 {
205 return $this->responsive_logo;
206 }
207
208 public function getFooter() : ?Footer
209 {
210 return $this->footer;
211 }
212
216 public function withHeaders($use_headers) : Page
217 {
218 $clone = clone $this;
219 $clone->with_headers = $use_headers;
220 return $clone;
221 }
222
223 public function getWithHeaders() : bool
224 {
225 return $this->with_headers;
226 }
227
228 public function getIsUIDemo() : bool
229 {
230 return $this->ui_demo;
231 }
232
233 public function withUIDemo(bool $switch = true) : Standard
234 {
235 $clone = clone $this;
236 $clone->ui_demo = $switch;
237 return $clone;
238 }
239
240 public function withTitle(string $title) : Page\Standard
241 {
242 $clone = clone $this;
243 $clone->title = $title;
244 return $clone;
245 }
246
247 public function getTitle() : string
248 {
249 return $this->title;
250 }
251
252 public function withShortTitle(string $title) : Page\Standard
253 {
254 $clone = clone $this;
255 $clone->short_title = $title;
256 return $clone;
257 }
258
259 public function getShortTitle() : string
260 {
261 return $this->short_title;
262 }
263
264
265 public function withViewTitle(string $title) : Page\Standard
266 {
267 $clone = clone $this;
268 $clone->view_title = $title;
269 return $clone;
270 }
271
272 public function getViewTitle() : string
273 {
274 return $this->view_title;
275 }
276
277
278 public function withModeInfo(ModeInfo $mode_info) : \ILIAS\UI\Component\Layout\Page\Standard
279 {
280 $clone = clone $this;
281 $clone->mode_info = $mode_info;
282 return $clone;
283 }
284
285 public function getModeInfo() : ?ModeInfo
286 {
287 return $this->mode_info;
288 }
289
290
291 public function hasModeInfo() : bool
292 {
293 return $this->mode_info instanceof ModeInfo;
294 }
295
296 public function withNoFooter() : Standard
297 {
298 $clone = clone $this;
299 $clone->footer = null;
300 return $clone;
301 }
302
303 public function withAdditionalMetaDatum(string $key, string $value) : \ILIAS\UI\Component\Layout\Page\Standard
304 {
305 $clone = clone $this;
306 $clone->meta_data[$key] = $value;
307 return $clone;
308 }
309
310 public function getMetaData() : array
311 {
312 return $this->meta_data;
313 }
314}
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:90
withAdditionalMetaDatum(string $key, string $value)
Definition: Standard.php:303
footer()
Definition: footer.php:2
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:12
This describes the MainBar.
Definition: MainBar.php:16
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.
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.