110 lines
3.6 KiB
PHP
110 lines
3.6 KiB
PHP
<?php
|
|
require_once "../controllers/usuarios.controller.php";
|
|
require_once "../models/usuarios.model.php";
|
|
|
|
class ajaxUsuarios {
|
|
public $id;
|
|
public $todos_los_campos;
|
|
|
|
public function ajaxLOVUsuarios() {
|
|
$registros = UsuariosController::ctrLOVUsuarios();
|
|
echo json_encode($registros, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
public function ajaxListarUsuarios() {
|
|
$respuesta = UsuariosController::ctrListarUsuarios();
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
echo json_encode($respuesta, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
public function ajaxDatosUsuario() {
|
|
$respuesta = UsuariosController::ctrDatosUsuario($this->id);
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
echo json_encode($respuesta, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
public function ajaxNuevoUsuario() {
|
|
$registros = UsuariosController::ctrNuevoUsuario($this->todos_los_campos);
|
|
echo json_encode($registros, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
public function ajaxBorrarUsuario() {
|
|
$respuesta = UsuariosController::ctrBorrarUsuario($this->id);
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
echo json_encode($respuesta, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|
|
|
|
|
|
public function ajaxDatosCurso() {
|
|
$respuesta = UsuariosController::ctrDatosCurso($this->id);
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
echo json_encode($respuesta, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
public function ajaxGuardarCurso() {
|
|
$registros = UsuariosController::ctrGuardarCurso($this->todos_los_campos);
|
|
echo json_encode($registros, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
public function ajaxListarDatosCurso() {
|
|
$respuesta = UsuariosController::ctrListarDatosCurso();
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
echo json_encode($respuesta, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
public function ajaxEditarUsuario() {
|
|
$registros = UsuariosController::ctrEditarUsuario($this->todos_los_campos);
|
|
echo json_encode($registros, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
}
|
|
|
|
// if (isset($_POST['accion']) && $_POST['accion'] == "LOV") {
|
|
// $registros = new ajaxUsuarios();
|
|
// $registros->ajaxLOVUsuarios();
|
|
// }
|
|
// if (isset($_POST['accion']) && $_POST['accion'] == "LISTAR") {
|
|
// $registros = new ajaxUsuarios();
|
|
// $registros->ajaxListarUsuarios();
|
|
// }
|
|
// if (isset($_POST['accion']) && $_POST['accion'] == "DATOS") {
|
|
// $registros = new ajaxUsuarios();
|
|
// $registros->id = $_POST['id'];
|
|
// $registros->ajaxDatosUsuario();
|
|
// }
|
|
|
|
|
|
|
|
if (isset($_POST['accion']) && $_POST['accion'] == "DATOS-CURSO") {
|
|
$registros = new ajaxUsuarios();
|
|
$registros->id = $_POST['id'];
|
|
$registros->ajaxDatosCurso();
|
|
}
|
|
if (isset($_POST['accion']) && $_POST['accion'] == "GUARDAR-DATOS-CURSO") {
|
|
$registros = new ajaxUsuarios();
|
|
$registros->todos_los_campos = $_POST;
|
|
$registros->ajaxGuardarCurso();
|
|
}
|
|
|
|
if (isset($_POST['accion']) && $_POST['accion'] == "LISTAR-DATOS-CURSO") {
|
|
$registros = new ajaxUsuarios();
|
|
$registros->ajaxListarDatosCurso();
|
|
}
|
|
|
|
if (isset($_POST['accion']) && $_POST['accion'] == "NUEVO") {
|
|
$registros = new ajaxUsuarios();
|
|
$registros->todos_los_campos = $_POST;
|
|
$registros->ajaxNuevoUsuario();
|
|
}
|
|
|
|
if (isset($_POST['accion']) && $_POST['accion'] == "BORRAR") {
|
|
$registros = new ajaxUsuarios();
|
|
$registros->id = $_POST['id'];
|
|
$registros->ajaxBorrarUsuario();
|
|
}
|
|
|
|
if (isset($_POST['accion']) && $_POST['accion'] == "NUEVO") {
|
|
$registros = new ajaxUsuarios();
|
|
$registros->todos_los_campos = $_POST;
|
|
$registros->ajaxNuevoUsuario();
|
|
}
|
|
|
|
if (isset($_POST['accion']) && $_POST['accion'] == "EDITAR") {
|
|
$registros = new ajaxUsuarios();
|
|
$registros->todos_los_campos = $_POST;
|
|
$registros->ajaxEditarUsuario();
|
|
}
|