Exemplo n.º 1
0
 public function action_create()
 {
     if (Input::method() == 'POST') {
         $val = Model_Seccion::validate('create');
         if ($val->run()) {
             $seccion = Model_Seccion::forge(array('descripcion' => Input::post('descripcion')));
             if ($seccion and $seccion->save()) {
                 Session::set_flash('success', 'Added seccion #' . $seccion->id . '.');
                 Response::redirect('seccion');
             } else {
                 Session::set_flash('error', 'Could not save seccion.');
             }
         } else {
             Session::set_flash('error', $val->error());
         }
     }
     $this->template->title = "Secciones";
     $this->template->content = View::forge('seccion/create');
 }