propel-util
[ class tree: propel-util ] [ index: propel-util ] [ all elements ]

Class: PropelPager

Source Location: /util/PropelPager.php

Class Overview


PropelPager


Author(s):

Version:

  • $Revision: 563 $

Copyright:

  • Copyright (c) 2004 Rob Halff: LGPL - See LICENCE

Variables

Methods



Class Details

[line 103]
PropelPager

Example Usage:

require_once 'propel/util/PropelPager.php'; require_once '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:

<p> Total Pages: <?=$pager->getTotalPages()?> Total Records: <?=$pager->getTotalRecordCount()?> </p> <table> <tr> <td> <?if ($link = $pager->getFirstPage):?> <a href="somescript?page=<?=$link?>"><?=$link?></a>| <?endif?> </td> <td> <?if ($link = $pager->getPrev()):?> <a href="somescript?page=<?=$link?>">Previous</a>| <?endif?> </td> <td> <?foreach ($pager->getPrevLinks() as $link):?> <a href="somescript?page=<?=$link?>"><?=$link?></a>| <?endforeach?> </td> <td><?=$pager->getPage()?></td> <td> <?foreach ($pager->getNextLinks() as $link):?> | <a href="somescript?page=<?=$link?>"><?=$link?></a> <?endforeach?> </td> <td> <?if ($link = $pager->getNext()):?> <a href="somescript?page=<?=$link?>">Last</a>| <?endif?> </td> <td> <?if ($link = $pager->getLastPage()):?> <a href="somescript?page=<?=$link?>"><?=$link?></a>| <?endif?> </td> </tr> </table> <table id="latestPoems"> <tr> <th>Title</th> <th>Auteur</th> <th>Date</th> <th>comments</th> </tr> <?foreach ($pager->getResult() as $poem):?> <tr> <td><?=$poem->getTitle()?></td> <td><?=$poem->getPoemUsers()->getUname()?></td> <td><?=$poem->getTime()?></td> <td><?=$poem->getComments()?></td> </tr> <?endforeach?> </table>




Tags:

author:  Rob Halff <info@rhalff.com>
version:  $Revision: 563 $
copyright:  Copyright (c) 2004 Rob Halff: LGPL - See LICENCE


[ Top ]


Class Variables

$max =  0

[line 119]



Tags:

var:  Max rows to return (0 means all)
access:  protected

Type:   int


[ Top ]

$start =  0

[line 116]



Tags:

var:  Start row (offset)
access:  protected

Type:   int


[ Top ]



Class Methods


constructor __construct [line 129]

PropelPager __construct( [Criteria $c = null], [string $peerClass = null], [string $peerSelectMethod = null], [int $page = 1], [int $rowsPerPage = 25])

Create a new Propel Pager.



Tags:

access:  public


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.

[ Top ]

method atFirstPage [line 310]

boolean atFirstPage( )

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



Tags:

access:  public


[ Top ]

method atLastPage [line 335]

boolean atLastPage( )

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



Tags:

access:  public


[ Top ]

method getCriteria [line 156]

Criteria getCriteria( )

Return the Criteria object for this pager.



Tags:

access:  public


[ Top ]

method getFirstPage [line 300]

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




Tags:

return:  1
access:  public


[ Top ]

method getLastPage [line 320]

int getLastPage( )

Get last page



Tags:

access:  public


[ Top ]

method getNext [line 432]

mixed getNext( )

get next id



Tags:

access:  public


[ Top ]

method getNextLinks [line 386]

array getNextLinks( [int $range = 5])

get an array of next id's



Tags:

access:  public


Parameters:

int   $range  

[ Top ]

method getPage [line 457]

int getPage( )

Get current page.



Tags:

access:  public


[ Top ]

method getPeerClass [line 176]

string getPeerClass( )

Return the Peer Classname.



Tags:

access:  public


[ Top ]

method getPeerCountMethod [line 240]

void getPeerCountMethod( )

Return the Peer count method.



Tags:

access:  public


[ Top ]

method getPeerMethod [line 201]

string getPeerMethod( )

Return the Peer select method.

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




Tags:

see:  PropelPager::getPeerSelectMethod()
deprecated:  
access:  public


[ Top ]

method getPeerSelectMethod [line 221]

string getPeerSelectMethod( )

Return the Peer select method.



Tags:

access:  public


[ Top ]

method getPrev [line 418]

mixed getPrev( )

get previous id



Tags:

access:  public


[ Top ]

method getPrevLinks [line 363]

array getPrevLinks( [int $range = 5])

get an array of previous id's



Tags:

access:  public


Parameters:

int   $range  

[ Top ]

method getResult [line 269]

mixed getResult( )

Get the paged resultset



Tags:

access:  public


[ Top ]

method getRowsPerPage [line 477]

int getRowsPerPage( )

Get number of rows per page.



Tags:

access:  public


[ Top ]

method getTotalPages [line 345]

int getTotalPages( )

get total pages



Tags:

access:  public


[ Top ]

method getTotalRecordCount [line 498]

int getTotalRecordCount( )

Gets the total number of (un-LIMITed) records.

This method will perform a query that executes un-LIMITed query.




Tags:

return:  Total number of records - disregarding page, maxrows, etc.
access:  public


[ Top ]

method isLastPageComplete [line 408]

bool isLastPageComplete( )

Returns whether last page is complete



Tags:

return:  Last page complete or not
access:  public


[ Top ]

method setCriteria [line 147]

void setCriteria( Criteria $c)

Set the criteria for this pager.



Tags:

access:  public


Parameters:

Criteria   $c  

[ Top ]

method setMax [line 538]

void setMax( int $v)

Sets max rows (limit).



Tags:

access:  public


Parameters:

int   $v  

[ Top ]

method setPage [line 446]

void setPage( int $page)

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



Tags:

access:  public


Parameters:

int   $page  

[ Top ]

method setPeerClass [line 167]

void setPeerClass( string $class)

Set the Peer Classname



Tags:

access:  public


Parameters:

string   $class  

[ Top ]

method setPeerCountMethod [line 232]

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




Tags:

access:  public


Parameters:

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

[ Top ]

method setPeerMethod [line 189]

void setPeerMethod( string $method)

Set the Peer select method.

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




Tags:

see:  PropelPager::setPeerSelectMethod()
deprecated:  
access:  public


Parameters:

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

[ Top ]

method setPeerSelectMethod [line 212]

void setPeerSelectMethod( string $method)

Set the Peer select method.



Tags:

access:  public


Parameters:

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

[ Top ]

method setRowsPerPage [line 466]

void setRowsPerPage( int $r)

Set the number of rows per page.



Tags:

access:  public


Parameters:

int   $r  

[ Top ]

method setStart [line 528]

void setStart( int $v)

Sets the start row or offset.



Tags:

access:  public


Parameters:

int   $v  

[ Top ]


Documentation generated on Thu, 22 Nov 2007 03:33:53 +0000 by phpDocumentor 1.4.0