public function save() { if (isset($_SESSION["perfil"]) && $_SESSION["perfil"] == 'PROFESOR') { $obj = new unidad(); if ($_POST['idunidad'] == '') { $p = $obj->insert($_POST); if ($p[0]) { header('Location: index.php?controller=cursosemestre'); } else { $data = array(); $view = new View(); $data['msg'] = $p[1]; $data['url'] = 'index.php?controller=cursosemestre'; $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=cursosemestre'); } else { $data = array(); $view = new View(); $data['msg'] = $p[1]; $data['url'] = 'index.php?controller=cursosemestre'; $view->setData($data); $view->setTemplate('../view/_Error_App.php'); $view->setLayout('../template/Layout.php'); $view->render(); } } } else { $obj = new unidad(); if ($_POST['idunidad'] == '') { $p = $obj->insert($_POST); if ($p[0]) { header('Location: index.php?controller=unidad'); } else { $data = array(); $view = new View(); $data['msg'] = $p[1]; $data['url'] = 'index.php?controller=unidad'; $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=unidad'); } else { $data = array(); $view = new View(); $data['msg'] = $p[1]; $data['url'] = 'index.php?controller=unidad'; $view->setData($data); $view->setTemplate('../view/_Error_App.php'); $view->setLayout('../template/Layout.php'); $view->render(); } } } }
public function create() { $obj = new unidad(); $tem = new tema(); $obj->insert($_POST); $tem->insert($_POST); }