class PropelPager implements Countable, Iterator
PropelPager
Example Usage:
requireonce 'propel/util/PropelPager.php'; requireonce 'PEACH/Propel/Poem/poemPeer.php';
$c = new Criteria(); $c->addDescendingOrderByColumn(poemPeer::SID);
// with join $pager = new PropelPager($c, 'poemPeer', 'doSelectJoinPoemUsers', 1, 50);
// without Join
$pager = new PropelPager($c, 'poemPeer', 'doSelect', 1, 50);
Some template:
Total Pages: =$pager->getTotalPages()?> Total Records: =$pager->getTotalRecordCount()?>
getFirstPage):?> =$link?>| | getPrev()):?> Previous| | getPrevLinks() as $link):?> =$link?>| | =$pager->getPage()?> | getNextLinks() as $link):?> | =$link?> | getNext()):?> Last| | getLastPage()):?> =$link?>| |
Title | Auteur | Date | comments |
---|---|---|---|
=$poem->getTitle()?> | =$poem->getPoemUsers()->getUname()?> | =$poem->getTime()?> | =$poem->getComments()?> |
Methods
__construct(Criteria $c = null, string $peerClass = null, string $peerSelectMethod = null, int $page = 1, int $rowsPerPage = 25)
Create a new Propel Pager. |
||
void |
setCriteria(Criteria $c)
Set the criteria for this pager. |
|
Criteria |
getCriteria()
Return the Criteria object for this pager. |
|
void |
setPeerClass(string $class)
Set the Peer Classname |
|
string |
getPeerClass()
Return the Peer Classname. |
|
void |
setPeerMethod(string $method)
Set the Peer select method. |
|
string |
getPeerMethod()
Return the Peer select method. |
|
void |
setPeerSelectMethod(string $method)
Set the Peer select method. |
|
string |
getPeerSelectMethod()
Return the Peer select method. |
|
setPeerCountMethod(string $method)
Sets the Count method. |
||
getPeerCountMethod()
Return the Peer count method. |
||
mixed |
getResult()
Get the paged resultset |
|
int |
getFirstPage()
Get the first page |
|
boolean |
atFirstPage()
Convenience method to indicate whether current page is the first page. |
|
int |
getLastPage()
Get last page |
|
boolean |
atLastPage()
Convenience method to indicate whether current page is the last page. |
|
int |
getTotalPages()
get total pages |
|
array |
getPrevLinks(int $range = 5)
get an array of previous id's |
|
array |
getNextLinks(int $range = 5)
get an array of next id's |
|
bool |
isLastPageComplete()
Returns whether last page is complete |
|
mixed |
getPrev()
get previous id |
|
mixed |
getNext()
get next id |
|
void |
setPage(int $page)
Set the current page number (First page is 1). |
|
int |
getPage()
Get current page. |
|
setRowsPerPage(int $r)
Set the number of rows per page. |
||
int |
getRowsPerPage()
Get number of rows per page. |
|
int |
getTotalRecordCount()
Gets the total number of (un-LIMITed) records. |
|
setStart(int $v)
Sets the start row or offset. |
||
void |
setMax(int $v)
Sets max rows (limit). |
|
int |
count()
Returns the count of the current page's records |
|
mixed |
current()
Returns the current element of the iterator |
|
int |
key()
Returns the current key of the iterator |
|
void |
next()
Advances the iterator to the next element |
|
void |
rewind()
Resets the iterator to the first element |
|
boolean |
valid()
Checks if the current key exists in the container |
Details
at line 124
public
__construct(Criteria $c = null, string $peerClass = null, string $peerSelectMethod = null, int $page = 1, int $rowsPerPage = 25)
Create a new Propel Pager.
at line 144
public void
setCriteria(Criteria $c)
Set the criteria for this pager.
at line 154
public Criteria
getCriteria()
Return the Criteria object for this pager.
at line 166
public void
setPeerClass(string $class)
Set the Peer Classname
at line 176
public string
getPeerClass()
Return the Peer Classname.
at line 191
public void
setPeerMethod(string $method)
Set the Peer select method.
This exists for legacy support, please use setPeerSelectMethod().
at line 204
public string
getPeerMethod()
Return the Peer select method.
This exists for legacy support, please use getPeerSelectMethod().
at line 216
public void
setPeerSelectMethod(string $method)
Set the Peer select method.
at line 226
public string
getPeerSelectMethod()
Return the Peer select method.
at line 238
public
setPeerCountMethod(string $method)
Sets the Count method.
This is set based on the Peer method, for example if Peer method is doSelectJoin() then the count method will be doCountJoin().
at line 246
public
getPeerCountMethod()
Return the Peer count method.
at line 275
public mixed
getResult()
Get the paged resultset
at line 306
public int
getFirstPage()
Get the first page
For now I can only think of returning 1 always. It should probably return 0 if there are no pages
at line 316
public boolean
atFirstPage()
Convenience method to indicate whether current page is the first page.
at line 326
public int
getLastPage()
Get last page
at line 341
public boolean
atLastPage()
Convenience method to indicate whether current page is the last page.
at line 351
public int
getTotalPages()
get total pages
at line 372
public array
getPrevLinks(int $range = 5)
get an array of previous id's
at line 396
public array
getNextLinks(int $range = 5)
get an array of next id's
at line 418
public bool
isLastPageComplete()
Returns whether last page is complete
at line 428
public mixed
getPrev()
get previous id
at line 444
public mixed
getNext()
get next id
at line 462
public void
setPage(int $page)
Set the current page number (First page is 1).
at line 474
public int
getPage()
Get current page.
at line 484
public
setRowsPerPage(int $r)
Set the number of rows per page.
at line 496
public int
getRowsPerPage()
Get number of rows per page.
at line 518
public int
getTotalRecordCount()
Gets the total number of (un-LIMITed) records.
This method will perform a query that executes un-LIMITed query.
at line 541
public
setStart(int $v)
Sets the start row or offset.
at line 553
public void
setMax(int $v)
Sets max rows (limit).
at line 563
public int
count()
Returns the count of the current page's records
at line 573
public mixed
current()
Returns the current element of the iterator
at line 587
public int
key()
Returns the current key of the iterator
at line 597
public void
next()
Advances the iterator to the next element
at line 607
public void
rewind()
Resets the iterator to the first element
at line 617
public boolean
valid()
Checks if the current key exists in the container