function index() { $v = versions_helper::get_published_version(); $m = ORM::factory('version')->orderby('id', 'DESC')->find_all(); $type = Input::instance()->get('type', ''); $type = $type > '' ? '?type=' . $type : ''; View::factory('versions')->set('versions', $m)->set('current', $v)->set('type', $type)->render(true); }
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->join('page_content_positions', 'page_content_positions.page_content_pid', 'page_contents.pid'); $this->db->where('version', $w); $this->db->where('state!=', 'D'); $this->db_applied['orderby'] = true; $this->db->orderby('page_content_positions.order', 'ASC'); return parent::find_all($limit, $offset); }
/** * 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); }
function index() { $v = versions_helper::get_published_version(); $m = ORM::factory('version')->find_all(); View::factory('versions')->set('versions', $m)->set('current', $v)->render(true); }