Class

PropelPager

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: getTotalPages()?> Total Records: getTotalRecordCount()?>

getFirstPage):?> | getPrev()):?> Previous| getPrevLinks() as $link):?> | getPage()?> getNextLinks() as $link):?> | getNext()):?> Last| getLastPage()):?> |
getResult() as $poem):?>
Title Auteur Date comments
getTitle()?> getPoemUsers()->getUname()?> getTime()?> 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.

Parameters

Criteria $c
string $peerClass The name of the static Peer class.
string $peerSelectMethod The name of the static method for selecting content from the Peer class.
int $page The current page (1-based).
int $rowsPerPage The number of rows that should be displayed per page.

at line 144
public void setCriteria(Criteria $c)

Set the criteria for this pager.

Parameters

Criteria $c

Return Value

void

at line 154
public Criteria getCriteria()

Return the Criteria object for this pager.

Return Value

Criteria

at line 166
public void setPeerClass(string $class)

Set the Peer Classname

Parameters

string $class

Return Value

void

at line 176
public string getPeerClass()

Return the Peer Classname.

Return Value

string

at line 191
public void setPeerMethod(string $method)

Set the Peer select method.

This exists for legacy support, please use setPeerSelectMethod().

Parameters

string $method The name of the static method to call on the Peer class.

Return Value

void

See also

setPeerSelectMethod()

at line 204
public string getPeerMethod()

Return the Peer select method.

This exists for legacy support, please use getPeerSelectMethod().

Return Value

string

See also

getPeerSelectMethod()

at line 216
public void setPeerSelectMethod(string $method)

Set the Peer select method.

Parameters

string $method The name of the static method to call on the Peer class.

Return Value

void

at line 226
public string getPeerSelectMethod()

Return the Peer select method.

Return Value

string

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().

Parameters

string $method The name of the static method to call on the Peer class.

at line 246
public getPeerCountMethod()

Return the Peer count method.

at line 275
public mixed getResult()

Get the paged resultset

Return Value

mixed $rs

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

Return Value

int 1

at line 316
public boolean atFirstPage()

Convenience method to indicate whether current page is the first page.

Return Value

boolean

at line 326
public int getLastPage()

Get last page

Return Value

int $lastPage

at line 341
public boolean atLastPage()

Convenience method to indicate whether current page is the last page.

Return Value

boolean

at line 351
public int getTotalPages()

get total pages

Return Value

int $this->pages

get an array of previous id's

Parameters

int $range

Return Value

array $links

get an array of next id's

Parameters

int $range

Return Value

array $links

at line 418
public bool isLastPageComplete()

Returns whether last page is complete

Return Value

bool Last page complete or not

at line 428
public mixed getPrev()

get previous id

Return Value

mixed $prev

at line 444
public mixed getNext()

get next id

Return Value

mixed $next

at line 462
public void setPage(int $page)

Set the current page number (First page is 1).

Parameters

int $page

Return Value

void

at line 474
public int getPage()

Get current page.

Return Value

int

at line 484
public setRowsPerPage(int $r)

Set the number of rows per page.

Parameters

int $r

at line 496
public int getRowsPerPage()

Get number of rows per page.

Return Value

int

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.

Return Value

int Total number of records - disregarding page, maxrows, etc.

at line 541
public setStart(int $v)

Sets the start row or offset.

Parameters

int $v

at line 553
public void setMax(int $v)

Sets max rows (limit).

Parameters

int $v

Return Value

void

at line 563
public int count()

Returns the count of the current page's records

Return Value

int

at line 573
public mixed current()

Returns the current element of the iterator

Return Value

mixed

at line 587
public int key()

Returns the current key of the iterator

Return Value

int

at line 597
public void next()

Advances the iterator to the next element

Return Value

void

at line 607
public void rewind()

Resets the iterator to the first element

Return Value

void

at line 617
public boolean valid()

Checks if the current key exists in the container

Return Value

boolean