Exemplo n.º 1
0
 public function action_edit($id = null)
 {
     is_null($id) and Response::redirect('Seccion');
     $seccion = Model_Seccion::find($id);
     $val = Model_Seccion::validate('edit');
     if ($val->run()) {
         $seccion->descripcion = Input::post('descripcion');
         if ($seccion->save()) {
             Session::set_flash('success', 'Updated seccion #' . $id);
             Response::redirect('seccion');
         } else {
             Session::set_flash('error', 'Could not update seccion #' . $id);
         }
     } else {
         if (Input::method() == 'POST') {
             $seccion->descripcion = $val->validated('descripcion');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('seccion', $seccion, false);
     }
     $this->template->title = "Secciones";
     $this->template->content = View::forge('seccion/edit');
 }