ILIAS  trunk Revision v11.0_alpha-1846-g895b5f47236
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
many_pages.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
34 function 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
$url
Definition: shib_logout.php:66
many_pages()
description: > Example of rendering a pagination view control with a lot of pages ...
Definition: many_pages.php:34
global $DIC
Definition: shib_login.php:22