rex_pager
in package
The rex_pager-class implements all the logic which is necessary to implement some sort of pagination.
Tags
Table of Contents
Methods
- __construct() : mixed
- Constructs a rex_pager.
- getCurrentPage() : int
- Returns the number of the current page.
- getCursor() : int
- Returns the current pagination position.
- getCursorName() : string
- Returns the name of the parameter which is used for pagination.
- getFirstPage() : int
- Returns the first page for pagination.
- getLastPage() : int
- Return the page number of the last page.
- getNextPage() : int
- Returns the number of the next page in respect to the current page.
- getPageCount() : int
- Returns the number of pages which result from the given number of rows and the rows per page.
- getPrevPage() : int
- Returns the previous page in respect to the current page.
- getRowCount() : int
- Returns the number of rows for pagination.
- getRowsPerPage() : int
- Returns the number of rows which will be displayed on a page.
- isActivePage() : bool
- Checks wheter the given page number is the active/current page.
- setCursor() : void
- setPage() : void
- setRowCount() : void
- Sets the row count.
- validateCursor() : int
- Validates the cursor.
Methods
__construct()
Constructs a rex_pager.
public
__construct([int $rowsPerPage = 30 ][, string $cursorName = 'start' ]) : mixed
Parameters
- $rowsPerPage : int = 30
-
The number of rows which should be displayed on one page
- $cursorName : string = 'start'
-
The name of the parameter used for pagination
getCurrentPage()
Returns the number of the current page.
public
getCurrentPage() : int
Return values
int —The current page number
getCursor()
Returns the current pagination position.
public
getCursor([int $pageNo = null ]) : int
When the parameter pageNo is given, the cursor for the given page is returned. When no parameter is given, the cursor for active page is returned.
Parameters
- $pageNo : int = null
Return values
intgetCursorName()
Returns the name of the parameter which is used for pagination.
public
getCursorName() : string
Return values
string —The name of the cursor
getFirstPage()
Returns the first page for pagination.
public
getFirstPage() : int
Return values
int —The first page number
getLastPage()
Return the page number of the last page.
public
getLastPage() : int
Return values
int —the last page number
getNextPage()
Returns the number of the next page in respect to the current page.
public
getNextPage() : int
Return values
int —The next page number
getPageCount()
Returns the number of pages which result from the given number of rows and the rows per page.
public
getPageCount() : int
Return values
int —The number of pages
getPrevPage()
Returns the previous page in respect to the current page.
public
getPrevPage() : int
Return values
int —The previous page number
getRowCount()
Returns the number of rows for pagination.
public
getRowCount() : int
Return values
int —The number of rows
getRowsPerPage()
Returns the number of rows which will be displayed on a page.
public
getRowsPerPage() : int
Return values
int —The rows displayed on a page
isActivePage()
Checks wheter the given page number is the active/current page.
public
isActivePage(int $pageNo) : bool
Parameters
- $pageNo : int
Return values
bool —True when the given pageNo is the current page, otherwise False
setCursor()
public
setCursor(int $cursor) : void
Parameters
- $cursor : int
setPage()
public
setPage(int $page) : void
Parameters
- $page : int
setRowCount()
Sets the row count.
public
setRowCount(int $rowCount) : void
Parameters
- $rowCount : int
validateCursor()
Validates the cursor.
public
validateCursor(int $cursor) : int
Parameters
- $cursor : int