ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
base.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
35 function base()
36 {
37  global $DIC;
38  $factory = $DIC->ui()->factory();
39  $renderer = $DIC->ui()->renderer();
40  $url = $DIC->http()->request()->getRequestTarget();
41  $refinery = $DIC->refinery();
42  $request_wrapper = $DIC->http()->wrapper()->query();
43 
44  $parameter_name = 'page';
45  $current_page = 0;
46  if ($request_wrapper->has($parameter_name)) {
47  $current_page = $request_wrapper->retrieve($parameter_name, $refinery->kindlyTo()->int());
48  }
49 
50  $pagination = $factory->viewControl()->pagination()
51  ->withTargetURL($url, $parameter_name)
52  ->withTotalEntries(98)
53  ->withPageSize(10)
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
base()
description: > Example for rendering a pagination view control.
Definition: base.php:35
global $DIC
Definition: shib_login.php:22