ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\UI\examples\ViewControl\Pagination Namespace Reference

Functions

 base ()
 

description: > Example for rendering a pagination view control. More...

 
 many_pages ()
 

description: > Example of rendering a pagination view control with a lot of pages More...

 
 many_pages_dropdown ()
 

description: > Example of rendering a pagination view control with many pages as dropdown More...

 
 no_pages ()
 

description: > Example for a pagination view control with no pages More...

 
 with_signal ()
 

description: > Example for rendering a pagination view control with a signal More...

 

Function Documentation

◆ base()

ILIAS\UI\examples\ViewControl\Pagination\base ( )


description: > Example for rendering a pagination view control.

expected output: > ILIAS shows a series of numbers 1-10 positioned between a "Back" (<) and "Next" (<) glyph. Clicking a number loads a new page: the updated number will be shown under the series of numbers, e.g. "entries 80-90" after clicking "9". You can browse the pages by using the glyphs too. Please note that the "Back" glyph can't be used on the first page and the

"Next" glyph can't be used on the last page.

Definition at line 35 of file base.php.

References $DIC, ILIAS\UI\examples\Layout\Page\Standard\$refinery, $renderer, ILIAS\UI\examples\Layout\Page\Standard\$request_wrapper, and $url.

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
global $DIC
Definition: shib_login.php:22

◆ many_pages()

ILIAS\UI\examples\ViewControl\Pagination\many_pages ( )


description: > Example of rendering a pagination view control with a lot of pages

expected output: > ILIAS shows a series of numbers 1-500 in between the "Back" (<) and "Next" (>) glyph. The series of numbers is not displayed completely as it is limited to six elements (e.g. 1, 2, 3, 4, 5, 500). Navigating through the pagination

does not differ from the base pagination.

Definition at line 34 of file many_pages.php.

References $DIC, ILIAS\UI\examples\Layout\Page\Standard\$refinery, $renderer, ILIAS\UI\examples\Layout\Page\Standard\$request_wrapper, and $url.

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
global $DIC
Definition: shib_login.php:22

◆ many_pages_dropdown()

ILIAS\UI\examples\ViewControl\Pagination\many_pages_dropdown ( )


description: > Example of rendering a pagination view control with many pages as dropdown

expected output: > ILIAS shows two dropdown fields in between the "Back" (<) and "Next" (>) glyph. Clicking onto one of the dropdown fields will open a list of numbers. You can navigate to other pages through clicking the number in the dropdown control. If a number was clicked you will get redirected to the specific page and the number appears also in the label of the second dropdown. You can also use the glyphs to navigate through the pages, but please note that the "Back" glyph can't be used

on the first page and the "Next" glyph can't be used on the last page.

Definition at line 36 of file many_pages_dropdown.php.

References $DIC, ILIAS\UI\examples\Layout\Page\Standard\$refinery, $renderer, ILIAS\UI\examples\Layout\Page\Standard\$request_wrapper, and $url.

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
global $DIC
Definition: shib_login.php:22

◆ no_pages()

ILIAS\UI\examples\ViewControl\Pagination\no_pages ( )


description: > Example for a pagination view control with no pages

expected output: >

A Pagination with one page only will render as empty string which results into an empty display.

Definition at line 32 of file no_pages.php.

References $DIC, $renderer, and $url.

33 {
34  global $DIC;
35  $factory = $DIC->ui()->factory();
36  $renderer = $DIC->ui()->renderer();
37  $url = $DIC->http()->request()->getRequestTarget();
38 
39  $pagination = $factory->viewControl()->pagination()
40  ->withPageSize(10)
41  ->withTotalEntries(10);
42 
43  return $renderer->render($pagination);
44 }
$renderer
$url
Definition: shib_logout.php:66
global $DIC
Definition: shib_login.php:22

◆ with_signal()

ILIAS\UI\examples\ViewControl\Pagination\with_signal ( )


description: > Example for rendering a pagination view control with a signal

expected output: > ILIAS shows a series of numbers 1-10 in between the "Back" (<) and "Next" (>) glyph. Clicking a number or a glyph

will open a modal including an image.

Definition at line 33 of file with_signal.php.

References $DIC, and $renderer.

34 {
35  global $DIC;
36  $factory = $DIC->ui()->factory();
37  $renderer = $DIC->ui()->renderer();
38 
39  $image = $factory->image()->responsive("assets/ui-examples/images/Image/mountains.jpg", "Image source: https://stocksnap.io, Creative Commons CC0 license");
40  $page = $factory->modal()->lightboxImagePage($image, 'Mountains');
41  $modal = $factory->modal()->lightbox($page);
42 
43  $pagination = $factory->viewControl()->pagination()
44  ->withTotalEntries(98)
45  ->withPageSize(10)
46  ->withResetSignals()
47  ->withOnSelect($modal->getShowSignal());
48 
49  return $renderer->render([$pagination, $modal]);
50 }
$renderer
global $DIC
Definition: shib_login.php:22