PagerRenderer
in package
Class PagerRenderer
This class is passed to the view that describes the pagination, and is used to get the link information and provide utility methods needed to work with pagination.
Table of Contents
- $current : int
- Current page number.
- $first : int
- First page number.
- $last : int
- Last page number.
- $pageCount : int
- Total number of pages.
- $pageSelector : string
- Name of $_GET parameter
- $segment : int
- Segment number used for pagination.
- $total : int
- Total number of items.
- $uri : URI
- URI base for pagination links
- __construct() : mixed
- Constructor.
- getCurrent() : string
- Returns the URI of the current page.
- getCurrentPageNumber() : int
- Returns the page number of the current page.
- getFirst() : string
- Returns the URI of the first page.
- getFirstPageNumber() : int
- Returns the page number of the first page.
- getLast() : string
- Returns the URI of the last page.
- getLastPageNumber() : int
- Returns the page number of the last page.
- getNext() : string|null
- Returns a URL to the "next" page. The next page is NOT, the page after the current page, but is the page that follows the "last" page.
- getNextPage() : string|null
- Returns a URL to the "next" page.
- getNextPageNumber() : int|null
- Returns the next page number.
- getPageCount() : int
- Returns total number of pages.
- getPrevious() : string|null
- Returns a URL to the "previous" page. The previous page is NOT the page before the current page, but is the page just before the "first" page.
- getPreviousPage() : string|null
- Returns a URL to the "previous" page.
- getPreviousPageNumber() : int|null
- Returns the previous page number.
- hasNext() : bool
- Checks to see if there is a "next" page after our "last" page.
- hasNextPage() : bool
- Checks to see if there is a "next" page after our "last" page.
- hasPrevious() : bool
- Checks to see if there is a "previous" page before our "first" page.
- hasPreviousPage() : bool
- Checks to see if there is a "previous" page before our "first" page.
- links() : array<string|int, mixed>
- Returns an array of links that should be displayed. Each link is represented by another array containing of the URI the link should go to, the title (number) of the link, and a boolean value representing whether this link is active or not.
- setSurroundCount() : PagerRenderer
- Sets the total number of links that should appear on either side of the current page. Adjusts the first and last counts to reflect it.
- updatePages() : mixed
- Updates the first and last pages based on $surroundCount, which is the number of links surrounding the active page to show.
Properties
$current
Current page number.
protected
int
$current
$first
First page number.
protected
int
$first
$last
Last page number.
protected
int
$last
$pageCount
Total number of pages.
protected
int
$pageCount
$pageSelector
Name of $_GET parameter
protected
string
$pageSelector
$segment
Segment number used for pagination.
protected
int
$segment
$total
Total number of items.
protected
int
$total
$uri
URI base for pagination links
protected
URI
$uri
Methods
__construct()
Constructor.
public
__construct(array<string|int, mixed> $details) : mixed
Parameters
- $details : array<string|int, mixed>
Return values
mixed —getCurrent()
Returns the URI of the current page.
public
getCurrent() : string
Return values
string —getCurrentPageNumber()
Returns the page number of the current page.
public
getCurrentPageNumber() : int
Return values
int —getFirst()
Returns the URI of the first page.
public
getFirst() : string
Return values
string —getFirstPageNumber()
Returns the page number of the first page.
public
getFirstPageNumber() : int
Return values
int —getLast()
Returns the URI of the last page.
public
getLast() : string
Return values
string —getLastPageNumber()
Returns the page number of the last page.
public
getLastPageNumber() : int
Return values
int —getNext()
Returns a URL to the "next" page. The next page is NOT, the page after the current page, but is the page that follows the "last" page.
public
getNext() : string|null
You MUST call hasNext() first, or this value may be invalid.
Return values
string|null —getNextPage()
Returns a URL to the "next" page.
public
getNextPage() : string|null
You MUST call hasNextPage() first, or this value may be invalid.
Return values
string|null —getNextPageNumber()
Returns the next page number.
public
getNextPageNumber() : int|null
Return values
int|null —getPageCount()
Returns total number of pages.
public
getPageCount() : int
Return values
int —getPrevious()
Returns a URL to the "previous" page. The previous page is NOT the page before the current page, but is the page just before the "first" page.
public
getPrevious() : string|null
You MUST call hasPrevious() first, or this value may be invalid.
Return values
string|null —getPreviousPage()
Returns a URL to the "previous" page.
public
getPreviousPage() : string|null
You MUST call hasPreviousPage() first, or this value may be invalid.
Return values
string|null —getPreviousPageNumber()
Returns the previous page number.
public
getPreviousPageNumber() : int|null
Return values
int|null —hasNext()
Checks to see if there is a "next" page after our "last" page.
public
hasNext() : bool
Return values
bool —hasNextPage()
Checks to see if there is a "next" page after our "last" page.
public
hasNextPage() : bool
Return values
bool —hasPrevious()
Checks to see if there is a "previous" page before our "first" page.
public
hasPrevious() : bool
Return values
bool —hasPreviousPage()
Checks to see if there is a "previous" page before our "first" page.
public
hasPreviousPage() : bool
Return values
bool —links()
Returns an array of links that should be displayed. Each link is represented by another array containing of the URI the link should go to, the title (number) of the link, and a boolean value representing whether this link is active or not.
public
links() : array<string|int, mixed>
Return values
array<string|int, mixed> —setSurroundCount()
Sets the total number of links that should appear on either side of the current page. Adjusts the first and last counts to reflect it.
public
setSurroundCount([int|null $count = null ]) : PagerRenderer
Parameters
- $count : int|null = null
Return values
PagerRenderer —updatePages()
Updates the first and last pages based on $surroundCount, which is the number of links surrounding the active page to show.
protected
updatePages([int|null $count = null ]) : mixed
Parameters
- $count : int|null = null
-
The new "surroundCount"