Phpr_Pagination class
Defined in |
/phproad/modules/phpr/classes/phpr_pagination.php, lines 16-242 |
Author |
LemonStand eCommerce Inc. |
Allows to paginate records, including database models.
Phpr_Pagination is an general purpose class allowing to paginate a list of records, including database models.
Usually objects of this class are created automatically with Db_ActiveRecord::paginate() method.
Below is a typical usage of the pagination object:
$pagination = $products->paginate(0, 10);
After obtaining the pagination object you can extract the number of pages from this object
and generate pagination markup.
Method details
¶
getCurrentPageIndex() method
public integer getCurrentPageIndex()
{return} |
integer |
returns the page index. |
Returns a zero-based index of the current page.
¶
getFirstPageRowIndex() method
public integer getFirstPageRowIndex()
{return} |
integer |
returns the row index. |
Returns an index of the first row on the current page.
¶
getLastPageRowIndex() method
public integer getLastPageRowIndex()
{return} |
integer |
returns the row index. |
Returns an index of the last row on the current page.
¶
getPageCount() method
public integer getPageCount()
{return} |
integer |
returns the total number of pages. |
Returns the total number of pages.
¶
getPageSize() method
public integer getPageSize()
{return} |
integer |
returns the number of rows on a single page. |
Returns the number of rows on a single page.
The number of rows (page size) can be set in the object constructor or with
setPageSize() method.
¶
getRowCount() method
public integer getRowCount()
{return} |
integer |
returns the total number of rows. |
Returns the total number of rows.
The total number of rows should be previously set with setRowCount() method.
¶
isFirstPage() method
public boolean isFirstPage()
{return} |
boolean |
returns TRUE if the current page is first. Returns FALSE otherwise. |
Determines whether the current page is first.
¶
isLastPage() method
public boolean isLastPage()
{return} |
boolean |
returns TRUE if the current page is last. Returns FALSE otherwise. |
Determines whether the current page is last.
¶
limitActiveRecord() method
¶
setCurrentPageIndex() method
public integer setCurrentPageIndex(integer $value)
$value |
integer |
specifies the zero-based page index. |
{return} |
integer |
returns the new page index. |
Sets a zero-based index of a current page.
Use this method to switch the pagination to another page before you call
limitActiveRecord() method.
The method returns the new page index. This value can differ from the
passed value if case if the passed value exceeds the maximum number of
pages or less than zero.
¶
setPageSize() method
public void setPageSize(integer $value)
$value |
integer |
specifies the number of rows on a single page. |
Sets the number of rows on a single page.
¶
setRowCount() method
public void setRowCount(integer $row_count)
$row_count |
integer |
specifies the total number of rows. |
¶
__construct() method
public Phpr_Pagination __construct(integer $page_size=20)
$page_size |
integer |
specifies the page size (number of records per page). |
{return} |
Phpr_Pagination |
returns the pagination object. |
Creates a new object of Phpr_Pagination class.
|