From 4756b8a5f775bf88225e5acb8b0e5cf47e884629 Mon Sep 17 00:00:00 2001 From: fernandoparada18 Date: Mon, 22 Feb 2016 00:56:24 -0430 Subject: [PATCH] Nuevos controladores y se incorporo en cargo el metodo editar #4 --- controllers/cargoController.php | 45 +++++++++++++++++++++++++++ controllers/docenteController.php | 19 +++++++++++ controllers/herramientaController.php | 8 +++++ controllers/institucionController.php | 8 +++++ controllers/municipioController.php | 8 +++++ controllers/parroquiaController.php | 33 ++++++++++++++++++++ controllers/plantelController.php | 0 controllers/rubroController.php | 26 ++++++++++++++++ controllers/usuarioController.php | 0 9 files changed, 147 insertions(+) create mode 100755 controllers/cargoController.php mode change 100644 => 100755 controllers/docenteController.php mode change 100644 => 100755 controllers/herramientaController.php mode change 100644 => 100755 controllers/institucionController.php mode change 100644 => 100755 controllers/municipioController.php create mode 100755 controllers/parroquiaController.php mode change 100644 => 100755 controllers/plantelController.php create mode 100755 controllers/rubroController.php mode change 100644 => 100755 controllers/usuarioController.php diff --git a/controllers/cargoController.php b/controllers/cargoController.php new file mode 100755 index 0000000..2ff302a --- /dev/null +++ b/controllers/cargoController.php @@ -0,0 +1,45 @@ +cargo = new Cargo(); + } + + public function index(){ + $datos = $this->cargo->listar(); + return $datos; + } + + public function agregar(){ + if($_POST){ + $this->cargo->set("nombre", $_POST['descripcion']); + $this->cargo->add(); + header('Location: '. URL . "cargo"); + } + } + + public function editar($id){ + if($_POST){ + $this->cargo->set("id", $_POST['id']); + $this->cargo->set("nombre", $_POST['descripcion']); + $this->cargo->edit(); + header('Location: '. URL . "cargo"); + }else{ + $this->cargo->set("id", $id); + $datos = $this->cargo->view(); + return $datos; + } + } + + public function eliminar($id){ + $this->cargo->set("id", $id); + $this->cargo->delete(); + header ('Location: '.URL.'cargo'); + } + } +?> diff --git a/controllers/docenteController.php b/controllers/docenteController.php old mode 100644 new mode 100755 index 0b2615b..12ac271 --- a/controllers/docenteController.php +++ b/controllers/docenteController.php @@ -1,18 +1,37 @@ docente = new Docente(); + $this->usuario = new Usuario(); } public function index(){ $datos = $this->docente->listar(); return $datos; } + + public function agregar(){ + if(!$_POST){ + $datos = $this->usuario->noAsignado(); + return $datos; + }else{ + $this->docente->set("cedula", $_POST['cedula']); + $this->docente->set("nombres", $_POST['nombres']); + $this->docente->set("apellidos", $_POST['apellidos']); + $this->docente->set("telefono", $_POST['telefono']); + $this->docente->set("correo", $_POST['correo']); + $this->docente->set("idUsuario", $_POST['idUsuario']); + $this->docente->add(); + header("Location: " . URL . "docente"); + } + } } ?> diff --git a/controllers/herramientaController.php b/controllers/herramientaController.php old mode 100644 new mode 100755 index 38d5c6f..9d5f575 --- a/controllers/herramientaController.php +++ b/controllers/herramientaController.php @@ -14,5 +14,13 @@ public function index(){ $datos = $this->herramienta->listar(); return $datos; } + + public function agregar(){ + if($_POST){ + $this->herramienta->set("descripcion", $_POST['descripcion']); + $this->herramienta->add(); + header('Location: ' . URL . 'herramienta'); + } + } } ?> diff --git a/controllers/institucionController.php b/controllers/institucionController.php old mode 100644 new mode 100755 index d2b0dcf..b69c11c --- a/controllers/institucionController.php +++ b/controllers/institucionController.php @@ -14,5 +14,13 @@ public function index(){ $datos = $this->institucion->listar(); return $datos; } + + public function agregar(){ + if($_POST){ + $this->institucion->set("descripcion", $_POST['descripcion']); + $this->institucion->add(); + header('Location: ' . URL . 'institucion'); + } + } } ?> diff --git a/controllers/municipioController.php b/controllers/municipioController.php old mode 100644 new mode 100755 index 2846e65..e072c13 --- a/controllers/municipioController.php +++ b/controllers/municipioController.php @@ -14,5 +14,13 @@ public function index(){ $datos = $this->municipio->listar(); return $datos; } + + public function agregar(){ + if($_POST){ + $this->municipio->set("municipio", $_POST['nombre']); + $this->municipio->add(); + header('Location: ' . URL . 'municipio'); + } + } } ?> diff --git a/controllers/parroquiaController.php b/controllers/parroquiaController.php new file mode 100755 index 0000000..85dbf5a --- /dev/null +++ b/controllers/parroquiaController.php @@ -0,0 +1,33 @@ +municipio = new Municipio(); + $this->parroquia = new Parroquia(); + } + + public function index(){ + $datos = $this->parroquia->listar(); + return $datos; + } + + public function agregar(){ + if(!$_POST){ + $datos = $this->municipio->listar(); + return $datos; + }else{ + $this->parroquia->set("idMunicipio", $_POST['idMunicipio']); + $this->parroquia->set("nombre", $_POST['nombre']); + $this->parroquia->add(); + header('Location: ' . URL . 'parroquia'); + } + } + } +?> diff --git a/controllers/plantelController.php b/controllers/plantelController.php old mode 100644 new mode 100755 diff --git a/controllers/rubroController.php b/controllers/rubroController.php new file mode 100755 index 0000000..97af07e --- /dev/null +++ b/controllers/rubroController.php @@ -0,0 +1,26 @@ +rubro = new Rubro(); + } + + public function index(){ + $datos = $this->rubro->listar(); + return $datos; + } + + public function agregar(){ + if($_POST){ + $this->rubro->set("nombre", $_POST['descripcion']); + $this->rubro->add(); + header('Location: ' . URL . 'rubro'); + } + } + } +?> diff --git a/controllers/usuarioController.php b/controllers/usuarioController.php old mode 100644 new mode 100755