/** * Accepts an ORM instance with query parameters set and returns the * current page of results e.g., * * $query = ORM::factory('customer')->where('status', 'approved); * $pages = new Pagination(); * $results = $pages->paginate($query); * * @param object ORM * @return object ORM_Iterator */ public function paginate(ORM $query) { // Work out what page we're currently on and set the SQL offsets // appropriately. // // This is necessary because if you create a Pagination object // without specifying the total pages, then current page is // always set to 1. $this->determine_current_page(); // Find the current page of results $results = $query->find_all($this->items_per_page, $this->sql_offset); // Set the correct total_item count $this->total_items = $query->count_last_query(); // Re-initialize to ensure all values are set correctly $this->initialize(); return $results; }
/** * Finds multiple database rows and returns an iterator of the rows found. * * @chainable * @param integer SQL limit * @param integer SQL offset * @return ORM_Iterator */ public function find_all($limit = NULL, $offset = NULL) { if (Kohana::config('versions.version') == 'max') { $w = new Database_Expression('(SELECT max(version) FROM ' . $this->table_name . ' AS q WHERE ' . $this->table_name . '.pid=q.pid)'); } else { $v = versions_helper::get_published_version(); $w = new Database_Expression('(SELECT max(version) FROM ' . $this->table_name . ' AS q WHERE ' . $this->table_name . '.pid=q.pid AND version <= ' . $v . ')'); } $this->db->where('version', $w); $this->db->where('state!=', 'D'); return parent::find_all($limit, $offset); }
/** * The find_all override enforces that the grid view only shows public triggers or triggers created by this user, * and also filters the subscriber information to this user only. A bit too complex for base filter and auth * filter techniques. */ public function find_all($limit = NULL, $offset = NULL) { $this->in('private_for_user_id', array(null, $_SESSION['auth_user']->id)); return parent::find_all($limit, $offset); }
/** * Override the find_all method * * @see Gleez_ORM_Core::find_all */ public function find_all($id = NULL) { $this->where($this->_object_name . '.id', '!=', User::GUEST_ID); return parent::find_all($id); }
/** * Wrap Idiorm's find_all method to return * an array of instances of the class associated * with this wrapper instead of the raw ORM class. */ public function find_all() { return array_map(array($this, '_create_model_instance'), parent::find_all()); }
/** * Model_Base::find_all() * apply filters and sorts before find all * * @return */ public function find_all() { $this->apply_filters(); $this->apply_sorts(); $this->apply_amount(); $this->apply_skip(); return parent::find_all(); }
public function find_all() { $this->where('prefix', '!=', Model_Location::RESERVED_LOCATION); return parent::find_all(); }