123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- <?php
- require_once("../include/constantes.php");
- require_once("../include/util.php");
- require_once("../include/bd_pdo.php");
- require_once("../classes/ValidaSesion.php");
- require_once("../classes/MainMenu.php");
- $menu = 12;
- $submenu = 127;
- //--- Objeto para validar usuario. El id de alumno lo lee desde sesión
- $objSesion = new ValidaSesion($pdo, $submenu, GEMA);
- if(!$objSesion->tieneAcceso()){
- $objSesion->terminaSesion();
- }
- ?>
- <!DOCTYPE html>
- <html lang="es" prefix="og: http://ogp.me/ns#">
- <head>
- <title>GEMA - 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">
- <link rel="stylesheet" href="../css/jquery-ui.css" type="text/css">
- <link rel="stylesheet" href="../css/month-picker.css" type="text/css">
- <link rel="stylesheet" href="../css/calendar.css" type="text/css">
- </head>
- <body>
- <div>
- <?php
- //--- Objeto que pinta menu
- $menuObj = new MainMenu($_SESSION["usuario_id"], $menu, $pdo, GEMA, "Alumnos por estado");//usr, menu, pdo, sist, titulo
- $menuObj->printMenu();
-
- //Obtiene estados
- $stmt = $pdo->prepare("Select * from fs_estadoalumno(NULL)");
- if(!$stmt->execute()){
- $errorDesc = "Ocurrió un error al cargar los salones.";
- }else{
- $estado_rs = $stmt->fetchAll();
- }
- $stmt->closeCursor();
- $stmt = null;
-
- //Carreras (todos los existentes) independiente de plan
- $stmt = $pdo->prepare('Select * from fs_carrera(NULL, NULL, false)');
- if(!$stmt->execute()){
- $errorDesc = "Ocurrió un error al cargar las carreras";
- }else{
- $carrera_rs = $stmt->fetchAll();
- }
- $stmt->closeCursor();
-
- $filter_fhoy = date("Y-m-d");
-
- $query = "";
- if(isset($_POST["fecha_inicial"]) && $_POST["fecha_inicial"] !=""){
- $filter_fini = fechaGuion(trim(filter_input(INPUT_POST, "fecha_inicial", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW))));//limpia texto
- $query .= ":fini, ";
- }else{
- $query .= "NULL, ";
- }
- if(isset($_POST["fecha_final"]) && $_POST["fecha_final"] !="") {
- $filter_ffin = fechaGuion(trim(filter_input(INPUT_POST, "fecha_final", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW))));//limpia texto
- $query .= ":ffin, ";
- }else{
- $query .= "NULL, ";
- }
- if(isset($_POST["fecha_hoy"]) && $_POST["fecha_hoy"] !="") {
- $filter_fhoy = fechaGuion(trim(filter_input(INPUT_POST, "fecha_hoy", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW))));//limpia texto
- }
- $query .= ":fhoy, ";
- if(isset($_POST["estado"]) && $_POST["estado"] !=""){
- $filter_estado = filter_input(INPUT_POST, "estado", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- $query .= ":edo, ";
- }else{
- $query .= "NULL, ";
- }
- if(isset($_POST["carrera"]) && $_POST["carrera"] !="" ){
- $filter_carrera = filter_input(INPUT_POST, "carrera", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- $query .= ":carrera, ";
- }else{
- $query .= "NULL, ";
- }
- $query .= "0, ".MAX_ROWS;
- $stmt = $pdo->prepare('Select * from fs_alumnosestado('.$query.')');//sólo activos
- if(isset($filter_fini)) $stmt->bindParam(":fini", $filter_fini);
- if(isset($filter_ffin)) $stmt->bindParam(":ffin", $filter_ffin);
- if(isset($filter_estado)) $stmt->bindParam(":edo", $filter_estado);
- if(isset($filter_carrera)) $stmt->bindParam(":carrera", $filter_carrera);
- $stmt->bindParam(":fhoy", $filter_fhoy);
- if(!$stmt->execute()){
- echo "Ocurrió un error al cargar los alumnos activos.";
- //print_r($stmt->errorInfo());
- exit();
- }
- $alumno_rs = $stmt->fetchAll();
- $stmt->closeCursor();
-
- //--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 de los alumnos."; break;
- case 1: $errorDesc = "Ocurrió un error al leer los datos de los alumnos."; break;
-
- }
- }
- ?>
-
- <main class="container-fluid content marco">
- <?php include_once("../include/errorMessage.php");?>
- <!-- Filtro -->
- <div class="row justify-content-center">
- <div class="col-12">
- <form action="reporte_alumnos.php" method="post">
- <div class="form-box form-box-info">
- <div class="form-group row">
- <label for="fecha_inicial" class="col-4 col-form-label">Generación Inicial</label>
- <div class="col-8 col-sm-4">
- <input id="fecha_inicial" type="text" class="form-control" placeholder="mm, aaaa" maxlength="10" readonly="readonly" required="required">
- <input type="hidden" id="fecha_inicial-hidden" name="fecha_inicial" value="">
- <div class="invalid-feedback">No es una fecha válida.</div>
- </div>
- </div>
- <div class="form-group row">
- <label for="fecha_final" class="col-4 col-form-label">Generación Final</label>
- <div class="col-8 col-sm-4">
- <input id="fecha_final" name="fecha_final" type="text" class="form-control" placeholder="mm, aaaa" maxlength="10" readonly="readonly" required="required">
- <input type="hidden" id="fecha_final-hidden" name="fecha_final" value="">
- <div class="invalid-feedback">No es una fecha válida.</div>
- </div>
- </div>
- <div class="form-group row">
- <label for="fecha_hoy" class="col-4 col-form-label">Fecha de corte</label>
- <div class="col-8 col-sm-4">
- <input id="fecha_hoy" name="fecha_hoy" type="text" class="form-control date-picker" placeholder="dd/mm/aaaa" maxlength="10" readonly="readonly" required="required" value="<?php echo fechaSlash($filter_fhoy);?>">
- <div class="invalid-feedback">No es una fecha válida.</div>
- </div>
- </div>
- <div class="form-group row">
- <label for="filter_estado" class="col-4 col-form-label">Estado</label>
- <div class="col-8 col-sm-4">
- <div class="datalist datalist-select mb-1 w-100">
- <div class="datalist-input">Mostrar todos</div>
- <span class="ing-buscar icono"></span>
- <ul style="display:none">
- <li data-id="">Mostrar todos</li>
- <?php foreach($estado_rs as $estado) { ?>
- <li data-id="<?php echo $estado["EstadoAlumno_id"];?>" <?php if(isset($filter_estado) && $filter_estado == $estado["EstadoAlumno_id"] ){ echo "class='selected'";}?>><?php echo $estado["EstadoAlumno_desc"];?></li>
- <?php }?>
- </ul>
- <input type="hidden" id="filter_estado" name="estado" value="">
- </div>
- </div>
- </div>
- <div class="form-group row">
- <label for="plan" class="col-4 col-form-label">Carrera</label>
- <div class="col-8 col-sm-4">
- <div class="datalist datalist-select mb-1 w-100">
- <div class="datalist-input">Mostrar de todas</div>
- <span class="ing-buscar icono"></span>
- <ul style="display:none">
- <li data-id="">Mostrar de todas</li>
- <?php
- $last_nivel = -1;
- foreach($carrera_rs as $carrera){
- if($last_nivel != intval($carrera["Nivel_id"])){
- $last_nivel = intval($carrera["Nivel_id"]);
- ?>
- <li data-id="" class="not-selectable"><?php echo $carrera["Nivel_desc"]; ?></li>
- <?php } ?>
- <li class="pl-5 <?php if(isset($filter_carrera) && $filter_carrera== intval($carrera["Carrera_id"])){ echo 'selected'; }?>" data-id="<?php echo $carrera["Carrera_id"];?>"><?php echo $carrera["Carrera_desc"];?></li>
- <?php }?>
- </ul>
- <input type="hidden" id="filter_carrera" name="carrera" value="">
- </div>
- </div>
- </div>
- </div>
- <div class="row mb-4">
- <div class="col-12 text-center">
- <button type="submit" class="btn btn-outline-primary"><?php echo $ICO["buscar"]; ?> Buscar alumnos</button>
- <button type="button" class="btn btn-outline-danger btn-reset"><?php echo $ICO["borrar"]?> Limpiar</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- <!-- end Filtro -->
- <?php if (isset($alumno_rs) && count($alumno_rs)>0){ ?>
- <form action="./export/xls_alumnos.php" target="_blank" method="post">
- <input type="hidden" name="estado" value="<?php echo isset($filter_estado)?$filter_estado:"";?>">
- <input type="hidden" name="carrera" value="<?php echo isset($filter_carrera)?$filter_carrera:"";?>">
- <input type="hidden" name="fecha_inicial" value="<?php echo isset($filter_fini)?$filter_fini:"";?>">
- <input type="hidden" name="fecha_final" value="<?php echo isset($filter_ffin)?$filter_ffin:"";?>">
- <input type="hidden" name="fecha_hoy" value="<?php echo $filter_fhoy;?>">
- <p class="pb-4"><button type="submit" class="btn btn-outline-secondary float-right"><?php echo $ICO["descargar"];?> Descargar datos</button></p>
- </form>
-
- <div class="row mt-4">
- <div class="col-12 table-responsive">
- <p>Se muestran los primeros <strong><?php echo MAX_ROWS;?></strong> resultados. Utiliza los filtros para encontrar los alumno que buscas o descarga el listado completo.</p>
- <table class="table table-sm table-striped table-white">
- <thead class="thead-dark">
- <tr >
- <th>Estado</th>
- <th>Clave</th>
- <th>Nombre</th>
- <th>Generación</th>
- <th>Programa académico</th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($alumno_rs as $usuario){
- ?>
- <tr data-id="<?php echo $usuario["Usuario_id"]; ?>">
-
- <td style="width:40px; color: <?php echo $usuario["EstadoAlumno_color"];?>" class="text-center" title="<?php echo $usuario["EstadoAlumno_desc"]." - ".$usuario["SubEstadoAlumno_desc"]; ?>">
- <?php echo $ICO_LG["circulo"]; ?>
- </td>
- <td class="text-center font-weight-bold" style="width:90px;"><?php echo $usuario["Usuario_claveULSA"]; ?></td>
- <td><?php echo $usuario["Usuario_apellidos"]." ".$usuario["Usuario_nombre"]; ?></td>
- <td class="text-center text-capitalize" style="width:110px;"><?php echo fechaMonthPicker($usuario["Alumno_generacion"]); ?></td>
- <td><?php echo $usuario["Carrera_desc"]." ".$usuario["PlanEstudio_desc"]; ?></td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- </div>
- </div>
-
- <?php } ?>
- </main>
- <!--- FOOTER--->
- <?php require_once("../include/footer.php"); ?>
-
-
- </div>
-
- <script src="../js/jquery.min.js"></script>
- <script src="../js/jquery-ui.js"></script>
- <script src="../js/datepicker-es.js"></script>
- <script src="../js/month-picker.js"></script>
- <script src="../js/bootstrap/popper.min.js"></script>
- <script src="../js/bootstrap/bootstrap.min.js"></script>
- <script src="../js/datalist.js"></script>
- <script src="../js/sidebarmenu.js"></script>
- <script>
- $(document).on( "click", ".btn-reset", function(event){
- var forma = $(this).parents("form");
- forma.find("input[type=text]").val("");
- setDatalistFirst("#filter_estado");
- setDatalistFirst("#filter_carrera");
- //$("#fecha_hoy").val("<?php echo date("d/m/Y");?>");
- forma.submit();
- });
-
- $(document).ready(function(){
-
- $("#fecha_hoy").datepicker({ dateFormat: "dd/mm/yy", changeMonth: true, changeYear:true});
- $("#fecha_hoy").datepicker( $.datepicker.regional[ "es" ] );
- $('#fecha_inicial').MonthPicker({ Button: false, MaxMonth: 0, MonthFormat: 'M, yy', AltFormat: 'yy-mm-dd', AltField: '#fecha_inicial-hidden' <?php if(isset($filter_fini)){ echo ", SelectedMonth: '".fechaMonthPicker($filter_fini)."'";}?> });
- $('#fecha_final').MonthPicker({ Button: false, MaxMonth: 0, MonthFormat: 'M, yy', AltFormat: 'yy-mm-dd', AltField: '#fecha_final-hidden' <?php if(isset($filter_ffin)){ echo ", SelectedMonth: '".fechaMonthPicker($filter_ffin)."'";}?> });
- });
- </script>
-
- </body>
- </html>
|