ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
many_pages.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
34function many_pages()
35{
36 global $DIC;
37 $factory = $DIC->ui()->factory();
38 $renderer = $DIC->ui()->renderer();
39 $url = $DIC->http()->request()->getRequestTarget();
40 $refinery = $DIC->refinery();
41 $request_wrapper = $DIC->http()->wrapper()->query();
42
43 $parameter_name = 'page2';
44 $current_page = 0;
45 if ($request_wrapper->has($parameter_name)) {
46 $current_page = $request_wrapper->retrieve($parameter_name, $refinery->kindlyTo()->int());
47 }
48
49 $pagination = $factory->viewControl()->pagination()
50 ->withTargetURL($url, $parameter_name)
51 ->withTotalEntries(1000)
52 ->withPageSize(2)
53 ->withMaxPaginationButtons(5)
54 ->withCurrentPage($current_page);
55
56 list($range_offset, $range_length) = $pagination->getRange()->unpack();
57 $result = "Show $range_length entries starting at $range_offset";
58
59 return $renderer->render($pagination)
60 . '<hr>'
61 . $result;
62}
$renderer
global $DIC
Definition: shib_login.php:26
$url
Definition: shib_logout.php:68