public function index() { $this->set_default_side_bar(); $this->title = 'All Packages'; Nimble::set_title($this->title); $page = isset($_GET['page']) ? $_GET['page'] : NULL; switch ($this->format) { case 'xml': $this->packages = Package::find_all(); $this->header('Content-Type: text/xml', 200); echo $this->packages->to_xml(); $this->layout = false; $this->has_rendered = true; break; case 'json': $this->packages = Package::find_all(); $this->header('Content-type: application/json', 200); echo $this->packages->to_json(); $this->layout = false; $this->has_rendered = true; break; case 'atom': $this->layout = false; $this->has_rendered = true; break; case 'rss': $this->layout = false; $this->has_rendered = true; break; default: $this->full = true; $this->packages = Package::paginate(array('select' => '`packages`.*, AVG(`package_ratings`.`rating`) as rating', 'order' => 'rating DESC', 'per_page' => 20, 'page' => $page, 'joins' => 'LEFT JOIN `package_ratings` on `package_ratings`.`package_id` = `packages`.`id`', 'group' => '`packages`.id')); break; } }
public function packages() { $this->data['cycles'] = Cycle::all(); $this->data['services'] = Service::orderBy('name')->get(); $this->data['packages'] = Package::paginate(25); return $this->layout->content = View::make('packages', $this->data); }
public function index() { $this->set_default_side_bar(); $this->title = 'All Packages'; Nimble::set_title($this->title); $page = isset($_GET['page']) ? $_GET['page'] : NULL; $this->packages = Package::paginate(array('order' => 'name DESC', 'per_page' => 20, 'page' => $page)); switch ($this->format) { case 'xml': $this->header('Content-Type: text/xml', 200); echo $this->packages->to_xml(array('include' => array('versions'))); $this->layout = false; $this->has_rendered = true; break; case 'atom': break; case 'rss': break; } }
public static function simple_search($value) { $page = isset($_GET['page']) ? $_GET['page'] : NULL; return Package::paginate(array('select' => '`packages`.*, AVG(`package_ratings`.`rating`) as rating', 'order' => 'rating DESC', 'per_page' => 20, 'page' => $page, 'conditions' => NimbleRecord::sanitize(array('name LIKE ?', "%{$value}%")), 'joins' => 'LEFT JOIN `package_ratings` on `package_ratings`.`package_id` = `packages`.`id`', 'group' => '`packages`.id')); }
public static function simple_search($value) { $page = isset($_GET['page']) ? $_GET['page'] : NULL; return Package::paginate(array('order' => 'updated_at DESC', 'per_page' => 20, 'page' => $page, 'conditions' => NimbleRecord::sanitize(array('name LIKE ?', "%{$value}%")))); }