Example #1
0
 /**
  * Create a new Simple Pager.
  * @param  Criteria $oQuery
  * @param  int $iPage The current iPage (1-based).
  * @param  int $iMaxRowsPerPage The number of rows that should be displayed per iPage.
  */
 public function __construct($oQuery, $iPage = 1, $iMaxRowsPerPage = 25)
 {
     $this->oQuery = clone $oQuery;
     $this->iTotalRecordCount = $oQuery->count();
     if ($iMaxRowsPerPage) {
         $this->iTotalPageCount = (int) ceil($this->iTotalRecordCount / $iMaxRowsPerPage);
     } else {
         $this->iTotalPageCount = 1;
     }
     $this->setPage($iPage);
     $this->setRowsPerPage($iMaxRowsPerPage);
 }