public function action_create() { if (Input::method() == 'POST') { $val = Model_Traininfo::validate('create'); if ($val->run()) { $traininfo = Model_Traininfo::forge(array('train_id' => Input::post('train_id'), 'base_line' => Input::post('base_line'), 'start_station_id' => Input::post('start_station_id'), 'terminal_station_id' => Input::post('terminal_station_id'), 'travel_direction' => Input::post('travel_direction'), 'operation_state' => Input::post('operation_state'), 'from_station_id' => Input::post('from_station_id'), 'from_station_name' => Input::post('from_station_name'), 'from_station_index' => Input::post('from_station_index'), 'to_station_id' => Input::post('to_station_id'), 'to_station_name' => Input::post('to_station_name'), 'to_station_index' => Input::post('to_station_index'), 'delay_state' => Input::post('delay_state'))); if ($traininfo and $traininfo->save()) { Session::set_flash('success', 'Added traininfo #' . $traininfo->id . '.'); Response::redirect('traininfo'); } else { Session::set_flash('error', 'Could not save traininfo.'); } } else { Session::set_flash('error', $val->error()); } } $this->template->title = "Traininfos"; $this->template->content = View::forge('traininfo/create'); }