/** * Constructor * * @param Criteria $criteria * * @return void */ public function __construct(ElementCriteriaModel $criteria) { $this->limit = $criteria->limit; $this->count = $criteria->count(); $this->total = $criteria->total(); $this->current_page = isset($criteria->page) ? (int) $criteria->page : 1; if ($this->current_page > $this->total) { $this->current_page = $this->total; } $this->last_page = ceil($criteria->total() / $this->limit); }
/** * Get Elements * * @param ElementCriteriaModel $criteria Criteria * * @return array Elements */ public function getElements(ElementCriteriaModel $criteria) { return $criteria->find(); }