ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
many_pages_dropdown.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
37{
38 global $DIC;
39 $factory = $DIC->ui()->factory();
40 $renderer = $DIC->ui()->renderer();
41 $url = $DIC->http()->request()->getRequestTarget();
42 $refinery = $DIC->refinery();
43 $request_wrapper = $DIC->http()->wrapper()->query();
44
45 $parameter_name = 'page3';
46 $current_page = 0;
47 if ($request_wrapper->has($parameter_name)) {
48 $current_page = $request_wrapper->retrieve($parameter_name, $refinery->kindlyTo()->int());
49 }
50
51 $pagination = $factory->viewControl()->pagination()
52 ->withTargetURL($url, $parameter_name)
53 ->withTotalEntries(102)
54 ->withPageSize(10)
55 ->withDropdownAt(5)
56 ->withCurrentPage($current_page);
57
58 $custom_pagination = $pagination
59 ->withDropdownLabel('current page is %1$d (of %2$d pages in total)');
60
61 list($range_offset, $range_length) = $pagination->getRange()->unpack();
62 $result = "Show $range_length entries starting at $range_offset";
63
64 return $renderer->render([$pagination, $custom_pagination])
65 . '<hr>'
66 . $result;
67}
$renderer
global $DIC
Definition: shib_login.php:26
$url
Definition: shib_logout.php:68