ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
many_pages_dropdown.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
21 {
22  global $DIC;
23  $factory = $DIC->ui()->factory();
24  $renderer = $DIC->ui()->renderer();
25  $url = $DIC->http()->request()->getRequestTarget();
26  $refinery = $DIC->refinery();
27  $request_wrapper = $DIC->http()->wrapper()->query();
28 
29  $parameter_name = 'page3';
30  $current_page = 0;
31  if ($request_wrapper->has($parameter_name)) {
32  $current_page = $request_wrapper->retrieve($parameter_name, $refinery->kindlyTo()->int());
33  }
34 
35  $pagination = $factory->viewControl()->pagination()
36  ->withTargetURL($url, $parameter_name)
37  ->withTotalEntries(102)
38  ->withPageSize(10)
39  ->withDropdownAt(5)
40  ->withCurrentPage($current_page);
41 
42  $custom_pagination = $pagination
43  ->withDropdownLabel('current page is %1$d (of %2$d pages in total)');
44 
45  list($range_offset, $range_length) = $pagination->getRange()->unpack();
46  $result = "Show $range_length entries starting at $range_offset";
47 
48  return $renderer->render([$pagination, $custom_pagination])
49  . '<hr>'
50  . $result;
51 }
$renderer
$url
Definition: shib_logout.php:63
many_pages_dropdown()
description: > Example of rendering a pagination view control with many pages as dropdown ...
global $DIC
Definition: shib_login.php:25