123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <?php
- require_once("./include/constantes.php");
- require_once("./include/bd_pdo.php");
- require_once("./classes/MainMenu.php");
- session_start();
-
- //--- Valida que el usuaro tenga permisos de superadministrador
- if(!isset($_SESSION) || !$_SESSION["sgi_administrador"]){
- header("Location: main.php");
- exit();
- }
- $session_life = 1*60*60;//convertido a segundos
- if (isset($_SESSION["timeout"])) {
- // calculate the session's "time to live"
- $sessionTTL = time() - $_SESSION["timeout"];
- if ($sessionTTL > $session_life) {
- $_SESSION = array();
- session_destroy();
- $pag = $_SERVER['SERVER_NAME']."/salir.php?expired=1";
- header("Location: http://".$pag);
- exit();
- }
- }else{
- $_SESSION = array();
- session_destroy();
- $pag = $_SERVER['SERVER_NAME']."/salir.php?expired=1";
- header("Location: http://".$pag);
- exit();
- }
- $_SESSION["timeout"] = time();
-
- ?>
- <!DOCTYPE html>
- <html lang="es" prefix="og: http://ogp.me/ns#">
- <head>
- <title>.: Facultad de Ingeniería :.</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <link rel="icon" type="image/png" href="img/favicon.png" />
- <link rel="stylesheet" href="./css/bootstrap-ulsa.min.css" type="text/css">
- <link rel="stylesheet" href="./css/indivisa.css" type="text/css">
- <link rel="stylesheet" href="./css/sgi.css?rand=<?php echo rand();?>" type="text/css">
- <link rel="stylesheet" href="./css/fa_all.css" type="text/css">
- <style>
- .badge{padding:4px 8px; margin-left:10px;}
- </style>
- </head>
- <body>
- <div>
- <?php
- //--- Objeto que pinta menu
- $menuObj = new MainMenu($_SESSION["usuario_id"], NULL, $pdo, NULL, "Datos de usuarios");//usr, menu, pdo, sist
- require_once("./include/main_menus.php");
- if(isset($_MAIN_MENU)){
- foreach($_MAIN_MENU as $menu){
- $menuObj->agregaMenu($menu["nombre"], $menu["pag"], $menu["ico"]);
- }
- $menuObj->printMenu();
- }
-
- //Obtiene datos de alumnos
- $stmt = $pdo->prepare('Select * from fs_checkusuario(1, 0, '.(MAX_ROWS*2).')');
- if(!$stmt->execute()){
- $errorDesc = "Ocurrió un error al cargar los datos";
- }else
- $datos_rs = $stmt->fetchAll();
- $stmt->closeCursor();
- $stmt = null;
- //Obtiene datos de alumnos
- $stmt = $pdo->prepare('Select COUNT(*) as total from fs_checkusuario(1, 0, NULL)');
- if(!$stmt->execute()){
- $errorDesc = "Ocurrió un error al cargar los datos";
- }else
- $datosTotal_rs = $stmt->fetch();
- $stmt->closeCursor();
- $stmt = null;
-
- //--Manejo de errores y mensajes de exito
- if(isset($_GET["error"]) && is_numeric($_GET["error"])){
- switch ($_GET["error"]){
- case 0: $errorDesc = "No se reciberon los datos correctamente."; break;
- case 1: $errorDesc = "Ocurrió un error al actualizar los datos de los usuarios."; break;
- }
- if(isset($_GET["lista"])){
- $errorDesc .= "IDs: ".$_GET["lista"];
- }
- }
- if(isset($_GET["ok"]) && is_numeric($_GET["ok"])){
- switch ($_GET["ok"]){
- case 0: $successDesc = "Los datos se actualizaron correctamente."; break;
- }
- }
- ?>
- <div class="container marco mt-4">
- <?php include_once("./include/errorMessage.php"); ?>
-
- <?php
- if(isset($datos_rs) && count($datos_rs) > 0){
- ?>
- <div class="row">
- <div class="col-6">
- <p>Se muestran los primeros <?php echo MAX_ROWS*2;?> registros de <?php echo $datosTotal_rs["total"];?></p>
- </div>
- <div class="col-6 text-right">
- <a href="datos_usuarios_export.php" class="btn btn-outline-secondary"><?php echo $ICO["descargar"];?> Descargar xls</a>
- </div>
- </div>
- <?php } ?>
- </div>
- <main class="container-fluid content">
- <?php
- if(isset($datos_rs) && count($datos_rs) > 0){
- ?>
- <div class="row justify-content-center">
- <div class="col-12 col-lg-10 table-responsive">
- <table class="table table-sm table-striped table-white">
- <thead class="thead-dark">
- <tr >
- <th>Corregido</th>
- <th>Nombre</th>
- <th>CURP</th>
- <th>Contacto</th>
- <th>
- <div class="custom-control custom-checkbox">
- <input type="checkbox" class="custom-control-input selectAll" id="selectAll0">
- <label class="custom-control-label" for="selectAll0">Modificar</label>
- </div>
- </th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($datos_rs as $dato){
- ?>
- <tr data-id="<?php echo $dato["Usuario_id"]; ?>" id="id<?php echo $dato["Usuario_id"]; ?>" class="data-row">
- <td style="vertical-align:middle" class="text-center">
- <?php if ($dato["CheckUsuario_cambio"]){ echo "<span class='text-success'>".$ICO["aceptar"]."</span>"; }
- else{ echo "<span class='text-info'>".$ICO["menos"]."</span>"; }
- ?>
- <br><small><?php echo date("d/m/Y h:i",strtotime($dato["CheckUsuario_fecha_revision"]));?></small>
- </td>
- <td style="vertical-align:middle">
- <?php echo $dato["Usuario_grado_new"]." ".$dato["Usuario_apellidos_new"]." ".$dato["Usuario_nombre_new"]; ?> <span class="badge badge-secondary">Nuevo</span><br>
- <span class="text-info"><?php echo $dato["Usuario_grado_new"]." ".$dato["Usuario_apellidos_old"]." ".$dato["Usuario_nombre_old"]; ?></span> <span class="badge badge-info">Actual</span>
- </td>
- <td style="vertical-align:middle" class="text-center">
- <?php echo $dato["Usuario_curp_new"]; ?> <span class="badge badge-secondary">Nuevo</span><br>
- <span class="text-info"><?php echo $dato["Usuario_curp_old"]; ?></span> <span class="badge badge-info">Actual</span>
- </td>
- <td style="vertical-align:middle; font-size:80%" ><?php
- $stmt = $pdo->prepare('Select * from fs_checkusuario_contacto(:usr)');
- $stmt->bindParam(":usr", $dato["Usuario_id"]);
- if(!$stmt->execute()){
- $errorDesc = "Ocurrió un error al cargar los datos";
- }else{
- //$datosContacto_rs = $stmt->fetchAll();
- foreach($stmt->fetchAll() as $contacto){
- echo "<b>".$contacto["TipoContacto_desc"]." ".$contacto["SubtipoContacto_desc"]."</b>: ".$contacto["CheckContacto_valor"]."<br>";
- }
- }
- $stmt->closeCursor();
- ?>
- </td>
- <td style="vertical-align:middle" class="text-center icono-acciones">
-
- <div class="form-check form-check-inline">
- <input class="form-check-input radio-lg radio-accept" type="radio" id="check1_<?php echo $dato["Usuario_id"]; ?>" name="checkgroup_<?php echo $dato["Usuario_id"]; ?>" value="2">
- <label for="check1_<?php echo $dato["Usuario_id"]; ?>" class="col-form-label text-success"><?php echo $ICO["aceptar"];?></label>
- </div>
-
- <div class="form-check form-check-inline">
- <input class="form-check-input radio-lg" type="radio" id="check2_<?php echo $dato["Usuario_id"]; ?>" name="checkgroup_<?php echo $dato["Usuario_id"]; ?>" value="3">
- <label for="check2_<?php echo $dato["Usuario_id"]; ?>" class="col-form-label text-danger"><?php echo $ICO["cancelar"];?></label>
- </div>
-
- <span class="text-info clear pointer"><?php echo $ICO["borrar"];?></span> </span>
- </td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- </div>
- </div>
- <div class="row">
- <div class="col-12 text-center">
- <button type="button" class="btn btn-primary" id="btn-guardar"><?php echo $ICO["aceptar"];?> Actualizar</button>
- </div>
- </div>
-
- <form id="formHidden" method="post" action="./action/datos_autoriza.php">
- <input type="hidden" name="data" id="users_data" value="">
- </form>
-
- <?php } else { ?>
- <h4 class="text-center">No hay datos para actualizar</h4>
- <?php } ?>
- </main>
- <!--- FOOTER--->
- <?php require_once("./include/footer.php"); ?>
-
- </div>
- <script src="./js/jquery.min.js"></script>
- <script src="./js/bootstrap/popper.min.js"></script>
- <script src="./js/bootstrap/bootstrap.min.js"></script>
- <script src="./js/sidebarmenu.js"></script>
-
- <script>
-
- function changeAllChecks(activo){
- $(".selectAll").prop("checked", activo);//deselecciona general
- $(".select_materia").prop("checked", activo);//deselecciona cada uno
- $("#btn_lote").prop("disabled", !activo);//bloquea boton
- }
- $('body').on('change', '.selectAll', function() {
- var check = $(this).prop("checked");
- $(this).parents(".table").find(".radio-accept").prop("checked", check);
- });
- $(document).ready(function(){
-
- $(".btn-menus").click(function(){
- var sist = $(this).parents("tr").data("id");
- $("#sist").val(sist);
- //$("#formHidden").attr("action", "menus.php").submit();
- $("#formHidden").submit();
- });
-
- $(".clear").click(function(){
- var sist = $(this).parent().find(":radio").prop("checked", false);
- });
-
-
- $("#btn-guardar").click(function(){
- var objClase = [];
- $.each($('.data-row input[type="radio"]:checked'), function(){
- objClase.push({id:$(this).parents('.data-row').data('id'), value: parseInt($(this).val())});
- });
-
- //console.log(JSON.stringify(objClase));
- $("#users_data").val(JSON.stringify(objClase));
- $("#formHidden").submit();
-
- });
- });
- </script>
- </body>
- </html>
|