public function action_images($id = null) { $pass = Model_Pass::find($id); if (Input::method() == 'POST') { $manager = new Pass_File_Manager($pass); $image_selection_number = \Fuel\Core\Input::post('upload_image_selection'); $images = $manager->required_images(); $name = $images[$image_selection_number]; if ($manager->get_upload_files(array('png'), $name) == false) { Session::set_flash('error', $manager->error); } elseif ($pass and $pass->save()) { Session::set_flash('success', e('Added pass #' . $pass->id . '.')); Response::redirect('admin/pass/images/' . $pass->id); } else { Session::set_flash('error', e('Could not save pass.')); } } $this->template->set_global('pass', $pass); $this->template->title = "Pass Images"; $images_vm = ViewModel::forge('admin/pass/images'); $images_vm->pass = $pass; $this->template->content = $images_vm; }