Exemplo n.º 1
0
 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();
         }
     }
 }