public function packages($type) { $this->load->model('spark'); $n = $this->input->get('n'); $n = $n ? $n : 10; if ($type == 'latest') { $sparks = Spark::getTop($n); $data['type'] = 'Latest'; $data['description'] = 'These are the most recently registered sparks with at least one release.'; } elseif ($type == 'featured') { $sparks = Spark::getLatestOf($n, TRUE); $data['type'] = 'Featured'; $data['description'] = 'These are sparks that the GetSparks team thinks are worth a spin'; } elseif ($type == 'official') { $sparks = Spark::getLatestOf($n, NULL, TRUE); $data['type'] = 'Official'; $data['description'] = 'These are sparks written by GetSparks, the Reactor Team, or CodeIgntier gurus'; } $data['sparks'] = $sparks; $this->load->view('rss/sparks', $data); }
/** * The call for showing the package listing page. For type, handles * 'latest', 'featured' and 'official' * @param string $type */ function browse($type = false) { UtilityHelper::tryPageCache(1); $this->load->model('spark'); $this->load->model('rating'); $sparks = array(); $data['browse_type'] = ''; $data['description'] = ''; $data['browse_type_raw'] = $type; if ($type == 'latest') { $sparks = Spark::getTop(200); $data['browse_type'] = 'Browse Latest'; $data['description'] = 'These are the most recently registered sparks with at least one release.'; } elseif ($type == 'featured') { $sparks = Spark::getLatestOf(FALSE, TRUE); $data['browse_type'] = 'Browse Featured'; $data['description'] = 'These are sparks that the GetSparks team thinks are worth a spin'; } elseif ($type == 'official') { $sparks = Spark::getLatestOf(FALSE, NULL, TRUE); $data['browse_type'] = 'Browse Official'; $data['description'] = 'These are sparks written by GetSparks, the Reactor Team, or CodeIgntier gurus'; } else { # Ugly fix for now, not sure why we didn't have a 'browse all' # in the first place :P $sparks = Spark::getTop(1000); $data['browse_type'] = 'Browse All'; $data['description'] = 'These are all of GetSparks\' sparks'; } # Get a list of spark ids on this page $ids = array(); foreach ($sparks as $s) { $ids[] = $s->id; } # Wait until the views are donw $data['sparks'] = $sparks; $data['ratings'] = $this->rating->getRatingsFromList($ids); $this->load->view('packages/listing', $data); }