public function view($id = null)
 {
     if (empty($id)) {
         redirect('packs');
     } else {
         if (Pack::count(array('conditions' => array('id = ?', $id))) == 0) {
             redirect('packs');
         } else {
             $this->data['pack'] = Pack::get_single_pack_info($id);
             $this->data['subtitle'] = $this->data['pack']->name;
             $this->data['songs'] = Ranked_file::all(array('conditions' => array("pack_id = ?", $id), 'order' => "rate ASC"));
             if (isset($_GET['recalc'])) {
                 error_reporting(E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_WARNING);
                 set_time_limit(0);
                 foreach ($this->data['songs'] as $file) {
                     $calculated_difficulty = $this->_process_everything($file->raw_file, $file->rate);
                     $file->difficulty_score = $calculated_difficulty;
                 }
             }
             $this->content_view = 'packs/view';
         }
     }
 }
 public static function get_recent_files()
 {
     return Ranked_file::all(array("select" => "`ranked_files`.id, `ranked_files`.title, `ranked_files`.artist, `ranked_files`.rate, `ranked_files`.stamina_file, `ranked_files`.file_type, `ranked_files`.pack_id, `ranked_files`.length, `ranked_files`.difficulty_score, `ranked_files`.new_difficulty_score, `packs`.name AS pack_name, `packs`.abbreviation AS pack_abbr", "joins" => "LEFT JOIN `packs` ON `packs`.id = `ranked_files`.pack_id", 'order' => '`ranked_files`.id DESC', 'limit' => 100));
 }
 function auto_type_test()
 {
     $this->data['subtitle'] = "Auto File Type Comparison Page";
     $this->data['charts'] = Ranked_file::all();
     $this->content_view = "admin/auto_type";
 }