Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Nuevos controladores y se incorporo en cargo el metodo editar #4
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandoparada18 committed Feb 22, 2016
1 parent f0551a0 commit 4756b8a
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 0 deletions.
45 changes: 45 additions & 0 deletions controllers/cargoController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php namespace controllers;

use models\Cargo as Cargo;

class cargoController{

private $cargo;

public function __construct(){
$this->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');
}
}
?>
19 changes: 19 additions & 0 deletions controllers/docenteController.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
<?php namespace controllers;

use models\Docente as Docente;
use models\Usuario as Usuario;

class docenteController{

private $docente;
private $usuario;

public function __construct(){
$this->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");
}
}
}
?>
8 changes: 8 additions & 0 deletions controllers/herramientaController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}
?>
8 changes: 8 additions & 0 deletions controllers/institucionController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}
?>
8 changes: 8 additions & 0 deletions controllers/municipioController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}
?>
33 changes: 33 additions & 0 deletions controllers/parroquiaController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php namespace controllers;

use models\Municipio as Municipio;
use models\Parroquia as Parroquia;

class parroquiaController{

private $municipio;
private $parroquia;

public function __construct(){
$this->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');
}
}
}
?>
Empty file modified controllers/plantelController.php
100644 → 100755
Empty file.
26 changes: 26 additions & 0 deletions controllers/rubroController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php namespace controllers;

use models\Rubro as Rubro;

class rubroController{

private $rubro;

public function __construct(){
$this->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');
}
}
}
?>
Empty file modified controllers/usuarioController.php
100644 → 100755
Empty file.

0 comments on commit 4756b8a

Please sign in to comment.