ILIAS  release_8 Revision v8.24
base.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
7function base()
8{
9 //Loading factories
10 global $DIC;
11 $f = $DIC->ui()->factory();
12 $renderer = $DIC->ui()->renderer();
13 $refinery = $DIC->refinery();
14 $request_wrapper = $DIC->http()->wrapper()->query();
15
16 //Some Target magic to get a behaviour closer to some real use case
17 $target = $DIC->http()->request()->getRequestTarget();
18 $param = "Section";
19 $active = 0;
20 if ($request_wrapper->has($param) && $request_wrapper->retrieve($param, $refinery->kindlyTo()->int())) {
21 $active = $request_wrapper->retrieve($param, $refinery->kindlyTo()->int());
22 }
23
24 //Here the real magic to draw the controls
25 $back = $f->button()->standard("Back", "$target&$param=" . ($active - 1));
26 $next = $f->button()->standard("Next" . " " . ($active - 1), "$target&$param=" . ($active + 1));
27 $middle = $f->button()->standard("Go to Engaged Section (Current Section: $active)", "$target&$param=0");
28 //Note that the if the middle button needs to be engaged by the surrounding component, as so, if need to be drawn
29 //as engaged. This can e.g. be the case for rendering a button labeled "Today" or similar.
30 if ($active == 0) {
31 $middle = $middle->withLabel("Engaged Section")->withEngagedState(true);
32 }
33 $view_control_section = $f->viewControl()->section($back, $middle, $next);
34 $html = $renderer->render($view_control_section);
35 return $html;
36}
global $DIC
Definition: feed.php:28
Refinery Factory $refinery
$param
Definition: xapitoken.php:46