function rank_chart()
 {
     $this->data['subtitle'] = "Rank New Chart";
     if (intval($this->input->post('step')) == 1) {
         if ($this->form_validation->run('parser') == FALSE) {
             if (isset($_GET['suggested_id'])) {
                 $chart = Suggested_chart::find(intval($_GET['suggested_id']));
                 $this->data['chart'] = $chart->raw_file;
             }
             $this->content_view = "mod/rank_chart";
             $this->data['error'] = true;
         } else {
             // Validation good, second form!
             $this->_process_everything();
             $this->data['packs'] = Pack::all(array('order' => 'name asc'));
             $this->content_view = "mod/rank_chart_confirm";
         }
     } elseif (intval($this->input->post('step')) == 2) {
         if ($this->form_validation->run('rank_chart') == FALSE) {
             $this->data['packs'] = Pack::all(array('order' => 'name asc'));
             $this->data['error'] = true;
             $this->content_view = "mod/rank_chart_confirm";
         } else {
             // Validation good, save the file!
             $attributes = array('pack_id' => $this->input->post('pack_id'), 'stamina_file' => $this->input->post('stamina_file'), 'file_type' => $this->input->post('file_type'), 'auto_type' => $this->input->post('auto_type'), 'date_ranked' => $this->input->post('date_ranked'), 'rate' => $this->input->post('rate'), 'title' => $this->input->post('title'), 'subtitle' => $this->input->post('subtitle'), 'artist' => $this->input->post('artist'), 'length' => $this->input->post('length'), 'dance_points' => $this->input->post('dance_points'), 'notes' => $this->input->post('notes'), 'taps' => $this->input->post('taps'), 'jumps' => $this->input->post('jumps'), 'hands' => $this->input->post('hands'), 'quads' => $this->input->post('quads'), 'holds' => $this->input->post('holds'), 'mines' => $this->input->post('mines'), 'peak_nps' => $this->input->post('peak_nps'), 'avg_nps' => $this->input->post('avg_nps'), 'avg_weighted_nps' => $this->input->post('avg_weighted_nps'), 'difficulty_score' => $this->input->post('difficulty_score'), 'raw_file' => $this->input->post('raw_file'));
             $new_file = new Ranked_file($attributes);
             $new_file->save();
             $rate = $this->input->post('rate');
             $log_string = $this->session->userdata('username') . " (" . $this->session->userdata('display_name') . ") ranked new file: " . number_format($rate, 1) . "x " . $this->input->post('title') . " - " . $this->input->post('difficulty_score');
             write_to_mod_log($log_string);
             $this->data['rank_success'] = true;
             Mod::edit_chart($new_file->id);
         }
     } else {
         if (isset($_GET['suggested_id'])) {
             $chart = Suggested_chart::find(intval($_GET['suggested_id']));
             $this->data['chart'] = $chart;
         }
         if (isset($_GET['suggested_rate'])) {
             $this->data['rate'] = doubleval($_GET['suggested_rate']);
         }
         $this->content_view = "mod/rank_chart";
     }
 }