public function save() { $obj = new alumno_cca(); if ($_POST['idalumno'] == '') { $p = $obj->insert($_POST); if ($p[0]) { header('Location:index.php?controller=alumno_cca&action=buscar2'); } else { $data = array(); $view = new View(); $data['msg'] = $p[1]; $data['url'] = 'index.php?controller=alumno_cca'; $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_cca'); } else { $data = array(); $view = new View(); $data['msg'] = $p[1]; $data['url'] = 'index.php?controller=alumno_cca'; $view->setData($data); $view->setTemplate('../view/_Error_App.php'); $view->setLayout('../template/Layout.php'); $view->render(); } } }
public function buscar2() { if (!isset($_GET['p'])) { $_GET['p'] = 1; } $obj = new alumno_cca(); $data = array(); if (!isset($_GET['q'])) { $_GET['q'] = ""; } if (!isset($_GET['p'])) { $_GET['p'] = ""; } if (!isset($_GET['criterio'])) { $_GET['criterio'] = "alumnon.dni"; } $data['data'] = $obj->buscar2($_GET['q'], $_GET['p'], $_GET['criterio']); $data['query'] = $_GET['q']; $data['pag'] = $this->Pagination(array('rows' => $data['data']['rowspag'], 'url' => 'index.php?controller=alumno_cca&action=buscar2', 'query' => $_GET['q'])); $cols = array("Id", "Nombres", "Apellidop", "Apellidom", "Identificacion", "Sexo", "Parametro"); $opt = array("alumnon.dni" => "DNI", "alumnon.nombres" => "NOMBRE"); $data['grilla_cca'] = $this->grilla_cca("alumno_cca", NULL, NULL, $cols, $data['data']['rows'], $opt, $data['pag'], false, false, false, false, true); $view = new View(); $view->setData($data); $view->setTemplate('../view/alumno_cca/_Lista_2.php'); $view->setLayout('../template/Vacia.php'); $view->render(); }