reporte_profesorcarrera.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <?php
  2. ini_set('display_errors', 1);
  3. ini_set('display_startup_errors', 1);
  4. error_reporting(E_ALL);
  5. require_once("../include/constantes.php");
  6. require_once("../include/util.php");
  7. require_once("../include/bd_pdo.php");
  8. require_once("../classes/ValidaSesion.php");
  9. require_once("../classes/MainMenu.php");
  10. $menu = 7;
  11. $submenu = 77;
  12. //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
  13. $objSesion = new ValidaSesion($pdo, $submenu, APSA);
  14. if(!$objSesion->tieneAcceso()){
  15. $objSesion->terminaSesion();
  16. }
  17. $objSesion->validaPeriodoUsuario();//si no tiene periodo manda a main
  18. ?>
  19. <!DOCTYPE html>
  20. <html lang="es" prefix="og: http://ogp.me/ns#">
  21. <head>
  22. <title>APSA - Facultad de Ingeniería</title>
  23. <meta charset="utf-8">
  24. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  25. <link rel="icon" type="image/png" href="../img/favicon.png" />
  26. <link rel="stylesheet" href="../css/bootstrap-ulsa.min.css" type="text/css">
  27. <link rel="stylesheet" href="../css/indivisa.css" type="text/css">
  28. <link rel="stylesheet" href="../css/sgi.css?rand=<?php echo rand();?>" type="text/css">
  29. <link rel="stylesheet" href="../css/fa_all.css" type="text/css">
  30. <script src="../js/util.js"></script>
  31. </head>
  32. <body>
  33. <div>
  34. <?php
  35. //--- Objeto que pinta menu
  36. $menuObj = new MainMenu($_SESSION["usuario_id"], $menu, $pdo, APSA, "Profesores por carrera");//usr, menu, pdo, sist
  37. $menuObj->printMenu();
  38. //Carrera
  39. $stmt = $pdo->prepare('Select * from fs_carrera(NULL, :nivel, false)');
  40. $stmt->bindParam(":nivel", $_SESSION["nivel_id"]);
  41. if(!$stmt->execute()){
  42. $errorDesc = "Ocurrió un error al cargar las áreas académicas";
  43. }else{
  44. $carrera_rs = $stmt->fetchAll();
  45. }
  46. $stmt->closeCursor();
  47. if(!empty($_POST["carrera"])){
  48. $filter_carrera = filter_input(INPUT_POST, "carrera", FILTER_SANITIZE_NUMBER_INT);//limpia texto
  49. $query ="";
  50. if(isset($_POST["desc"])){
  51. $query .= ":nom, ";
  52. $filter_desc = trim(filter_input(INPUT_POST, "desc", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
  53. }else{
  54. $query .= "'', ";
  55. }
  56. if(isset($_POST["clave"])){
  57. $query .= ":clave, ";
  58. $filter_clave = filter_input(INPUT_POST, "clave", FILTER_SANITIZE_NUMBER_INT);//limpia texto
  59. }else{
  60. $query .= "'', ";
  61. }
  62. //echo 'Select * from fs_profesorescarrera('.$query.$_SESSION["periodo_id"].', 1, 0, '.MAX_ROWS.')';
  63. $stmt = $pdo->prepare('Select * from fs_profesorescarrera(:carrera, '.$query.' :periodo)');
  64. $stmt->bindParam(":carrera", $filter_carrera);
  65. if(isset($filter_desc)) $stmt->bindParam(":nom", $filter_desc);
  66. if(isset($filter_clave)) $stmt->bindParam(":clave", $filter_clave);
  67. $stmt->bindParam(":periodo", $_SESSION["periodo_id"]);
  68. if(!$stmt->execute()){
  69. $errorDesc = "Ocurrió un error al cargar los profesores.";
  70. print_r($stmt->errorInfo());
  71. }else
  72. $usuario_rs = $stmt->fetchAll();
  73. $stmt->closeCursor();
  74. /*$stmt = $pdo->prepare('Select * from fs_profesorescarrera_faltantes(:periodo, :carrera, NULL)');
  75. $stmt->bindParam(":carrera", $filter_carrera);
  76. $stmt->bindParam(":periodo", $_SESSION["periodo_id"]);
  77. if(!$stmt->execute()){
  78. $errorDesc = "Ocurrió un error al cargar los profesores faltantes.";
  79. print_r($stmt->errorInfo());
  80. }else
  81. $materia_rs = $stmt->fetchAll();
  82. $stmt->closeCursor();*/
  83. }
  84. //--Manejo de errores y mensajes de exito
  85. if(isset($_GET["error"]) && is_numeric($_GET["error"])){
  86. switch ($_GET["error"]){
  87. case 0: $errorDesc = "No se reciberon los datos del usuario."; break;
  88. case 1: $errorDesc = "No existe el usuario que buscas. Selecciona una del listado."; break;
  89. case 2: $errorDesc = "Ocurrió un error al leer los datos del usuario."; break;
  90. case 3: $errorDesc = "No tienes permisos para realizar esa acción."; break;
  91. }
  92. }
  93. ?>
  94. <main class="container-fluid content marco">
  95. <?php include_once("../include/errorMessage.php");?>
  96. <?php include("../include/periodoCambio.php");?>
  97. <!-- Filtro -->
  98. <div class="row">
  99. <div class="col-12">
  100. <form action="#" method="post">
  101. <div class="form-box form-box-info">
  102. <?php if(count($carrera_rs) > 1){ ?>
  103. <div class="form-group row">
  104. <label for="filter_carrera" class="col-4 col-form-label">Carrera</label>
  105. <div class="col-8 col-sm-4">
  106. <select id="filter_carrera" name="carrera" class="form-control">
  107. <?php foreach($carrera_rs as $carrera) {?>
  108. <option value="<?php echo $carrera["Carrera_id"];?>" <?php if(isset($filter_carrera) && $filter_carrera == $carrera["Carrera_id"]){echo "selected='selected'";}?> ><?php echo $carrera["Carrera_desc"];?></option>
  109. <?php } ?>
  110. </select>
  111. </div>
  112. </div>
  113. <?php } ?>
  114. <div class="form-group row">
  115. <label for="filter_desc" class="col-4 col-form-label">Nombre</label>
  116. <div class="col-8 col-sm-4">
  117. <input id="filter_desc" name="desc" type="text" class="form-control" <?php if(isset($filter_desc) ){echo 'value="'.$filter_desc.'"';}?>>
  118. </div>
  119. </div>
  120. <div class="form-group row">
  121. <label for="filter_clave" class="col-4 col-form-label">Clave ULSA</label>
  122. <div class="col-8 col-sm-4">
  123. <input id="filter_clave" name="clave" type="text" class="form-control" <?php if(isset($filter_clave) ){echo 'value="'.$filter_clave.'"';}?>>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="form-group row">
  128. <div class="col-12 text-center">
  129. <button type="submit" class="btn btn-outline-primary"><?php echo $ICO["buscar"]; ?> Filtrar</button>
  130. <button type="button" class="btn btn-outline-danger btn-reset"><?php echo $ICO["borrar"]?> Limpiar</button>
  131. </div>
  132. </div>
  133. </form>
  134. </div>
  135. </div>
  136. <!-- end Filtro -->
  137. <?php
  138. if(isset($usuario_rs)){
  139. if(count($usuario_rs) > 0){
  140. ?>
  141. <form action="./export/xls_profesorcarrera.php" target="_blank" method="post">
  142. <input type="hidden" name="carrera" value="<?php if(isset($filter_carrera)){ echo $filter_carrera; }?>">
  143. <input type="hidden" name="desc" value="<?php if(isset($filter_desc)){ echo $filter_desc; }?>">
  144. <input type="hidden" name="clave" value="<?php if(isset($filter_clave)){ echo $filter_clave; }?>">
  145. <p class="text-right"><button type="submit" class="btn btn-outline-secondary"><?php echo $ICO["descargar"]; ?> Generar xls</button></p>
  146. </form>
  147. <?php }?>
  148. <div class="row">
  149. <div class="col-12 table-responsive">
  150. <table class="table table-sm table-striped table-white">
  151. <thead class="thead-dark">
  152. <tr >
  153. <th>Materia</th>
  154. <th>Semestre</th>
  155. <th>Clave</th>
  156. <!-- <th>Grado</th> -->
  157. <th>Nombre</th>
  158. </tr>
  159. </thead>
  160. <tbody>
  161. <?php
  162. foreach($usuario_rs as $usuario){
  163. ?>
  164. <tr data-id="<?php echo $usuario["Usuario_id"]; ?>">
  165. <td><?php echo $usuario["Materia_desc"] ?></td>
  166. <td class="text-center "><?php echo $usuario["Materia_semestre"] ?></td>
  167. <td class="text-center "><?php echo $usuario["Usuario_claveULSA"] ?></td>
  168. <!-- <td ><?php echo $usuario["Usuario_grado"] ?></td> -->
  169. <td><?php echo $usuario["Usuario_apellidos"]." ".$usuario["Usuario_nombre"]; ?></td>
  170. </tr>
  171. <?php } ?>
  172. </tbody>
  173. </table>
  174. </div>
  175. </div>
  176. <?php } ?>
  177. <?php if (isset($materia_rs) && count($materia_rs) > 0){ ?>
  178. <h4 class="mt-4 mb-3">Materias que faltan de profesor</h4>
  179. <div class="row">
  180. <div class="col-12 table-responsive">
  181. <table class="table table-sm table-striped table-white">
  182. <thead class="thead-dark">
  183. <tr >
  184. <th>Grupo</th>
  185. <th>Materia</th>
  186. </tr>
  187. </thead>
  188. <tbody>
  189. <?php
  190. foreach($materia_rs as $materia){
  191. ?>
  192. <tr data-id="<?php echo $materia["Materia_id"]; ?>">
  193. <td><?php echo $materia["Grupo_desc"]." ".$materia["Carrera_prefijo"]; ?></td>
  194. <td><?php echo $materia["Materia_desc"] ?></td>
  195. </tr>
  196. <?php } ?>
  197. </tbody>
  198. </table>
  199. </div>
  200. </div>
  201. <?php } ?>
  202. </main>
  203. <!--- FOOTER--->
  204. <?php require_once("../include/footer.php"); ?>
  205. <form id="pdfForm" action="./export/pdf_horariousuario.php" target="_blank" method="post">
  206. <input type="hidden" id="usr_id" name="id" value="">
  207. </form>
  208. </div>
  209. <script src="../js/jquery.min.js"></script>
  210. <script src="../js/bootstrap/popper.min.js"></script>
  211. <script src="../js/bootstrap/bootstrap.min.js"></script>
  212. <script src="../js/sidebarmenu.js"></script>
  213. <script src="../js/datalist.js"></script>
  214. <script>
  215. setDatalist("#periodo", <?php echo $_SESSION["periodo_id"]; ?>);
  216. $(document).on('click', '#dlPeriodo ul li' ,function(){
  217. $("#formaPeriodo").submit();
  218. });
  219. $(document).on( "click", ".btn-reset", function(event){
  220. var forma = $(this).parents("form");
  221. forma.find("input[type=text]").val("");
  222. forma.find("select").prop("selectedIndex",0);
  223. forma.submit();
  224. });
  225. $(document).on( "click", ".open-pdf", function(event){
  226. $("#usr_id").val($(this).data("id"));
  227. $("#pdfForm").submit();
  228. });
  229. </script>
  230. </body>
  231. </html>