horario_profesor.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. require_once 'class/c_login.php';
  3. if (!isset($_SESSION['user']))
  4. die(header('Location: index.php'));
  5. $user = unserialize($_SESSION['user']);
  6. $user->access();
  7. if (!$user->admin && in_array($user->acceso, ['n']))
  8. die(header('Location: main.php?error=1'));
  9. $user->print_to_log('Consultar horario');
  10. $write = $user->admin || in_array($user->acceso, ['w']);
  11. // var_dump($user);
  12. ?>
  13. <!DOCTYPE html>
  14. <html lang="en">
  15. <head>
  16. <title>Consultar horario | <?= $user->facultad['facultad'] ?? 'General' ?></title>
  17. <meta charset="utf-8">
  18. <meta http-equiv="content-type" content="text/plain; charset=UTF-8" />
  19. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  20. <?php include_once "import/html_css_files.php"; ?>
  21. <script src="js/scrollables.js" defer></script>
  22. <script src="js/jquery.min.js" defer></script>
  23. <script src="js/bootstrap/bootstrap.min.js" defer></script>
  24. <script src="js/messages.js" defer></script>
  25. <script>
  26. const write = <?= $write ? 'true' : 'false' ?>;
  27. </script>
  28. <script src="js/moment.js" defer></script>
  29. <script src="js/horario_profesor.js" defer></script>
  30. </head>
  31. <!-- -->
  32. <body style="display: block;">
  33. <?php
  34. include('include/constantes.php');
  35. include("import/html_header.php");
  36. html_header("Consultar horario", "Sistema de gestión de checador");
  37. ?>
  38. <?= "<!-- $user -->" ?>
  39. <main class="container content marco content-margin" id="local-app">
  40. <section id="message"></section>
  41. <?php require('import/periodo.php') ?>
  42. <form id="form" class="form-horizontal">
  43. <div class="form-group">
  44. <div class="form-box">
  45. <input type="hidden" name="periodo" value="<?= $user->periodo ?>" />
  46. <div class="form-group row">
  47. <label for="clave_profesor" class="col-4 col-form-label">Profesor</label>
  48. <div class="col-6">
  49. <input list="lista_profesores" name="clave_profesor" id="clave_profesor" class="form-control" placeholder="Profesor" required="required">
  50. <div class="valid-feedback">
  51. Profesor encontrado
  52. </div>
  53. <div class="invalid-feedback">
  54. Profesor no encontrado
  55. </div>
  56. <datalist id="lista_profesores">
  57. <?php
  58. $profesores = $db->where('facultad_id', $user->facultad['facultad_id'])->get("fs_profesor");
  59. foreach ($profesores as $profesor) {
  60. extract($profesor);
  61. ?>
  62. <option data-grado="<?= $grado ?>" data-clave="<?= $clave ?>" data-profesor="<?= $profesor ?>" data-id="<?= $id; ?>" value="<?= "$clave | $grado $profesor" ?>"></option>
  63. <?php
  64. }
  65. ?>
  66. </datalist>
  67. <ul class="list-group" id="profesores"></ul>
  68. <input type="hidden" id="periodo_id" name="periodo_id" value="<?= $user->periodo ?>">
  69. <input type="hidden" id="profesor_id" name="profesor_id" value="">
  70. </div>
  71. </div>
  72. <!-- ICO-BUSCAR FILTRAR & ICO-BORRAR LIMPIAR -->
  73. <div class="form-group row justify-content-center">
  74. <button class="btn btn-outline-primary mr-2">
  75. <span class="ing-buscar icono"></span>
  76. Buscar horario
  77. </button>
  78. <button type="button" class="btn btn-outline-danger" onclick="location.reload()">
  79. <span class="ing-borrar icono"></span>
  80. Limpiar
  81. </button>
  82. </div>
  83. </div>
  84. </div>
  85. </form>
  86. <div class="form-group mt-4 row justify-content-center">
  87. <?php if ($write) { ?>
  88. <button type="button" id="nuevo" class="btn btn-outline-primary ml-4 d-none" title="Nuevo horario" data-toggle="modal" data-target="#modal-editar">
  89. <span class="ing-mas ing-fw"></span> Nuevo
  90. </button>
  91. <?php } ?>
  92. </div>
  93. </div>
  94. </div>
  95. </form>
  96. <!-- Horario is a (table with one a cell) within a table
  97. 7:15 - 8:45, 8:45 - 10:15, 10:30 - 12:00, 12:00 - 13:30
  98. de lunes a viernes, a excepción de que tenga sábado
  99. -->
  100. <div id="btn-excel-horario" class="mb-2 float-right hidden">
  101. <button class="btn btn-outline-secondary " title="Exportar a Excel">
  102. <span class="ing-descarga ing-fw"></span> Exportar a Excel
  103. </button>
  104. </div>
  105. <!-- Table responsive -->
  106. <div class="table-responsive">
  107. <table class="table table-bordered table-sm table-responsive-md" id="table-horario">
  108. <thead class="thead-dark">
  109. <tr id="headers">
  110. <th scope="col" class="text-center">Hora</th>
  111. <th scope="col" class="text-center">Lunes</th>
  112. <th scope="col" class="text-center">Martes</th>
  113. <th scope="col" class="text-center">Miércoles</th>
  114. <th scope="col" class="text-center">Jueves</th>
  115. <th scope="col" class="text-center">Viernes</th>
  116. <th scope="col" class="text-center">Sábado</th>
  117. </tr>
  118. </thead>
  119. <tbody id="horario"></tbody>
  120. </table>
  121. </div>
  122. </main>
  123. </body>
  124. </html>