ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TableViewControlPagination.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
28{
29 protected int $number_of_rows = 800;
30 protected ?Range $range = null;
31
32 protected function initViewControlpagination(): void
33 {
34 $this->range = $this->getRange();
35 }
36
37 protected function getViewControlPagination(?int $total_count = null): ViewControl\Pagination|ViewControl\Group
38 {
39 $smallest_option = current(Pagination::DEFAULT_LIMITS);
40 if (is_null($total_count) || $total_count >= $smallest_option) {
41 $range = $this->getRange();
42 return
43 $this->view_control_factory->pagination()
44 ->withTotalCount($total_count)
45 ->withValue([
46 Pagination::FNAME_OFFSET => $range->getStart(),
47 Pagination::FNAME_LIMIT => $range->getLength()
48 ]);
49 }
50 return $this->view_control_factory->group([
51 $this->view_control_factory->nullControl(),
52 $this->view_control_factory->nullControl()
53 ]);
54 }
55
56 public function withRange(?Range $range): self
57 {
58 $clone = clone $this;
59 $clone->range = $range;
60 return $clone;
61 }
62
63 public function getRange(): Range
64 {
65 return $this->range ?? $this->data_factory->range(0, $this->number_of_rows);
66 }
67}
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:29
Groups are a special kind of input because they are a monoid operation.
Definition: Group.php:38
This describes a Pagination View Control.
Definition: Pagination.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21