public function save() { $obj = new grupo(); if ($_POST['idgrupo'] == '') { $p = $obj->insert($_POST); if ($p[0]) { header('Location: index.php?controller=grupo'); } else { $data = array(); $view = new View(); $data['msg'] = $p[1]; $data['url'] = 'index.php?controller=grupo'; $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=grupo'); } else { $data = array(); $view = new View(); $data['msg'] = $p[1]; $data['url'] = 'index.php?controller=grupo'; $view->setData($data); $view->setTemplate('../view/_Error_App.php'); $view->setLayout('../template/Layout.php'); $view->render(); } } }