public function suggest() { $this->data['subtitle'] = "Suggest New Chart"; if ($this->input->post()) { if ($this->form_validation->run('suggest_file') == FALSE) { $this->content_view = "charts/suggest"; $this->data['error'] = true; } else { $this->content_view = "charts/suggest_success"; $attributes = array("title" => $this->input->post('title'), "artist" => $this->input->post('artist'), "pack" => $this->input->post('pack'), "rate" => $this->input->post('rate'), "chart" => $this->input->post('chart'), "raw_file" => $this->input->post('file'), "file_type" => $this->input->post('file_type'), "user_id" => $this->session->userdata('user_id')); $new_announcement = new Suggested_chart($attributes); $new_announcement->save(); } } else { $this->content_view = "charts/suggest"; } }
public static function get_list() { return Suggested_chart::all(array("select" => "suggested_charts.*, users.username as username, users.display_name as display_name", "joins" => "LEFT JOIN `users` ON `suggested_charts`.user_id = `users`.id", "order" => "id desc")); }
function get_mod_alert_count_suggested_charts() { $sf_count = Suggested_chart::count(array('conditions' => 'status = "pending"')); return $sf_count; }
function suggested_files($id = null, $status = null) { if (!empty($id) && !empty($status) && ($status == "added" || $status == "rejected" || $status == "pending")) { $id = intval($id); $sf = Suggested_chart::find($id); $sf->status = $status; $sf->save(); } $this->data['subtitle'] = "User Suggested Charts"; $this->content_view = "mod/suggested_files"; $this->data['suggested_files'] = Suggested_chart::get_list(); }