Exemplo n.º 1
0
 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';
         }
     }
 }