public function view($id = null)
 {
     if (empty($id)) {
         redirect('charts');
     } else {
         if (Ranked_file::count(array('conditions' => array('id = ?', $id))) == 0) {
             redirect('charts');
         } else {
             error_reporting(E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_WARNING);
             $file = Ranked_file::find($id);
             $pack = Pack::find($file->pack_id);
             $this->data['user_scores'] = User_score::get_scores_for_chart($id);
             $this->data['pack'] = $pack;
             $this->data['subtitle'] = $file->title;
             $this->_process_everything($file->raw_file, $file->rate);
         }
     }
 }
 public static function get_single_pack_info($id)
 {
     return Pack::find(array("select" => "`packs`.*, (SELECT COUNT(*) FROM `ranked_files` WHERE `ranked_files`.`pack_id` = `packs`.`id`) AS file_count", "conditions" => array("id = ?", $id)));
 }
 function delete_pack($pack_id)
 {
     if (Pack::count(array('conditions' => array('id = ?', $pack_id))) != 1) {
         redirect('home');
     }
     $this->content_view = "mod/delete_pack_success";
     $pack = Pack::find($pack_id);
     $pack_name = $pack->name;
     $pack->delete();
     $log_string = $this->session->userdata('username') . " (" . $this->session->userdata('display_name') . ") deleted pack: " . $pack_name;
     write_to_mod_log($log_string);
 }