Example #1
0
 public function count()
 {
     if (is_numeric($this->rowset[0])) {
         $check_count = clone $this->target_model;
         $check_count->select_columns = array($check_count->primary_key);
         $check_count->filter($check_count->primary_key, $this->rowset);
         return $check_count->all()->count();
     } else {
         return parent::count();
     }
 }
Example #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 = $this->paginate($model);
     $this->set_count($model->total_without_limits);
     parent::__construct($model, $rowset);
 }
Example #3
0
 public function count()
 {
     $this->load();
     return parent::count();
 }