Pagination
class Pagination implements PaginationInterface
Pagination class.
Properties
protected int | $items | Number of items. | |
protected int | $itemsPerPage | Number of items per page. | |
protected int | $currentPage | Current page. | |
protected array | $options | Options. | |
protected int | $pages | Number of pages. | |
protected int | $offset | Offset. | |
protected Request | $request | Request instance. | |
protected array | $params | Query parameter cache. | |
protected URLBuilder | $urlBuilder | URL builder instance. | |
protected ViewFactory | $viewFactory | View factory instance. | |
protected array | $pagination | Pagination. |
Methods
Constructor.
Returns the number of items.
Returns the number of items per page.
Returns the current page.
Returns TRUE if we're on a valid page and FALSE if not.
Returns the number pages.
Returns the limit.
Returns the offset.
Builds a url to the desired page.
Returns an array representation of the pagination object.
Returns data which can be serialized by json_encode().
Returns a json representation of the pagination object.
Builds and returns the pagination array.
Renders and returns the pagination partial.
Details
at line 111
__construct(int $items, int $itemsPerPage, int $currentPage, array $options = [])
Constructor.
at line 133
int
items()
Returns the number of items.
at line 141
int
itemsPerPage()
Returns the number of items per page.
at line 149
int
currentPage()
Returns the current page.
at line 157
bool
isValidPage()
Returns TRUE if we're on a valid page and FALSE if not.
at line 165
int
numberOfPages()
Returns the number pages.
at line 173
int
limit()
Returns the limit.
at line 181
int
offset()
Returns the offset.
at line 191
setRequest(Request $request)
Sets the request instance.
at line 201
setURLBuilder(URLBuilder $urlBuilder)
Sets the URL builder instance.
at line 211
setViewFactory(ViewFactory $viewFactory)
Sets the view factory builder instance.
at line 222
protected string
buildPageUrl(int $page)
Builds a url to the desired page.
at line 235
array
toArray()
Returns an array representation of the pagination object.
at line 265
array
jsonSerialize()
Returns data which can be serialized by json_encode().
at line 273
string
toJson(int $options = 0)
Returns a json representation of the pagination object.
at line 283
array
pagination()
Builds and returns the pagination array.
at line 349
string
render(string $view)
Renders and returns the pagination partial.