ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ui.php
Go to the documentation of this file.
1 <?php
2 
4 
5 function ui()
6 {
7  global $DIC;
8  $f = $DIC->ui()->factory();
9  $renderer = $DIC->ui()->renderer();
10 
11  $url = 'src/UI/examples/Layout/Page/Standard/ui.php?new_ui=1';
12  $btn = $f->button()->standard('See UI in fullscreen-mode', $url);
13  return $renderer->render($btn);
14 }
15 
16 
17 if ($_GET['new_ui'] == '1') {
19 
20  $f = $DIC->ui()->factory();
21  $renderer = $DIC->ui()->renderer();
22  $logo = $f->image()->responsive("templates/default/images/HeaderIcon.svg", "ILIAS");
23  $breadcrumbs = pagedemoCrumbs($f);
24  $metabar = pagedemoMetabar($f);
25  $mainbar = pagedemoMainbar($f, $renderer);
26  $mainbar = $mainbar
27  //->withActive("pws")
32  //->withActive("tool2")
33  //->withActive($mainbar::NONE_ACTIVE)
34  ;
35 
36  $footer = pagedemoFooter($f);
37 
38  $entries = $mainbar->getEntries();
39  $tools = $mainbar->getToolEntries();
40  $content = pagedemoContent($f, $renderer, $mainbar);
41 
42  $page = $f->layout()->page()->standard(
43  $content,
44  $metabar,
45  $mainbar,
46  $breadcrumbs,
47  $logo,
48  $footer,
49  'UI PAGE DEMO', //page title
50  'ILIAS', //short title
51  'Std. Page Demo' //view title
52  )->withModeInfo($f->mainControls()->modeInfo("Member View", new URI($_SERVER['HTTP_REFERER'])))
53  ->withUIDemo(true);
54 
55  echo $renderer->render($page);
56 }
57 
58 
59 if ($_GET['replaced'] == '1') {
60  echo('Helo. Content from RPC.');
61  exit();
62 }
63 
69 {
70  chdir('../../../../../../');
71  require_once("Services/Init/classes/class.ilInitialisation.php");
72  require_once('src/UI/examples/Layout/Page/Standard/ui.php');
74 }
75 
76 function pagedemoCrumbs($f)
77 {
78  $crumbs = array(
79  $f->link()->standard("entry1", '#'),
80  $f->link()->standard("entry2", '#'),
81  $f->link()->standard("entry3", '#'),
82  $f->link()->standard("entry4", '#')
83  );
84  return $f->breadcrumbs($crumbs);
85 }
86 
87 function pagedemoContent($f, $r, $mainbar)
88 {
89  $tools = $mainbar->getToolEntries();
90 
91  $second_tool = array_values($tools)[1];
92  $url = "./src/UI/examples/Layout/Page/Standard/ui.php?replaced=1";
93  $replace_signal = $second_tool->getReplaceSignal()->withAsyncRenderUrl($url);
94  $replace_btn = $f->button()->standard('replace contents in 2nd tool', $replace_signal);
95 
96  $invisible_tool = array_values($tools)[2];
97  $engage_signal = $mainbar->getEngageToolSignal(array_keys($tools)[2]);
98  $invisible_tool_btn = $f->button()->standard('show the hidden tool', $engage_signal);
99 
100  return array(
101  $f->panel()->standard(
102  'Using Signals',
103  $f->legacy(
104  "This button will replace the contents of the second tool-slate.<br />"
105  . "Goto Tools, second entry and click it.<br />"
106  . $r->render($replace_btn)
107  . "<br><br>This will unhide and activate another tool<br />"
108  . $r->render($invisible_tool_btn)
109  )
110  ),
111 
112  $f->panel()->standard(
113  'Demo Content 2',
114  $f->legacy("some content<br>some content<br>some content<br>x.")
115  ),
116  $f->panel()->standard(
117  'Demo Content 3',
118  $f->legacy(loremIpsum())
119  ),
120  $f->panel()->standard(
121  'Demo Content 4',
122  $f->legacy("some content<br>some content<br>some content<br>x.")
123  )
124  );
125 }
126 
127 
128 
130 {
131  $df = new \ILIAS\Data\Factory();
132  $text = 'Additional info:';
133  $links = [];
134  $links[] = $f->link()->standard("Goto ILIAS", "http://www.ilias.de");
135  $links[] = $f->link()->standard("Goto ILIAS", "http://www.ilias.de");
136 
137  $footer = $f->mainControls()->footer($links, $text)
138  ->withPermanentURL(
139  $df->uri(
140  $_SERVER['REQUEST_SCHEME'] .
141  '://' .
142  $_SERVER['SERVER_NAME'] .
143  ':' .
144  $_SERVER['SERVER_PORT'] .
145  $_SERVER['SCRIPT_NAME'] .
146  '?' .
147  $_SERVER['QUERY_STRING']
148  )
149  );
150  return $footer;
151 }
152 
154 {
155  $help = $f->button()->bulky($f->symbol()->glyph()->help(), 'Help', '#');
156  $user = $f->button()->bulky($f->symbol()->glyph()->user(), 'User', '#');
157  $search = $f->maincontrols()->slate()->legacy(
158  'Search',
159  $f->symbol()->glyph()->search()->withCounter($f->counter()->status(1)),
160  $f->legacy(substr(loremIpsum(), 0, 180))
161  );
162  $notes = $f->maincontrols()->slate()->legacy(
163  'Notification',
164  $f->symbol()->glyph()->notification()->withCounter($f->counter()->novelty(3)),
165  $f->legacy('<p>some content</p>')
166  );
167 
168  $metabar = $f->mainControls()->metabar()
169  ->withAdditionalEntry('search', $search)
170  ->withAdditionalEntry('help', $help)
171  ->withAdditionalEntry('notes', $notes)
172  ->withAdditionalEntry('user', $user)
173  ;
174 
175  return $metabar;
176 }
177 
178 function pagedemoMainbar($f, $r)
179 {
180  $tools_btn = $f->button()->bulky(
181  $f->symbol()->icon()->custom('./src/UI/examples/Layout/Page/Standard/grid.svg', ''),
182  'Tools',
183  '#'
184  );
185  $more_btn = $f->button()->bulky(
186  $f->symbol()->icon()->standard('', ''),
187  'more',
188  '#'
189  );
190 
191  $mainbar = $f->mainControls()->mainbar()
192  ->withToolsButton($tools_btn)
193  ->withMoreButton($more_btn);
194 
195  $entries = [];
196  $entries['repository'] = getDemoEntryRepository($f);
197  $entries['pws'] = getDemoEntryPersonalWorkspace($f, $r);
198  $entries['achievements'] = getDemoEntryAchievements($f);
199  $entries['communication'] = getDemoEntryCommunication($f);
200  $entries['organisation'] = getDemoEntryOrganisation($f);
201  $entries['administration'] = getDemoEntryAdministration($f);
202 
203  foreach ($entries as $id => $entry) {
204  $mainbar = $mainbar->withAdditionalEntry($id, $entry);
205  }
206 
207  $tools = getDemoEntryTools($f);
208 
209  $mainbar = $mainbar
210  ->withAdditionalToolEntry('tool1', $tools['tool1'], false, $f->button()->close())
211  ->withAdditionalToolEntry('tool2', $tools['tool2'])
212  ->withAdditionalToolEntry('tool3', $tools['tool3'], true, $f->button()->close())
213  ->withAdditionalToolEntry('tool4', $tools['tool4'], false, $f->button()->close());
214 
215  return $mainbar;
216 }
217 
218 
220 {
221  $symbol = $f->symbol()->icon()
222  ->custom('./src/UI/examples/Layout/Page/Standard/layers.svg', '')
223  ->withSize('small');
224  $slate = $f->maincontrols()->slate()->combined('Repository', $symbol, '');
225 
226  $icon = $f->symbol()->icon()
227  ->standard('', '')
228  ->withSize('small')
229  ->withAbbreviation('X');
230 
231  $button = $f->button()->bulky(
232  $icon,
233  'Button 1',
234  './src/UI/examples/Layout/Page/Standard/ui.php?new_ui=1'
235  );
236 
237  $df = new \ILIAS\Data\Factory();
238  $url = $df->uri(
239  $_SERVER['REQUEST_SCHEME'] .
240  '://' .
241  $_SERVER['SERVER_NAME'] .
242  ':' .
243  $_SERVER['SERVER_PORT'] .
244  $_SERVER['SCRIPT_NAME'] .
245  '?' .
246  $_SERVER['QUERY_STRING']
247  );
248  $link1 = $f->link()->bulky($icon, 'Favorites (Link)', $url);
249  $link2 = $f->link()->bulky($icon, 'Courses (Link2)', $url);
250  $link3 = $f->link()->bulky($icon, 'Groups (Link)', $url);
251 
252  $slate = $slate
253  ->withAdditionalEntry($button->withLabel('Repository - Home'))
254  ->withAdditionalEntry($button->withLabel('Repository - Tree'))
255  ->withAdditionalEntry($button->withLabel('Repository - Last visited'))
256  ->withAdditionalEntry($link1)
257  ->withAdditionalEntry($link2)
258  ->withAdditionalEntry($link3)
259  ->withAdditionalEntry($button->withLabel('Study Programme'))
260  ->withAdditionalEntry($button->withLabel('Own Repository-Objects'))
261  ;
262 
263  foreach (range(1, 20) as $cnt) {
264  $slate = $slate
265  ->withAdditionalEntry($button->withLabel('fillup ' . $cnt));
266  }
267 
268  return $slate;
269 }
270 
272 {
273  $icon = $f->symbol()->icon()
274  ->standard('', '')
275  ->withSize('small')
276  ->withAbbreviation('X');
277 
278  $button = $f->button()->bulky(
279  $icon,
280  'Button 1',
281  './src/UI/examples/Layout/Page/Standard/ui.php?new_ui=1'
282  );
283 
284  $symbol = $f->symbol()->icon()
285  ->custom('./src/UI/examples/Layout/Page/Standard/user.svg', '')
286  ->withSize('small');
287 
288  $slate = $f->maincontrols()->slate()
289  ->combined('Personal Workspace', $symbol, '');
290 
291  $symbol = $f->symbol()->icon()
292  ->custom('./src/UI/examples/Layout/Page/Standard/bookmarks.svg', '')
293  ->withSize('small');
294 
295  $bookmarks = $f->legacy(implode('<br />', [
296  $r->render($f->button()->shy('my bookmark 1', '#')),
297  $r->render($f->button()->shy('my bookmark 2', '#'))
298  ]));
299  $slate_bookmarks = $f->maincontrols()->slate()
300  ->legacy('Bookmarks', $symbol, $bookmarks);
301 
302  $slate = $slate
303  ->withAdditionalEntry($button->withLabel('Overview'))
304  ->withAdditionalEntry($slate_bookmarks)
305  ->withAdditionalEntry($button->withLabel('Calendar'))
306  ->withAdditionalEntry($button->withLabel('Task'))
307  ->withAdditionalEntry($button->withLabel('Portfolios'))
308  ->withAdditionalEntry($button->withLabel('Personal Resources'))
309  ->withAdditionalEntry($button->withLabel('Shared Resources'))
310  ->withAdditionalEntry($button->withLabel('Notes'))
311  ->withAdditionalEntry($button->withLabel('News'))
312  ->withAdditionalEntry($button->withLabel('Background Tasks'))
313  ->withAdditionalEntry($slate_bookmarks)
314  ;
315  return $slate;
316 }
317 
319 {
320  $symbol = $f->symbol()->icon()
321  ->custom('./src/UI/examples/Layout/Page/Standard/achievements.svg', '')
322  ->withSize('small');
323  $slate = $f->maincontrols()->slate()->legacy(
324  'Achievements',
325  $symbol,
326  $f->legacy('content: Achievements')
327  );
328  return $slate;
329 }
330 
332 {
333  $symbol = $f->symbol()->icon()
334  ->custom('./src/UI/examples/Layout/Page/Standard/communication.svg', '')
335  ->withSize('small');
336  $slate = $f->maincontrols()->slate()->legacy(
337  'Communication',
338  $symbol,
339  $f->legacy('content: Communication')
340  );
341  return $slate;
342 }
343 
345 {
346  $symbol = $f->symbol()->icon()
347  ->custom('./src/UI/examples/Layout/Page/Standard/organisation.svg', '')
348  ->withSize('small');
349 
350  $sf = $f->maincontrols()->slate();
351  $slate = $sf->combined('Organisation', $symbol, '')
352  ->withAdditionalEntry(
353  $sf->combined('1', $symbol, '')
354  ->withAdditionalEntry($sf->combined('1.1', $symbol, ''))
355  ->withAdditionalEntry(
356  $sf->combined('1.2', $symbol, '')
357  ->withAdditionalEntry($sf->combined('1.2.1', $symbol, ''))
358  ->withAdditionalEntry($sf->combined('1.2.2', $symbol, ''))
359  )
360  )
361  ->withAdditionalEntry(
362  $sf->combined('2', $symbol, '')
363  ->withAdditionalEntry($sf->combined('2.1', $symbol, ''))
364  )
365  ->withAdditionalEntry($sf->combined('3', $symbol, ''))
366  ->withAdditionalEntry($sf->combined('4', $symbol, ''))
367  ;
368 
369 
370  return $slate;
371 }
372 
374 {
375  $symbol = $f->symbol()->icon()
376  ->custom('./src/UI/examples/Layout/Page/Standard/administration.svg', '')
377  ->withSize('small');
378  $slate = $f->maincontrols()->slate()->legacy(
379  'Administration',
380  $symbol,
381  $f->legacy('content: Administration')
382  );
383  return $slate;
384 }
385 
387 {
388  $tools = [];
389 
390  $symbol = $f->symbol()->icon()
391  ->custom('./src/UI/examples/Layout/Page/Standard/question.svg', '')
392  ->withSize('small');
393  $slate = $f->maincontrols()->slate()->legacy(
394  'Help',
395  $symbol,
396  $f->legacy('<h2>tool 1</h2><p>Some Text for Tool 1 entry</p>')
397  );
398  $tools['tool1'] = $slate;
399 
400  $symbol = $f->symbol()->icon()
401  ->custom('./src/UI/examples/Layout/Page/Standard/pencil.svg', '')
402  ->withSize('small');
403  $slate = $f->maincontrols()->slate()->legacy(
404  'Editor',
405  $symbol,
406  $f->legacy('<h2>tool 2</h2><p>Some Text for Tool 1 entry</p>')
407  );
408  $tools['tool2'] = $slate;
409 
410  $symbol = $f->symbol()->icon()
411  ->custom('./src/UI/examples/Layout/Page/Standard/notebook.svg', '')
412  ->withSize('small');
413  $slate = $f->maincontrols()->slate()->legacy(
414  'Initially hidden',
415  $symbol,
416  $f->legacy(loremIpsum())
417  );
418  $tools['tool3'] = $slate;
419 
420  $slate = $f->maincontrols()->slate()->legacy(
421  'Closable Tool',
422  $symbol,
423  $f->legacy(loremIpsum())
424  );
425  $tools['tool4'] = $slate;
426 
427 
428  return $tools;
429 }
430 
431 function loremIpsum() : string
432 {
433  return <<<EOT
434  <h2>Lorem ipsum</h2>
435  <p>
436  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
437  tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
438  At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
439  no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
440  consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
441  dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo
442  duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus
443  est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
444  sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore
445  magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo
446  dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est
447  Lorem ipsum dolor sit amet.
448  </p>
449  <p>
450  Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
451  consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan
452  et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
453  dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer
454  adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore
455  magna aliquam erat volutpat.
456  </p>
457  <p>
458  Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit
459  lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure
460  dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore
461  eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui
462  blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
463  </p>
464  <p>
465  Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming
466  id quod mazim placerat facer
467  </p>
468 EOT;
469 }
pagedemoCrumbs($f)
Definition: ui.php:76
exit
Definition: login.php:29
$_GET["client_id"]
getDemoEntryPersonalWorkspace($f, $r)
Definition: ui.php:271
pagedemoMetabar($f)
Definition: ui.php:153
pagedemoFooter($f)
Definition: ui.php:129
pagedemoContent($f, $r, $mainbar)
Definition: ui.php:87
loremIpsum()
Definition: ui.php:431
static initILIAS()
ilias initialisation
getDemoEntryOrganisation($f)
Definition: ui.php:344
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
The scope of this class is split ilias-conform URI&#39;s into components.
Definition: URI.php:17
ui()
Definition: ui.php:5
getDemoEntryCommunication($f)
Definition: ui.php:331
if($_GET['new_ui']=='1') if($_GET['replaced']=='1') _initIliasForPreview()
Below are helpers for the construction of demo-content.
Definition: ui.php:68
getDemoEntryTools($f)
Definition: ui.php:386
getDemoEntryAchievements($f)
Definition: ui.php:318
$DIC
Definition: xapitoken.php:46
pagedemoMainbar($f, $r)
Definition: ui.php:178
$url
getDemoEntryRepository($f)
Definition: ui.php:219
getDemoEntryAdministration($f)
Definition: ui.php:373