ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
base.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
34function base()
35{
36 //Loading factories
37 global $DIC;
38 $f = $DIC->ui()->factory();
39 $renderer = $DIC->ui()->renderer();
40 $refinery = $DIC->refinery();
41 $request_wrapper = $DIC->http()->wrapper()->query();
42
43 //Some Target magic to get a behaviour closer to some real use case
44 $target = $DIC->http()->request()->getRequestTarget();
45 $param = "Mode";
46
47 $active = 1;
48 if ($request_wrapper->has($param) && $request_wrapper->retrieve($param, $refinery->kindlyTo()->int())) {
49 $active = $request_wrapper->retrieve($param, $refinery->kindlyTo()->int());
50 }
51
52 //Here the real magic to draw the controls
53 $actions = array(
54 "$param 1" => "$target&$param=1",
55 "$param 2" => "$target&$param=2",
56 "$param 3" => "$target&$param=3",
57 );
58
59 $aria_label = "change_the_currently_displayed_mode";
60 $view_control = $f->viewControl()->mode($actions, $aria_label)->withActive("$param $active");
61 $html = $renderer->render($view_control);
62
63 return $html;
64}
$renderer
global $DIC
Definition: shib_login.php:26
$param
Definition: xapitoken.php:46