ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
async.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
34function async()
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 //Initializing the options, note that the label is taken care of by JS
44 $options = [
45 'default_option' => 'Default',
46 'latest' => 'Most Recent',
47 'oldest' => 'Oldest'
48 ];
49
50 //Note that the selected option needs to be displayed in the label
51 $select_option = 'default_option';
52 if ($request_wrapper->has('sortation') && $request_wrapper->retrieve('sortation', $refinery->kindlyTo()->string())) {
53 $select_option = $request_wrapper->retrieve('sortation', $refinery->kindlyTo()->string());
54 }
55
56 //Generation of the UI Component
57 $modal = $f->modal()->lightbox($f->modal()->lightboxTextPage('Note: This is just used to show case, how
58 this control can be used,to change an other components content.', "Sortation has changed: " . $options[$select_option]));
59 $s = $f->viewControl()->sortation($options, $select_option)
60 ->withTargetURL($DIC->http()->request()->getRequestTarget(), 'sortation')
61 ->withOnSort($modal->getShowSignal());
62
63 //Rendering
64 return $renderer->render([$s,$modal]);
65}
$renderer
global $DIC
Definition: shib_login.php:26