| Fecha | +Aviso | +Estado | +
|---|
diff --git a/action/action_avisos.php b/action/action_avisos.php new file mode 100644 index 0000000..18c03ff --- /dev/null +++ b/action/action_avisos.php @@ -0,0 +1,52 @@ + +#input $_GET['id_espacio_sgu'] +#output rutas: [ ...ruta, salones: [{...salon}] ] +header('Content-Type: application/json charset=utf-8'); +ini_set('display_errors', 1); +ini_set('display_startup_errors', 1); +error_reporting(E_ALL); + +$ruta = "../"; +require_once $ruta . "class/c_login.php"; +if (!isset($_SESSION['user'])) { + http_response_code(401); + die(json_encode(['error' => 'unauthorized'])); +} +$user = unserialize($_SESSION['user']); + +// check method +try { + if ($_SERVER['REQUEST_METHOD'] === 'GET') { + $data = $db->query( + 'SELECT * FROM AVISO', + [ + ':facultad_id' => $user->facultad['facultad_id'], + ':fecha_inicio' => $_GET['fecha'] ?? $_GET['fecha_inicio'] ?? null, + ':fecha_fin' => $_GET['fecha'] ?? $_GET['fecha_fin'] ?? null, + ] + ); + + $last_query = [ + 'query' => $db->getLastQuery(), + ]; + + echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + } else { + http_response_code(405); + echo json_encode(['error' => 'method not allowed']); + exit; + } +} catch (PDOException $th) { + http_response_code(500); + echo json_encode([ + 'error' => $th->getMessage(), + 'query' => $db->getLastQuery(), + ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR); + exit; +} catch (Exception $th) { + http_response_code(500); + echo json_encode([ + 'error' => $th->getMessage(), + ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + exit; +} \ No newline at end of file diff --git a/action/action_avisos_delete.php b/action/action_avisos_delete.php deleted file mode 100644 index e4409f6..0000000 --- a/action/action_avisos_delete.php +++ /dev/null @@ -1,9 +0,0 @@ - $_POST['id']]; -echo json_encode(query($sql, $params, false)); -?> \ No newline at end of file diff --git a/action/action_avisos_insert.php b/action/action_avisos_insert.php deleted file mode 100644 index dfb6fec..0000000 --- a/action/action_avisos_insert.php +++ /dev/null @@ -1,28 +0,0 @@ - $tipo], false); - foreach($profesores_carrera as $profesor){ - array_push($profesores, $profesor['profesor_id']); - } - - } -} -$sql = "SELECT fi_aviso(:fecha_inicial, :fecha_final, :texto, :facultad)"; -$params = [':fecha_inicial' => $_POST['fecha_inicial'], ':fecha_final' => $_POST['fecha_final'], ':texto' => $_POST['texto'], ':facultad' => $_POST['facultad']]; -$aviso_id = query($sql, $params, true); - -$sql = "SELECT fi_aviso_profesor(:aviso_id, :profesor_id)"; -foreach($profesores as $profesor_id){ - $params = [':aviso_id' => $aviso_id['fi_aviso'], ':profesor_id' => $profesor_id]; - query($sql, $params, false); -} -header("Location: ../avisos.php"); -exit(); -?> \ No newline at end of file diff --git a/action/action_avisos_update.php b/action/action_avisos_update.php deleted file mode 100644 index 6f6bf24..0000000 --- a/action/action_avisos_update.php +++ /dev/null @@ -1,52 +0,0 @@ - $_POST['aviso_id']], true); -if(isset($_POST['fecha_final'])){ - $fecha_fin = $_POST['fecha_final']; -}else{ - $fecha_fin = $aviso['aviso_fecha_final']; -} -if(isset($_POST['texto'])){ - $texto = $_POST['texto']; -}else{ - $texto = $aviso['aviso_texto']; -} -if(isset($_POST['fecha_inicial'])){ - $fecha_inicio = $_POST['fecha_inicial']; -}else{ - $fecha_inicio = $aviso['aviso_fecha_inicial']; -} - -$sql = "SELECT fu_update_aviso(:id, :fecha_fin, :texto, :fecha_inicio)"; -$params = [':id' => $_POST['aviso_id'], ':fecha_fin' => $fecha_fin, ':texto' => $texto, ':fecha_inicio' => $fecha_inicio]; -query($sql, $params, true); - -query("SELECT fd_aviso_profesor(:aviso_id)", [':aviso_id' => $_POST['aviso_id']], false); - -$profesores = []; -if(isset($_POST['tipo'])){ - foreach($_POST['tipo'] as $tipo){ - $profesores_carrera = query("SELECT profesor_id FROM fs_profesor_carrera(:carrera_id)", [':carrera_id' => $tipo], false); - foreach($profesores_carrera as $profesor){ - array_push($profesores, $profesor['profesor_id']); - } - - } -} - - -foreach($_POST['usuario'] as $profesor){ - array_push($profesores, $profesor); -} -$sql = "SELECT fi_aviso_profesor(:aviso_id, :profesor_id)"; -foreach($profesores as $profesor_id){ - $params = [':aviso_id' => $_POST['aviso_id'], ':profesor_id' => $profesor_id]; - query($sql, $params, false); -} - -header("Location: ../avisos.php"); -exit(); -?> \ No newline at end of file diff --git a/auditoria.php b/auditoria.php index 0dec217..6bceb47 100644 --- a/auditoria.php +++ b/auditoria.php @@ -242,114 +242,114 @@ -
| - - Fecha - | +||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| + + Fecha + | -Salón | -Profesor | +Salón | +Profesor | -Horario | -Registro | -Supervisor | - if ($user->acceso == 'w') { ?> -Justificar | - } ?> -
|---|---|---|---|---|---|---|---|---|
| No hay clases en este horario | -||||||||
| {{ registro.registro_fecha_ideal }} - | -{{ registro.salon }} | -- {{ registro.profesor_clave }} - {{ registro.profesor_nombre }} - - | +Horario | +Registro | +Supervisor | + if ($user->acceso == 'w') { ?> +Justificar | + } ?> +||
| No hay clases en este horario | +||||||||
| {{ registro.registro_fecha_ideal }} + | +{{ registro.salon }} | ++ {{ registro.profesor_clave }} + {{ registro.profesor_nombre }} + + | -{{ registro.horario_hora?.slice(0,5) }} - - {{registro.horario_fin?.slice(0,5) }} | - -
-
-
-
- Registro {{ registro.registro_fecha?.slice(11,19) }}
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
- {{ registro.usuario_nombre
- }}
-
-
- Hora
- {{ registro.registro_fecha_supervisor?.slice(11,19) }}
-
-
- Observaciones:
- {{registro.comentario?.slice(0,25)}}{{registro.comentario.length
- > 10 ? '...' : ''}}
-
- |
- if ($user->acceso == 'w') { ?>
+ {{ registro.horario_hora?.slice(0,5) }} - + {{registro.horario_fin?.slice(0,5) }} | +
-
-
+
+
+
+ Registro {{ registro.registro_fecha?.slice(11,19) }}
+
+
+
+
+
+
+
|
- } ?>
- |
| Fecha | +Aviso | +Estado | +
|---|
diff --git a/avisos.php b/avisos.php index e277d73..d2481b7 100644 --- a/avisos.php +++ b/avisos.php @@ -1,265 +1,61 @@ -access(); -if($user->acceso == null){ - header('Location: main.php?error=1'); -}else{ - $user->print_to_log('Avisos'); -} -$fac = $user->facultad['facultad_id']; -if($user->admin){ - $fac = null; -} -$limit = 20; -if(isset($_POST['filter_fecha']) && $_POST['filter_fecha'] != ""){ - $filter_fecha = $_POST['filter_fecha']; -} -else{ - $filter_fecha = null; -} -if(isset($_GET['pag'])){ - $pag = $_GET['pag'] - 1; -}else{ - $pag = 0; -} -if($user->admin){ - $count = query("SELECT count(1) FROM fs_aviso(null, :fecha, :facultad_id, null, 0, null)", [':fecha' => $filter_fecha, ':facultad_id' => $fac], true); - $fs_avisos = query("SELECT * FROM fs_aviso(null, :fecha, :facultad_id, :limite, :offset, null)", [':fecha' => $filter_fecha, ':facultad_id' => $fac, ':limite' => $limit, ':offset' => $pag * $limit], false); -}else{ - $count = query("SELECT count(1) FROM fs_aviso(null, :fecha, :facultad_id, null, 0, true)", [':fecha' => $filter_fecha, ':facultad_id' => $fac], true); - $fs_avisos = query("SELECT * FROM fs_aviso(null, :fecha, :facultad_id, :limite, :offset, true)", [':fecha' => $filter_fecha, ':facultad_id' => $fac, ':limite' => $limit, ':offset' => $pag * $limit], false); -} -$paginas = ceil($count['count'] / $limit); -?>
-
- - +
+ + + +
+