123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- <?php
- require_once("../include/constantes.php");
- require_once("../include/bd_pdo.php");
- require_once("../classes/ValidaSesion.php");
- require_once("../classes/MainMenu.php");
- $menu = 7;
- $submenu = 74;
- //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
- $objSesion = new ValidaSesion($pdo, $submenu, APSA);
- if(!$objSesion->tieneAcceso()){
- $objSesion->terminaSesion();
- }
- $objSesion->validaPeriodoUsuario();//si no tiene periodo manda a main
-
- //Obtiene áreas académicas
- if(!$_SESSION["jefe_carrera"] || $_SESSION["sgi_administrador"]){
- $stmt = $pdo->prepare("Select * from fs_areaacademica(NULL, :nivel)");
- }else{
- if(!$_SESSION["jefe_carrera"]){
- header("Location: ../index.php?error=3");
- exit();
- }
- $stmt = $pdo->prepare("Select * from fs_areausuario(:usr, :nivel)");
- $stmt->bindParam(":usr", $_SESSION["usuario_id"]);
- }
- $stmt->bindParam(":nivel", $_SESSION["nivel_id"]);
- if(!$stmt->execute()){
- $errorDesc = "Ocurrió un error al cargar las áreas académicas.";
- }else{
- $areas_rs = $stmt->fetchAll();
- }
- $stmt->closeCursor();
-
- ?>
- <!DOCTYPE html>
- <html lang="es" prefix="og: http://ogp.me/ns#">
- <head>
- <title>APSA - 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/calendar.css" type="text/css">
- <script src="../js/util.js"></script>
- </head>
- <body>
- <div>
- <?php
- //--- Objeto que pinta menu
- $menuObj = new MainMenu($_SESSION["usuario_id"], $menu, $pdo, APSA, "Reporte de Syllabus y Plande cátedra");//usr, menu, pdo, sist
- $menuObj->printMenu();
-
-
- //Obtiene datos
- $query = "";
- if(count($areas_rs)>1){
- if(isset($_POST["area"]) && is_numeric($_POST["area"])){
- $query .= ":area";
- $filter_area = filter_input(INPUT_POST, "area", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- }else{
- $query .= "NULL";
- }
- }else{
- $query .= ":area";
- $filter_area = $areas_rs[0]["Area_id"];
- }
-
- $stmt = $pdo->prepare('Select * from fs_reporte_syllabus_plan(:periodo, '.$query.')');
- $stmt->bindParam(":periodo", $_SESSION["periodo_id"]);
- if(isset($filter_area)) $stmt->bindParam(":area", $filter_area);
-
- if(!$stmt->execute()){
- $errorDesc = "Ocurrió un error al cargar los datos";
- }else{
- $reporte_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 del grupo."; break;
- case 1: $errorDesc = "Ocurrió un error al insertar los datos del grupo."; break;
- case 2: $errorDesc = "Ocurrió un error al actualizar los datos del grupo."; break;
- case 3: $errorDesc = "No tienes permisos para realizar esa acción."; break;
- case 4: $errorDesc = "Ocurrió un error al cargar los datos grupos."; break;
- case 5: $errorDesc = "No existen grupos para el periodo. Primero debes crear grupos en esta sección."; break;
- case 6: $errorDesc = "El grupo que buscas no existe. Consulta la lista de grupos disponibles en esta sección."; break;
- }
- }
- if(isset($_GET["ok"]) && is_numeric($_GET["ok"])){
- switch ($_GET["ok"]){
- case 0: $successDesc = "El grupo se guardó correctamente."; break;
- case 1: $successDesc = "El grupo se actualizó correctamente."; break;
- }
- }
- ?>
- <main class="container-fluid content marco">
- <?php include_once("../include/errorMessage.php");?>
-
- <?php include("../include/periodoCambio.php");?>
- <?php
- if(isset($reporte_rs)){
- ?>
-
-
- <!-- Filtro -->
- <?php if(count($areas_rs)>1){ ?>
- <div class="row">
- <div class="col-12">
- <form action="reporte_syllabus.php" method="post">
- <div class="form-box form-box-info">
- <div class="form-group row">
- <label for="filter_area" class="col-4 col-form-label">Área académica</label>
- <div class="col-8 col-sm-4">
- <div class="datalist datalist-select mb-1 w-100">
- <div class="datalist-input">Mostrar todas</div>
- <span class="ing-buscar icono"></span>
- <ul style="display:none">
- <li data-id="">Mostrar todas</li>
- <?php foreach($areas_rs as $area) {?>
- <li data-id="<?php echo $area["Area_id"];?>" <?php if(isset($filter_area) && $filter_area == $area["Area_id"]){echo "class='selected'";}?> ><?php echo $area["Area_desc"];?></li>
- <?php }?>
- </ul>
- <input type="hidden" id="filter_area" name="area" value="">
- </div>
- </div>
- </div>
- </div>
- <div class="form-group row">
- <div class="col-12 text-center">
- <button type="submit" class="btn btn-outline-primary"><?php echo $ICO["buscar"]; ?> Filtrar</button>
- <button type="button" class="btn btn-outline-danger btn-reset"><?php echo $ICO["borrar"]?> Limpiar</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- <?php } else if(count($areas_rs)==1){
- echo "<h3 class='text-center mb-4'>Área: ".$areas_rs[0]["Area_desc"]."</h3>";
- }?>
-
- <?php if(count($reporte_rs)>0){ ?>
- <div class="row ">
- <div class="col-12 table-responsive">
- <ul>
- <li><b>Syllabus</b>: Cantidad de campos llenos, el total de posibles campos es 13.</li>
- <li><b>Plan de Cátedra</b>: Cantidad de sesiones llenas considerando 16 semanas.</li>
- </ul>
- <div class="text-right my-4">
-
- <form action="./export/xls_syllabus.php" target="_blank" method="post" id="formaReporte" >
- <input type="hidden" value="<?php echo isset($filter_area)?$filter_area:'';?>" name="area">
- <button type="submit" class="btn btn-outline-secondary btn-reporte" data-target="./export/pdf_syllabus_all.php">
- <?php echo $ICO["descargar"];?> Todos los Syllabus
- </button>
- <button type="submit" class="btn btn-outline-secondary btn-reporte" data-target="./export/pdf_plancatedra_all.php">
- <?php echo $ICO["descargar"];?> Todos los Planes de Cátedra
- </button>
- <button type="submit" class="btn btn-outline-secondary btn-reporte" data-target="./export/xls_syllabus.php">
- <?php echo $ICO["descargar"];?> Reporte general
- </button>
- </form>
- </div>
- <table class="table table-sm table-striped table-white">
- <thead class="thead-dark">
- <tr >
- <th>Clave</th>
- <th>Nombre</th>
- <th>Materia</th>
- <th>Grupo</th>
- <th>Área</th>
- <th>Syllabus</th>
- <th>Plan</th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($reporte_rs as $rep){
- $limite = 50;
- ?>
- <tr data-prof="<?php echo $rep["Usuario_id"];?>" data-mat="<?php echo $rep["Materia_id"];?>" data-gpo="<?php echo $rep["Grupo_id"];?>" data-gpo_nom="<?php echo $rep["Grupo_desc"];?>" data-sub="<?php echo $rep["Submateria_id"];?>">
- <td class="text-center"><?php echo $rep["Usuario_claveULSA"];?></td>
- <td><?php echo $rep["Usuario_apellidos"]." ".$rep["Usuario_nombre"]; ?></td>
- <td><?php echo $rep["Materia_desc"];
- if($rep["electiva"]) echo '<span class="badge badge-info ml-3 px-2 py-1" style="font-size: 60%;">ELECTIVA</span>';?></td>
- <td><?php echo $rep["Grupo_desc"].$rep["Carrera_prefijo"];?></td>
- <td class="text-center"><?php echo $rep["Area_desc"]; ?></td>
- <td class="text-center text-nowrap <?php echo (round($rep["total_campos_llenos"]/13*100,1) < $limite)?"table-danger":"" ?>">
- <span class="ver-syllabus pointer"><?php echo $ICO["ver"];?>
- <?php echo round($rep["total_campos_llenos"]/13*100,1);?>%</span>
- </td>
- <td class="text-center text-nowrap <?php echo (round($rep["promedio_sesiones_semana"]*100,1) < $limite)?"table-danger":"" ?>">
- <span class="ver-plan pointer"><?php echo $ICO["ver"];?>
- <?php echo round($rep["promedio_sesiones_semana"]*100,1);?>%</span>
- </td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- <form action="./export/pdf_plancatedra.php" target="_blank" method="post" id="formaSubmit">
- <input type="hidden" name="mat" value="" id="mat">
- <input type="hidden" name="gpo" value="" id="gpo">
- <input type="hidden" name="gpo_nom" value="" id="gpo_nom">
- <input type="hidden" name="sub" value="" id="sub">
- <input type="hidden" name="prof" value="" id="prof">
- </form>
- </div>
- </div>
- <?php }else{ ?>
- <h2 class="text-center text-danger">No se encontraron registros</h2>
- <?php } ?>
- <?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/bootstrap/popper.min.js"></script>
- <script src="../js/bootstrap/bootstrap.min.js"></script>
- <script src="../js/fechas.js"></script>
- <script src="../js/sidebarmenu.js"></script>
- <script src="../js/datalist.js"></script>
- <script>
- //Cambia el reporte de acuerdo al botón
- $(document).on( "click", ".btn-reporte", function(event){
- var newAction = $(this).data('target');
- $('#formaReporte').attr('action', newAction);
- });
- $(document).on( "click", ".ver-syllabus", function(event){
- $("#mat").val( $(this).parents("tr").data("mat") );
- $("#gpo").val( $(this).parents("tr").data("gpo") );
- $("#gpo_nom").val( $(this).parents("tr").data("gpo_nom") );
- $("#prof").val( $(this).parents("tr").data("prof") );
- $("#sub").val( $(this).parents("tr").data("sub") );
- $("#formaSubmit").attr("action", "./export/pdf_syllabus.php");
- $("#formaSubmit").submit();
- });
- $(document).on( "click", ".ver-plan", function(event){
- $("#mat").val( $(this).parents("tr").data("mat") );
- $("#gpo").val( $(this).parents("tr").data("gpo") );
- $("#gpo_nom").val( $(this).parents("tr").data("gpo_nom") );
- $("#prof").val( $(this).parents("tr").data("prof") );
- $("#sub").val( $(this).parents("tr").data("sub") );
- $("#formaSubmit").attr("action", "./export/pdf_plancatedra.php");
- $("#formaSubmit").submit();
- });
- $(document).on( "click", ".btn-reset", function(event){
- var forma = $(this).parents("form");
- forma.find("input[type=text]").val("");
- //forma.find("select").prop("selectedIndex",0);
- setDatalistFirst("#filter_carrera");
- setDatalistFirst("#filter_sem");
- forma.submit();
- });
- setDatalist("#periodo", <?php echo $_SESSION["periodo_id"]; ?>);
- $(document).on('click', '#dlPeriodo ul li' ,function(){
- $("#formaPeriodo").submit();
- });
- </script>
-
- </body>
- </html>
|