public function save() { $obj = new alumno(); if ($_POST['CodigoAlumno'] == '') { $p = $obj->insert($_POST); if ($p[0]) { header('Location:index.php?controller=alumno'); } else { $data = array(); $view = new View(); $data['msg'] = $p[1]; $data['url'] = 'index.php?controller=alumno'; $view->setData($data); $view->setTemplate('../view/_Error_App.php'); $view->setLayout('../template/Layout.php'); $view->render(); } } else { $p = $obj->update($_POST); if ($p[0]) { header('Location: index.php?controller=alumno'); } else { $data = array(); $view = new View(); $data['msg'] = $p[1]; $data['url'] = 'index.php?controller=alumno'; $view->setData($data); $view->setTemplate('../view/_Error_App.php'); $view->setLayout('../template/Layout.php'); $view->render(); } } }
public function editar($alumno_id) { $alumno = new Alumno(); if (Input::haspost("alumno")) { $alumno_editando = new alumno(Input::post("alumno")); $alumno_editando->asignarIp(); if ($alumno_editando->update()) { Flash::valid("Registro editado"); } else { Flash::error("El registro no pudo ser editado"); } Router::redirect("alumno/"); } $this->alumno = $alumno->find($alumno_id); }