ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
many_pages.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
7 function many_pages()
8 {
9  global $DIC;
10  $factory = $DIC->ui()->factory();
11  $renderer = $DIC->ui()->renderer();
12  $url = $DIC->http()->request()->getRequestTarget();
13  $refinery = $DIC->refinery();
14  $request_wrapper = $DIC->http()->wrapper()->query();
15 
16  $parameter_name = 'page2';
17  $current_page = 0;
18  if ($request_wrapper->has($parameter_name)) {
19  $current_page = $request_wrapper->retrieve($parameter_name, $refinery->kindlyTo()->int());
20  }
21 
22  $pagination = $factory->viewControl()->pagination()
23  ->withTargetURL($url, $parameter_name)
24  ->withTotalEntries(1000)
25  ->withPageSize(2)
26  ->withMaxPaginationButtons(5)
27  ->withCurrentPage($current_page);
28 
29  list($range_offset, $range_length) = $pagination->getRange()->unpack();
30  $result = "Show $range_length entries starting at $range_offset";
31 
32  return $renderer->render($pagination)
33  . '<hr>'
34  . $result;
35 }
global $DIC
Definition: feed.php:28
$url
$factory
Definition: metadata.php:75
Refinery Factory $refinery