ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
many_pages.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
18 function many_pages()
19 {
20  global $DIC;
21  $factory = $DIC->ui()->factory();
22  $renderer = $DIC->ui()->renderer();
23  $url = $DIC->http()->request()->getRequestTarget();
24  $refinery = $DIC->refinery();
25  $request_wrapper = $DIC->http()->wrapper()->query();
26 
27  $parameter_name = 'page2';
28  $current_page = 0;
29  if ($request_wrapper->has($parameter_name)) {
30  $current_page = $request_wrapper->retrieve($parameter_name, $refinery->kindlyTo()->int());
31  }
32 
33  $pagination = $factory->viewControl()->pagination()
34  ->withTargetURL($url, $parameter_name)
35  ->withTotalEntries(1000)
36  ->withPageSize(2)
37  ->withMaxPaginationButtons(5)
38  ->withCurrentPage($current_page);
39 
40  list($range_offset, $range_length) = $pagination->getRange()->unpack();
41  $result = "Show $range_length entries starting at $range_offset";
42 
43  return $renderer->render($pagination)
44  . '<hr>'
45  . $result;
46 }
$renderer
$url
Definition: shib_logout.php:63
many_pages()
description: > Example of rendering a pagination view control with a lot of pages ...
Definition: many_pages.php:18
global $DIC
Definition: shib_login.php:25