\rex_pager

The rex_pager-class implements all the logic which is necessary to implement some sort of pagination.

Summary

Methods
Properties
Constants
__construct()
setRowCount()
getRowCount()
getPageCount()
getRowsPerPage()
setPage()
setCursor()
getCursor()
validateCursor()
getCursorName()
getFirstPage()
getPrevPage()
getCurrentPage()
getNextPage()
getLastPage()
isActivePage()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct(int  $rowsPerPage = 30, string  $cursorName = 'start') : mixed

Constructs a rex_pager.

Parameters

int $rowsPerPage

The number of rows which should be displayed on one page

string $cursorName

The name of the parameter used for pagination

Returns

mixed —

setRowCount()

setRowCount(int  $rowCount) : mixed

Sets the row count.

Parameters

int $rowCount

Returns

mixed —

getRowCount()

getRowCount() : int

Returns the number of rows for pagination.

Returns

int —

The number of rows

getPageCount()

getPageCount() : int

Returns the number of pages which result from the given number of rows and the rows per page.

Returns

int —

The number of pages

getRowsPerPage()

getRowsPerPage() : int

Returns the number of rows which will be displayed on a page.

Returns

int —

The rows displayed on a page

setPage()

setPage(int  $page) : void

Parameters

int $page

setCursor()

setCursor(int  $cursor) : void

Parameters

int $cursor

getCursor()

getCursor(int  $pageNo = null) : int

Returns the current pagination position.

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

int $pageNo

Returns

int —

validateCursor()

validateCursor(int  $cursor) : int

Validates the cursor.

Parameters

int $cursor

Returns

int —

getCursorName()

getCursorName() : string

Returns the name of the parameter which is used for pagination.

Returns

string —

The name of the cursor

getFirstPage()

getFirstPage() : int

Returns the first page for pagination.

Returns

int —

The first page number

getPrevPage()

getPrevPage() : int

Returns the previous page in respect to the current page.

Returns

int —

The previous page number

getCurrentPage()

getCurrentPage() : int

Returns the number of the current page.

Returns

int —

The current page number

getNextPage()

getNextPage() : int

Returns the number of the next page in respect to the current page.

Returns

int —

The next page number

getLastPage()

getLastPage() : int

Return the page number of the last page.

Returns

int —

the last page number

isActivePage()

isActivePage(int  $pageNo) : bool

Checks wheter the given page number is the active/current page.

Parameters

int $pageNo

Returns

bool —

True when the given pageNo is the current page, otherwise False