Esempio n. 1
0
 /**
  * internal pagination function so it returns only 
  * the row, not the entire model
  * @param string $WaxModel 
  * @return array
  */
 public function paginate(WaxModel $model)
 {
     $rows = $model->rows();
     foreach ($rows as $row) {
         $ids[] = $row[$model->primary_key];
     }
     return $ids;
 }
Esempio n. 2
0
 /**
  * the constructor takes the model and values passes in, assigns values to internal
  * vars, sets up the offset and limit on the model and use this->paginate
  * calls parent __construct
  * @param string $WaxModel 
  * @param string $page 
  * @param string $per_page 
  */
 public function __construct(WaxModel $model, $page, $per_page)
 {
     $this->per_page = $per_page;
     $this->current_page = $page;
     //setup model
     $this->model = $model;
     $this->model->_offset = ($page - 1) * $per_page;
     $this->model->_limit = $per_page;
     //paginate the model
     $rowset = $model->rows();
     $this->set_count($model->total_without_limits);
     parent::__construct($model, $rowset);
 }