ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
many_pages_dropdown.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
37 {
38  global $DIC;
39  $factory = $DIC->ui()->factory();
40  $renderer = $DIC->ui()->renderer();
41  $url = $DIC->http()->request()->getRequestTarget();
42  $refinery = $DIC->refinery();
43  $request_wrapper = $DIC->http()->wrapper()->query();
44 
45  $parameter_name = 'page3';
46  $current_page = 0;
47  if ($request_wrapper->has($parameter_name)) {
48  $current_page = $request_wrapper->retrieve($parameter_name, $refinery->kindlyTo()->int());
49  }
50 
51  $pagination = $factory->viewControl()->pagination()
52  ->withTargetURL($url, $parameter_name)
53  ->withTotalEntries(102)
54  ->withPageSize(10)
55  ->withDropdownAt(5)
56  ->withCurrentPage($current_page);
57 
58  $custom_pagination = $pagination
59  ->withDropdownLabel('current page is %1$d (of %2$d pages in total)');
60 
61  list($range_offset, $range_length) = $pagination->getRange()->unpack();
62  $result = "Show $range_length entries starting at $range_offset";
63 
64  return $renderer->render([$pagination, $custom_pagination])
65  . '<hr>'
66  . $result;
67 }
$renderer
$url
Definition: shib_logout.php:66
many_pages_dropdown()
description: > Example of rendering a pagination view control with many pages as dropdown ...
global $DIC
Definition: shib_login.php:22