![]() |
rapila
|
Public Member Functions | |
__construct ($oQuery, $iPage=1, $iMaxRowsPerPage=25) | |
requiresPagination () | |
setPageLinkBase ($sPageLinkBaseBase) | |
getResult () | |
getQuery () | |
getFirstPage () | |
atFirstPage () | |
getLastPage () | |
atLastPage () | |
getPreviousLinks ($iRange=5) | |
getNextLinks ($iRange=5) | |
isLastPageComplete () | |
getPrevious () | |
getNext () | |
getPageLink ($iPage) | |
getPreviousLink () | |
getNextLink () | |
setPage ($iPage) | |
getPage () | |
setRowsPerPage ($iMaxRowsPerPage) | |
getRowsPerPage () | |
getTotalRecordCount () | |
setStart ($iValue) | |
getTotalPageCount () | |
setMaxRowPerPage ($iValue) | |
getRowsOnPage ($iPage) | |
count () | |
current () | |
key () | |
next () | |
rewind () | |
valid () | |
Protected Attributes | |
$iStart = 0 | |
$iMaxRowsPerPage = 0 | |
This file is part of the Rapila package. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
MIT License SimplePager • inspired by the PropelPager • handling only query objects
Example Usage:
$oQuery = ExampleQuery::create()->whateverQuery();
$oPager = new SimplePager($oQuery, 1, 50); [query, page, max_rows per_page]
$oPager->requiresPagination() $oPager->setPageLinkBase(url_without_page)
$oPager->getPreviousLink() $oPager->getNextLink()
foreach($oPager->getPreviousLinks() as $iPage) { echo $oPager->getPageLink($iPage); } // returns PropelCollection $oPager->getResult()[->getData()]
Iterate since PropelObjects extends ArrayObject $oIterator = $oPager->getResult()->getIterator(); while ($oIterator->valid()) { echo $oIterator->current(); $oIterator->next(); }
// Queries executed with defined select $oPager->getQuery()->select('fieldName1', 'fieldName2')->find() // etc
SimplePager::__construct | ( | $oQuery, | |
$iPage = 1 , |
|||
$iMaxRowsPerPage = 25 |
|||
) |
Create a new Simple Pager.
Criteria | $oQuery | |
int | $iPage | The current iPage (1-based). |
int | $iMaxRowsPerPage | The number of rows that should be displayed per iPage. |
SimplePager::atFirstPage | ( | ) |
Convenience method to indicate whether current iPage is the first iPage.
SimplePager::atLastPage | ( | ) |
Convenience method to indicate whether current iPage is the last page.
SimplePager::count | ( | ) |
Returns the count of the current page's records
SimplePager::getFirstPage | ( | ) |
Get the first iPage
For now I can only think of returning 1 always. It should probably return 0 if there are no iTotalPageCount
SimplePager::getLastPage | ( | ) |
Get last iPage
SimplePager::getNext | ( | ) |
Get next id
SimplePager::getNextLink | ( | ) |
get relative or absolute page link
SimplePager::getNextLinks | ( | $iRange = 5 | ) |
Get an array of next id's
int | $iRange |
SimplePager::getPage | ( | ) |
Get current iPage.
SimplePager::getPageLink | ( | $iPage | ) |
int | $iPage |
SimplePager::getPrevious | ( | ) |
Get previous id
SimplePager::getPreviousLink | ( | ) |
get relative or absolute page link
SimplePager::getPreviousLinks | ( | $iRange = 5 | ) |
Get an array of previous id's
int | $iRange |
SimplePager::getQuery | ( | ) |
SimplePager::getResult | ( | ) |
Get the iPaged resultset
SimplePager::getRowsPerPage | ( | ) |
Get number of rows per iPage.
SimplePager::getTotalPageCount | ( | ) |
get total iTotalPageCount
SimplePager::getTotalRecordCount | ( | ) |
Gets the total number of (un-LIMITed) records.
SimplePager::isLastPageComplete | ( | ) |
Returns whether last page is complete
SimplePager::requiresPagination | ( | ) |
SimplePager::setMaxRowPerPage | ( | $iValue | ) |
Sets max rows (limit).
int | $iValue |
SimplePager::setPage | ( | $iPage | ) |
Set the current iPage number (First iPage is 1).
int | $iPage |
SimplePager::setPageLinkBase | ( | $sPageLinkBaseBase | ) |
Set the asic pager url without page number
string | base url description: the base url without the page id |
SimplePager::setRowsPerPage | ( | $iMaxRowsPerPage | ) |
Set the number of rows per iPage.
int | $iMaxRowsPerPage |
SimplePager::setStart | ( | $iValue | ) |
Sets the start row or offset.
int |