[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/vendor/propel/util/ -> PropelPager.php (sommaire)

(pas de description)

Poids: 544 lignes (12 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

PropelPager:: (32 méthodes):
  __construct()
  setCriteria()
  getCriteria()
  setPeerClass()
  getPeerClass()
  setPeerMethod()
  getPeerMethod()
  setPeerSelectMethod()
  getPeerSelectMethod()
  setPeerCountMethod()
  getPeerCountMethod()
  guessPeerCountMethod()
  getResult()
  doRs()
  getFirstPage()
  atFirstPage()
  getLastPage()
  atLastPage()
  getTotalPages()
  getPrevLinks()
  getNextLinks()
  isLastPageComplete()
  getPrev()
  getNext()
  setPage()
  getPage()
  setRowsPerPage()
  getRowsPerPage()
  calculateStart()
  getTotalRecordCount()
  setStart()
  setMax()


Classe: PropelPager  - X-Ref

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>


__construct($c = null, $peerClass = null, $peerSelectMethod = null, $page = 1, $rowsPerPage = 25)   X-Ref
Create a new Propel Pager.

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

setCriteria(Criteria $c)   X-Ref
Set the criteria for this pager.

param: Criteria $c
return: void

getCriteria()   X-Ref
Return the Criteria object for this pager.

return: Criteria

setPeerClass($class)   X-Ref
Set the Peer Classname

param: string $class
return: void

getPeerClass()   X-Ref
Return the Peer Classname.

return: string

setPeerMethod($method)   X-Ref
Set the Peer select method.
This exists for legacy support, please use setPeerSelectMethod().

param: string $method The name of the static method to call on the Peer class.
return: void

getPeerMethod()   X-Ref
Return the Peer select method.
This exists for legacy support, please use getPeerSelectMethod().

return: string

setPeerSelectMethod($method)   X-Ref
Set the Peer select method.

param: string $method The name of the static method to call on the Peer class.
return: void

getPeerSelectMethod()   X-Ref
Return the Peer select method.

return: string

setPeerCountMethod($method)   X-Ref
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*().

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

getPeerCountMethod()   X-Ref
Return the Peer count method.


guessPeerCountMethod()   X-Ref
Guesses the Peer count method based on the select method.


getResult()   X-Ref
Get the paged resultset

return: mixed $rs

doRs()   X-Ref
Get the paged resultset

Main method which creates a paged result set based on the criteria
and the requested peer select method.


getFirstPage()   X-Ref
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: int 1

atFirstPage()   X-Ref
Convenience method to indicate whether current page is the first page.

return: boolean

getLastPage()   X-Ref
Get last page

return: int $lastPage

atLastPage()   X-Ref
Convenience method to indicate whether current page is the last page.

return: boolean

getTotalPages()   X-Ref
get total pages

return: int $this->pages

getPrevLinks($range = 5)   X-Ref
get an array of previous id's

param: int $range
return: array $links

getNextLinks($range = 5)   X-Ref
get an array of next id's

param: int $range
return: array $links

isLastPageComplete()   X-Ref
Returns whether last page is complete

return: bool Last page complete or not

getPrev()   X-Ref
get previous id

return: mixed $prev

getNext()   X-Ref
get next id

return: mixed $next

setPage($page)   X-Ref
Set the current page number (First page is 1).

param: int $page
return: void

getPage()   X-Ref
Get current page.

return: int

setRowsPerPage($r)   X-Ref
Set the number of rows per page.

param: int $r

getRowsPerPage()   X-Ref
Get number of rows per page.

return: int

calculateStart()   X-Ref
Calculate startrow / max rows based on current page and rows-per-page.

return: void

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

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

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

setStart($v)   X-Ref
Sets the start row or offset.

param: int $v

setMax($v)   X-Ref
Sets max rows (limit).

param: int $v
return: void



Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7