Actualización

This commit is contained in:
Your Name
2024-10-07 19:31:30 +00:00
parent 189566ce16
commit e5715e3b05
108 changed files with 27751 additions and 26012 deletions

View File

@@ -1,26 +1,26 @@
name: Deploy Pruebas name: Deploy Pruebas
on: on:
push: push:
branches: branches:
- master - master
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: environment:
name: pruebasPAAD name: pruebasPAAD
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Deploy to Server - name: Deploy to Server
uses: appleboy/ssh-action@master uses: appleboy/ssh-action@master
with: with:
host: ${{ secrets.SERVER_IP }} host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USER }} username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }} key: ${{ secrets.SSH_PRIVATE_KEY }}
script: | script: |
cd /usr/share/nginx/html/paad/ cd /usr/share/nginx/html/paad/
git fetch --all git fetch --all
git reset --hard origin/master git reset --hard origin/master

34
.gitignore vendored
View File

@@ -1,17 +1,17 @@
composer.phar composer.phar
/vendor/ /vendor/
/temp/ /temp/
/template/ /template/
/node_modules/ /node_modules/
/include/nusoap/ /include/nusoap/
/fonts/ /fonts/
/imagenes/ /imagenes/
/concept/ /concept/
/backup/ /backup/
/.vscode/ /.vscode/
/log/ /log/
/include/.env /include/.env
*/.env */.env
log/asistencias_2023_08.log log/asistencias_2023_08.log

View File

@@ -1,13 +1,13 @@
# Checador de Profesor de la Universidad La Salle 🎓 # Checador de Profesor de la Universidad La Salle 🎓
![Imagen Institucional de La Salle](https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png) ![Imagen Institucional de La Salle](https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png)
## Descripción ## Descripción
Herramienta diseñada para el registro y control de asistencia de profesores en la Universidad La Salle. Asegura que los profesores realicen el registro de su entrada y salida y proporciona herramientas de auditoría para supervisores. Herramienta diseñada para el registro y control de asistencia de profesores en la Universidad La Salle. Asegura que los profesores realicen el registro de su entrada y salida y proporciona herramientas de auditoría para supervisores.
## Características ## Características
- Registro de entrada de profesores. - Registro de entrada de profesores.
- Base de datos segura con información del profesor. - Base de datos segura con información del profesor.
- Herramientas de auditoría para supervisores. - Herramientas de auditoría para supervisores.

View File

@@ -1,52 +1,52 @@
<? <?
#input $_GET['id_espacio_sgu'] #input $_GET['id_espacio_sgu']
#output rutas: [ ...ruta, salones: [{...salon}] ] #output rutas: [ ...ruta, salones: [{...salon}] ]
header('Content-Type: application/json charset=utf-8'); header('Content-Type: application/json charset=utf-8');
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
$ruta = "../"; $ruta = "../";
require_once $ruta . "class/c_login.php"; require_once $ruta . "class/c_login.php";
if (!isset($_SESSION['user'])) { if (!isset($_SESSION['user'])) {
http_response_code(401); http_response_code(401);
die(json_encode(['error' => 'unauthorized'])); die(json_encode(['error' => 'unauthorized']));
} }
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
// check method // check method
try { try {
if ($_SERVER['REQUEST_METHOD'] === 'GET') { if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$data = $db->query( $data = $db->query(
'SELECT * FROM AVISO', 'SELECT * FROM AVISO',
[ [
':facultad_id' => $user->facultad['facultad_id'], ':facultad_id' => $user->facultad['facultad_id'],
':fecha_inicio' => $_GET['fecha'] ?? $_GET['fecha_inicio'] ?? null, ':fecha_inicio' => $_GET['fecha'] ?? $_GET['fecha_inicio'] ?? null,
':fecha_fin' => $_GET['fecha'] ?? $_GET['fecha_fin'] ?? null, ':fecha_fin' => $_GET['fecha'] ?? $_GET['fecha_fin'] ?? null,
] ]
); );
$last_query = [ $last_query = [
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
]; ];
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
} else { } else {
http_response_code(405); http_response_code(405);
echo json_encode(['error' => 'method not allowed']); echo json_encode(['error' => 'method not allowed']);
exit; exit;
} }
} catch (PDOException $th) { } catch (PDOException $th) {
http_response_code(500); http_response_code(500);
echo json_encode([ echo json_encode([
'error' => $th->getMessage(), 'error' => $th->getMessage(),
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR); ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR);
exit; exit;
} catch (Exception $th) { } catch (Exception $th) {
http_response_code(500); http_response_code(500);
echo json_encode([ echo json_encode([
'error' => $th->getMessage(), 'error' => $th->getMessage(),
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
exit; exit;
} }

View File

@@ -36,7 +36,7 @@ if (is_array($user)) {
} else { } else {
$_SESSION['user'] = serialize($user); $_SESSION['user'] = serialize($user);
header("Location: " . (isset($_SESSION['ruta']) ? $_SESSION['ruta'] : "../main.php")); header("Location: " . ($_SESSION['ruta'] ?? "../main.php"));
} }
exit; exit;

View File

@@ -1,81 +1,81 @@
<?php <?php
$ruta = "../"; $ruta = "../";
require_once "../vendor/autoload.php"; require_once "../vendor/autoload.php";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
if (!isset($_SESSION['user'])) { if (!isset($_SESSION['user'])) {
http_response_code(401); http_response_code(401);
die(json_encode(['error' => 'unauthorized'])); die(json_encode(['error' => 'unauthorized']));
} }
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
$facultad_id = $user->facultad["facultad_id"]; $facultad_id = $user->facultad["facultad_id"];
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\IOFactory;
// Create the Spreadsheet // Create the Spreadsheet
$spreadsheet = new Spreadsheet(); $spreadsheet = new Spreadsheet();
// Get data for each 'puesto' // Get data for each 'puesto'
$puestos = $db->orderBy('nombre')->where('facultad_id', $facultad_id)->get('puesto', columns: ['nombre', 'puesto_id']); $puestos = $db->orderBy('nombre')->where('facultad_id', $facultad_id)->get('puesto', columns: ['nombre', 'puesto_id']);
$sheetIndex = 0; // To track and switch between sheets $sheetIndex = 0; // To track and switch between sheets
foreach ($puestos as $puesto) { foreach ($puestos as $puesto) {
// Create a new worksheet for each 'puesto' // Create a new worksheet for each 'puesto'
if ($sheetIndex == 0) { if ($sheetIndex == 0) {
// Use the first default sheet // Use the first default sheet
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle(substr($puesto['nombre'], 0, 31)); // Name the first sheet $sheet->setTitle(substr($puesto['nombre'], 0, 31)); // Name the first sheet
} else { } else {
$sheet = $spreadsheet->createSheet(); // Create new sheet $sheet = $spreadsheet->createSheet(); // Create new sheet
$sheet->setTitle(substr($puesto['nombre'], 0, 31)); // Set sheet title to puesto name $sheet->setTitle(substr($puesto['nombre'], 0, 31)); // Set sheet title to puesto name
} }
// Get associated materias for current puesto // Get associated materias for current puesto
$materias = $db $materias = $db
->join('materia m', 'm.materia_id = pm.materia_id') ->join('materia m', 'm.materia_id = pm.materia_id')
->orderBy('materia_nombre') ->orderBy('materia_nombre')
->where('puesto_id', $puesto['puesto_id']) ->where('puesto_id', $puesto['puesto_id'])
->get('puesto_materia pm', columns: ['clave_materia', 'materia_nombre']); ->get('puesto_materia pm', columns: ['clave_materia', 'materia_nombre']);
$sheet->setCellValue('A1', $puesto['nombre']); $sheet->setCellValue('A1', $puesto['nombre']);
// Add header row for each 'materia' table // Add header row for each 'materia' table
$sheet->setCellValue('A2', 'Clave Materia'); $sheet->setCellValue('A2', 'Clave Materia');
$sheet->setCellValue('B2', 'Materia Nombre'); $sheet->setCellValue('B2', 'Materia Nombre');
// Set some styling for headers // Set some styling for headers
$sheet->getStyle('A2:B2')->getFont()->setBold(true); $sheet->getStyle('A2:B2')->getFont()->setBold(true);
$sheet->getStyle('A2:B2')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER); $sheet->getStyle('A2:B2')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
// Start populating from the second row // Start populating from the second row
$row = 2; $row = 2;
// Populate the sheet with materias data // Populate the sheet with materias data
foreach ($materias as $materia) { foreach ($materias as $materia) {
$sheet->setCellValue("A$row", $materia['clave_materia']); $sheet->setCellValue("A$row", $materia['clave_materia']);
$sheet->setCellValue("B$row", $materia['materia_nombre']); $sheet->setCellValue("B$row", $materia['materia_nombre']);
$row++; $row++;
} }
// Auto-size columns // Auto-size columns
foreach (range('A', 'B') as $column) { foreach (range('A', 'B') as $column) {
$sheet->getColumnDimension($column)->setAutoSize(true); $sheet->getColumnDimension($column)->setAutoSize(true);
} }
// Move to the next sheet index // Move to the next sheet index
$sheetIndex++; $sheetIndex++;
} }
// Set the first sheet as active when the Excel file is opened // Set the first sheet as active when the Excel file is opened
$spreadsheet->setActiveSheetIndex(0); $spreadsheet->setActiveSheetIndex(0);
// Output the file for download // Output the file for download
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="materias_por_puesto.xlsx"'); header('Content-Disposition: attachment;filename="materias_por_puesto.xlsx"');
header('Cache-Control: max-age=0'); header('Cache-Control: max-age=0');
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save('php://output'); $writer->save('php://output');

View File

@@ -1,15 +1,15 @@
<?php <?php
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
$ruta = "../"; $ruta = "../";
require_once "../include/bd_pdo.php"; require_once "../include/bd_pdo.php";
global $db; global $db;
try { try {
$db->querySingle("UPDATE usuario SET estado_baja = TRUE WHERE usuario_id = ?", [$_GET['id']]); $db->querySingle("UPDATE usuario SET estado_baja = TRUE WHERE usuario_id = ?", [$_GET['id']]);
header("Location: ../usuarios.php", true, 307); header("Location: ../usuarios.php", true, 307);
} catch (PDOException $e) { } catch (PDOException $e) {
header("Location: ../usuarios.php?error=2"); header("Location: ../usuarios.php?error=2");
exit; exit;
} }

View File

@@ -1,33 +1,33 @@
<?php <?php
/* /*
* Borra reposición * Borra reposición
*/ */
$pag = "../reposiciones_crear.php"; $pag = "../reposiciones_crear.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
if(!isset($_POST["id"])){ if(!isset($_POST["id"])){
$return["error"] = "Error! No se recibió la información necesaria."; $return["error"] = "Error! No se recibió la información necesaria.";
}else{ }else{
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$creador = $user->user["id"]; $creador = $user->user["id"];
try{ try{
$db->query('SELECT * from fd_asignacion_solicitud(:id, :creador)', [":id"=> $id, ":creador"=>$creador]); $db->query('SELECT * from fd_asignacion_solicitud(:id, :creador)', [":id"=> $id, ":creador"=>$creador]);
$return["ok"] = "La solicitud se borró correctamente"; $return["ok"] = "La solicitud se borró correctamente";
}catch(Exception $e){ }catch(Exception $e){
$return["error"] = "Ocurrió un error al borrar la solicitud de salón."; $return["error"] = "Ocurrió un error al borrar la solicitud de salón.";
} }
} }
echo json_encode($return); echo json_encode($return);
?> ?>

View File

@@ -1,186 +1,186 @@
<?php <?php
/* /*
* Inserta reposición * Inserta reposición
*/ */
$pag = "../asignacion_crear.php"; $pag = "../asignacion_crear.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
require_once "../class/mailer.php"; require_once "../class/mailer.php";
define("COORDINADOR", 9); define("COORDINADOR", 9);
define("ENVIO_CORREOS", true); define("ENVIO_CORREOS", true);
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
//$user->access(); //$user->access();
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion $duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
$fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//limpia texto $fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//limpia texto
$hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto $hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto $min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto $alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad $aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
if(isset($_POST["salon"]) && $_POST["salon"] != "") if(isset($_POST["salon"]) && $_POST["salon"] != "")
$salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto $salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto
if(empty($_POST["prof"])) if(empty($_POST["prof"]))
$prof = $user["id"]; $prof = $user["id"];
else else
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto $prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//if(isset($_POST["salon"]) && $_POST["salon"] != "") //if(isset($_POST["salon"]) && $_POST["salon"] != "")
//$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto //$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto $comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto
$aula_rs = $db->querySingle("select tipoaula_nombre, tipoaula_supervisor from tipoaula where tipoaula_id = :id", [":id"=>$aula]); $aula_rs = $db->querySingle("select tipoaula_nombre, tipoaula_supervisor from tipoaula where tipoaula_id = :id", [":id"=>$aula]);
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]); $duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
$duracion_tiempo = $duracion_rs["duracion_interval"]; $duracion_tiempo = $duracion_rs["duracion_interval"];
//-- Obtiene datos de horario regular de clase //-- Obtiene datos de horario regular de clase
$hora = $hora_ini.":".$min_ini.":00"; $hora = $hora_ini.":".$min_ini.":00";
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
//Datos de dependencia de usuario //Datos de dependencia de usuario
$fac_rs = $db->querySingle("SELECT facultad_nombre, clave_dependencia from facultad where facultad_id = :id_fac",[':id_fac' => $user->facultad["facultad_id"]] ); $fac_rs = $db->querySingle("SELECT facultad_nombre, clave_dependencia from facultad where facultad_id = :id_fac",[':id_fac' => $user->facultad["facultad_id"]] );
$salon_desc = "Pendiente"; $salon_desc = "Pendiente";
if(!empty($salon)){ if(!empty($salon)){
$salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon', $salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon',
[':id_salon' => $salon] [':id_salon' => $salon]
); );
if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){ if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){
$salon_desc = "Pendiente"; $salon_desc = "Pendiente";
}else{ }else{
$salon_json = json_decode($salon_rs["salon_array"], true); $salon_json = json_decode($salon_rs["salon_array"], true);
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){ if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
unset($salon_json[0]); unset($salon_json[0]);
} }
$salon_desc = join(" / ",$salon_json); $salon_desc = join(" / ",$salon_json);
} }
} }
//Obtiene correos //Obtiene correos
$correos_rs = $db->query('SELECT coor.usuario_correo as coordinador_correo $correos_rs = $db->query('SELECT coor.usuario_correo as coordinador_correo
from reposicion_solicitud rs from reposicion_solicitud rs
inner join profesor p on rs.profesor_id =p.profesor_id inner join profesor p on rs.profesor_id =p.profesor_id
inner join usuario u on u.usuario_id = rs.usuario_id inner join usuario u on u.usuario_id = rs.usuario_id
inner join horario_view hv on hv.horario_id = rs.horario_id inner join horario_view hv on hv.horario_id = rs.horario_id
inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord
where hv.facultad_id = :id_fac', where hv.facultad_id = :id_fac',
[':rol_coord' => COORDINADOR, ':id_fac' => $user->facultad["facultad_id"]] [':rol_coord' => COORDINADOR, ':id_fac' => $user->facultad["facultad_id"]]
); );
$coord_correos=[]; $coord_correos=[];
foreach($correos_rs as $correo){ foreach($correos_rs as $correo){
if( count($coord_correos)==0 && $correo["coordinador_correo"]!=""){ if( count($coord_correos)==0 && $correo["coordinador_correo"]!=""){
if(!isset($coord_correos["correo"]) || !in_array($correo["coordinador_correo"], $coord_correos["correo"])){ if(!isset($coord_correos["correo"]) || !in_array($correo["coordinador_correo"], $coord_correos["correo"])){
array_push($coord_correos, $correo["coordinador_correo"]); array_push($coord_correos, $correo["coordinador_correo"]);
} }
} }
} }
$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo as coordinador_correo $correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo as coordinador_correo
FROM horario_supervisor hs FROM horario_supervisor hs
inner join usuario sup on sup.usuario_id =hs.usuario_id inner join usuario sup on sup.usuario_id =hs.usuario_id
where :id_fac = ANY(hs.facultad_id_array) where :id_fac = ANY(hs.facultad_id_array)
and sup.usuario_correo is not null and sup.usuario_correo != ''", and sup.usuario_correo is not null and sup.usuario_correo != ''",
[':id_fac' => $user->facultad["facultad_id"]] ); [':id_fac' => $user->facultad["facultad_id"]] );
// Valida que grupo no tenga clases // Valida que grupo no tenga clases
/*$result = validaConflictoHoras($pdo, $gpo, $dia_new, $hora, $materia, "-", $fecha_new, $fecha_fin_new, $duracion); /*$result = validaConflictoHoras($pdo, $gpo, $dia_new, $hora, $materia, "-", $fecha_new, $fecha_fin_new, $duracion);
if($result != ""){//error if($result != ""){//error
//echo $result; //echo $result;
header("Location:".$pag."?error=7"); header("Location:".$pag."?error=7");
exit(); exit();
} }
*/ */
//Valida que profesor no este en 2 reposiciones al mismo tiempo en la fecha nueva //Valida que profesor no este en 2 reposiciones al mismo tiempo en la fecha nueva
$traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)', $traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)',
[':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo] [':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo]
)["traslape_profesor_reposicion"]; )["traslape_profesor_reposicion"];
if($traslape){ if($traslape){
//print_r($_POST); //print_r($_POST);
//echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)"; //echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)";
header("Location:".$pag."?error=9"); header("Location:".$pag."?error=9");
exit(); exit();
} }
try{ try{
$edo = 1; $edo = 1;
if(!$user->jefe_carrera) if(!$user->jefe_carrera)
$edo = 2; $edo = 2;
//echo "SELECT * from fi_asignacion_solicitud( $fecha_new, $hora, $prof, $edo, $comentario, $alumnos, $aula, $duracion_tiempo, ".$user->user["id"].")"; exit(); //echo "SELECT * from fi_asignacion_solicitud( $fecha_new, $hora, $prof, $edo, $comentario, $alumnos, $aula, $duracion_tiempo, ".$user->user["id"].")"; exit();
$db->query('SELECT * from fi_asignacion_solicitud(:f_nueva, :hora_nueva, :prof, :edo, :desc, :alumnos, :aula, :duracion, :usr)', $db->query('SELECT * from fi_asignacion_solicitud(:f_nueva, :hora_nueva, :prof, :edo, :desc, :alumnos, :aula, :duracion, :usr)',
[':f_nueva' => $fecha_new, ':hora_nueva' => $hora, [':f_nueva' => $fecha_new, ':hora_nueva' => $hora,
':prof' => $prof, ':edo'=>$edo, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"] ':prof' => $prof, ':edo'=>$edo, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"]
] ]
); );
}catch(Exception $e){ }catch(Exception $e){
echo $e->getMessage(); echo $e->getMessage();
//header("Location: ".$pag."?error=1"); //header("Location: ".$pag."?error=1");
exit(); exit();
} }
$asunto = ""; $asunto = "";
$texto = ""; $texto = "";
$to = ""; $to = "";
switch($edo){ switch($edo){
case 1://Correo a coordinador case 1://Correo a coordinador
if( count($coord_correos) > 0 ){ if( count($coord_correos) > 0 ){
$to = join(",", $coord_correos); $to = join(",", $coord_correos);
} }
$asunto = "Solicitud de salon nueva"; $asunto = "Solicitud de salon nueva";
$texto = "<p>Se creó una solicitud de asignación de salón nueva.</p>"; $texto = "<p>Se creó una solicitud de asignación de salón nueva.</p>";
$texto .= "<p><b>Se solicita un espacio de tipo ".mb_strtoupper($aula_rs["tipoaula_nombre"])."</b> para el día <b>".$fecha." a las ".$hora." hrs. </b>"; $texto .= "<p><b>Se solicita un espacio de tipo ".mb_strtoupper($aula_rs["tipoaula_nombre"])."</b> para el día <b>".$fecha." a las ".$hora." hrs. </b>";
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>"; $texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
break; break;
case 2://Correo a supervisor case 2://Correo a supervisor
$asunto = "Solicitud de salon nueva - ".$fac_rs["clave_dependencia"]." ".$fac_rs["facultad_nombre"]; $asunto = "Solicitud de salon nueva - ".$fac_rs["clave_dependencia"]." ".$fac_rs["facultad_nombre"];
//crear plantilla //crear plantilla
$texto = "<p>Se creó una solicitud de asignación de salón nueva para: <b>".$fac_rs["clave_dependencia"]." ".$fac_rs["facultad_nombre"]."</b>.</p>"; $texto = "<p>Se creó una solicitud de asignación de salón nueva para: <b>".$fac_rs["clave_dependencia"]." ".$fac_rs["facultad_nombre"]."</b>.</p>";
$texto .= "<p>Para el día <b>".$fecha." a las ".$hora." hrs. </b>"; $texto .= "<p>Para el día <b>".$fecha." a las ".$hora." hrs. </b>";
if(!$aula_rs["tipoaula_supervisor"]){ if(!$aula_rs["tipoaula_supervisor"]){
$texto .= " en el salón: <b>".$salon_desc."</b></p>"; $texto .= " en el salón: <b>".$salon_desc."</b></p>";
}else{ }else{
$texto .= " en un salón de tipo: <b>".mb_strtoupper($aula_rs["tipoaula_nombre"])."</b></p>"; $texto .= " en un salón de tipo: <b>".mb_strtoupper($aula_rs["tipoaula_nombre"])."</b></p>";
} }
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>"; $texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
$to = join(",", $correosSup_rs); $to = join(",", $correosSup_rs);
break; break;
} }
/* /*
$log = new LogActividad(); $log = new LogActividad();
$desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]"; $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/ $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
if($to!= "" && ENVIO_CORREOS){ if($to!= "" && ENVIO_CORREOS){
//crear plantilla //crear plantilla
$texto = '<body > $texto = '<body >
<img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px"> <img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px">
'.$texto.' '.$texto.'
</body>'; </body>';
require_once('../include/phpmailer/PHPMailerAutoload.php'); require_once('../include/phpmailer/PHPMailerAutoload.php');
if($_ENV['DB_NAME'] == "paad_pruebas"){ if($_ENV['DB_NAME'] == "paad_pruebas"){
$asunto = "PRUEBAS-".$asunto; $asunto = "PRUEBAS-".$asunto;
Mailer::enviarCorreo("alejandro.lara@lasalle.mx", $asunto, $texto, true); Mailer::enviarCorreo("alejandro.lara@lasalle.mx", $asunto, $texto, true);
}else{ }else{
Mailer::enviarCorreo($to, $asunto, $texto, true); Mailer::enviarCorreo($to, $asunto, $texto, true);
} }
} }
header("Location: ".$pag."?ok=0"); header("Location: ".$pag."?ok=0");
?> ?>

View File

@@ -1,81 +1,81 @@
<?php <?php
/* /*
* Obtiene datos de reposición * Obtiene datos de reposición
*/ */
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
/*if(!$objSesion->tieneAcceso()){ /*if(!$objSesion->tieneAcceso()){
$return["error"] = "Error! No tienes permisos para realizar esta acción."; $return["error"] = "Error! No tienes permisos para realizar esta acción.";
}else*/ if(!isset($_POST["id"])){ }else*/ if(!isset($_POST["id"])){
$return["error"] = "Error! No se recibió la información de la reposición."; $return["error"] = "Error! No se recibió la información de la reposición.";
}else{ }else{
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
try{ try{
if($user->rol["rol_id"] == 7){//es supervisor if($user->rol["rol_id"] == 7){//es supervisor
$rs = $db->querySingle('SELECT * from fs_asignacion_solicitud(:id, NULL, NULL, :sup, NULL)', $rs = $db->querySingle('SELECT * from fs_asignacion_solicitud(:id, NULL, NULL, :sup, NULL)',
[':id' => $id, ':sup'=>$user->user["id"]] [':id' => $id, ':sup'=>$user->user["id"]]
); );
}else{//coordinador }else{//coordinador
$rs = $db->querySingle('SELECT * from fs_asignacion_solicitud(:id, NULL, NULL, NULL, null)', $rs = $db->querySingle('SELECT * from fs_asignacion_solicitud(:id, NULL, NULL, NULL, null)',
[':id' => $id] [':id' => $id]
); );
} }
}catch(Exception $e){ }catch(Exception $e){
$return["error"] = "Ocurrió un error al leer los datos de la reposición."; $return["error"] = "Ocurrió un error al leer los datos de la reposición.";
echo json_encode($return); echo json_encode($return);
exit(); exit();
} }
$return["fecha_nueva"] = date('d/m/Y', strtotime($rs["fecha_nueva"])); $return["fecha_nueva"] = date('d/m/Y', strtotime($rs["fecha_nueva"]));
$hora_nueva = explode(":",$rs["hora_nueva"]); $hora_nueva = explode(":",$rs["hora_nueva"]);
$return["hora_ini"] = $hora_nueva[0]; $return["hora_ini"] = $hora_nueva[0];
$return["min_ini"] = $hora_nueva[1]; $return["min_ini"] = $hora_nueva[1];
$hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]); $hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]);
$return["hora_fin"] = $hora_nueva_fin[0]; $return["hora_fin"] = $hora_nueva_fin[0];
$return["min_fin"] = $hora_nueva_fin[1]; $return["min_fin"] = $hora_nueva_fin[1];
$return["duracion"] = $rs["duracion_total"]; $return["duracion"] = $rs["duracion_total"];
// $return["carrera"] = $rs["PlanEstudio_desc"]; // $return["carrera"] = $rs["PlanEstudio_desc"];
// $return["materia"] = $rs["materia_id"]; // $return["materia"] = $rs["materia_id"];
// $return["materia_desc"] = $rs["materia_nombre"]; // $return["materia_desc"] = $rs["materia_nombre"];
$return["salon"] = $rs["salon_id"]; $return["salon"] = $rs["salon_id"];
if($rs["salon_id"]==""){ if($rs["salon_id"]==""){
$return["salon_desc"] = "Pendiente"; $return["salon_desc"] = "Pendiente";
}else{ }else{
$salon_json = json_decode($rs["salon_array"], true); $salon_json = json_decode($rs["salon_array"], true);
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){ if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
unset($salon_json[0]); unset($salon_json[0]);
} }
$return["salon_desc"] = join(" / ",$salon_json); $return["salon_desc"] = join(" / ",$salon_json);
} }
//$return["salon_desc"] = $rs["salon"]=="" ? "-Pendiente-": $rs["salon"]; //$return["salon_desc"] = $rs["salon"]=="" ? "-Pendiente-": $rs["salon"];
$return["profesor"] = $rs["profesor_id"]; $return["profesor"] = $rs["profesor_id"];
$return["profesor_nombre"] = $rs["profesor_nombre"]; $return["profesor_nombre"] = $rs["profesor_nombre"];
$return["comentario"] = $rs["descripcion"]; $return["comentario"] = $rs["descripcion"];
$return["alumnos"] = $rs["alumnos"]; $return["alumnos"] = $rs["alumnos"];
$return["aula"] = $rs["tipoaula_id"]; $return["aula"] = $rs["tipoaula_id"];
$return["aula_desc"] = $rs["tipoaula_nombre"]; $return["aula_desc"] = $rs["tipoaula_nombre"];
$return["aula_supervisor"] = $rs["tipoaula_supervisor"]; $return["aula_supervisor"] = $rs["tipoaula_supervisor"];
$return["dia"] = date('w', strtotime($rs["fecha_nueva"])); $return["dia"] = date('w', strtotime($rs["fecha_nueva"]));
$return["motivo_cancelacion"] = $rs["motivo_cancelacion"]; $return["motivo_cancelacion"] = $rs["motivo_cancelacion"];
$return["estado"] = $rs["estado_reposicion_id"]; $return["estado"] = $rs["estado_reposicion_id"];
$return["facultad"] = $rs["facultad_nombre"]; $return["facultad"] = $rs["facultad_nombre"];
$return["supervisor_nombre"] = $rs["supervisor_nombre"]; $return["supervisor_nombre"] = $rs["supervisor_nombre"];
} }
echo json_encode($return); echo json_encode($return);
?> ?>

View File

@@ -1,135 +1,135 @@
<?php <?php
/* /*
* Actualiza reposición * Actualiza reposición
*/ */
$pag = "../asignacion_crear.php"; $pag = "../asignacion_crear.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
define("COORDINADOR", 9); define("COORDINADOR", 9);
define("ENVIO_CORREOS", true); define("ENVIO_CORREOS", true);
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
/*if(!isset($_POST["id"]) || !isset($_POST["fecha_falta"]) || !isset($_POST["fecha_inicial"]) || !isset($_POST["hora_ini"]) || !isset($_POST["min_ini"]) || !isset($_POST["materia"]) || !isset($_POST["grupo"])){ /*if(!isset($_POST["id"]) || !isset($_POST["fecha_falta"]) || !isset($_POST["fecha_inicial"]) || !isset($_POST["hora_ini"]) || !isset($_POST["min_ini"]) || !isset($_POST["materia"]) || !isset($_POST["grupo"])){
header("Location: ".$pag."?error=0"); header("Location: ".$pag."?error=0");
exit(); exit();
}*/ }*/
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion $duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
$fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//limpia texto $fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//limpia texto
$hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto $hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto $min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto $alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad $aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
if(empty($_POST["prof"])) if(empty($_POST["prof"]))
$prof = $user["id"]; $prof = $user["id"];
else else
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto $prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//if(isset($_POST["salon"]) && $_POST["salon"] != "") //if(isset($_POST["salon"]) && $_POST["salon"] != "")
//$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto //$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto $comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]); $duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
$duracion_tiempo = $duracion_rs["duracion_interval"]; $duracion_tiempo = $duracion_rs["duracion_interval"];
$hora = $hora_ini.":".$min_ini.":00"; $hora = $hora_ini.":".$min_ini.":00";
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
//echo $fecha_new."<br>"; //echo $fecha_new."<br>";
//echo $fecha_fin_new."<br>"; //echo $fecha_fin_new."<br>";
$fac_rs = $db->querySingle("SELECT facultad_nombre, clave_dependencia from facultad where facultad_id = :id_fac",[':id_fac' => $user->facultad["facultad_id"]] ); $fac_rs = $db->querySingle("SELECT facultad_nombre, clave_dependencia from facultad where facultad_id = :id_fac",[':id_fac' => $user->facultad["facultad_id"]] );
$salon_desc = "Pendiente"; $salon_desc = "Pendiente";
if(!empty($salon)){ if(!empty($salon)){
$salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon', $salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon',
[':id_salon' => $salon] [':id_salon' => $salon]
); );
if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){ if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){
$salon_desc = "Pendiente"; $salon_desc = "Pendiente";
}else{ }else{
$salon_json = json_decode($salon_rs["salon_array"], true); $salon_json = json_decode($salon_rs["salon_array"], true);
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){ if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
unset($salon_json[0]); unset($salon_json[0]);
} }
$salon_desc = join(" / ",$salon_json); $salon_desc = join(" / ",$salon_json);
} }
} }
//Obtiene correos //Obtiene correos
$correos_rs = $db->query('SELECT coor.usuario_correo as coordinador_correo $correos_rs = $db->query('SELECT coor.usuario_correo as coordinador_correo
from reposicion_solicitud rs from reposicion_solicitud rs
inner join profesor p on rs.profesor_id =p.profesor_id inner join profesor p on rs.profesor_id =p.profesor_id
inner join usuario u on u.usuario_id = rs.usuario_id inner join usuario u on u.usuario_id = rs.usuario_id
inner join horario_view hv on hv.horario_id = rs.horario_id inner join horario_view hv on hv.horario_id = rs.horario_id
inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord
where hv.facultad_id = :id_fac', where hv.facultad_id = :id_fac',
[':rol_coord' => COORDINADOR, ':id_fac' => $user->facultad["facultad_id"]] [':rol_coord' => COORDINADOR, ':id_fac' => $user->facultad["facultad_id"]]
); );
$coord_correos=[]; $coord_correos=[];
foreach($correos_rs as $correo){ foreach($correos_rs as $correo){
if( count($coord_correos)==0 && $correo["coordinador_correo"]!=""){ if( count($coord_correos)==0 && $correo["coordinador_correo"]!=""){
if(!isset($coord_correos["correo"]) || !in_array($correo["coordinador_correo"], $coord_correos["correo"])){ if(!isset($coord_correos["correo"]) || !in_array($correo["coordinador_correo"], $coord_correos["correo"])){
array_push($coord_correos, $correo["coordinador_correo"]); array_push($coord_correos, $correo["coordinador_correo"]);
} }
} }
} }
$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo as coordinador_correo $correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo as coordinador_correo
FROM horario_supervisor hs FROM horario_supervisor hs
inner join usuario sup on sup.usuario_id =hs.usuario_id inner join usuario sup on sup.usuario_id =hs.usuario_id
where :id_fac = ANY(hs.facultad_id_array) where :id_fac = ANY(hs.facultad_id_array)
and sup.usuario_correo is not null and sup.usuario_correo != ''", and sup.usuario_correo is not null and sup.usuario_correo != ''",
[':id_fac' => $user->facultad["facultad_id"]] ); [':id_fac' => $user->facultad["facultad_id"]] );
//Valida que profesor no este en 2 reposiciones al mismo tiempo //Valida que profesor no este en 2 reposiciones al mismo tiempo
$traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur, :id)', $traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur, :id)',
[':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo, ':id'=>$id] [':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo, ':id'=>$id]
)["traslape_profesor_reposicion"]; )["traslape_profesor_reposicion"];
echo "SELECT * from traslape_profesor_reposicion($prof, '".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."', $hora, $duracion_tiempo, $id)"; echo "SELECT * from traslape_profesor_reposicion($prof, '".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."', $hora, $duracion_tiempo, $id)";
if($traslape){ if($traslape){
//header("Location:".$pag."?error=9"); //header("Location:".$pag."?error=9");
echo "traslape"; echo "traslape";
exit(); exit();
} }
/* /*
$log = new LogActividad(); $log = new LogActividad();
$desc_log = "Actualiza reposición ID[".$id."] Fechas[".$fecha_ini."][".$fecha_fin."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."]"; $desc_log = "Actualiza reposición ID[".$id."] Fechas[".$fecha_ini."][".$fecha_fin."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/ $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
try{ try{
$db->query('SELECT * from fu_asignacion_solicitud(:id, :f_nueva, :hora_nueva, NULL, NULL, :desc, :alumnos, :aula, :duracion, NULL)', $db->query('SELECT * from fu_asignacion_solicitud(:id, :f_nueva, :hora_nueva, NULL, NULL, :desc, :alumnos, :aula, :duracion, NULL)',
[':id'=> $id, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, [':id'=> $id, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora,
':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo
] ]
); );
}catch(Exception $e){ }catch(Exception $e){
//header("Location: ".$pag."?error=2"); //header("Location: ".$pag."?error=2");
print_r($e->getMessage()); print_r($e->getMessage());
echo "SELECT * from fu_asignacion_solicitud(:id, :f_nueva, :hora_nueva, NULL, NULL, :desc, :alumnos, :aula, :duracion, NULL)'"; echo "SELECT * from fu_asignacion_solicitud(:id, :f_nueva, :hora_nueva, NULL, NULL, :desc, :alumnos, :aula, :duracion, NULL)'";
print_r( print_r(
[':id'=> $id, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, [':id'=> $id, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora,
':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo
]); ]);
exit(); exit();
} }
header("Location: ".$pag); header("Location: ".$pag);
exit(); exit();
?> ?>

View File

@@ -1,26 +1,26 @@
<?php <?php
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
if(empty($_POST["id"]) || empty($_POST["hor"])){ if(empty($_POST["id"]) || empty($_POST["hor"])){
$return["error"] = "Error! No se recibió la información del usuario."; $return["error"] = "Error! No se recibió la información del usuario.";
}else{ }else{
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$hor = filter_input(INPUT_POST, "hor", FILTER_SANITIZE_NUMBER_INT);//limpia texto $hor = filter_input(INPUT_POST, "hor", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$rs = $db->query('SELECT * from fs_asistenciaprofesor_horario(:id, :hor)', [':id' => $id, ':hor' => $hor]); $rs = $db->query('SELECT * from fs_asistenciaprofesor_horario(:id, :hor)', [':id' => $id, ':hor' => $hor]);
$asistArr = array(); $asistArr = array();
foreach($rs as $row){ foreach($rs as $row){
$asistArr[] = $row["registro_fecha_ideal"]; $asistArr[] = $row["registro_fecha_ideal"];
} }
$return["asistenciaArr"] = $asistArr; $return["asistenciaArr"] = $asistArr;
} }
echo json_encode($return); echo json_encode($return);
?> ?>

View File

@@ -1,293 +1,293 @@
<? <?
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
header('Content-Type: application/json'); header('Content-Type: application/json');
if (!Login::is_logged()) { if (!Login::is_logged()) {
header('HTTP/1.1 401 Unauthorized'); header('HTTP/1.1 401 Unauthorized');
echo json_encode(array('error' => 'No se ha iniciado sesión')); echo json_encode(array('error' => 'No se ha iniciado sesión'));
exit(); exit();
} }
$user = Login::get_user(); $user = Login::get_user();
try { try {
switch ($_SERVER['REQUEST_METHOD']) { switch ($_SERVER['REQUEST_METHOD']) {
case 'GET': case 'GET':
$facultad_id = $user->facultad['facultad_id']; $facultad_id = $user->facultad['facultad_id'];
$avisos = $db->query( $avisos = $db->query(
"SELECT * FROM aviso "SELECT * FROM aviso
WHERE WHERE
(CURRENT_DATE BETWEEN aviso_fecha_inicial AND aviso_fecha_final) AND (CURRENT_DATE BETWEEN aviso_fecha_inicial AND aviso_fecha_final) AND
(facultad_id = :facultad_id OR :facultad_id IS NULL) AND (facultad_id = :facultad_id OR :facultad_id IS NULL) AND
aviso_estado aviso_estado
ORDER BY aviso_id DESC", ORDER BY aviso_id DESC",
array('facultad_id' => $facultad_id) array('facultad_id' => $facultad_id)
); );
/* /*
if (empty($avisos)) { if (empty($avisos)) {
header('HTTP/1.1 404 Not Found'); header('HTTP/1.1 404 Not Found');
echo json_encode(array('error' => 'No hay avisos disponibles')); echo json_encode(array('error' => 'No hay avisos disponibles'));
exit(); exit();
} }
*/ */
$avisos = array_map(fn($aviso) => array( $avisos = array_map(fn($aviso) => array(
...$aviso, ...$aviso,
'carreras' => $db->query( 'carreras' => $db->query(
"SELECT carrera_id, carrera_nombre FROM aviso_carrera "SELECT carrera_id, carrera_nombre FROM aviso_carrera
JOIN carrera USING (carrera_id) JOIN carrera USING (carrera_id)
WHERE aviso_id = :aviso_id", WHERE aviso_id = :aviso_id",
array('aviso_id' => $aviso['aviso_id']) array('aviso_id' => $aviso['aviso_id'])
), ),
'profesores' => $db->query( 'profesores' => $db->query(
"SELECT profesor_id, profesor_clave, profesor_nombre FROM aviso_profesor "SELECT profesor_id, profesor_clave, profesor_nombre FROM aviso_profesor
JOIN profesor USING (profesor_id) JOIN profesor USING (profesor_id)
WHERE aviso_id = :aviso_id", WHERE aviso_id = :aviso_id",
array('aviso_id' => $aviso['aviso_id']) array('aviso_id' => $aviso['aviso_id'])
), ),
), $avisos); ), $avisos);
echo json_encode($avisos); echo json_encode($avisos);
break; break;
case 'POST': case 'POST':
$raw_input = file_get_contents('php://input'); $raw_input = file_get_contents('php://input');
if (empty($raw_input)) { if (empty($raw_input)) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(array('error' => 'No se recibieron parámetros')); echo json_encode(array('error' => 'No se recibieron parámetros'));
exit(); exit();
} }
$input_data = json_decode($raw_input); $input_data = json_decode($raw_input);
if (json_last_error() !== JSON_ERROR_NONE) { if (json_last_error() !== JSON_ERROR_NONE) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(array('error' => 'Invalid JSON format')); echo json_encode(array('error' => 'Invalid JSON format'));
exit(); exit();
} }
$schema = <<<JSON $schema = <<<JSON
{ {
"\$schema": "http://json-schema.org/draft-07/schema#", "\$schema": "http://json-schema.org/draft-07/schema#",
"type": "object", "type": "object",
"required": ["aviso_fecha_inicial", "aviso_fecha_final", "aviso_titulo", "aviso_texto"], "required": ["aviso_fecha_inicial", "aviso_fecha_final", "aviso_titulo", "aviso_texto"],
"properties": { "properties": {
"aviso_fecha_inicial": { "aviso_fecha_inicial": {
"type": "string", "type": "string",
"format": "date" "format": "date"
}, },
"aviso_fecha_final": { "aviso_fecha_final": {
"type": "string", "type": "string",
"format": "date" "format": "date"
}, },
"aviso_texto": { "aviso_texto": {
"type": "string" "type": "string"
}, },
"aviso_titulo": { "aviso_titulo": {
"type": "string" "type": "string"
}, },
"carreras": { "carreras": {
"type": "array", "type": "array",
"items": { "items": {
"type": "integer", "type": "integer",
"minimum": 1 "minimum": 1
}, },
"minItems": 0, "minItems": 0,
"uniqueItems": true "uniqueItems": true
}, },
"profesores": { "profesores": {
"type": "array", "type": "array",
"items": { "items": {
"type": "integer", "type": "integer",
"minimum": 1 "minimum": 1
}, },
"minItems": 0, "minItems": 0,
"uniqueItems": true "uniqueItems": true
} }
}, },
"anyOf": [ "anyOf": [
{"required": ["carreras"]}, {"required": ["carreras"]},
{"required": ["profesores"]} {"required": ["profesores"]}
] ]
} }
JSON; JSON;
// VALIDATE JSON SCHEMA // VALIDATE JSON SCHEMA
$validate = new JsonSchema\Validator(); $validate = new JsonSchema\Validator();
$validate->validate($input_data, json_decode($schema)); $validate->validate($input_data, json_decode($schema));
if (!$validate->isValid()) { if (!$validate->isValid()) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode( echo json_encode(
array( array(
'error' => 'El formato de la solicitud es incorrecto', 'error' => 'El formato de la solicitud es incorrecto',
'success' => false, 'success' => false,
'errors' => $validate->getErrors() 'errors' => $validate->getErrors()
) )
); );
exit(); exit();
} }
$aviso_id = $db->insert( $aviso_id = $db->insert(
'aviso', 'aviso',
array( array(
'aviso_fecha_inicial' => $input_data->aviso_fecha_inicial, 'aviso_fecha_inicial' => $input_data->aviso_fecha_inicial,
'aviso_fecha_final' => $input_data->aviso_fecha_final, 'aviso_fecha_final' => $input_data->aviso_fecha_final,
'aviso_texto' => $input_data->aviso_texto, 'aviso_texto' => $input_data->aviso_texto,
'facultad_id' => $user->facultad['facultad_id'], 'facultad_id' => $user->facultad['facultad_id'],
), ),
'aviso_id' 'aviso_id'
); );
if (isset($input_data->carreras)) { if (isset($input_data->carreras)) {
array_walk($input_data->carreras, fn($carrera_id) => $db->insert('aviso_carrera', array('aviso_id' => $aviso_id, 'carrera_id' => $carrera_id))); array_walk($input_data->carreras, fn($carrera_id) => $db->insert('aviso_carrera', array('aviso_id' => $aviso_id, 'carrera_id' => $carrera_id)));
} }
if (isset($input_data->profesores)) { if (isset($input_data->profesores)) {
array_walk($input_data->profesores, fn($profesor_id) => $db->insert('aviso_profesor', array('aviso_id' => $aviso_id, 'profesor_id' => $profesor_id))); array_walk($input_data->profesores, fn($profesor_id) => $db->insert('aviso_profesor', array('aviso_id' => $aviso_id, 'profesor_id' => $profesor_id)));
} }
echo json_encode( echo json_encode(
array( array(
'aviso_id' => $aviso_id, 'aviso_id' => $aviso_id,
'msg' => 'Aviso creado exitosamente', 'msg' => 'Aviso creado exitosamente',
'success' => true 'success' => true
) )
); );
break; break;
case 'PUT': case 'PUT':
$raw_input = file_get_contents('php://input'); $raw_input = file_get_contents('php://input');
if (empty($raw_input)) { if (empty($raw_input)) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(array('error' => 'No se recibieron parámetros')); echo json_encode(array('error' => 'No se recibieron parámetros'));
exit(); exit();
} }
$input_data = json_decode($raw_input); $input_data = json_decode($raw_input);
if (json_last_error() !== JSON_ERROR_NONE) { if (json_last_error() !== JSON_ERROR_NONE) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(array('error' => 'Invalid JSON format')); echo json_encode(array('error' => 'Invalid JSON format'));
exit(); exit();
} }
$schema = <<<JSON $schema = <<<JSON
{ {
"\$schema": "http://json-schema.org/draft-07/schema#", "\$schema": "http://json-schema.org/draft-07/schema#",
"type": "object", "type": "object",
"required": ["aviso_id", "aviso_fecha_final"], "required": ["aviso_id", "aviso_fecha_final"],
"properties": { "properties": {
"aviso_id": { "aviso_id": {
"type": "integer", "type": "integer",
"minimum": 1 "minimum": 1
}, },
"aviso_fecha_final": { "aviso_fecha_final": {
"type": "string", "type": "string",
"format": "date" "format": "date"
} }
} }
} }
JSON; JSON;
// VALIDATE JSON SCHEMA // VALIDATE JSON SCHEMA
$validate = new JsonSchema\Validator(); $validate = new JsonSchema\Validator();
$validate->validate($input_data, json_decode($schema)); $validate->validate($input_data, json_decode($schema));
if (!$validate->isValid()) { if (!$validate->isValid()) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode( echo json_encode(
array( array(
'error' => 'El formato de la solicitud es incorrecto', 'error' => 'El formato de la solicitud es incorrecto',
'errors' => $validate->getErrors(), 'errors' => $validate->getErrors(),
'success' => false, 'success' => false,
) )
); );
exit(); exit();
} }
$db->where('aviso_id', $input_data->aviso_id) $db->where('aviso_id', $input_data->aviso_id)
->update( ->update(
'aviso', 'aviso',
array( array(
'aviso_fecha_final' => $input_data->aviso_fecha_final, 'aviso_fecha_final' => $input_data->aviso_fecha_final,
), ),
); );
if (isset($input_data->carreras)) { if (isset($input_data->carreras)) {
$db->where('aviso_id', $input_data->aviso_id)->delete('aviso_carrera'); $db->where('aviso_id', $input_data->aviso_id)->delete('aviso_carrera');
array_walk($input_data->carreras, fn($carrera_id) => $db->insert('aviso_carrera', array('aviso_id' => $input_data->aviso_id, 'carrera_id' => $carrera_id))); array_walk($input_data->carreras, fn($carrera_id) => $db->insert('aviso_carrera', array('aviso_id' => $input_data->aviso_id, 'carrera_id' => $carrera_id)));
} }
if (isset($input_data->profesores)) { if (isset($input_data->profesores)) {
$db->where('aviso_id', $input_data->aviso_id)->delete('aviso_profesor'); $db->where('aviso_id', $input_data->aviso_id)->delete('aviso_profesor');
array_walk($input_data->profesores, fn($profesor_id) => $db->insert('aviso_profesor', array('aviso_id' => $input_data->aviso_id, 'profesor_id' => $profesor_id))); array_walk($input_data->profesores, fn($profesor_id) => $db->insert('aviso_profesor', array('aviso_id' => $input_data->aviso_id, 'profesor_id' => $profesor_id)));
} }
echo json_encode( echo json_encode(
array( array(
'msg' => 'Aviso actualizado exitosamente', 'msg' => 'Aviso actualizado exitosamente',
'success' => true 'success' => true
) )
); );
break; break;
case 'DELETE': case 'DELETE':
$raw_input = file_get_contents('php://input'); $raw_input = file_get_contents('php://input');
if (empty($raw_input)) { if (empty($raw_input)) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(array('error' => 'No se recibieron parámetros')); echo json_encode(array('error' => 'No se recibieron parámetros'));
exit(); exit();
} }
$input_data = json_decode($raw_input); $input_data = json_decode($raw_input);
if (json_last_error() !== JSON_ERROR_NONE) { if (json_last_error() !== JSON_ERROR_NONE) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(array('error' => 'Invalid JSON format')); echo json_encode(array('error' => 'Invalid JSON format'));
exit(); exit();
} }
$schema = <<<JSON $schema = <<<JSON
{ {
"\$schema": "http://json-schema.org/draft-07/schema#", "\$schema": "http://json-schema.org/draft-07/schema#",
"type": "object", "type": "object",
"required": ["aviso_id"], "required": ["aviso_id"],
"properties": { "properties": {
"aviso_id": { "aviso_id": {
"type": "integer", "type": "integer",
"minimum": 1 "minimum": 1
} }
} }
} }
JSON; JSON;
// VALIDATE JSON SCHEMA // VALIDATE JSON SCHEMA
$validate = new JsonSchema\Validator(); $validate = new JsonSchema\Validator();
$validate->validate($input_data, json_decode($schema)); $validate->validate($input_data, json_decode($schema));
if (!$validate->isValid()) { if (!$validate->isValid()) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode( echo json_encode(
array( array(
'error' => 'El formato de la solicitud es incorrecto', 'error' => 'El formato de la solicitud es incorrecto',
'errors' => $validate->getErrors(), 'errors' => $validate->getErrors(),
'success' => false, 'success' => false,
) )
); );
exit(); exit();
} }
$result = $db->where('aviso_id', $input_data->aviso_id)->update('aviso', array('aviso_estado' => false)); $result = $db->where('aviso_id', $input_data->aviso_id)->update('aviso', array('aviso_estado' => false));
echo json_encode( echo json_encode(
array( array(
'msg' => 'Aviso eliminado exitosamente', 'msg' => 'Aviso eliminado exitosamente',
'success' => true, 'success' => true,
'result' => $result 'result' => $result
) )
); );
break; break;
} }
} catch (PDOException $e) { } catch (PDOException $e) {
echo json_encode( echo json_encode(
array( array(
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
'exception' => $e->getTraceAsString() 'exception' => $e->getTraceAsString()
) )
); );
} }

View File

@@ -1,66 +1,66 @@
<?php <?php
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
header('Content-Type: application/json'); header('Content-Type: application/json');
if (!Login::is_logged()) { if (!Login::is_logged()) {
header('HTTP/1.1 401 Unauthorized'); header('HTTP/1.1 401 Unauthorized');
echo json_encode(['error' => 'No se ha iniciado sesión']); echo json_encode(['error' => 'No se ha iniciado sesión']);
exit(); exit();
} }
$user = Login::get_user(); $user = Login::get_user();
try { try {
switch ($_SERVER['REQUEST_METHOD']) { switch ($_SERVER['REQUEST_METHOD']) {
case 'GET': case 'GET':
// Fetch all puestos // Fetch all puestos
$facultad_id = $user->facultad['facultad_id']; $facultad_id = $user->facultad['facultad_id'];
$periodo_nivel_id = $db->where('periodo_id', $user->periodo_id)->getOne('periodo', 'nivel_id')['nivel_id']; $periodo_nivel_id = $db->where('periodo_id', $user->periodo_id)->getOne('periodo', 'nivel_id')['nivel_id'];
$carreras = $db->query(<<<SQL $carreras = $db->query(<<<SQL
SELECT carrera_id, carrera_nombre, clave_carrera, SELECT carrera_id, carrera_nombre, clave_carrera,
facultad_id, facultad_nombre, facultad_id, facultad_nombre,
nivel_id, nivel_nombre nivel_id, nivel_nombre
FROM carrera FROM carrera
join nivel using (nivel_id) join nivel using (nivel_id)
join facultad using (facultad_id) join facultad using (facultad_id)
WHERE facultad_id = :facultad_id OR :facultad_id IS NULL AND WHERE facultad_id = :facultad_id OR :facultad_id IS NULL AND
nivel.nivel_id = :periodo_nivel_id nivel.nivel_id = :periodo_nivel_id
ORDER BY facultad_nombre, carrera_nombre ORDER BY facultad_nombre, carrera_nombre
SQL, [ SQL, [
'facultad_id' => $facultad_id, 'facultad_id' => $facultad_id,
'periodo_nivel_id' => $periodo_nivel_id 'periodo_nivel_id' => $periodo_nivel_id
]); ]);
echo json_encode($carreras); echo json_encode($carreras);
break; break;
case 'PUT': case 'PUT':
// Update carrera {nivel_id} // Update carrera {nivel_id}
$raw = file_get_contents('php://input'); $raw = file_get_contents('php://input');
$data = json_decode($raw, true); $data = json_decode($raw, true);
if (!isset($data['carrera_id'], $data['nivel_id'])) { if (!isset($data['carrera_id'], $data['nivel_id'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Falta el id de la carrera o el nivel']); echo json_encode(['error' => 'Falta el id de la carrera o el nivel']);
exit(); exit();
} }
$carrera_id = $data['carrera_id']; $carrera_id = $data['carrera_id'];
$nivel_id = $data['nivel_id']; $nivel_id = $data['nivel_id'];
$db->where('carrera_id', $carrera_id)->update('carrera', ['nivel_id' => $nivel_id]); $db->where('carrera_id', $carrera_id)->update('carrera', ['nivel_id' => $nivel_id]);
$carrera_nombre = $db->where('carrera_id', $carrera_id)->getOne('carrera', 'carrera_nombre')['carrera_nombre']; $carrera_nombre = $db->where('carrera_id', $carrera_id)->getOne('carrera', 'carrera_nombre')['carrera_nombre'];
$nivel_nombre = $db->where('nivel_id', $nivel_id)->getOne('nivel', 'nivel_nombre')['nivel_nombre']; $nivel_nombre = $db->where('nivel_id', $nivel_id)->getOne('nivel', 'nivel_nombre')['nivel_nombre'];
echo json_encode(['success' => "$carrera_nombre actualizada a $nivel_nombre"]); echo json_encode(['success' => "$carrera_nombre actualizada a $nivel_nombre"]);
break; break;
default: default:
header('HTTP/1.1 405 Method Not Allowed'); header('HTTP/1.1 405 Method Not Allowed');
echo json_encode(['error' => 'Método no permitido']); echo json_encode(['error' => 'Método no permitido']);
break; break;
} }
} catch (PDOException $e) { } catch (PDOException $e) {
echo json_encode([ echo json_encode([
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
'exception' => $e->getTraceAsString() 'exception' => $e->getTraceAsString()
]); ]);
} }

View File

@@ -1,20 +1,20 @@
<?php <?php
require_once '../class/mailer.php'; require_once '../class/mailer.php';
require_once('../include/phpmailer/PHPMailerAutoload.php'); require_once('../include/phpmailer/PHPMailerAutoload.php');
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
if(!isset($_GET["correo"])){ if(!isset($_GET["correo"])){
echo "Debes especificar la dirección a la que se enviará el correo <strong>?correo=</strong>"; echo "Debes especificar la dirección a la que se enviará el correo <strong>?correo=</strong>";
exit(); exit();
} }
$to = $_GET["correo"]; $to = $_GET["correo"];
$texto = "<h1>Esto es una prueba automatizada</h1><p>El correo se envió atutomáticamente, no debes hacer nada más.</p>"; $texto = "<h1>Esto es una prueba automatizada</h1><p>El correo se envió atutomáticamente, no debes hacer nada más.</p>";
$asunto="Prueba"; $asunto="Prueba";
Mailer::enviarCorreo($to, $asunto, $texto, true); Mailer::enviarCorreo($to, $asunto, $texto, true);
echo "Enviado!".date("H:i:s"); echo "Enviado!".date("H:i:s");
?> ?>

View File

@@ -1,46 +1,46 @@
<?php <?php
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
header('Content-Type: application/json'); header('Content-Type: application/json');
if (!Login::is_logged()) { if (!Login::is_logged()) {
header('HTTP/1.1 401 Unauthorized'); header('HTTP/1.1 401 Unauthorized');
echo json_encode(['error' => 'No se ha iniciado sesión']); echo json_encode(['error' => 'No se ha iniciado sesión']);
exit(); exit();
} }
$user = Login::get_user(); $user = Login::get_user();
try { try {
switch ($_SERVER['REQUEST_METHOD']) { switch ($_SERVER['REQUEST_METHOD']) {
case 'GET': case 'GET':
$profesor_id = $db $profesor_id = $db
->where('profesor_clave', $_GET['profesor']) ->where('profesor_clave', $_GET['profesor'])
->getOne('profesor', 'profesor_id'); ->getOne('profesor', 'profesor_id');
// Fetch all puestos // Fetch all puestos
$horarios = $db->query(<<<SQL $horarios = $db->query(<<<SQL
SELECT * FROM horario SELECT * FROM horario
NATURAL JOIN horario_profesor NATURAL JOIN horario_profesor
NATURAL JOIN facultad NATURAL JOIN facultad
NATURAL LEFT JOIN materia NATURAL LEFT JOIN materia
NATURAL LEFT JOIN carrera NATURAL LEFT JOIN carrera
WHERE periodo_id = ? AND profesor_id = ? WHERE periodo_id = ? AND profesor_id = ?
SQL, SQL,
[$user->periodo_id, $profesor_id['profesor_id']] [$user->periodo_id, $profesor_id['profesor_id']]
); );
echo json_encode($horarios); echo json_encode($horarios);
break; break;
default: default:
header('HTTP/1.1 405 Method Not Allowed'); header('HTTP/1.1 405 Method Not Allowed');
echo json_encode(['error' => 'Método no permitido']); echo json_encode(['error' => 'Método no permitido']);
break; break;
} }
} catch (PDOException $e) { } catch (PDOException $e) {
echo json_encode([ echo json_encode([
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
'exception' => $e->getTraceAsString() 'exception' => $e->getTraceAsString()
]); ]);
} }

View File

@@ -1,76 +1,76 @@
<?php <?php
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
header('Content-Type: application/json'); header('Content-Type: application/json');
if (!Login::is_logged()) { if (!Login::is_logged()) {
header('HTTP/1.1 401 Unauthorized'); header('HTTP/1.1 401 Unauthorized');
echo json_encode(['error' => 'No se ha iniciado sesión']); echo json_encode(['error' => 'No se ha iniciado sesión']);
exit(); exit();
} }
$user = Login::get_user(); $user = Login::get_user();
try { try {
switch ($_SERVER['REQUEST_METHOD']) { switch ($_SERVER['REQUEST_METHOD']) {
case 'POST': case 'POST':
// check parameters // check parameters
$raw = file_get_contents('php://input'); $raw = file_get_contents('php://input');
$post_data = json_decode($raw, true); $post_data = json_decode($raw, true);
$data = $db->querySingle( $data = $db->querySingle(
'WITH HORARIOS AS ( 'WITH HORARIOS AS (
SELECT * SELECT *
FROM horario FROM horario
JOIN horario_profesor USING (horario_id) JOIN horario_profesor USING (horario_id)
WHERE horario.periodo_id = :periodo_id WHERE horario.periodo_id = :periodo_id
) )
INSERT INTO registro (profesor_id, horario_id, registro_fecha_ideal, registro_justificada, justificador_id, registro_fecha_justificacion, justificacion) INSERT INTO registro (profesor_id, horario_id, registro_fecha_ideal, registro_justificada, justificador_id, registro_fecha_justificacion, justificacion)
VALUES (:profesor_id, :horario_id, :registro_fecha_ideal, :registro_justificada, :justificador_id, NOW(), :justificacion) VALUES (:profesor_id, :horario_id, :registro_fecha_ideal, :registro_justificada, :justificador_id, NOW(), :justificacion)
ON CONFLICT (profesor_id, horario_id, registro_fecha_ideal) ON CONFLICT (profesor_id, horario_id, registro_fecha_ideal)
DO UPDATE SET registro_justificada = :registro_justificada, justificador_id = :justificador_id, registro_fecha_justificacion = NOW(), justificacion = :justificacion DO UPDATE SET registro_justificada = :registro_justificada, justificador_id = :justificador_id, registro_fecha_justificacion = NOW(), justificacion = :justificacion
RETURNING *', RETURNING *',
array( array(
'periodo_id' => $user->periodo_id, 'periodo_id' => $user->periodo_id,
'profesor_id' => $post_data['profesor_id'], 'profesor_id' => $post_data['profesor_id'],
'horario_id' => $post_data['horario_id'], 'horario_id' => $post_data['horario_id'],
'registro_fecha_ideal' => $post_data['registro_fecha_ideal'], 'registro_fecha_ideal' => $post_data['registro_fecha_ideal'],
'registro_justificada' => $post_data['registro_justificada'], 'registro_justificada' => $post_data['registro_justificada'],
'justificador_id' => $user->user['id'], 'justificador_id' => $user->user['id'],
'justificacion' => empty($post_data['justificacion']) ? null : $post_data['justificacion'], 'justificacion' => empty($post_data['justificacion']) ? null : $post_data['justificacion'],
) )
); );
$data_justificador = $db->querySingle( $data_justificador = $db->querySingle(
"SELECT justificador.usuario_nombre as justificador_nombre, "SELECT justificador.usuario_nombre as justificador_nombre,
justificador.usuario_clave as justificador_clave, justificador.usuario_clave as justificador_clave,
facultad.facultad_nombre as justificador_facultad, rol.rol_titulo as justificador_rol facultad.facultad_nombre as justificador_facultad, rol.rol_titulo as justificador_rol
FROM USUARIO JUSTIFICADOR FROM USUARIO JUSTIFICADOR
JOIN ROL on ROL.rol_id = justificador.rol_id JOIN ROL on ROL.rol_id = justificador.rol_id
LEFT JOIN facultad on facultad.facultad_id = justificador.facultad_id LEFT JOIN facultad on facultad.facultad_id = justificador.facultad_id
where justificador.usuario_id = :justificador_id", where justificador.usuario_id = :justificador_id",
array( array(
'justificador_id' => $user->user['id'], 'justificador_id' => $user->user['id'],
) )
); );
// exit('exit'); // exit('exit');
echo json_encode(array_merge($data, $data_justificador), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); echo json_encode(array_merge($data, $data_justificador), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
break; break;
default: default:
header('HTTP/1.1 405 Method Not Allowed'); header('HTTP/1.1 405 Method Not Allowed');
echo json_encode(['error' => 'Método no permitido']); echo json_encode(['error' => 'Método no permitido']);
} }
} catch (PDOException $e) { } catch (PDOException $e) {
echo json_encode([ echo json_encode([
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
'exception' => $e->getTraceAsString() 'exception' => $e->getTraceAsString()
]); ]);
} catch (Exception $e) { } catch (Exception $e) {
echo json_encode([ echo json_encode([
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'exception' => $e->getTraceAsString() 'exception' => $e->getTraceAsString()
]); ]);
} }

View File

@@ -1,31 +1,31 @@
<?php <?php
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
header('Content-Type: application/json'); header('Content-Type: application/json');
if (!Login::is_logged()) { if (!Login::is_logged()) {
header('HTTP/1.1 401 Unauthorized'); header('HTTP/1.1 401 Unauthorized');
echo json_encode(['error' => 'No se ha iniciado sesión']); echo json_encode(['error' => 'No se ha iniciado sesión']);
exit(); exit();
} }
$user = Login::get_user(); $user = Login::get_user();
try { try {
switch ($_SERVER['REQUEST_METHOD']) { switch ($_SERVER['REQUEST_METHOD']) {
case 'GET': case 'GET':
// Fetch all puestos // Fetch all puestos
$nivel = $db->get('nivel'); $nivel = $db->get('nivel');
echo json_encode($nivel); echo json_encode($nivel);
break; break;
default: default:
header('HTTP/1.1 405 Method Not Allowed'); header('HTTP/1.1 405 Method Not Allowed');
echo json_encode(['error' => 'Método no permitido']); echo json_encode(['error' => 'Método no permitido']);
break; break;
} }
} catch (PDOException $e) { } catch (PDOException $e) {
echo json_encode([ echo json_encode([
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
'exception' => $e->getTraceAsString() 'exception' => $e->getTraceAsString()
]); ]);
} }

View File

@@ -1,44 +1,44 @@
<? <?
#input $_GET['id_espacio_sgu'] #input $_GET['id_espacio_sgu']
#output rutas: [ ...ruta, salones: [{...salon}] ] #output rutas: [ ...ruta, salones: [{...salon}] ]
header('Content-Type: application/json charset=utf-8'); header('Content-Type: application/json charset=utf-8');
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
$ruta = "../"; $ruta = "../";
require_once $ruta . "class/c_login.php"; require_once $ruta . "class/c_login.php";
if (!isset($_SESSION['user'])) { if (!isset($_SESSION['user'])) {
http_response_code(401); http_response_code(401);
die(json_encode(['error' => 'unauthorized'])); die(json_encode(['error' => 'unauthorized']));
} }
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
// check method // check method
if ($_SERVER['REQUEST_METHOD'] !== 'GET') { if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
http_response_code(405); http_response_code(405);
die(json_encode(['error' => 'method not allowed'])); die(json_encode(['error' => 'method not allowed']));
} }
const JSON_OPTIONS = JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR; const JSON_OPTIONS = JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR;
try { try {
$data = $db->querySingle("SELECT *, LEAST(periodo_fecha_fin, CURRENT_DATE) as fecha_final FROM periodo WHERE periodo_id = ?", array($user->periodo_id)); $data = $db->querySingle("SELECT *, LEAST(periodo_fecha_fin, CURRENT_DATE) as fecha_final FROM periodo WHERE periodo_id = ?", array($user->periodo_id));
$last_query = [ $last_query = [
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
]; ];
echo json_encode($data, JSON_OPTIONS); echo json_encode($data, JSON_OPTIONS);
} catch (PDOException $th) { } catch (PDOException $th) {
http_response_code(500); http_response_code(500);
echo json_encode([ echo json_encode([
'error' => $th->getMessage(), 'error' => $th->getMessage(),
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
], JSON_OPTIONS); ], JSON_OPTIONS);
exit; exit;
} catch (Exception $th) { } catch (Exception $th) {
http_response_code(500); http_response_code(500);
echo json_encode([ echo json_encode([
'error' => $th->getMessage(), 'error' => $th->getMessage(),
], JSON_OPTIONS); ], JSON_OPTIONS);
exit; exit;
} }

View File

@@ -1,204 +1,204 @@
<?php <?php
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
header('Content-Type: application/json'); header('Content-Type: application/json');
if (!Login::is_logged()) { if (!Login::is_logged()) {
header('HTTP/1.1 401 Unauthorized'); header('HTTP/1.1 401 Unauthorized');
echo json_encode(['error' => 'No se ha iniciado sesión']); echo json_encode(['error' => 'No se ha iniciado sesión']);
exit(); exit();
} }
$user = Login::get_user(); $user = Login::get_user();
try { try {
switch ($_SERVER['REQUEST_METHOD']) { switch ($_SERVER['REQUEST_METHOD']) {
case 'GET': case 'GET':
// Fetch all puestos // Fetch all puestos
$periodo_id = $user->periodo_id; $periodo_id = $user->periodo_id;
if (is_null($user->facultad['facultad_id'])) { if (is_null($user->facultad['facultad_id'])) {
$periodos = $db $periodos = $db
//->where('CURRENT_DATE BETWEEN periodo_fecha_inicio AND periodo_fecha_fin') //->where('CURRENT_DATE BETWEEN periodo_fecha_inicio AND periodo_fecha_fin')
->join('nivel', 'nivel.nivel_id = periodo.nivel_id') ->join('nivel', 'nivel.nivel_id = periodo.nivel_id')
->orderBy('periodo_id') ->orderBy('periodo_id')
->get('periodo', null, 'periodo.*, nivel_nombre as nivel'); ->get('periodo', null, 'periodo.*, nivel_nombre as nivel');
} else { } else {
$periodos = $db->query( $periodos = $db->query(
"SELECT DISTINCT periodo.*, nivel_nombre as nivel FROM periodo "SELECT DISTINCT periodo.*, nivel_nombre as nivel FROM periodo
JOIN horario_view USING (periodo_id) JOIN horario_view USING (periodo_id)
JOIN nivel ON nivel.nivel_id = periodo.nivel_id JOIN nivel ON nivel.nivel_id = periodo.nivel_id
WHERE /*CURRENT_DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin WHERE /*CURRENT_DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin
AND */facultad_id = :facultad_id AND */facultad_id = :facultad_id
ORDER BY periodo_id ORDER BY periodo_id
", ",
['facultad_id' => $user->facultad['facultad_id']] ['facultad_id' => $user->facultad['facultad_id']]
); );
} }
echo json_encode($periodos); echo json_encode($periodos);
break; break;
case 'PUT': case 'PUT':
// Update nivel_id of a periodo // Update nivel_id of a periodo
$raw = file_get_contents('php://input'); $raw = file_get_contents('php://input');
$data = json_decode($raw, true); $data = json_decode($raw, true);
if (!isset($data['action'])) { if (!isset($data['action'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Falta la acción a realizar']); echo json_encode(['error' => 'Falta la acción a realizar']);
exit(); exit();
} }
switch ($data['action']) { switch ($data['action']) {
case 'changeNivel': case 'changeNivel':
if (!isset($data['periodo_id'], $data['nivel_id'])) { if (!isset($data['periodo_id'], $data['nivel_id'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Falta el id del periodo o el nivel']); echo json_encode(['error' => 'Falta el id del periodo o el nivel']);
exit(); exit();
} }
$periodo_id = $data['periodo_id']; $periodo_id = $data['periodo_id'];
$nivel_id = $data['nivel_id']; $nivel_id = $data['nivel_id'];
$db->where('periodo_id', $periodo_id)->update('periodo', ['nivel_id' => $nivel_id]); $db->where('periodo_id', $periodo_id)->update('periodo', ['nivel_id' => $nivel_id]);
$periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre']; $periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre'];
$nivel_nombre = $db->where('nivel_id', $nivel_id)->getOne('nivel', 'nivel_nombre')['nivel_nombre']; $nivel_nombre = $db->where('nivel_id', $nivel_id)->getOne('nivel', 'nivel_nombre')['nivel_nombre'];
echo json_encode([ echo json_encode([
'success' => 'success' =>
"El nivel del periodo $periodo_nombre ha sido cambiado a $nivel_nombre" "El nivel del periodo $periodo_nombre ha sido cambiado a $nivel_nombre"
]); ]);
break; break;
case 'changeFechaInicio': case 'changeFechaInicio':
if (!isset($data['periodo_id'], $data['periodo_fecha_inicio'])) { if (!isset($data['periodo_id'], $data['periodo_fecha_inicio'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Falta el id del periodo o la fecha de inicio']); echo json_encode(['error' => 'Falta el id del periodo o la fecha de inicio']);
exit(); exit();
} }
$periodo_id = $data['periodo_id']; $periodo_id = $data['periodo_id'];
$periodo_fecha_inicio = $data['periodo_fecha_inicio']; $periodo_fecha_inicio = $data['periodo_fecha_inicio'];
$db->where('periodo_id', $periodo_id)->update('periodo', ['periodo_fecha_inicio' => $periodo_fecha_inicio]); $db->where('periodo_id', $periodo_id)->update('periodo', ['periodo_fecha_inicio' => $periodo_fecha_inicio]);
$periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre']; $periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre'];
echo json_encode([ echo json_encode([
'success' => 'success' =>
"La fecha de inicio del periodo $periodo_nombre ha sido cambiada a $periodo_fecha_inicio" "La fecha de inicio del periodo $periodo_nombre ha sido cambiada a $periodo_fecha_inicio"
]); ]);
break; break;
case 'changeFechaFin': case 'changeFechaFin':
if (!isset($data['periodo_id'], $data['periodo_fecha_fin'])) { if (!isset($data['periodo_id'], $data['periodo_fecha_fin'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Falta el id del periodo o la fecha de fin']); echo json_encode(['error' => 'Falta el id del periodo o la fecha de fin']);
exit(); exit();
} }
$periodo_id = $data['periodo_id']; $periodo_id = $data['periodo_id'];
$periodo_fecha_fin = $data['periodo_fecha_fin']; $periodo_fecha_fin = $data['periodo_fecha_fin'];
$db->where('periodo_id', $periodo_id)->update('periodo', ['periodo_fecha_fin' => $periodo_fecha_fin]); $db->where('periodo_id', $periodo_id)->update('periodo', ['periodo_fecha_fin' => $periodo_fecha_fin]);
$periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre']; $periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre'];
echo json_encode([ echo json_encode([
'success' => 'success' =>
"La fecha de fin del periodo $periodo_nombre ha sido cambiada a $periodo_fecha_fin" "La fecha de fin del periodo $periodo_nombre ha sido cambiada a $periodo_fecha_fin"
]); ]);
break; break;
case 'updatePeriodo': case 'updatePeriodo':
if (!isset($data['periodo_id'], $data['periodo_nombre'], $data['id_periodo_sgu'], $data['periodo_clave'])) { if (!isset($data['periodo_id'], $data['periodo_nombre'], $data['id_periodo_sgu'], $data['periodo_clave'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Faltan datos para actualizar el periodo']); echo json_encode(['error' => 'Faltan datos para actualizar el periodo']);
exit(); exit();
} }
$periodo_id = $data['periodo_id']; $periodo_id = $data['periodo_id'];
$db->where('periodo_id', $periodo_id)->update('periodo', array_filter($data, fn($key) => in_array($key, [ $db->where('periodo_id', $periodo_id)->update('periodo', array_filter($data, fn($key) => in_array($key, [
'periodo_nombre', 'periodo_nombre',
'id_periodo_sgu', 'id_periodo_sgu',
'periodo_clave', 'periodo_clave',
]), ARRAY_FILTER_USE_KEY)); ]), ARRAY_FILTER_USE_KEY));
$periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre']; $periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre'];
echo json_encode([ echo json_encode([
'success' => 'success' =>
"El periodo $periodo_nombre ha sido actualizado" "El periodo $periodo_nombre ha sido actualizado"
]); ]);
break; break;
default: default:
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Acción no válida']); echo json_encode(['error' => 'Acción no válida']);
exit(); exit();
} }
break; break;
case 'POST': case 'POST':
$raw = file_get_contents('php://input'); $raw = file_get_contents('php://input');
$data = json_decode($raw, true); $data = json_decode($raw, true);
if (!isset($data['periodo_nombre'], $data['nivel_id'], $data['periodo_fecha_inicio'], $data['periodo_fecha_fin'])) { if (!isset($data['periodo_nombre'], $data['nivel_id'], $data['periodo_fecha_inicio'], $data['periodo_fecha_fin'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Faltan datos para crear el periodo']); echo json_encode(['error' => 'Faltan datos para crear el periodo']);
exit(); exit();
} }
$newPeriodo = $db->insert( $newPeriodo = $db->insert(
'periodo', 'periodo',
array_filter($data, fn($key) => in_array($key, [ array_filter($data, fn($key) => in_array($key, [
'periodo_nombre', 'periodo_nombre',
'nivel_id', 'nivel_id',
'periodo_fecha_inicio', 'periodo_fecha_inicio',
'periodo_fecha_fin', 'periodo_fecha_fin',
'periodo_clave', 'periodo_clave',
'id_periodo_sgu', 'id_periodo_sgu',
]), ARRAY_FILTER_USE_KEY) ]), ARRAY_FILTER_USE_KEY)
); );
echo json_encode([ echo json_encode([
'success' => true, 'success' => true,
'message' => 'El periodo ha sido creado', 'message' => 'El periodo ha sido creado',
'periodo' => $newPeriodo 'periodo' => $newPeriodo
]); ]);
break; break;
case 'DELETE': case 'DELETE':
// Delete a periodo // Delete a periodo
$raw = file_get_contents('php://input'); $raw = file_get_contents('php://input');
$data = json_decode($raw, true); $data = json_decode($raw, true);
if (!isset($data['periodo_id'])) { if (!isset($data['periodo_id'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Falta el id del periodo']); echo json_encode(['error' => 'Falta el id del periodo']);
exit(); exit();
} }
$periodo_id = $data['periodo_id']; $periodo_id = $data['periodo_id'];
$periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre']; $periodo_nombre = $db->where('periodo_id', $periodo_id)->getOne('periodo', 'periodo_nombre')['periodo_nombre'];
$db->where('periodo_id', $periodo_id)->delete('periodo'); $db->where('periodo_id', $periodo_id)->delete('periodo');
echo json_encode([ echo json_encode([
'success' => true, 'success' => true,
'message' => "El periodo $periodo_nombre ha sido eliminado" 'message' => "El periodo $periodo_nombre ha sido eliminado"
]); ]);
break; break;
default: default:
header('HTTP/1.1 405 Method Not Allowed'); header('HTTP/1.1 405 Method Not Allowed');
echo json_encode(['error' => 'Método no permitido']); echo json_encode(['error' => 'Método no permitido']);
break; break;
} }
} catch (PDOException $e) { } catch (PDOException $e) {
echo json_encode([ echo json_encode([
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
'exception' => $e->getTraceAsString() 'exception' => $e->getTraceAsString()
]); ]);
} catch (Exception $e) { } catch (Exception $e) {
echo json_encode([ echo json_encode([
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'exception' => $e->getTraceAsString() 'exception' => $e->getTraceAsString()
]); ]);
} }

View File

@@ -1,135 +1,135 @@
<? <?
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
header('Content-Type: application/json'); header('Content-Type: application/json');
if (!Login::is_logged()) { if (!Login::is_logged()) {
header('HTTP/1.1 401 Unauthorized'); header('HTTP/1.1 401 Unauthorized');
echo json_encode(['error' => 'No se ha iniciado sesión']); echo json_encode(['error' => 'No se ha iniciado sesión']);
exit(); exit();
} }
$user = Login::get_user(); $user = Login::get_user();
try { try {
switch ($_SERVER['REQUEST_METHOD']) { switch ($_SERVER['REQUEST_METHOD']) {
case 'GET': case 'GET':
$facultad = $_GET['facultad'] ?? $user->facultad['facultad_id'] ?? null; $facultad = $_GET['facultad'] ?? $user->facultad['facultad_id'] ?? null;
$porcentaje = $_GET['porcentaje'] ?? null; $porcentaje = $_GET['porcentaje'] ?? null;
$faltas = $_GET['faltas'] ?? null; $faltas = $_GET['faltas'] ?? null;
if (!isset($facultad) || !is_numeric($facultad)) { if (!isset($facultad) || !is_numeric($facultad)) {
$error = 'No se ha seleccionado una facultad'; $error = 'No se ha seleccionado una facultad';
} else if ((!isset($faltas) || !is_numeric($faltas)) && (!isset($porcentaje) || !is_numeric($porcentaje))) { } else if ((!isset($faltas) || !is_numeric($faltas)) && (!isset($porcentaje) || !is_numeric($porcentaje))) {
$error = 'Debe especificar las faltas o el porcentaje'; $error = 'Debe especificar las faltas o el porcentaje';
} else if (isset($faltas) && (!is_numeric($faltas) || $faltas <= 0)) { } else if (isset($faltas) && (!is_numeric($faltas) || $faltas <= 0)) {
$error = 'Las faltas deben ser un número mayor a 0'; $error = 'Las faltas deben ser un número mayor a 0';
} else if (isset($porcentaje) && (!is_numeric($porcentaje) || $porcentaje <= 0)) { } else if (isset($porcentaje) && (!is_numeric($porcentaje) || $porcentaje <= 0)) {
$error = 'El porcentaje debe ser un número mayor a 0'; $error = 'El porcentaje debe ser un número mayor a 0';
} else if (isset($faltas) && isset($porcentaje)) { } else if (isset($faltas) && isset($porcentaje)) {
$error = 'No se puede especificar las faltas y el porcentaje al mismo tiempo'; $error = 'No se puede especificar las faltas y el porcentaje al mismo tiempo';
} else if (!isset($facultad) || !is_numeric($facultad)) { } else if (!isset($facultad) || !is_numeric($facultad)) {
$error = 'Debe especificar una facultad'; $error = 'Debe especificar una facultad';
} }
if (isset($error)) { if (isset($error)) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => $error]); echo json_encode(['error' => $error]);
exit(); exit();
} }
// Initialize the data array // Initialize the data array
$data = array(); $data = array();
// Check if 'profesor' or 'supervisor' is set and prepare the specific part of the SQL query accordingly. // Check if 'profesor' or 'supervisor' is set and prepare the specific part of the SQL query accordingly.
if (isset($_GET['profesor']) || isset($_GET['supervisor'])) { if (isset($_GET['profesor']) || isset($_GET['supervisor'])) {
$condition = isset($_GET['profesor']) $condition = isset($_GET['profesor'])
? "r.registro_fecha IS NULL AND NOT COALESCE(r.registro_justificada, FALSE)" ? "r.registro_fecha IS NULL AND NOT COALESCE(r.registro_justificada, FALSE)"
: "estado_supervisor_id = 2"; : "estado_supervisor_id = 2";
$filter = isset($faltas) $filter = isset($faltas)
? "afcp.faltas >= :faltas" ? "afcp.faltas >= :faltas"
: "afcp.porcentaje >= :porcentaje"; : "afcp.porcentaje >= :porcentaje";
// Prepare the SQL query with placeholders for parameters // Prepare the SQL query with placeholders for parameters
$data = array_column($db->query( $data = array_column($db->query(
"WITH fechas AS ( "WITH fechas AS (
SELECT SELECT
h.horario_id, h.horario_id,
fechas_clase(h.horario_id, true) AS registro_fecha_ideal, fechas_clase(h.horario_id, true) AS registro_fecha_ideal,
hp.profesor_id hp.profesor_id
FROM horario h FROM horario h
JOIN horario_profesor hp USING (horario_id) JOIN horario_profesor hp USING (horario_id)
WHERE (h.PERIODO_ID, h.FACULTAD_ID) = (:periodo_id, :facultad_id) AND hp.profesor_id <> 0 WHERE (h.PERIODO_ID, h.FACULTAD_ID) = (:periodo_id, :facultad_id) AND hp.profesor_id <> 0
), ),
asistencia_faltas AS ( asistencia_faltas AS (
SELECT SELECT
f.profesor_id, f.profesor_id,
COUNT(1) AS total, COUNT(1) AS total,
COUNT(1) FILTER (WHERE $condition AND f.registro_fecha_ideal <= current_date) AS faltas COUNT(1) FILTER (WHERE $condition AND f.registro_fecha_ideal <= current_date) AS faltas
FROM fechas f FROM fechas f
LEFT JOIN registro r USING (registro_fecha_ideal, horario_id, profesor_id) LEFT JOIN registro r USING (registro_fecha_ideal, horario_id, profesor_id)
GROUP BY f.profesor_id GROUP BY f.profesor_id
), ),
asistencia_faltas_con_porcentaje AS ( asistencia_faltas_con_porcentaje AS (
SELECT SELECT
af.profesor_id, af.profesor_id,
af.faltas, af.faltas,
af.total, af.total,
CASE CASE
WHEN af.total > 0 THEN ROUND((af.faltas::NUMERIC / af.total) * 100, 2) WHEN af.total > 0 THEN ROUND((af.faltas::NUMERIC / af.total) * 100, 2)
ELSE NULL ELSE NULL
END AS porcentaje END AS porcentaje
FROM asistencia_faltas af FROM asistencia_faltas af
WHERE af.faltas > 0 WHERE af.faltas > 0
) )
SELECT SELECT
json_build_object( json_build_object(
'profesor', json_build_object( 'profesor', json_build_object(
'profesor_nombre', p.profesor_nombre, 'profesor_nombre', p.profesor_nombre,
'profesor_clave', p.profesor_clave, 'profesor_clave', p.profesor_clave,
'profesor_correo', p.profesor_correo 'profesor_correo', p.profesor_correo
), ),
'profesor_id', afcp.profesor_id, 'profesor_id', afcp.profesor_id,
'faltas', afcp.faltas, 'faltas', afcp.faltas,
'total', afcp.total, 'total', afcp.total,
'porcentaje', afcp.porcentaje 'porcentaje', afcp.porcentaje
) AS result_json ) AS result_json
FROM asistencia_faltas_con_porcentaje afcp FROM asistencia_faltas_con_porcentaje afcp
JOIN profesor p USING (profesor_id) JOIN profesor p USING (profesor_id)
WHERE $filter WHERE $filter
ORDER BY afcp.porcentaje DESC; ORDER BY afcp.porcentaje DESC;
", ",
[ [
'periodo_id' => $user->periodo_id, 'periodo_id' => $user->periodo_id,
'facultad_id' => $facultad, 'facultad_id' => $facultad,
] + (isset($faltas) ] + (isset($faltas)
? ['faltas' => $faltas] ? ['faltas' => $faltas]
: ['porcentaje' => $porcentaje]) : ['porcentaje' => $porcentaje])
), 'result_json'); ), 'result_json');
} else { } else {
// Send a 400 Bad Request header and an error message in JSON format // Send a 400 Bad Request header and an error message in JSON format
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Especifique si las faltas son de profesor o supervisor']); echo json_encode(['error' => 'Especifique si las faltas son de profesor o supervisor']);
exit(); exit();
} }
if (empty($data)) { if (empty($data)) {
header('HTTP/1.1 404 Not Found'); header('HTTP/1.1 404 Not Found');
echo json_encode(['error' => 'No se encontraron faltas']); echo json_encode(['error' => 'No se encontraron faltas']);
} else { } else {
echo json_encode( echo json_encode(
array_map(fn($item) => json_decode($item), $data) array_map(fn($item) => json_decode($item), $data)
); );
} }
break; break;
default: default:
header('HTTP/1.1 405 Method Not Allowed'); header('HTTP/1.1 405 Method Not Allowed');
echo json_encode(['error' => 'Método no permitido']); echo json_encode(['error' => 'Método no permitido']);
break; break;
} }
} catch (PDOException $e) { } catch (PDOException $e) {
echo json_encode([ echo json_encode([
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
]); ]);
} }

View File

@@ -1,113 +1,113 @@
<?php <?php
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
header('Content-Type: application/json'); header('Content-Type: application/json');
if (!Login::is_logged()) { if (!Login::is_logged()) {
header('HTTP/1.1 401 Unauthorized'); header('HTTP/1.1 401 Unauthorized');
echo json_encode(['error' => 'No se ha iniciado sesión']); echo json_encode(['error' => 'No se ha iniciado sesión']);
exit(); exit();
} }
$user = Login::get_user(); $user = Login::get_user();
try { try {
switch ($_SERVER['REQUEST_METHOD']) { switch ($_SERVER['REQUEST_METHOD']) {
case 'GET': case 'GET':
// Fetch all puestos // Fetch all puestos
$facultad_id = $user->facultad['facultad_id'] ?? -1; $facultad_id = $user->facultad['facultad_id'] ?? -1;
$puestos = array_map( $puestos = array_map(
fn($p) => array( fn($p) => array(
...$p, ...$p,
'materias' => $db->where('puesto_id', $p['puesto_id']) 'materias' => $db->where('puesto_id', $p['puesto_id'])
->join('puesto_materia', 'puesto_materia.materia_id = materia.materia_id', 'LEFT') ->join('puesto_materia', 'puesto_materia.materia_id = materia.materia_id', 'LEFT')
->get(tableName: 'materia', columns: ['materia.materia_id', 'materia_nombre', 'clave_materia',]), ->get(tableName: 'materia', columns: ['materia.materia_id', 'materia_nombre', 'clave_materia',]),
'encargado' => $db->where('puesto_id', $p['puesto_id']) 'encargado' => $db->where('puesto_id', $p['puesto_id'])
->join('puesto_usuario', 'puesto_usuario.usuario_id = usuario.usuario_id', 'LEFT') ->join('puesto_usuario', 'puesto_usuario.usuario_id = usuario.usuario_id', 'LEFT')
->getOne('usuario', ['usuario.usuario_id', 'usuario_nombre', 'usuario_clave']), ->getOne('usuario', ['usuario.usuario_id', 'usuario_nombre', 'usuario_clave']),
), ),
$db->orderBy('puesto.nombre', 'desc') $db->orderBy('puesto.nombre', 'desc')
->where('facultad_id', $facultad_id) ->where('facultad_id', $facultad_id)
->get(tableName: 'puesto', columns: 'puesto_id, nombre'), ->get(tableName: 'puesto', columns: 'puesto_id, nombre'),
); );
echo json_encode($puestos); echo json_encode($puestos);
break; break;
case 'POST': case 'POST':
$raw_input = file_get_contents('php://input'); $raw_input = file_get_contents('php://input');
$input_data = json_decode($raw_input, true); $input_data = json_decode($raw_input, true);
if (!$input_data || !isset($input_data['puesto_nombre'])) { if (!$input_data || !isset($input_data['puesto_nombre'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Datos inválidos']); echo json_encode(['error' => 'Datos inválidos']);
exit(); exit();
} }
$puesto = $db->insert('puesto', [ $puesto = $db->insert('puesto', [
'nombre' => $input_data['puesto_nombre'], 'nombre' => $input_data['puesto_nombre'],
'facultad_id' => $user->facultad['facultad_id'], 'facultad_id' => $user->facultad['facultad_id'],
], ['puesto_id', 'nombre', 'facultad_id']); ], ['puesto_id', 'nombre', 'facultad_id']);
echo json_encode( echo json_encode(
array( array(
...$puesto, ...$puesto,
'materias' => [], 'materias' => [],
'encargado' => null, 'encargado' => null,
), ),
); );
break; break;
case 'PUT': case 'PUT':
$raw_input = file_get_contents('php://input'); $raw_input = file_get_contents('php://input');
$input_data = json_decode($raw_input, true); $input_data = json_decode($raw_input, true);
if (!$input_data || !isset($input_data['puesto_id'], $input_data['materias'])) { if (!$input_data || !isset($input_data['puesto_id'], $input_data['materias'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Datos inválidos']); echo json_encode(['error' => 'Datos inválidos']);
exit(); exit();
} }
$db->where('puesto_id', $input_data['puesto_id'])->delete('puesto_materia'); $db->where('puesto_id', $input_data['puesto_id'])->delete('puesto_materia');
$db->where('puesto_id', $input_data['puesto_id'])->delete('puesto_usuario'); $db->where('puesto_id', $input_data['puesto_id'])->delete('puesto_usuario');
foreach ($input_data['materias'] as $materia_id) { foreach ($input_data['materias'] as $materia_id) {
$db->insert('puesto_materia', [ $db->insert('puesto_materia', [
'puesto_id' => $input_data['puesto_id'], 'puesto_id' => $input_data['puesto_id'],
'materia_id' => $materia_id, 'materia_id' => $materia_id,
]); ]);
} }
if (isset($input_data['usuario_id'])) if (isset($input_data['usuario_id']))
$db->insert('puesto_usuario', [ $db->insert('puesto_usuario', [
'puesto_id' => $input_data['puesto_id'], 'puesto_id' => $input_data['puesto_id'],
'usuario_id' => $input_data['usuario_id'], 'usuario_id' => $input_data['usuario_id'],
]); ]);
echo json_encode(['msg' => 'Puesto actualizado exitosamente']); echo json_encode(['msg' => 'Puesto actualizado exitosamente']);
break; break;
case 'DELETE': case 'DELETE':
$raw_input = file_get_contents('php://input'); $raw_input = file_get_contents('php://input');
$input_data = json_decode($raw_input, true); $input_data = json_decode($raw_input, true);
if (!$input_data || !isset($input_data['puesto_id'])) { if (!$input_data || !isset($input_data['puesto_id'])) {
header('HTTP/1.1 400 Bad Request'); header('HTTP/1.1 400 Bad Request');
echo json_encode(['error' => 'Datos inválidos']); echo json_encode(['error' => 'Datos inválidos']);
exit(); exit();
} }
$db->where('puesto_id', $input_data['puesto_id'])->delete('puesto'); $db->where('puesto_id', $input_data['puesto_id'])->delete('puesto');
echo json_encode(['msg' => 'Puesto eliminado exitosamente']); echo json_encode(['msg' => 'Puesto eliminado exitosamente']);
break; break;
default: default:
header('HTTP/1.1 405 Method Not Allowed'); header('HTTP/1.1 405 Method Not Allowed');
echo json_encode(['error' => 'Método no permitido']); echo json_encode(['error' => 'Método no permitido']);
break; break;
} }
} catch (PDOException $e) { } catch (PDOException $e) {
echo json_encode([ echo json_encode([
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'query' => $db->getLastQuery(), 'query' => $db->getLastQuery(),
'exception' => $e->getTraceAsString() 'exception' => $e->getTraceAsString()
]); ]);
} }

View File

@@ -1,288 +1,288 @@
<?php <?php
/* /*
Cambia de estado la reposición Cambia de estado la reposición
*/ */
$pag = "../reposiciones_crear.php"; $pag = "../reposiciones_crear.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
require_once "../class/mailer.php"; require_once "../class/mailer.php";
define("COORDINADOR", 9); define("COORDINADOR", 9);
define("SUPERVISOR", 7); define("SUPERVISOR", 7);
define("ENVIO_CORREOS", true); define("ENVIO_CORREOS", true);
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
$pag = "../reposiciones_autorizar.php"; $pag = "../reposiciones_autorizar.php";
if(!isset($_POST["id"]) || !isset($_POST["edo"]) ){ if(!isset($_POST["id"]) || !isset($_POST["edo"]) ){
header("Location: ".$pag."?error=0"); header("Location: ".$pag."?error=0");
exit(); exit();
} }
$id_repo = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id_repo = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$edo = filter_input(INPUT_POST, "edo", FILTER_SANITIZE_NUMBER_INT);//limpia texto $edo = filter_input(INPUT_POST, "edo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//limpia texto $tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
if(isset($_POST["salon"]) && $_POST["salon"] != "") if(isset($_POST["salon"]) && $_POST["salon"] != "")
$salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto $salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//-------------- //--------------
//Obtiene datos de salón asignado //Obtiene datos de salón asignado
$salon_desc = "Pendiente"; $salon_desc = "Pendiente";
if(!empty($salon)){ if(!empty($salon)){
$salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon', $salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon',
[':id_salon' => $salon] [':id_salon' => $salon]
); );
if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){ if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){
$salon_desc = "Pendiente"; $salon_desc = "Pendiente";
}else{ }else{
$salon_json = json_decode($salon_rs["salon_array"], true); $salon_json = json_decode($salon_rs["salon_array"], true);
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){ if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
unset($salon_json[0]); unset($salon_json[0]);
} }
$salon_desc = join(" / ",$salon_json); $salon_desc = join(" / ",$salon_json);
} }
} }
if($tipo ==1 || $tipo == 2){ if($tipo ==1 || $tipo == 2){
//-------------- //--------------
//Obtiene datos reposición //Obtiene datos reposición
$reposicion_rs = $db->querySingle('SELECT h.materia, r.fecha_nueva, r.hora_nueva, r.fecha_clase, r.descripcion, h.horario_hora, h.facultad_id, h.facultad, f.clave_dependencia, r.motivo_cancelacion, ta.tipoaula_supervisor , ta.tipoaula_nombre $reposicion_rs = $db->querySingle('SELECT h.materia, r.fecha_nueva, r.hora_nueva, r.fecha_clase, r.descripcion, h.horario_hora, h.facultad_id, h.facultad, f.clave_dependencia, r.motivo_cancelacion, ta.tipoaula_supervisor , ta.tipoaula_nombre
from reposicion_solicitud r from reposicion_solicitud r
inner join horario_view h on h.horario_id = r.horario_id inner join horario_view h on h.horario_id = r.horario_id
inner join facultad f on f.facultad_id = h.facultad_id inner join facultad f on f.facultad_id = h.facultad_id
inner join tipoaula ta on ta.tipoaula_id = r.tipoaula_id inner join tipoaula ta on ta.tipoaula_id = r.tipoaula_id
where r.reposicion_solicitud_id = :id_repo', where r.reposicion_solicitud_id = :id_repo',
[':id_repo' => $id_repo] [':id_repo' => $id_repo]
); );
//Obtiene correos //Obtiene correos
$correos_rs = $db->query('SELECT p.profesor_nombre, p.profesor_correo, u.usuario_nombre as jefe_nombre, u.usuario_correo as jefe_correo, $correos_rs = $db->query('SELECT p.profesor_nombre, p.profesor_correo, u.usuario_nombre as jefe_nombre, u.usuario_correo as jefe_correo,
coor.usuario_nombre as coordinador_nombre, coor.usuario_correo as coordinador_correo coor.usuario_nombre as coordinador_nombre, coor.usuario_correo as coordinador_correo
from reposicion_solicitud rs from reposicion_solicitud rs
inner join profesor p on rs.profesor_id =p.profesor_id inner join profesor p on rs.profesor_id =p.profesor_id
inner join usuario u on u.usuario_id = rs.usuario_id inner join usuario u on u.usuario_id = rs.usuario_id
inner join horario_view hv on hv.horario_id = rs.horario_id inner join horario_view hv on hv.horario_id = rs.horario_id
inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord
where rs.reposicion_solicitud_id = :id_repo', where rs.reposicion_solicitud_id = :id_repo',
[':rol_coord' => COORDINADOR, ':id_repo' => $id_repo] [':rol_coord' => COORDINADOR, ':id_repo' => $id_repo]
); );
//print_r($correos_rs); exit(); //print_r($correos_rs); exit();
}else{ }else{
//Obtiene datos asignación //Obtiene datos asignación
$reposicion_rs = $db->querySingle('SELECT r.fecha_nueva, r.hora_nueva, r.descripcion, f.facultad_id, f.facultad_nombre as facultad, f.clave_dependencia, r.motivo_cancelacion, ta.tipoaula_supervisor , ta.tipoaula_nombre, p.profesor_nombre $reposicion_rs = $db->querySingle('SELECT r.fecha_nueva, r.hora_nueva, r.descripcion, f.facultad_id, f.facultad_nombre as facultad, f.clave_dependencia, r.motivo_cancelacion, ta.tipoaula_supervisor , ta.tipoaula_nombre, p.profesor_nombre
from asignacion_solicitud r from asignacion_solicitud r
inner join usuario u on u.usuario_id = r.usuario_id inner join usuario u on u.usuario_id = r.usuario_id
inner join facultad f on f.facultad_id = u.facultad_id inner join facultad f on f.facultad_id = u.facultad_id
inner join tipoaula ta on ta.tipoaula_id = r.tipoaula_id inner join tipoaula ta on ta.tipoaula_id = r.tipoaula_id
inner join profesor p on p.profesor_id = r.profesor_id inner join profesor p on p.profesor_id = r.profesor_id
where r.asignacion_solicitud_id = :id_repo', where r.asignacion_solicitud_id = :id_repo',
[':id_repo' => $id_repo] [':id_repo' => $id_repo]
); );
//Obtiene correos //Obtiene correos
$correos_rs = $db->query('SELECT p.profesor_nombre, p.profesor_correo, NULL as jefe_nombre, NULL as jefe_correo, $correos_rs = $db->query('SELECT p.profesor_nombre, p.profesor_correo, NULL as jefe_nombre, NULL as jefe_correo,
coor.usuario_nombre as coordinador_nombre, coor.usuario_correo as coordinador_correo coor.usuario_nombre as coordinador_nombre, coor.usuario_correo as coordinador_correo
from asignacion_solicitud rs from asignacion_solicitud rs
inner join profesor p on rs.profesor_id =p.profesor_id inner join profesor p on rs.profesor_id =p.profesor_id
inner join usuario u on u.usuario_id = rs.usuario_id inner join usuario u on u.usuario_id = rs.usuario_id
inner join usuario coor on u.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord inner join usuario coor on u.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord
where rs.asignacion_solicitud_id = :id_repo', where rs.asignacion_solicitud_id = :id_repo',
[':rol_coord' => COORDINADOR, ':id_repo' => $id_repo] [':rol_coord' => COORDINADOR, ':id_repo' => $id_repo]
); );
} }
$prof_correos=array(); $prof_correos=array();
$jefe_correos=[]; $jefe_correos=[];
$coord_correos=[]; $coord_correos=[];
foreach($correos_rs as $correo){ foreach($correos_rs as $correo){
if( count($prof_correos)==0 && $correo["profesor_correo"]!=""){ if( count($prof_correos)==0 && $correo["profesor_correo"]!=""){
if( !isset($prof_correos["correo"]) || !in_array($correo["profesor_correo"], $prof_correos["correo"]) ){ if( !isset($prof_correos["correo"]) || !in_array($correo["profesor_correo"], $prof_correos["correo"]) ){
array_push($prof_correos, $correo["profesor_correo"]); array_push($prof_correos, $correo["profesor_correo"]);
} }
} }
if( count($jefe_correos)==0 && $correo["jefe_correo"]!=""){ if( count($jefe_correos)==0 && $correo["jefe_correo"]!=""){
if(!isset($jefe_correos["correo"]) || !in_array($correo["jefe_correo"], $jefe_correos["correo"])){ if(!isset($jefe_correos["correo"]) || !in_array($correo["jefe_correo"], $jefe_correos["correo"])){
array_push($jefe_correos, $correo["jefe_correo"]); array_push($jefe_correos, $correo["jefe_correo"]);
} }
} }
if( count($coord_correos)==0 && $correo["coordinador_correo"]!=""){ if( count($coord_correos)==0 && $correo["coordinador_correo"]!=""){
if(!isset($coord_correos["correo"]) || !in_array($correo["coordinador_correo"], $coord_correos["correo"])){ if(!isset($coord_correos["correo"]) || !in_array($correo["coordinador_correo"], $coord_correos["correo"])){
array_push($coord_correos, $correo["coordinador_correo"]); array_push($coord_correos, $correo["coordinador_correo"]);
} }
} }
} }
$correosSup_rs = $db->query("SELECT DISTINCT sup.usuario_correo as supervisor_correo $correosSup_rs = $db->query("SELECT DISTINCT sup.usuario_correo as supervisor_correo
FROM horario_supervisor hs FROM horario_supervisor hs
inner join usuario sup on sup.usuario_id =hs.usuario_id inner join usuario sup on sup.usuario_id =hs.usuario_id
where :facultad = ANY(hs.facultad_id_array)", where :facultad = ANY(hs.facultad_id_array)",
[':facultad'=>$reposicion_rs["facultad_id"]] ); [':facultad'=>$reposicion_rs["facultad_id"]] );
$sup_correos=[]; $sup_correos=[];
foreach($correosSup_rs as $correo){ foreach($correosSup_rs as $correo){
array_push($sup_correos, $correo["supervisor_correo"]); array_push($sup_correos, $correo["supervisor_correo"]);
} }
if($tipo ==1 || $tipo == 2){ if($tipo ==1 || $tipo == 2){
if($edo == 4){//cancelación if($edo == 4){//cancelación
$motivo = ""; $motivo = "";
if(isset($_POST["motivo"]) && $_POST["motivo"] != "") if(isset($_POST["motivo"]) && $_POST["motivo"] != "")
$motivo = trim($_POST["motivo"]); $motivo = trim($_POST["motivo"]);
$db->querySingle('SELECT fu_reposicion_cancela(:id, :motivo)', $db->querySingle('SELECT fu_reposicion_cancela(:id, :motivo)',
[':id' => $id_repo, ':motivo' => $motivo] [':id' => $id_repo, ':motivo' => $motivo]
); );
}else{ }else{
if(!empty($salon)){ if(!empty($salon)){
$db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, :sal, :edo, NULL, NULL, NULL, NULL)', $db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, :sal, :edo, NULL, NULL, NULL, NULL)',
[':id' => $id_repo, ':sal' => $salon, ':edo' => $edo] [':id' => $id_repo, ':sal' => $salon, ':edo' => $edo]
); );
}else{ }else{
$db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL)', $db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL)',
[':id' => $id_repo, ':edo' => $edo] [':id' => $id_repo, ':edo' => $edo]
); );
} }
} }
$fecha_clase = date('d/m/Y', strtotime($reposicion_rs["fecha_clase"])); $fecha_clase = date('d/m/Y', strtotime($reposicion_rs["fecha_clase"]));
$fecha_nueva = date('d/m/Y', strtotime($reposicion_rs["fecha_nueva"])); $fecha_nueva = date('d/m/Y', strtotime($reposicion_rs["fecha_nueva"]));
$hora_tmp = explode(":",$reposicion_rs["horario_hora"]); $hora_tmp = explode(":",$reposicion_rs["horario_hora"]);
$hora_clase = $hora_tmp[0].":".$hora_tmp[1]; $hora_clase = $hora_tmp[0].":".$hora_tmp[1];
$hora_tmp = explode(":",$reposicion_rs["hora_nueva"]); $hora_tmp = explode(":",$reposicion_rs["hora_nueva"]);
$hora_nueva = $hora_tmp[0].":".$hora_tmp[1]; $hora_nueva = $hora_tmp[0].":".$hora_tmp[1];
$asunto = ""; $asunto = "";
$texto = ""; $texto = "";
$to = ""; $to = "";
switch($edo){ switch($edo){
case 2://Correo a supervisor case 2://Correo a supervisor
$asunto = "Reposición nueva - ".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"]; $asunto = "Reposición nueva - ".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"];
//crear plantilla //crear plantilla
$texto = "<p>Se creó una reposición nueva para: <b>".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"]."</b>.</p>"; $texto = "<p>Se creó una reposición nueva para: <b>".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"]."</b>.</p>";
$texto .= "<p><b>".mb_strtoupper($reposicion_rs["materia"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b>"; $texto .= "<p><b>".mb_strtoupper($reposicion_rs["materia"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b>";
if(!$reposicion_rs["tipoaula_supervisor"]){ if(!$reposicion_rs["tipoaula_supervisor"]){
$texto .= " en el salón: <b>".$salon_desc."</b></p>"; $texto .= " en el salón: <b>".$salon_desc."</b></p>";
}else{ }else{
$texto .= " en un salón de tipo: <b>".$reposicion_rs["tipoaula_nombre"]."</b></p>"; $texto .= " en un salón de tipo: <b>".$reposicion_rs["tipoaula_nombre"]."</b></p>";
} }
$texto .= "<p style='font-style:italic; padding-left:25px'>".$reposicion_rs["descripcion"]."</p>"; $texto .= "<p style='font-style:italic; padding-left:25px'>".$reposicion_rs["descripcion"]."</p>";
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>"; $texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
$to = join(",", $sup_correos); $to = join(",", $sup_correos);
$ok = 0; $ok = 0;
break; break;
case 3://Correo a coordinador, profesor y jefe case 3://Correo a coordinador, profesor y jefe
$asunto = "Reposición autorizada - ".$reposicion_rs["materia"]; $asunto = "Reposición autorizada - ".$reposicion_rs["materia"];
$texto = "<p>La resposición de la clase de <b>".$reposicion_rs["materia"]."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. </b> está autorizada para realizarse el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en: $salon_desc</b></p>"; $texto = "<p>La resposición de la clase de <b>".$reposicion_rs["materia"]."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. </b> está autorizada para realizarse el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en: $salon_desc</b></p>";
$to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos); $to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
$ok = 0; $ok = 0;
$db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)', $db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)',
[':id' => $id_repo, ':sup'=>$user->user["id"]] [':id' => $id_repo, ':sup'=>$user->user["id"]]
); );
break; break;
case 4://Correo a coordinador, profesor y jefe case 4://Correo a coordinador, profesor y jefe
$asunto = "Reposición declinada - ".$reposicion_rs["materia"]; $asunto = "Reposición declinada - ".$reposicion_rs["materia"];
$texto = "<p>La resposición de la clase de <b>".$reposicion_rs["materia"]." planeada para el día ".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo:</p>"; $texto = "<p>La resposición de la clase de <b>".$reposicion_rs["materia"]." planeada para el día ".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo:</p>";
$texto .= "<p style='font-style:italic; padding-left:25px'>".$motivo."</p>"; $texto .= "<p style='font-style:italic; padding-left:25px'>".$motivo."</p>";
$to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos); $to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
$ok = 1; $ok = 1;
$db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)', $db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)',
[':id' => $id_repo, ':sup'=>$user->user["id"]] [':id' => $id_repo, ':sup'=>$user->user["id"]]
); );
break; break;
} }
}else{ }else{
if($edo == 4){//cancelación if($edo == 4){//cancelación
$motivo = ""; $motivo = "";
if(isset($_POST["motivo"]) && $_POST["motivo"] != "") if(isset($_POST["motivo"]) && $_POST["motivo"] != "")
$motivo = trim($_POST["motivo"]); $motivo = trim($_POST["motivo"]);
$db->querySingle('SELECT fu_asignacion_cancela(:id, :motivo)', $db->querySingle('SELECT fu_asignacion_cancela(:id, :motivo)',
[':id' => $id_repo, ':motivo' => $motivo] [':id' => $id_repo, ':motivo' => $motivo]
); );
}else{ }else{
if(!empty($salon)){ if(!empty($salon)){
$db->querySingle('SELECT fu_asignacion_solicitud(:id, NULL, NULL, :sal, :edo, NULL, NULL, NULL, NULL, NULL)', $db->querySingle('SELECT fu_asignacion_solicitud(:id, NULL, NULL, :sal, :edo, NULL, NULL, NULL, NULL, NULL)',
[':id' => $id_repo, ':sal' => $salon, ':edo' => $edo] [':id' => $id_repo, ':sal' => $salon, ':edo' => $edo]
); );
}else{ }else{
$db->querySingle('SELECT fu_asignacion_solicitud(:id, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL, NULL)', $db->querySingle('SELECT fu_asignacion_solicitud(:id, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL, NULL)',
[':id' => $id_repo, ':edo' => $edo] [':id' => $id_repo, ':edo' => $edo]
); );
} }
} }
$fecha_nueva = date('d/m/Y', strtotime($reposicion_rs["fecha_nueva"])); $fecha_nueva = date('d/m/Y', strtotime($reposicion_rs["fecha_nueva"]));
$hora_tmp = explode(":",$reposicion_rs["hora_nueva"]); $hora_tmp = explode(":",$reposicion_rs["hora_nueva"]);
$hora_nueva = $hora_tmp[0].":".$hora_tmp[1]; $hora_nueva = $hora_tmp[0].":".$hora_tmp[1];
$asunto = ""; $asunto = "";
$texto = ""; $texto = "";
$to = ""; $to = "";
switch($edo){ switch($edo){
case 2://Correo a supervisor case 2://Correo a supervisor
$asunto = "Asignación nueva - ".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"]; $asunto = "Asignación nueva - ".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"];
//crear plantilla //crear plantilla
$texto = "<p>Se creó una solicitud de asignación nueva para: <b>".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"]."</b>.</p>"; $texto = "<p>Se creó una solicitud de asignación nueva para: <b>".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"]."</b>.</p>";
$texto .= "<p>Se solicita el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> para el profesor: <b>".$reposicion_rs["profesor_nombre"]."</b>."; $texto .= "<p>Se solicita el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> para el profesor: <b>".$reposicion_rs["profesor_nombre"]."</b>.";
if(!$reposicion_rs["tipoaula_supervisor"]){ if(!$reposicion_rs["tipoaula_supervisor"]){
$texto .= " en el salón: <b>".$salon_desc."</b></p>"; $texto .= " en el salón: <b>".$salon_desc."</b></p>";
}else{ }else{
$texto .= " en un salón de tipo: <b>".$reposicion_rs["tipoaula_nombre"]."</b></p>"; $texto .= " en un salón de tipo: <b>".$reposicion_rs["tipoaula_nombre"]."</b></p>";
} }
$texto .= "<p style='font-style:italic; padding-left:25px'>".$reposicion_rs["descripcion"]."</p>"; $texto .= "<p style='font-style:italic; padding-left:25px'>".$reposicion_rs["descripcion"]."</p>";
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>"; $texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
$to = join(",", $sup_correos); $to = join(",", $sup_correos);
$ok = 0; $ok = 0;
break; break;
case 3://Correo a coordinador, profesor y jefe case 3://Correo a coordinador, profesor y jefe
$asunto = "Asignación autorizada - ".$reposicion_rs["profesor_nombre"]; $asunto = "Asignación autorizada - ".$reposicion_rs["profesor_nombre"];
$texto = "<p>La asignación de espacio para el profesor <b>".$reposicion_rs["profesor_nombre"]."</b> está autorizada para realizarse el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en: $salon_desc</b></p>"; $texto = "<p>La asignación de espacio para el profesor <b>".$reposicion_rs["profesor_nombre"]."</b> está autorizada para realizarse el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en: $salon_desc</b></p>";
$to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos); $to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
$ok = 0; $ok = 0;
$db->querySingle('SELECT fu_asignacion_solicitud_supervisor(:id, :sup)', $db->querySingle('SELECT fu_asignacion_solicitud_supervisor(:id, :sup)',
[':id' => $id_repo, ':sup'=>$user->user["id"]] [':id' => $id_repo, ':sup'=>$user->user["id"]]
); );
break; break;
case 4://Correo a coordinador, profesor y jefe case 4://Correo a coordinador, profesor y jefe
$asunto = "Asignación declinada - ".$reposicion_rs["profesor_nombre"]; $asunto = "Asignación declinada - ".$reposicion_rs["profesor_nombre"];
$texto = "<p>La asignación de espacio para el profesor <b>".$reposicion_rs["profesor_nombre"]."</b> planeada para el día ".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo:</p>"; $texto = "<p>La asignación de espacio para el profesor <b>".$reposicion_rs["profesor_nombre"]."</b> planeada para el día ".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo:</p>";
$texto .= "<p style='font-style:italic; padding-left:25px'>".$motivo."</p>"; $texto .= "<p style='font-style:italic; padding-left:25px'>".$motivo."</p>";
$to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos); $to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
$ok = 1; $ok = 1;
$db->querySingle('SELECT fu_asignacion_solicitud_supervisor(:id, :sup)', $db->querySingle('SELECT fu_asignacion_solicitud_supervisor(:id, :sup)',
[':id' => $id_repo, ':sup'=>$user->user["id"]] [':id' => $id_repo, ':sup'=>$user->user["id"]]
); );
break; break;
} }
} }
if($to!= "" && ENVIO_CORREOS){ if($to!= "" && ENVIO_CORREOS){
$texto = '<body > $texto = '<body >
<img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px"> <img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px">
'.$texto.' '.$texto.'
</body>'; </body>';
require_once('../include/phpmailer/PHPMailerAutoload.php'); require_once('../include/phpmailer/PHPMailerAutoload.php');
if($_ENV['DB_NAME'] == "paad_pruebas"){ if($_ENV['DB_NAME'] == "paad_pruebas"){
$asunto = "PRUEBAS-".$asunto; $asunto = "PRUEBAS-".$asunto;
Mailer::enviarCorreo("alejandro.lara@lasalle.mx", $asunto, $texto, true); Mailer::enviarCorreo("alejandro.lara@lasalle.mx", $asunto, $texto, true);
}else{ }else{
Mailer::enviarCorreo($to, $asunto, $texto, true); Mailer::enviarCorreo($to, $asunto, $texto, true);
} }
} }
/* /*
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log); $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/ */
header("Location: ".$pag."?ok=".$ok); header("Location: ".$pag."?ok=".$ok);
exit(); exit();
?> ?>

View File

@@ -1,33 +1,33 @@
<?php <?php
/* /*
* Borra reposición * Borra reposición
*/ */
$pag = "../reposiciones_crear.php"; $pag = "../reposiciones_crear.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
if(!isset($_POST["id"])){ if(!isset($_POST["id"])){
$return["error"] = "Error! No se recibió la información necesaria."; $return["error"] = "Error! No se recibió la información necesaria.";
}else{ }else{
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$creador = $user->user["id"]; $creador = $user->user["id"];
try{ try{
$db->query('SELECT * from fd_reposicion_solicitud(:id, :creador)', [":id"=> $id, ":creador"=>$creador]); $db->query('SELECT * from fd_reposicion_solicitud(:id, :creador)', [":id"=> $id, ":creador"=>$creador]);
$return["ok"] = "La reposición se borró correctamente"; $return["ok"] = "La reposición se borró correctamente";
}catch(Exception $e){ }catch(Exception $e){
$return["error"] = "Ocurrió un error al borrar la reposición."; $return["error"] = "Ocurrió un error al borrar la reposición.";
} }
} }
echo json_encode($return); echo json_encode($return);
?> ?>

View File

@@ -1,208 +1,208 @@
<?php <?php
/* /*
* Inserta reposición * Inserta reposición
*/ */
$pag = "../reposiciones_crear.php"; $pag = "../reposiciones_crear.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
require_once "../class/mailer.php"; require_once "../class/mailer.php";
define("COORDINADOR", 9); define("COORDINADOR", 9);
define("ENVIO_CORREOS", true); define("ENVIO_CORREOS", true);
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
//$user->access(); //$user->access();
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion $duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
$bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);// $bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);//
$ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);// $ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);//
$fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//Reposicion $fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//Reposicion
$fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//Reposicion $fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//Reposicion
$fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//Cambio salón $fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//Cambio salón
$hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto hora reposicion $hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto hora reposicion
$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto $min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$hor = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT);//limpia texto $hor = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto $alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//1 Repo , 0 Cambio $tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//1 Repo , 0 Cambio
$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad $aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
$salon = NULL; $salon = NULL;
if(!$user->jefe_carrera){//coordinador if(!$user->jefe_carrera){//coordinador
if(isset($_POST["salon"]) && $_POST["salon"] != "") if(isset($_POST["salon"]) && $_POST["salon"] != "")
$salon = filter_input(INPUT_POST, "dlSalon", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad $salon = filter_input(INPUT_POST, "dlSalon", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
} }
if(empty($_POST["prof"])) if(empty($_POST["prof"]))
$prof = $user->user["id"]; $prof = $user->user["id"];
else else
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto $prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto $comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]); $duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
$duracion_tiempo = $duracion_rs["duracion_interval"]; $duracion_tiempo = $duracion_rs["duracion_interval"];
//-- Obtiene datos de horario regular de clase //-- Obtiene datos de horario regular de clase
$horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor', $horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor',
[':hor' => $hor] [':hor' => $hor]
); );
$materia = $horario_rs["materia_id"]; $materia = $horario_rs["materia_id"];
$dia = $horario_rs["horario_dia"]; $dia = $horario_rs["horario_dia"];
$hora = $hora_ini.":".$min_ini.":00"; $hora = $hora_ini.":".$min_ini.":00";
if($tipo == 1){//Reposición if($tipo == 1){//Reposición
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
$fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d'); $fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_falta)); $dia_falta = date('w', strtotime($fecha_falta));
}else{ }else{
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d'); $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio)); $dia_falta = date('w', strtotime($fecha_cambio));
} }
//Valida que tenga clase en la fecha de falta //Valida que tenga clase en la fecha de falta
if(intval($dia) != intval($dia_falta)){ if(intval($dia) != intval($dia_falta)){
header("Location:".$pag."?error=11"); header("Location:".$pag."?error=11");
/*print_r($_POST); /*print_r($_POST);
echo 'SELECT * from horario_view where horario_id = '.$hor; echo 'SELECT * from horario_view where horario_id = '.$hor;
echo intval($dia)." != ".intval($dia_falta);*/ echo intval($dia)." != ".intval($dia_falta);*/
exit(); exit();
} }
//Obtiene materia //Obtiene materia
$materia_rs = $db->querySingle('SELECT materia_nombre from materia where materia_id = :mat',[':mat' => $materia]); $materia_rs = $db->querySingle('SELECT materia_nombre from materia where materia_id = :mat',[':mat' => $materia]);
//Obtiene correo //Obtiene correo
$correos_rs = $db->querySingle('SELECT coor.usuario_correo, coor.usuario_nombre from usuario coor where rol_id = :rol_coord and facultad_id = ( $correos_rs = $db->querySingle('SELECT coor.usuario_correo, coor.usuario_nombre from usuario coor where rol_id = :rol_coord and facultad_id = (
select coalesce(facultad_id,0) from usuario u where u.usuario_id = :id_usr) and coor.usuario_correo != \'\'',[':rol_coord' => COORDINADOR, ':id_usr' => $user->user["id"]] select coalesce(facultad_id,0) from usuario u where u.usuario_id = :id_usr) and coor.usuario_correo != \'\'',[':rol_coord' => COORDINADOR, ':id_usr' => $user->user["id"]]
); );
if( count($correos_rs) > 0 ){ if( count($correos_rs) > 0 ){
$to = $correos_rs["usuario_correo"]; $to = $correos_rs["usuario_correo"];
} }
if($tipo == 1){//Reposición if($tipo == 1){//Reposición
// Valida que grupo no tenga clases // Valida que grupo no tenga clases
/*$result = validaConflictoHoras($pdo, $gpo, $dia_new, $hora, $materia, "-", $fecha_new, $fecha_fin_new, $duracion); /*$result = validaConflictoHoras($pdo, $gpo, $dia_new, $hora, $materia, "-", $fecha_new, $fecha_fin_new, $duracion);
if($result != ""){//error if($result != ""){//error
//echo $result; //echo $result;
header("Location:".$pag."?error=7"); header("Location:".$pag."?error=7");
exit(); exit();
} }
*/ */
//Valida que profesor no este en 2 reposiciones al mismo tiempo en la fecha nueva //Valida que profesor no este en 2 reposiciones al mismo tiempo en la fecha nueva
$traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)', $traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)',
[':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo] [':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo]
)["traslape_profesor_reposicion"]; )["traslape_profesor_reposicion"];
if($traslape){ if($traslape){
//print_r($_POST); //print_r($_POST);
//echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)"; //echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)";
header("Location:".$pag."?error=9"); header("Location:".$pag."?error=9");
exit(); exit();
} }
try{ try{
if($user->jefe_carrera){//jefe if($user->jefe_carrera){//jefe
$db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo)', $db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo)',
[':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, ':hor' => $hor, [':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, ':hor' => $hor,
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"], ':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"],
':bloque' => $bloque, ':ciclo' => $ciclo ':bloque' => $bloque, ':ciclo' => $ciclo
] ]
); );
}else{//coordinador }else{//coordinador
echo 'SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 2, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo, '.$salon.')'; echo 'SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 2, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo, '.$salon.')';
$db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 2, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo, :salon)', $db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 2, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo, :salon)',
[':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, ':hor' => $hor, [':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, ':hor' => $hor,
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"], ':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"],
':bloque' => $bloque, ':ciclo' => $ciclo, ':salon'=>$salon ':bloque' => $bloque, ':ciclo' => $ciclo, ':salon'=>$salon
] ]
); );
} }
}catch(Exception $e){ }catch(Exception $e){
echo "ERROR Reposición<br>".$e->getMessage(); echo "ERROR Reposición<br>".$e->getMessage();
//header("Location: ".$pag."?error=1"); //header("Location: ".$pag."?error=1");
exit(); exit();
} }
$fecha_clase = date('d/m/Y', strtotime($fecha_falta)); $fecha_clase = date('d/m/Y', strtotime($fecha_falta));
$fecha_nueva = date('d/m/Y', strtotime($fecha_new)); $fecha_nueva = date('d/m/Y', strtotime($fecha_new));
$texto = "<p>Se creó una reposición nueva.</p>"; $texto = "<p>Se creó una reposición nueva.</p>";
$texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$horario_rs["horario_hora"]." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora." hrs.</b>"; $texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$horario_rs["horario_hora"]." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora." hrs.</b>";
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>"; $texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
/* /*
$log = new LogActividad(); $log = new LogActividad();
$desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]"; $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/ $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
}else{//Cambio salón / hora }else{//Cambio salón / hora
try{ try{
if($user->jefe_carrera){//jefe if($user->jefe_carrera){//jefe
$db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, false, :aula, :duracion, :usr, :bloque, :ciclo)', $db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, false, :aula, :duracion, :usr, :bloque, :ciclo)',
[':f_falta' => $fecha_cambio, ':f_nueva' => $fecha_cambio, ':hora_nueva' => $hora, ':hor' => $hor, [':f_falta' => $fecha_cambio, ':f_nueva' => $fecha_cambio, ':hora_nueva' => $hora, ':hor' => $hor,
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"], ':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"],
':bloque' => $bloque, ':ciclo' => $ciclo ':bloque' => $bloque, ':ciclo' => $ciclo
] ]
); );
}else{//coordinador }else{//coordinador
$db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 2, :desc, :alumnos, false, :aula, :duracion, :usr, :bloque, :ciclo, :salon)', $db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 2, :desc, :alumnos, false, :aula, :duracion, :usr, :bloque, :ciclo, :salon)',
[':f_falta' => $fecha_cambio, ':f_nueva' => $fecha_cambio, ':hora_nueva' => $hora, ':hor' => $hor, [':f_falta' => $fecha_cambio, ':f_nueva' => $fecha_cambio, ':hora_nueva' => $hora, ':hor' => $hor,
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"], ':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"],
':bloque' => $bloque, ':ciclo' => $ciclo, ':salon'=>$salon ':bloque' => $bloque, ':ciclo' => $ciclo, ':salon'=>$salon
] ]
); );
} }
}catch(Exception $e){ }catch(Exception $e){
echo "ERROR Cambio<br>".$e->getMessage(); echo "ERROR Cambio<br>".$e->getMessage();
//header("Location: ".$pag."?error=1"); //header("Location: ".$pag."?error=1");
exit(); exit();
} }
$texto = "<p>Se creó un cambio de salón nuevo.</p>"; $texto = "<p>Se creó un cambio de salón nuevo.</p>";
$texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_falta." a las ".$hora." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora." hrs.</b>"; $texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_falta." a las ".$hora." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora." hrs.</b>";
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarlo.</p>"; $texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarlo.</p>";
/* /*
$log = new LogActividad(); $log = new LogActividad();
$desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_cambio.">".$fecha_cambio_nueva."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]"; $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_cambio.">".$fecha_cambio_nueva."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log); $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/ */
} }
if($to!= "" && ENVIO_CORREOS){ if($to!= "" && ENVIO_CORREOS){
$asunto = "Reposición nueva - solicitud"; $asunto = "Reposición nueva - solicitud";
//crear plantilla //crear plantilla
$texto = '<body > $texto = '<body >
<img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px"> <img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px">
'.$texto.' '.$texto.'
</body>'; </body>';
require_once('../include/phpmailer/PHPMailerAutoload.php'); require_once('../include/phpmailer/PHPMailerAutoload.php');
if($_ENV['DB_NAME'] == "paad_pruebas"){ if($_ENV['DB_NAME'] == "paad_pruebas"){
$asunto = "PRUEBAS-".$asunto; $asunto = "PRUEBAS-".$asunto;
Mailer::enviarCorreo("alejandro.lara@lasalle.mx", $asunto, $texto, true); Mailer::enviarCorreo("alejandro.lara@lasalle.mx", $asunto, $texto, true);
}else{ }else{
Mailer::enviarCorreo($to, $asunto, $texto, true); Mailer::enviarCorreo($to, $asunto, $texto, true);
} }
} }
header("Location: ".$pag."?ok=0"); header("Location: ".$pag."?ok=0");
exit(); exit();
?> ?>

View File

@@ -1,49 +1,49 @@
<?php <?php
/* /*
* Obtiene datos de reposición * Obtiene datos de reposición
*/ */
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
/*if(!$objSesion->tieneAcceso()){ /*if(!$objSesion->tieneAcceso()){
$return["error"] = "Error! No tienes permisos para realizar esta acción."; $return["error"] = "Error! No tienes permisos para realizar esta acción.";
}else*/ if(!isset($_POST["id"])){ }else*/ if(!isset($_POST["id"])){
$return["error"] = "Error! No se recibió la información del profesor."; $return["error"] = "Error! No se recibió la información del profesor.";
}else{ }else{
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
try{ try{
if($user->jefe_carrera){ if($user->jefe_carrera){
$rs = $db->query('SELECT * FROM fs_materiasprofesor(:id, :jefe)', [':id' => $id, ':jefe'=>$user->user["id"]] ); $rs = $db->query('SELECT * FROM fs_materiasprofesor(:id, :jefe)', [':id' => $id, ':jefe'=>$user->user["id"]] );
}else{ }else{
$rs = $db->query('SELECT * FROM fs_materiasprofesor(:id, NULL)', [':id' => $id] ); $rs = $db->query('SELECT * FROM fs_materiasprofesor(:id, NULL)', [':id' => $id] );
} }
}catch(Exception $e){ }catch(Exception $e){
$return["error"] = "Ocurrió un error al leer los datos de las materias."; $return["error"] = "Ocurrió un error al leer los datos de las materias.";
echo json_encode($return); echo json_encode($return);
} }
$mat_arr = array(); $mat_arr = array();
foreach($rs as $m){ foreach($rs as $m){
$mat_arr[] = array("horario_id"=>$m["horario_id"], "horario_dia"=>$m["horario_dia"], $mat_arr[] = array("horario_id"=>$m["horario_id"], "horario_dia"=>$m["horario_dia"],
"horario_hora"=>substr($m["horario_hora"], 0, 2), "horario_min"=>substr($m["horario_hora"], 3, 2), "horario_hora"=>substr($m["horario_hora"], 0, 2), "horario_min"=>substr($m["horario_hora"], 3, 2),
"materia_nombre"=>$m["materia_nombre"].' - '.$m["horario_dia_nombre"]." ".substr($m["horario_hora"], 0, -3), "materia_nombre"=>$m["materia_nombre"].' - '.$m["horario_dia_nombre"]." ".substr($m["horario_hora"], 0, -3),
"grupo"=>$m["horario_grupo"], "duracion" => $m["duracion"] "grupo"=>$m["horario_grupo"], "duracion" => $m["duracion"]
); );
} }
$return["materias"] = $mat_arr; $return["materias"] = $mat_arr;
} }
echo json_encode($return); echo json_encode($return);
?> ?>

View File

@@ -1,91 +1,91 @@
<?php <?php
/* /*
* Obtiene datos de reposición * Obtiene datos de reposición
*/ */
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
/*if(!$objSesion->tieneAcceso()){ /*if(!$objSesion->tieneAcceso()){
$return["error"] = "Error! No tienes permisos para realizar esta acción."; $return["error"] = "Error! No tienes permisos para realizar esta acción.";
}else*/ if(!isset($_POST["id"])){ }else*/ if(!isset($_POST["id"])){
$return["error"] = "Error! No se recibió la información de la reposición."; $return["error"] = "Error! No se recibió la información de la reposición.";
}else{ }else{
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
try{ try{
$rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)', $rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)',
[':id' => $id] [':id' => $id]
); );
/*if($user->rol["rol_id"] == 7){//es supervisor /*if($user->rol["rol_id"] == 7){//es supervisor
$rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, :sup)', $rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, :sup)',
[':id' => $id, ':sup'=>$user->user["id"]] [':id' => $id, ':sup'=>$user->user["id"]]
); );
}else{//coordinador }else{//coordinador
$rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, :fac, NULL, NULL, NULL, NULL, NULL, NULL, null)', $rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, :fac, NULL, NULL, NULL, NULL, NULL, NULL, null)',
[':id' => $id, ":fac"=>$user->facultad["facultad_id"] ] [':id' => $id, ":fac"=>$user->facultad["facultad_id"] ]
); );
}*/ }*/
}catch(Exception $e){ }catch(Exception $e){
$return["error"] = "Ocurrió un error al leer los datos de la reposición."; $return["error"] = "Ocurrió un error al leer los datos de la reposición.";
echo json_encode($return); echo json_encode($return);
exit(); exit();
} }
$return["fecha_clase"] = date('d/m/Y', strtotime($rs["fecha_clase"])); $return["fecha_clase"] = date('d/m/Y', strtotime($rs["fecha_clase"]));
$return["fecha_nueva"] = date('d/m/Y', strtotime($rs["fecha_nueva"])); $return["fecha_nueva"] = date('d/m/Y', strtotime($rs["fecha_nueva"]));
$hora_nueva = explode(":",$rs["hora_nueva"]); $hora_nueva = explode(":",$rs["hora_nueva"]);
$return["hora_ini"] = $hora_nueva[0]; $return["hora_ini"] = $hora_nueva[0];
$return["min_ini"] = $hora_nueva[1]; $return["min_ini"] = $hora_nueva[1];
$hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]); $hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]);
$return["hora_fin"] = $hora_nueva_fin[0]; $return["hora_fin"] = $hora_nueva_fin[0];
$return["min_fin"] = $hora_nueva_fin[1]; $return["min_fin"] = $hora_nueva_fin[1];
$return["duracion"] = $rs["duracion_interval"]; $return["duracion"] = $rs["duracion_interval"];
// $return["carrera"] = $rs["PlanEstudio_desc"]; // $return["carrera"] = $rs["PlanEstudio_desc"];
$return["horario"] = $rs["horario_id"]; $return["horario"] = $rs["horario_id"];
$return["materia"] = $rs["materia_id"]; $return["materia"] = $rs["materia_id"];
$return["materia_desc"] = $rs["materia_nombre"]; $return["materia_desc"] = $rs["materia_nombre"];
$return["salon"] = $rs["salon_id"]; $return["salon"] = $rs["salon_id"];
if($rs["salon_id"]==""){ if($rs["salon_id"]==""){
$return["salon_desc"] = "Pendiente"; $return["salon_desc"] = "Pendiente";
}else{ }else{
$salon_json = json_decode($rs["salon_array"], true); $salon_json = json_decode($rs["salon_array"], true);
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){ if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
unset($salon_json[0]); unset($salon_json[0]);
} }
$return["salon_desc"] = join(" / ",$salon_json); $return["salon_desc"] = join(" / ",$salon_json);
} }
//$return["salon_desc"] = $rs["salon"]=="" ? "-Pendiente-": $rs["salon"]; //$return["salon_desc"] = $rs["salon"]=="" ? "-Pendiente-": $rs["salon"];
$return["ciclo"] = $rs["ciclo"]; $return["ciclo"] = $rs["ciclo"];
$return["bloque"] = $rs["bloque"]; $return["bloque"] = $rs["bloque"];
$return["profesor"] = $rs["profesor_id"]; $return["profesor"] = $rs["profesor_id"];
$return["profesor_nombre"] = $rs["profesor_nombre"]; $return["profesor_nombre"] = $rs["profesor_nombre"];
$return["comentario"] = $rs["descripcion"]; $return["comentario"] = $rs["descripcion"];
$return["alumnos"] = $rs["alumnos"]; $return["alumnos"] = $rs["alumnos"];
$return["tipo"] = $rs["es_reposicion"]; $return["tipo"] = $rs["es_reposicion"];
$return["aula"] = $rs["tipoaula_id"]; $return["aula"] = $rs["tipoaula_id"];
$return["aula_desc"] = $rs["tipoaula_nombre"]; $return["aula_desc"] = $rs["tipoaula_nombre"];
$return["aula_supervisor"] = $rs["tipoaula_supervisor"]; $return["aula_supervisor"] = $rs["tipoaula_supervisor"];
$return["dia"] = date('w', strtotime($rs["fecha_clase"])); $return["dia"] = date('w', strtotime($rs["fecha_clase"]));
$return["motivo_cancelacion"] = $rs["motivo_cancelacion"]; $return["motivo_cancelacion"] = $rs["motivo_cancelacion"];
$return["estado"] = $rs["estado_reposicion_id"]; $return["estado"] = $rs["estado_reposicion_id"];
$return["facultad"] = $rs["facultad_nombre"]; $return["facultad"] = $rs["facultad_nombre"];
$return["carrera"] = $rs["carrera_comun"]? $rs["carrera_nombre"]: ($rs["horario_carrera"]==""?$rs["carrera_nombre"]:$rs["horario_carrera"]);//si es común, se muestra la carrera de la materia, si no, la carrera del horario $return["carrera"] = $rs["carrera_comun"]? $rs["carrera_nombre"]: ($rs["horario_carrera"]==""?$rs["carrera_nombre"]:$rs["horario_carrera"]);//si es común, se muestra la carrera de la materia, si no, la carrera del horario
$return["grupo"] = $rs["horario_grupo"]; $return["grupo"] = $rs["horario_grupo"];
$return["supervisor_nombre"] = $rs["supervisor_nombre"]; $return["supervisor_nombre"] = $rs["supervisor_nombre"];
} }
echo json_encode($return); echo json_encode($return);
?> ?>

View File

@@ -1,125 +1,125 @@
<?php <?php
/* /*
* Actualizar reposiciones * Actualizar reposiciones
*/ */
$pag = "../reposiciones_crear.php"; $pag = "../reposiciones_crear.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
/*if(!isset($_POST["id"]) || !isset($_POST["fecha_falta"]) || !isset($_POST["fecha_inicial"]) || !isset($_POST["hora_ini"]) || !isset($_POST["min_ini"]) || !isset($_POST["materia"]) || !isset($_POST["grupo"])){ /*if(!isset($_POST["id"]) || !isset($_POST["fecha_falta"]) || !isset($_POST["fecha_inicial"]) || !isset($_POST["hora_ini"]) || !isset($_POST["min_ini"]) || !isset($_POST["materia"]) || !isset($_POST["grupo"])){
header("Location: ".$pag."?error=0"); header("Location: ".$pag."?error=0");
exit(); exit();
}*/ }*/
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion $duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
$bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);// $bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);//
$ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);// $ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);//
$fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//limpia texto $fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//limpia texto
$fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//limpia texto $fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//limpia texto
$fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//limpia texto $fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//limpia texto
$hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto $hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto $min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$hor = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT);//limpia texto $hor = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto $alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//1 Repo , 0 Cambio $tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//1 Repo , 0 Cambio
$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad $aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
if(empty($_POST["prof"])) if(empty($_POST["prof"]))
$prof = $user["id"]; $prof = $user["id"];
else else
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto $prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//if(isset($_POST["salon"]) && $_POST["salon"] != "") //if(isset($_POST["salon"]) && $_POST["salon"] != "")
//$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto //$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto $comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]); $duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
$duracion_tiempo = $duracion_rs["duracion_interval"]; $duracion_tiempo = $duracion_rs["duracion_interval"];
$horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor', $horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor',
[':hor' => $hor] [':hor' => $hor]
); );
$materia = $horario_rs["materia_id"]; $materia = $horario_rs["materia_id"];
$dia = $horario_rs["horario_dia"]; $dia = $horario_rs["horario_dia"];
$hora = $hora_ini.":".$min_ini.":00"; $hora = $hora_ini.":".$min_ini.":00";
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
//echo $fecha_new."<br>"; //echo $fecha_new."<br>";
//echo $fecha_fin_new."<br>"; //echo $fecha_fin_new."<br>";
if($tipo == 1){//Reposición if($tipo == 1){//Reposición
$fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d'); $fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_falta)); $dia_falta = date('w', strtotime($fecha_falta));
}else{ }else{
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d'); $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio)); $dia_falta = date('w', strtotime($fecha_cambio));
} }
//Valida que tenga clase en la fecha de falta //Valida que tenga clase en la fecha de falta
if(intval($dia) != intval($dia_falta)){ if(intval($dia) != intval($dia_falta)){
//header("Location:".$pag."?error=11"); //header("Location:".$pag."?error=11");
echo intval($dia)." != ".intval($dia_falta); echo intval($dia)." != ".intval($dia_falta);
exit(); exit();
} }
if($tipo == 1){//Reposición if($tipo == 1){//Reposición
// Valida que grupo no tenga clases // Valida que grupo no tenga clases
/*$result = validaConflictoHoras($pdo, $gpo, $dia, $hora, $materia, "-", $fecha_ini, $fecha_fin, $duracion); /*$result = validaConflictoHoras($pdo, $gpo, $dia, $hora, $materia, "-", $fecha_ini, $fecha_fin, $duracion);
if($result != ""){//error if($result != ""){//error
//echo $result; //echo $result;
header("Location:".$pag."?error=7"); header("Location:".$pag."?error=7");
exit(); exit();
} }
//Valida que profesor no este en 2 reposiciones al mismo tiempo //Valida que profesor no este en 2 reposiciones al mismo tiempo
*/ */
$traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur, :id)', $traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur, :id)',
[':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo, ':id'=>$id] [':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo, ':id'=>$id]
)["traslape_profesor_reposicion"]; )["traslape_profesor_reposicion"];
echo "SELECT * from traslape_profesor_reposicion($prof, '".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."', $hora, $duracion_tiempo, $id)"; echo "SELECT * from traslape_profesor_reposicion($prof, '".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."', $hora, $duracion_tiempo, $id)";
if($traslape){ if($traslape){
//header("Location:".$pag."?error=9"); //header("Location:".$pag."?error=9");
echo "traslape"; echo "traslape";
exit(); exit();
} }
/* /*
$log = new LogActividad(); $log = new LogActividad();
$desc_log = "Actualiza reposición ID[".$id."] Fechas[".$fecha_ini."][".$fecha_fin."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."]"; $desc_log = "Actualiza reposición ID[".$id."] Fechas[".$fecha_ini."][".$fecha_fin."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/ $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
} }
try{ try{
$db->query('SELECT * from fu_reposicion_solicitud(:id, :f_falta, :f_nueva, :hora_nueva, NULL, NULL, :desc, :alumnos, :aula, :duracion, NULL)', $db->query('SELECT * from fu_reposicion_solicitud(:id, :f_falta, :f_nueva, :hora_nueva, NULL, NULL, :desc, :alumnos, :aula, :duracion, NULL)',
[':id'=> $id, ':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, [':id'=> $id, ':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora,
':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo
] ]
); );
}catch(Exception $e){ }catch(Exception $e){
//header("Location: ".$pag."?error=2"); //header("Location: ".$pag."?error=2");
print_r($e->getMessage()); print_r($e->getMessage());
echo "SELECT * from fu_reposicion_solicitud(:id, :f_falta, :f_nueva, :hora_nueva, NULL, NULL, :desc, :alumnos, :aula, :duracion, NULL)'"; echo "SELECT * from fu_reposicion_solicitud(:id, :f_falta, :f_nueva, :hora_nueva, NULL, NULL, :desc, :alumnos, :aula, :duracion, NULL)'";
print_r( print_r(
[':id'=> $id, ':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, [':id'=> $id, ':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora,
':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo
]); ]);
exit(); exit();
} }
header("Location: ".$pag); header("Location: ".$pag);
exit(); exit();
?> ?>

View File

@@ -1,198 +1,198 @@
<?php <?php
/* /*
Cambia de estado la reposición Cambia de estado la reposición
*/ */
$pag = "../solicitudes_autorizar.php"; $pag = "../solicitudes_autorizar.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
require_once "../class/manda_correo.php"; require_once "../class/manda_correo.php";
define("COORDINADOR", 9); define("COORDINADOR", 9);
define("SUPERVISOR", 7); define("SUPERVISOR", 7);
define("ENVIO_CORREOS", true); define("ENVIO_CORREOS", true);
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
$pag = "../solicitudes_autorizar.php"; $pag = "../solicitudes_autorizar.php";
if(!isset($_POST["id"]) || !isset($_POST["edo"]) ){ if(!isset($_POST["id"]) || !isset($_POST["edo"]) ){
header("Location: ".$pag."?error=0"); header("Location: ".$pag."?error=0");
exit(); exit();
} }
$id_sol = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id_sol = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$edo = filter_input(INPUT_POST, "edo", FILTER_SANITIZE_NUMBER_INT);//limpia texto $edo = filter_input(INPUT_POST, "edo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//limpia texto $tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
if(isset($_POST["salon"]) && $_POST["salon"] != "") if(isset($_POST["salon"]) && $_POST["salon"] != "")
$salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto $salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//-------------- //--------------
//Obtiene datos de salón asignado //Obtiene datos de salón asignado
$salon_desc = "Pendiente"; $salon_desc = "Pendiente";
if(!empty($salon)){ if(!empty($salon)){
$salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon', $salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon',
[':id_salon' => $salon] [':id_salon' => $salon]
); );
if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){ if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){
$salon_desc = "Pendiente"; $salon_desc = "Pendiente";
}else{ }else{
$salon_json = json_decode($salon_rs["salon_array"], true); $salon_json = json_decode($salon_rs["salon_array"], true);
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){ if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
unset($salon_json[0]); unset($salon_json[0]);
} }
$salon_desc = join(" / ",$salon_json); $salon_desc = join(" / ",$salon_json);
} }
} }
$solicitud_rs = $db->querySingle('SELECT * from fs_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL)', [':id' => $id_sol]); $solicitud_rs = $db->querySingle('SELECT * from fs_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL)', [':id' => $id_sol]);
if($edo == 4){//cancelación if($edo == 4){//cancelación
$motivo = ""; $motivo = "";
if(isset($_POST["motivo"]) && $_POST["motivo"] != "") if(isset($_POST["motivo"]) && $_POST["motivo"] != "")
$motivo = trim($_POST["motivo"]); $motivo = trim($_POST["motivo"]);
$db->querySingle('SELECT fu_solicitud_cancela(:id, :motivo)', $db->querySingle('SELECT fu_solicitud_cancela(:id, :motivo)',
[':id' => $id_sol, ':motivo' => $motivo] [':id' => $id_sol, ':motivo' => $motivo]
); );
}else{ }else{
if(!empty($salon)){ if(!empty($salon)){
//fu_solicitud(p_solicitud_id, p_fecha_clase , p_fecha_nueva, p_hora_nueva, p_prof_id , p_desc, p_edo, p_alumnos, p_tipoaula , p_salon, p_duracion , p_horario_id , p_bloque, p_ciclo, p_motivo, p_supervisor_id ) //fu_solicitud(p_solicitud_id, p_fecha_clase , p_fecha_nueva, p_hora_nueva, p_prof_id , p_desc, p_edo, p_alumnos, p_tipoaula , p_salon, p_duracion , p_horario_id , p_bloque, p_ciclo, p_motivo, p_supervisor_id )
$db->querySingle('SELECT fu_solicitud(:id, NULL, NULL, NULL, NULL, NULL, :edo, NULL, NULL,:sal, NULL, NULL, NULL, NULL, NULL, NULL)', $db->querySingle('SELECT fu_solicitud(:id, NULL, NULL, NULL, NULL, NULL, :edo, NULL, NULL,:sal, NULL, NULL, NULL, NULL, NULL, NULL)',
[':id' => $id_sol, ':sal' => $salon, ':edo' => $edo] [':id' => $id_sol, ':sal' => $salon, ':edo' => $edo]
); );
}else{ }else{
$db->querySingle('SELECT fu_solicitud(:id, NULL, NULL, NULL, NULL, NULL, :edo, NULL, NULL,NULL, NULL, NULL, NULL, NULL, NULL, NULL)', $db->querySingle('SELECT fu_solicitud(:id, NULL, NULL, NULL, NULL, NULL, :edo, NULL, NULL,NULL, NULL, NULL, NULL, NULL, NULL, NULL)',
[':id' => $id_sol, ':edo' => $edo] [':id' => $id_sol, ':edo' => $edo]
); );
} }
} }
//fecha_nueva, fecha_clase //fecha_nueva, fecha_clase
$fecha_nueva = $solicitud_rs["fecha_nueva"]; $fecha_nueva = $solicitud_rs["fecha_nueva"];
$hora_nueva = $solicitud_rs["hora_nueva"]; $hora_nueva = $solicitud_rs["hora_nueva"];
$fecha_clase = $solicitud_rs["fecha_clase"]; $fecha_clase = $solicitud_rs["fecha_clase"];
$hora_clase = $solicitud_rs["horario_hora"]; $hora_clase = $solicitud_rs["horario_hora"];
$facultad = $solicitud_rs["facultad"]??""; $facultad = $solicitud_rs["facultad"]??"";
//echo $fecha_nueva." ** ".$fecha_clase; //echo $fecha_nueva." ** ".$fecha_clase;
if(!empty($fecha_nueva)){ if(!empty($fecha_nueva)){
$dia_new = date('w', strtotime($fecha_nueva)); $dia_new = date('w', strtotime($fecha_nueva));
//$fecha_nueva = DateTime::createFromFormat('Y-m-d', $fecha_nueva)->format('d/m/Y')." ".$hora_nueva; //$fecha_nueva = DateTime::createFromFormat('Y-m-d', $fecha_nueva)->format('d/m/Y')." ".$hora_nueva;
$fecha_nueva = $fecha_nueva." ".$hora_nueva; $fecha_nueva = $fecha_nueva." ".$hora_nueva;
} }
if(!empty($fecha_clase)){ if(!empty($fecha_clase)){
$dia_falta = date('w', strtotime($fecha_clase)); $dia_falta = date('w', strtotime($fecha_clase));
//$fecha_clase = DateTime::createFromFormat('d/m/Y', $fecha_clase)->format('Y-m-d'); //$fecha_clase = DateTime::createFromFormat('d/m/Y', $fecha_clase)->format('Y-m-d');
} }
switch($edo){ switch($edo){
case 2://Correo a supervisor case 2://Correo a supervisor
switch($tipo){ switch($tipo){
case 1://Reposición case 1://Reposición
$asunto = "Solicitud - Reposición nueva ".$solicitud_rs["clave_dependencia"]." ".$facultad; $asunto = "Solicitud - Reposición nueva ".$solicitud_rs["clave_dependencia"]." ".$facultad;
$texto = "<p>Se creó una nueva solicitud de reposición para: <b>".$solicitud_rs["clave_dependencia"]." ".$facultad."</b>.</p>"; $texto = "<p>Se creó una nueva solicitud de reposición para: <b>".$solicitud_rs["clave_dependencia"]." ".$facultad."</b>.</p>";
$texto .= "<p><b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b>"; $texto .= "<p><b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b>";
break; break;
case 2: case 2:
$asunto = "Solicitud - Cambio de salón ".$solicitud_rs["clave_dependencia"]." ".$facultad; $asunto = "Solicitud - Cambio de salón ".$solicitud_rs["clave_dependencia"]." ".$facultad;
$texto = "<p>Se creó una nueva solicitud de cambio de salón.</p>"; $texto = "<p>Se creó una nueva solicitud de cambio de salón.</p>";
$texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. </b>"; $texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. </b>";
break; break;
case 3: case 3:
$asunto = "Solicitud - Asignación de espacio ".$solicitud_rs["clave_dependencia"]." ".$facultad; $asunto = "Solicitud - Asignación de espacio ".$solicitud_rs["clave_dependencia"]." ".$facultad;
$texto = "<p>Se creó una nueva solicitud de asignación de salón.</p>"; $texto = "<p>Se creó una nueva solicitud de asignación de salón.</p>";
$texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. </b>"; $texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. </b>";
break; break;
case 4: case 4:
$asunto = "Solicitud - Cambio permanente ".$solicitud_rs["clave_dependencia"]." ".$facultad; $asunto = "Solicitud - Cambio permanente ".$solicitud_rs["clave_dependencia"]." ".$facultad;
$texto = "<p>Se creó una nueva solicitud de asignación de salón permanente.</p>"; $texto = "<p>Se creó una nueva solicitud de asignación de salón permanente.</p>";
$texto .= "<p><b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> a partir del día <b>".$fecha_clase." a las ".$hora_orig." hrs. </b> se propone cambiar para el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b>"; $texto .= "<p><b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> a partir del día <b>".$fecha_clase." a las ".$hora_orig." hrs. </b> se propone cambiar para el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b>";
break; break;
} }
//$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>"; //$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::SUPERVISOR); MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::SUPERVISOR);
$ok = 0; $ok = 0;
break; break;
case 3://Correo a coordinador, profesor y jefe case 3://Correo a coordinador, profesor y jefe
switch($tipo){ switch($tipo){
case 1://Reposición case 1://Reposición
$asunto = "Reposición nueva autorizada ".isset($solicitud_rs["materia"])?$solicitud_rs["materia"]:""; $asunto = "Reposición nueva autorizada ".isset($solicitud_rs["materia"])?$solicitud_rs["materia"]:"";
$texto = "<p>Se autorizó la solicitud de reposición.</p>"; $texto = "<p>Se autorizó la solicitud de reposición.</p>";
$texto .= "<p><b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. se repondrá el <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en ".$salon_desc."</b>"; $texto .= "<p><b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. se repondrá el <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en ".$salon_desc."</b>";
break; break;
case 2: case 2:
$asunto = "Cambio de salón autorizado"; $asunto = "Cambio de salón autorizado";
$texto = "<p>Se autorizó la solicitud de cambio de salón.</p>"; $texto = "<p>Se autorizó la solicitud de cambio de salón.</p>";
$texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en ".$salon_desc."</b>"; $texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en ".$salon_desc."</b>";
break; break;
case 3: case 3:
$asunto = "Asignación de espacio autorizada"; $asunto = "Asignación de espacio autorizada";
$texto = "<p>Se autorizó la asignación de salón.</p>"; $texto = "<p>Se autorizó la asignación de salón.</p>";
$texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en ".$salon_desc."</b>"; $texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en ".$salon_desc."</b>";
break; break;
case 4: case 4:
$asunto = "Cambio permanente autorizado ".$solicitud_rs["materia_nombre"]; $asunto = "Cambio permanente autorizado ".$solicitud_rs["materia_nombre"];
$texto = "<p>Se autorizó cambio de salón permanente.</p>"; $texto = "<p>Se autorizó cambio de salón permanente.</p>";
$texto .= "<p><b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> a partir del día <b>".$fecha_clase."</b> la clase será el <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en ".$salon_desc."</b>"; $texto .= "<p><b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> a partir del día <b>".$fecha_clase."</b> la clase será el <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en ".$salon_desc."</b>";
break; break;
} }
$ok = 0; $ok = 0;
$db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)', $db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)',
[':id' => $id_sol, ':sup'=>$user->user["id"]] [':id' => $id_sol, ':sup'=>$user->user["id"]]
); );
MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR| MandaCorreos::PROFESOR| MandaCorreos::JEFE); MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR| MandaCorreos::PROFESOR| MandaCorreos::JEFE);
break; break;
case 4://Correo a coordinador, profesor y jefe case 4://Correo a coordinador, profesor y jefe
switch($tipo){ switch($tipo){
case 1://Reposición case 1://Reposición
$asunto = "Reposición declinada ".$solicitud_rs["materia"]; $asunto = "Reposición declinada ".$solicitud_rs["materia"];
$texto = "<p>La reposición de <b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs.</b> programada para el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo</p>"; $texto = "<p>La reposición de <b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs.</b> programada para el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo</p>";
break; break;
case 2: case 2:
$asunto = "Cambio de salón declinado"; $asunto = "Cambio de salón declinado";
$texto = "<p>La solicitud de cambio de salón para el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo</p>"; $texto = "<p>La solicitud de cambio de salón para el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo</p>";
break; break;
case 3: case 3:
$asunto = "Asignación de espacio declinada"; $asunto = "Asignación de espacio declinada";
$texto = "<p>La asignación de salón para el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo</p>"; $texto = "<p>La asignación de salón para el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo</p>";
break; break;
case 4: case 4:
$asunto = "Cambio permanente declinado ".$solicitud_rs["materia_nombre"]; $asunto = "Cambio permanente declinado ".$solicitud_rs["materia_nombre"];
$texto = "<p>El cambio de salón permanente de <b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs.</b> programada para el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo</p>"; $texto = "<p>El cambio de salón permanente de <b>".mb_strtoupper($solicitud_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs.</b> programada para el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo</p>";
break; break;
} }
$texto .= "<p style='font-style:italic; padding-left:25px'>".$solicitud_rs["motivo"]."</p>"; $texto .= "<p style='font-style:italic; padding-left:25px'>".$solicitud_rs["motivo"]."</p>";
$ok = 1; $ok = 1;
$db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)', $db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)',
[':id' => $id_sol, ':sup'=>$user->user["id"]] [':id' => $id_sol, ':sup'=>$user->user["id"]]
); );
MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR| MandaCorreos::PROFESOR| MandaCorreos::JEFE); MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR| MandaCorreos::PROFESOR| MandaCorreos::JEFE);
break; break;
} }
/* /*
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log); $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/ */
header("Location: ".$pag."?ok=".$ok); header("Location: ".$pag."?ok=".$ok);
exit(); exit();
?> ?>

View File

@@ -1,33 +1,33 @@
<?php <?php
/* /*
* Borra reposición * Borra reposición
*/ */
$pag = "../reposiciones_crear.php"; $pag = "../reposiciones_crear.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
if(!isset($_POST["id"])){ if(!isset($_POST["id"])){
$return["error"] = "Error! No se recibió la información necesaria."; $return["error"] = "Error! No se recibió la información necesaria.";
}else{ }else{
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$creador = $user->user["id"]; $creador = $user->user["id"];
try{ try{
$db->query('SELECT * from fd_solicitud(:id, :creador)', [":id"=> $id, ":creador"=>$creador]); $db->query('SELECT * from fd_solicitud(:id, :creador)', [":id"=> $id, ":creador"=>$creador]);
$return["ok"] = "La solicitud se borró correctamente"; $return["ok"] = "La solicitud se borró correctamente";
}catch(Exception $e){ }catch(Exception $e){
$return["error"] = "Ocurrió un error al borrar la solicitud."; $return["error"] = "Ocurrió un error al borrar la solicitud.";
} }
} }
echo json_encode($return); echo json_encode($return);
?> ?>

View File

@@ -1,206 +1,206 @@
<?php <?php
/* /*
* Inserta reposición * Inserta reposición
*/ */
$pag = "../solicitud_crear.php"; $pag = "../solicitud_crear.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
require_once "../class/manda_correo.php"; require_once "../class/manda_correo.php";
define("COORDINADOR", 9); define("COORDINADOR", 9);
define("ENVIO_CORREOS", true); define("ENVIO_CORREOS", true);
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
//$user->access(); //$user->access();
$estado = filter_input(INPUT_POST, "estado", FILTER_SANITIZE_NUMBER_INT);// $estado = filter_input(INPUT_POST, "estado", FILTER_SANITIZE_NUMBER_INT);//
$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);// $tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion $duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
$bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);// $bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);//
$ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);// $ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);//
$fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//Reposicion $fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//Reposicion
$fecha = trim(htmlspecialchars($_POST["fecha_nueva"], ENT_QUOTES, "UTF-8"));//Reposicion $fecha = trim(htmlspecialchars($_POST["fecha_nueva"], ENT_QUOTES, "UTF-8"));//Reposicion
$fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//Cambio salón $fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//Cambio salón
$hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto hora reposicion $hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto hora reposicion
$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto $min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$horario = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT);//limpia texto $horario = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto $alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad $aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
$salon = NULL; $salon = NULL;
/*if(!$user->jefe_carrera){//coordinador /*if(!$user->jefe_carrera){//coordinador
if(isset($_POST["salon"]) && $_POST["salon"] != "") if(isset($_POST["salon"]) && $_POST["salon"] != "")
$salon = filter_input(INPUT_POST, "dlSalon", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad $salon = filter_input(INPUT_POST, "dlSalon", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
}*/ }*/
if(empty($_POST["prof"])) if(empty($_POST["prof"]))
$prof = $user->user["id"]; $prof = $user->user["id"];
else else
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto $prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto $comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]); $duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
$duracion_tiempo = $duracion_rs["duracion_interval"]; $duracion_tiempo = $duracion_rs["duracion_interval"];
//-- Obtiene datos de horario regular de clase //-- Obtiene datos de horario regular de clase
if($horario!= null && $tipo !=3) if($horario!= null && $tipo !=3)
{ {
$horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor', $horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor',
[':hor' => $horario] [':hor' => $horario]
); );
$materia = $horario_rs["materia_id"]; $materia = $horario_rs["materia_id"];
$dia = $horario_rs["horario_dia"]; $dia = $horario_rs["horario_dia"];
$hora_orig = $horario_rs["horario_hora"]; $hora_orig = $horario_rs["horario_hora"];
}else{ }else{
$dia = date('w', strtotime($fecha)); $dia = date('w', strtotime($fecha));
} }
$hora = $hora_ini.":".$min_ini.":00"; $hora = $hora_ini.":".$min_ini.":00";
switch($tipo){ switch($tipo){
case 1://Reposición case 1://Reposición
$fecha_nueva = $fecha; $fecha_nueva = $fecha;
$fecha_clase = $fecha_falta; $fecha_clase = $fecha_falta;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
$fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d'); $fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_falta)); $dia_falta = date('w', strtotime($fecha_falta));
//Valida que tenga clase en la fecha de falta //Valida que tenga clase en la fecha de falta
if(intval($dia) != intval($dia_falta)){ if(intval($dia) != intval($dia_falta)){
header("Location:".$pag."?error=11"); header("Location:".$pag."?error=11");
/*print_r($_POST); /*print_r($_POST);
echo 'SELECT * from horario_view where horario_id = '.$horario; echo 'SELECT * from horario_view where horario_id = '.$horario;
echo intval($dia)." != ".intval($dia_falta);*/ echo intval($dia)." != ".intval($dia_falta);*/
exit(); exit();
} }
break; break;
case 2://Cambio case 2://Cambio
$fecha_nueva = $fecha_cambio; $fecha_nueva = $fecha_cambio;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d'); $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio)); $dia_falta = date('w', strtotime($fecha_cambio));
break; break;
case 3://Solicitud de espacio case 3://Solicitud de espacio
$fecha_nueva = $fecha; $fecha_nueva = $fecha;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
break; break;
case 4://Cambio permanente case 4://Cambio permanente
$fecha_nueva = $fecha; $fecha_nueva = $fecha;
$fecha_clase = $fecha_cambio; $fecha_clase = $fecha_cambio;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d')." ".$hora; $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
break; break;
} }
if(isset($materia) && $materia!= null && $tipo !=3){ if(isset($materia) && $materia!= null && $tipo !=3){
//Obtiene materia //Obtiene materia
$materia_rs = $db->querySingle('SELECT materia_nombre from materia where materia_id = :mat',[':mat' => $materia]); $materia_rs = $db->querySingle('SELECT materia_nombre from materia where materia_id = :mat',[':mat' => $materia]);
} }
$query = ":f_falta, :f_nueva, :hora_nueva, :prof, :desc, :edo, :alumnos, :aula, :solicitudtipo, :usr, :duracion, :hor, :bloque, :ciclo"; $query = ":f_falta, :f_nueva, :hora_nueva, :prof, :desc, :edo, :alumnos, :aula, :solicitudtipo, :usr, :duracion, :hor, :bloque, :ciclo";
switch($tipo){ switch($tipo){
case 1://Reposición case 1://Reposición
$traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)', $traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)',
[':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo] [':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo]
)["traslape_profesor_reposicion"]; )["traslape_profesor_reposicion"];
if($traslape){ if($traslape){
//print_r($_POST); //print_r($_POST);
//echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)"; //echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)";
header("Location:".$pag."?error=9"); header("Location:".$pag."?error=9");
exit(); exit();
} }
$db_params=[ $db_params=[
":f_falta"=>$fecha_falta, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario, ":f_falta"=>$fecha_falta, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario,
":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"], ":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"],
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo ":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
]; ];
$asunto = "Solicitud - Reposición nueva"; $asunto = "Solicitud - Reposición nueva";
$texto = "<p>Se creó una nueva solicitud de reposición.</p>"; $texto = "<p>Se creó una nueva solicitud de reposición.</p>";
$texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_falta." a las ".$hora_orig." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora." hrs.</b>"; $texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_falta." a las ".$hora_orig." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora." hrs.</b>";
/* /*
$log = new LogActividad(); $log = new LogActividad();
$desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$horario."] Alumnos[".$alumnos."]"; $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$horario."] Alumnos[".$alumnos."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/ $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
break; break;
case 2: case 2:
$db_params=[ $db_params=[
":f_falta"=>$fecha_cambio, ":f_nueva"=>$fecha_cambio, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario, ":f_falta"=>$fecha_cambio, ":f_nueva"=>$fecha_cambio, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario,
":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"], ":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"],
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo ":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
]; ];
$asunto = "Solicitud - Cambio de salón"; $asunto = "Solicitud - Cambio de salón";
$texto = "<p>Se creó una nueva solicitud de cambio de salón.</p>"; $texto = "<p>Se creó una nueva solicitud de cambio de salón.</p>";
$texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora." hrs. </b>"; $texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora." hrs. </b>";
/* /*
$log = new LogActividad(); $log = new LogActividad();
$desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_cambio.">".$fecha_cambio_nueva."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$horario."] Alumnos[".$alumnos."]"; $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_cambio.">".$fecha_cambio_nueva."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$horario."] Alumnos[".$alumnos."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log); $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/ */
break; break;
case 3: case 3:
$db_params=[ $db_params=[
":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario,
":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"], ":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"],
":duracion"=>$duracion_tiempo ":duracion"=>$duracion_tiempo
]; ];
$query = "null, :f_nueva, :hora_nueva, :prof, :desc, :edo, :alumnos, :aula, :solicitudtipo, :usr, :duracion"; $query = "null, :f_nueva, :hora_nueva, :prof, :desc, :edo, :alumnos, :aula, :solicitudtipo, :usr, :duracion";
$asunto = "Solicitud - Asignación de espacio"; $asunto = "Solicitud - Asignación de espacio";
$texto = "<p>Se creó una nueva solicitud de asignación de salón.</p>"; $texto = "<p>Se creó una nueva solicitud de asignación de salón.</p>";
$texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora." hrs. </b>"; $texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora." hrs. </b>";
break; break;
case 4: case 4:
$db_params=[ $db_params=[
":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario,
":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"], ":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"],
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo ":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
]; ];
$query = "NULL, :f_nueva, :hora_nueva, :prof, :desc, :edo, :alumnos, :aula, :solicitudtipo, :usr, :duracion, :hor, :bloque, :ciclo"; $query = "NULL, :f_nueva, :hora_nueva, :prof, :desc, :edo, :alumnos, :aula, :solicitudtipo, :usr, :duracion, :hor, :bloque, :ciclo";
$asunto = "Solicitud - Cambio permanente"; $asunto = "Solicitud - Cambio permanente";
$texto = "<p>Se creó una nueva solicitud de asignación de salón permanente.</p>"; $texto = "<p>Se creó una nueva solicitud de asignación de salón permanente.</p>";
$texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> a partir del día <b>".$fecha_clase." a las ".$hora_orig." hrs. </b> se propone cambiar para el <b>".$fecha_nueva." a las ".$hora." hrs.</b>"; $texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> a partir del día <b>".$fecha_clase." a las ".$hora_orig." hrs. </b> se propone cambiar para el <b>".$fecha_nueva." a las ".$hora." hrs.</b>";
break; break;
} }
try{ try{
$db->query("SELECT * from fi_solicitud($query)", $db_params); $db->query("SELECT * from fi_solicitud($query)", $db_params);
}catch(Exception $e){ }catch(Exception $e){
echo "ERROR Cambio<br>".$e->getMessage(); echo "ERROR Cambio<br>".$e->getMessage();
echo $query; echo $query;
print_r($db_params); print_r($db_params);
//header("Location: ".$pag."?error=1"); //header("Location: ".$pag."?error=1");
exit(); exit();
} }
if(!MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR)){ if(!MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR)){
echo "ERROR Correo<br>"; echo "ERROR Correo<br>";
//header("Location: ".$pag."?error=2"); //header("Location: ".$pag."?error=2");
exit(); exit();
} }
header("Location: ".$pag."?ok=0"); header("Location: ".$pag."?ok=0");
exit(); exit();
?> ?>

View File

@@ -1,101 +1,101 @@
<?php <?php
/* /*
* Obtiene datos de reposición * Obtiene datos de reposición
*/ */
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
/*if(!$objSesion->tieneAcceso()){ /*if(!$objSesion->tieneAcceso()){
$return["error"] = "Error! No tienes permisos para realizar esta acción."; $return["error"] = "Error! No tienes permisos para realizar esta acción.";
}else*/ if(!isset($_POST["id"])){ }else*/ if(!isset($_POST["id"])){
$return["error"] = "Error! No se recibió la información de la reposición."; $return["error"] = "Error! No se recibió la información de la reposición.";
}else{ }else{
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
try{ try{
if($user->rol["rol_id"] == 7){//es supervisor if($user->rol["rol_id"] == 7){//es supervisor
$rs = $db->querySingle('SELECT * from fs_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, :sup)', $rs = $db->querySingle('SELECT * from fs_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, :sup)',
[':id' => $id, ':sup'=>$user->user["id"]] [':id' => $id, ':sup'=>$user->user["id"]]
); );
}else{//coordinador }else{//coordinador
$rs = $db->querySingle('SELECT * from fs_solicitud(:id, :fac, NULL, NULL, NULL, NULL, NULL, null)', $rs = $db->querySingle('SELECT * from fs_solicitud(:id, :fac, NULL, NULL, NULL, NULL, NULL, null)',
[':id' => $id, ":fac"=>$user->facultad["facultad_id"] ] [':id' => $id, ":fac"=>$user->facultad["facultad_id"] ]
); );
} }
}catch(Exception $e){ }catch(Exception $e){
$return["error"] = "Ocurrió un error al leer los datos de la reposición."; $return["error"] = "Ocurrió un error al leer los datos de la reposición.";
echo json_encode($return); echo json_encode($return);
exit(); exit();
} }
$dias = array('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'); $dias = array('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado');
if($rs["solicitudtipo_id"]!=3){ if($rs["solicitudtipo_id"]!=3){
$hora_nueva = explode(":",$rs["horario_hora"]); $hora_nueva = explode(":",$rs["horario_hora"]);
} }
if($rs["solicitudtipo_id"]!=4){ if($rs["solicitudtipo_id"]!=4){
$return["fecha_clase"] = isset($rs["fecha_clase"]) ? date('d/m/Y', strtotime($rs["fecha_clase"])):''; $return["fecha_clase"] = isset($rs["fecha_clase"]) ? date('d/m/Y', strtotime($rs["fecha_clase"])):'';
}else{ }else{
$return["fecha_clase"] = $dias[$rs["horario_dia"]]; $return["fecha_clase"] = $dias[$rs["horario_dia"]];
} }
$return["hora_clase_ini"] = $rs["horario_hora"]; $return["hora_clase_ini"] = $rs["horario_hora"];
$return["hora_clase_fin"] = $rs["horario_hora_fin"]; $return["hora_clase_fin"] = $rs["horario_hora_fin"];
$return["fecha_nueva"] = isset($rs["fecha_nueva"]) ? date('d/m/Y', strtotime($rs["fecha_nueva"])):''; $return["fecha_nueva"] = isset($rs["fecha_nueva"]) ? date('d/m/Y', strtotime($rs["fecha_nueva"])):'';
$return["hora_nueva"] = $rs["hora_nueva"]; $return["hora_nueva"] = $rs["hora_nueva"];
$hora_nueva = explode(":",$rs["hora_nueva"]); $hora_nueva = explode(":",$rs["hora_nueva"]);
$return["hora_ini"] = $hora_nueva[0]; $return["hora_ini"] = $hora_nueva[0];
$return["min_ini"] = $hora_nueva[1]; $return["min_ini"] = $hora_nueva[1];
$return["hora_nueva_fin"] = $rs["hora_nueva_fin"]; $return["hora_nueva_fin"] = $rs["hora_nueva_fin"];
$hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]); $hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]);
$return["hora_fin"] = $hora_nueva_fin[0]; $return["hora_fin"] = $hora_nueva_fin[0];
$return["min_fin"] = $hora_nueva_fin[1]; $return["min_fin"] = $hora_nueva_fin[1];
$return["duracion"] = $rs["duracion_interval"]; $return["duracion"] = $rs["duracion_interval"];
// $return["carrera"] = $rs["PlanEstudio_desc"]; // $return["carrera"] = $rs["PlanEstudio_desc"];
$return["horario"] = $rs["horario_id"]; $return["horario"] = $rs["horario_id"];
$return["materia"] = $rs["materia_id"]; $return["materia"] = $rs["materia_id"];
$return["materia_desc"] = $rs["materia_nombre"]; $return["materia_desc"] = $rs["materia_nombre"];
$return["salon"] = $rs["salon_id"]; $return["salon"] = $rs["salon_id"];
if($rs["salon_id"]==""){ if($rs["salon_id"]==""){
$return["salon_desc"] = "Pendiente"; $return["salon_desc"] = "Pendiente";
}else{ }else{
$salon_json = json_decode($rs["salon_array"], true); $salon_json = json_decode($rs["salon_array"], true);
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){ if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
unset($salon_json[0]); unset($salon_json[0]);
} }
$return["salon_desc"] = join(" / ",$salon_json); $return["salon_desc"] = join(" / ",$salon_json);
} }
$return["ciclo"] = $rs["ciclo"]; $return["ciclo"] = $rs["ciclo"];
$return["bloque"] = $rs["bloque"]; $return["bloque"] = $rs["bloque"];
$return["profesor"] = $rs["profesor_id"]; $return["profesor"] = $rs["profesor_id"];
$return["profesor_nombre"] = $rs["profesor_nombre"]; $return["profesor_nombre"] = $rs["profesor_nombre"];
$return["comentario"] = $rs["descripcion"]; $return["comentario"] = $rs["descripcion"];
$return["alumnos"] = $rs["alumnos"]; $return["alumnos"] = $rs["alumnos"];
$return["aula"] = $rs["tipoaula_id"]; $return["aula"] = $rs["tipoaula_id"];
$return["aula_desc"] = $rs["tipoaula_nombre"]; $return["aula_desc"] = $rs["tipoaula_nombre"];
$return["aula_supervisor"] = $rs["tipoaula_supervisor"]; $return["aula_supervisor"] = $rs["tipoaula_supervisor"];
$return["dia_nombre"] = isset($rs["fecha_clase"]) ? date('w', strtotime($rs["fecha_clase"])): ''; $return["dia_nombre"] = isset($rs["fecha_clase"]) ? date('w', strtotime($rs["fecha_clase"])): '';
$return["dia"] = isset($rs["fecha_clase"]) ? $dias[date('w', strtotime($rs["fecha_clase"]))]: ''; $return["dia"] = isset($rs["fecha_clase"]) ? $dias[date('w', strtotime($rs["fecha_clase"]))]: '';
$return["motivo_cancelacion"] = $rs["motivo_cancelacion"]; $return["motivo_cancelacion"] = $rs["motivo_cancelacion"];
$return["estado"] = $rs["estado_reposicion_id"]; $return["estado"] = $rs["estado_reposicion_id"];
$return["facultad"] = $rs["facultad_nombre"]; $return["facultad"] = $rs["facultad_nombre"];
$return["carrera"] = $rs["carrera_comun"]? $rs["carrera_nombre"]:$rs["horario_carrera"];//si es común, se muestra la carrera de la materia, si no, la carrera del horario $return["carrera"] = $rs["carrera_comun"]? $rs["carrera_nombre"]:$rs["horario_carrera"];//si es común, se muestra la carrera de la materia, si no, la carrera del horario
$return["grupo"] = $rs["horario_grupo"]; $return["grupo"] = $rs["horario_grupo"];
$return["supervisor_nombre"] = $rs["supervisor_nombre"]; $return["supervisor_nombre"] = $rs["supervisor_nombre"];
$return["solicitudtipo_id"] = $rs["solicitudtipo_id"]; $return["solicitudtipo_id"] = $rs["solicitudtipo_id"];
$return["solicitudtipo"] = $rs["solicitudtipo_nombre"]; $return["solicitudtipo"] = $rs["solicitudtipo_nombre"];
} }
echo json_encode($return); echo json_encode($return);
?> ?>

View File

@@ -1,197 +1,197 @@
<?php <?php
/* /*
* Actualiza reposición * Actualiza reposición
*/ */
$pag = "../solicitud_crear.php"; $pag = "../solicitud_crear.php";
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
require_once "../class/manda_correo.php"; require_once "../class/manda_correo.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die('No se ha iniciado sesión'); die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
/*if(!isset($_POST["id"]) || !isset($_POST["fecha_falta"]) || !isset($_POST["fecha_inicial"]) || !isset($_POST["hora_ini"]) || !isset($_POST["min_ini"]) || !isset($_POST["materia"]) || !isset($_POST["grupo"])){ /*if(!isset($_POST["id"]) || !isset($_POST["fecha_falta"]) || !isset($_POST["fecha_inicial"]) || !isset($_POST["hora_ini"]) || !isset($_POST["min_ini"]) || !isset($_POST["materia"]) || !isset($_POST["grupo"])){
header("Location: ".$pag."?error=0"); header("Location: ".$pag."?error=0");
exit(); exit();
}*/ }*/
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//1 a 4 $tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//1 a 4
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion $duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
$bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);// $bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);//
$ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);// $ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);//
$fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//limpia texto $fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//limpia texto
$fecha = trim(htmlspecialchars($_POST["fecha_nueva"], ENT_QUOTES, "UTF-8"));//limpia texto $fecha = trim(htmlspecialchars($_POST["fecha_nueva"], ENT_QUOTES, "UTF-8"));//limpia texto
$fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//limpia texto $fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//limpia texto
$hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto $hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto $min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$horario = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT);//limpia texto $horario = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto $alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto
$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad $aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
if(empty($_POST["prof"])) if(empty($_POST["prof"]))
$prof = $user["id"]; $prof = $user["id"];
else else
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto $prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//if(isset($_POST["salon"]) && $_POST["salon"] != "") //if(isset($_POST["salon"]) && $_POST["salon"] != "")
//$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto //$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto $comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]); $duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
$duracion_tiempo = $duracion_rs["duracion_interval"]; $duracion_tiempo = $duracion_rs["duracion_interval"];
//-- Obtiene datos de horario regular de clase //-- Obtiene datos de horario regular de clase
if($horario!= null && $tipo !=3) if($horario!= null && $tipo !=3)
{ {
$horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor', $horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor',
[':hor' => $horario] [':hor' => $horario]
); );
$materia = $horario_rs["materia_id"]; $materia = $horario_rs["materia_id"];
$dia = $horario_rs["horario_dia"]; $dia = $horario_rs["horario_dia"];
$hora_orig = $horario_rs["horario_hora"]; $hora_orig = $horario_rs["horario_hora"];
}else{ }else{
$dia = date('w', strtotime($fecha)); $dia = date('w', strtotime($fecha));
} }
$hora = $hora_ini.":".$min_ini.":00"; $hora = $hora_ini.":".$min_ini.":00";
switch($tipo){ switch($tipo){
case 1://Reposición case 1://Reposición
$fecha_nueva = $fecha; $fecha_nueva = $fecha;
$fecha_clase = $fecha_falta; $fecha_clase = $fecha_falta;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
$fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d'); $fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_falta)); $dia_falta = date('w', strtotime($fecha_falta));
//Valida que tenga clase en la fecha de falta //Valida que tenga clase en la fecha de falta
if(intval($dia) != intval($dia_falta)){ if(intval($dia) != intval($dia_falta)){
header("Location:".$pag."?error=11"); header("Location:".$pag."?error=11");
/*print_r($_POST); /*print_r($_POST);
echo 'SELECT * from horario_view where horario_id = '.$horario; echo 'SELECT * from horario_view where horario_id = '.$horario;
echo intval($dia)." != ".intval($dia_falta);*/ echo intval($dia)." != ".intval($dia_falta);*/
exit(); exit();
} }
break; break;
case 2://Cambio case 2://Cambio
$fecha_nueva = $fecha_cambio; $fecha_nueva = $fecha_cambio;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d'); $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio)); $dia_falta = date('w', strtotime($fecha_cambio));
break; break;
case 3://Solicitud de espacio case 3://Solicitud de espacio
$fecha_nueva = $fecha; $fecha_nueva = $fecha;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
break; break;
case 4://Cambio permanente case 4://Cambio permanente
$fecha_nueva = $fecha_new; $fecha_nueva = $fecha_new;
$fecha_clase = $fecha_cambio; $fecha_clase = $fecha_cambio;
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d')." ".$hora; $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d')." ".$hora;
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new)); $dia_new = date('w', strtotime($fecha_new));
break; break;
} }
if(isset($materia) && $materia!= null && $tipo !=3){ if(isset($materia) && $materia!= null && $tipo !=3){
//Obtiene materia //Obtiene materia
$materia_rs = $db->querySingle('SELECT materia_nombre from materia where materia_id = :mat',[':mat' => $materia]); $materia_rs = $db->querySingle('SELECT materia_nombre from materia where materia_id = :mat',[':mat' => $materia]);
} }
$query = ":id, :f_falta, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, :hor, :bloque, :ciclo, NULL, NULL"; $query = ":id, :f_falta, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, :hor, :bloque, :ciclo, NULL, NULL";
switch($tipo){ switch($tipo){
case 1://Reposición case 1://Reposición
$traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)', $traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)',
[':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo] [':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo]
)["traslape_profesor_reposicion"]; )["traslape_profesor_reposicion"];
if($traslape){ if($traslape){
//print_r($_POST); //print_r($_POST);
//echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)"; //echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)";
header("Location:".$pag."?error=9"); header("Location:".$pag."?error=9");
exit(); exit();
} }
$db_params=[ $db_params=[
"id"=>$id, ":f_falta"=>$fecha_falta, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, "id"=>$id, ":f_falta"=>$fecha_falta, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula, ":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo ":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
]; ];
$asunto = "Solicitud - Reposición nueva"; $asunto = "Solicitud - Reposición nueva";
$texto = "<p>Se actualizó una solicitud de reposición.</p>"; $texto = "<p>Se actualizó una solicitud de reposición.</p>";
$texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_falta." a las ".$hora_orig." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora." hrs.</b>"; $texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_falta." a las ".$hora_orig." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora." hrs.</b>";
/* /*
$log = new LogActividad(); $log = new LogActividad();
$desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$horario."] Alumnos[".$alumnos."]"; $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$horario."] Alumnos[".$alumnos."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/ $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
break; break;
case 2: case 2:
$db_params=[ $db_params=[
"id"=>$id, ":f_falta"=>$fecha_falta, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, "id"=>$id, ":f_falta"=>$fecha_falta, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula, ":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo ":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
]; ];
$asunto = "Solicitud - Cambio de salón"; $asunto = "Solicitud - Cambio de salón";
$texto = "<p>Se actualizó una solicitud de cambio de salón.</p>"; $texto = "<p>Se actualizó una solicitud de cambio de salón.</p>";
$texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora." hrs. </b>"; $texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora." hrs. </b>";
/* /*
$log = new LogActividad(); $log = new LogActividad();
$desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_cambio.">".$fecha_cambio_nueva."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$horario."] Alumnos[".$alumnos."]"; $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_cambio.">".$fecha_cambio_nueva."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$horario."] Alumnos[".$alumnos."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log); $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/ */
break; break;
case 3: case 3:
$db_params=[ $db_params=[
"id"=>$id, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, "id"=>$id, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula, ":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo ":duracion"=>$duracion_tiempo
]; ];
$query = ":id, NULL, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, NULL, NULL, NULL, NULL, NULL"; $query = ":id, NULL, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, NULL, NULL, NULL, NULL, NULL";
$asunto = "Solicitud - Asignación de espacio"; $asunto = "Solicitud - Asignación de espacio";
$texto = "<p>Se actualizó una solicitud de asignación de salón.</p>"; $texto = "<p>Se actualizó una solicitud de asignación de salón.</p>";
$texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora." hrs. </b>"; $texto .= "<p>El día <b>".$fecha_nueva." a las ".$hora." hrs. </b>";
break; break;
case 4: case 4:
$db_params=[ $db_params=[
"id"=>$id, ":f_falta"=>$fecha_cambio, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, "id"=>$id, ":f_falta"=>$fecha_cambio, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula, ":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo ":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
]; ];
$query = ":id, :f_falta, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, :hor, :bloque, :ciclo, NULL, NULL"; $query = ":id, :f_falta, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, :hor, :bloque, :ciclo, NULL, NULL";
$asunto = "Solicitud - Cambio permanente"; $asunto = "Solicitud - Cambio permanente";
$texto = "<p>Se actualizó una solicitud de asignación de salón permanente.</p>"; $texto = "<p>Se actualizó una solicitud de asignación de salón permanente.</p>";
$texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_orig." hrs. </b> se propone cambiar para el <b>".$fecha_nueva." a las ".$hora." hrs.</b>"; $texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_orig." hrs. </b> se propone cambiar para el <b>".$fecha_nueva." a las ".$hora." hrs.</b>";
break; break;
} }
try{ try{
$db->query("SELECT * from fu_solicitud($query)", $db_params); $db->query("SELECT * from fu_solicitud($query)", $db_params);
MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR); MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR);
}catch(Exception $e){ }catch(Exception $e){
echo "ERROR Cambio<br>".$e->getMessage(); echo "ERROR Cambio<br>".$e->getMessage();
//echo $query; //echo $query;
//print_r($db_params); //print_r($db_params);
//header("Location: ".$pag."?error=1"); //header("Location: ".$pag."?error=1");
exit(); exit();
} }
header("Location: ".$pag); header("Location: ".$pag);
exit(); exit();
?> ?>

View File

@@ -1,28 +1,28 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
$ruta = "../"; $ruta = "../";
require_once "../class/c_login.php"; require_once "../class/c_login.php";
// check if the session is started // check if the session is started
if (!isset($_SESSION['user'])) if (!isset($_SESSION['user']))
die(json_encode(['error' => 'No se ha iniciado sesión'])); die(json_encode(['error' => 'No se ha iniciado sesión']));
$user = unserialize($_SESSION['user']); $user = unserialize($_SESSION['user']);
$ruta = "../"; $ruta = "../";
require_once "../include/bd_pdo.php"; require_once "../include/bd_pdo.php";
$facultad_id = $user->facultad['facultad_id']; $facultad_id = $user->facultad['facultad_id'];
$materias = $db->query(<<<SQL $materias = $db->query(<<<SQL
SELECT usuario_id, usuario_nombre, usuario_clave SELECT usuario_id, usuario_nombre, usuario_clave
FROM usuario FROM usuario
WHERE WHERE
(facultad_id = :facultad_id OR :facultad_id IS NULL) (facultad_id = :facultad_id OR :facultad_id IS NULL)
ORDER BY usuario_nombre ASC ORDER BY usuario_nombre ASC
SQL, SQL,
array('facultad_id' => $facultad_id) array('facultad_id' => $facultad_id)
); );
// $user->print_to_log("Crea carrera", old: $_POST); // $user->print_to_log("Crea carrera", old: $_POST);
die(json_encode($materias)); die(json_encode($materias));

View File

@@ -1,34 +1,34 @@
<?php <?php
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/database.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/database.php";
$rawInput = file_get_contents('php://input'); $rawInput = file_get_contents('php://input');
$input = json_decode($rawInput, true); $input = json_decode($rawInput, true);
if (!$rawInput || !isset($input['profesor_id'], $input['log_id']) || $_SERVER['REQUEST_METHOD'] !== 'POST') { if (!$rawInput || !isset($input['profesor_id'], $input['log_id']) || $_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(400); http_response_code(400);
echo json_encode(['error' => 'Request error.']); echo json_encode(['error' => 'Request error.']);
die(); die();
} }
$periodos = array_map(fn($array) => $array['id_periodo_sgu'], $db $periodos = array_map(fn($array) => $array['id_periodo_sgu'], $db
->join('periodo', 'periodo.periodo_id = horario_view.periodo_id') ->join('periodo', 'periodo.periodo_id = horario_view.periodo_id')
->join('horario_profesor', 'horario_profesor.horario_id = horario_view.horario_id') ->join('horario_profesor', 'horario_profesor.horario_id = horario_view.horario_id')
->where('profesor_id', $input['profesor_id']) ->where('profesor_id', $input['profesor_id'])
->groupBy('id_periodo_sgu') ->groupBy('id_periodo_sgu')
->orderBy('id_periodo_sgu', 'DESC') ->orderBy('id_periodo_sgu', 'DESC')
->get('horario_view', 5, 'id_periodo_sgu')); ->get('horario_view', 5, 'id_periodo_sgu'));
$clave_profesor = $db->where('profesor_id', $input['profesor_id'])->getOne('profesor', 'profesor_clave')['profesor_clave']; $clave_profesor = $db->where('profesor_id', $input['profesor_id'])->getOne('profesor', 'profesor_clave')['profesor_clave'];
$horarios = []; $horarios = [];
$rest = new Horarios(); $rest = new Horarios();
foreach ($periodos as $periodo) { foreach ($periodos as $periodo) {
$horarios = array_merge($horarios, $rest->get(data: ['idPeriodo' => $periodo, 'claveProfesor' => $clave_profesor, 'fecha' => date('Y-m-d')])); $horarios = array_merge($horarios, $rest->get(data: ['idPeriodo' => $periodo, 'claveProfesor' => $clave_profesor, 'fecha' => date('Y-m-d')]));
} }
$db $db
->where('log_id', $input['log_id']) ->where('log_id', $input['log_id'])
->update("log_registro", ['horario_web' => json_encode($horarios)]); ->update("log_registro", ['horario_web' => json_encode($horarios)]);

View File

@@ -1,147 +1,147 @@
<? <?
$ruta = '../'; $ruta = '../';
require "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php"; require "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
trait DatabaseModel trait DatabaseModel
{ {
public function __construct(protected string $tableName, protected array $columns = []) public function __construct(protected string $tableName, protected array $columns = [])
{ {
} }
public function get(array $params = [], string $what = '*') public function get(array $params = [], string $what = '*')
{ {
global $db; global $db;
$conditions = []; $conditions = [];
foreach ($params as $key => $value) { foreach ($params as $key => $value) {
$conditions[] = "$key = :$key"; $conditions[] = "$key = :$key";
} }
$sql = "SELECT $what FROM $this->tableName"; $sql = "SELECT $what FROM $this->tableName";
if ($conditions) { if ($conditions) {
$sql .= " WHERE " . implode(" AND ", $conditions); $sql .= " WHERE " . implode(" AND ", $conditions);
} }
$result = $db->query($sql, $params); $result = $db->query($sql, $params);
return $result; return $result;
} }
protected function insert__(array $params = [], ?string $where = null) protected function insert__(array $params = [], ?string $where = null)
{ {
global $db; global $db;
if ($where === null) { if ($where === null) {
$where = $this->tableName; $where = $this->tableName;
} }
$columns = []; $columns = [];
foreach ($params as $key => $value) { foreach ($params as $key => $value) {
$columns[] = "$key = :$key"; $columns[] = "$key = :$key";
} }
$sql = "INSERT INTO $where SET " . implode(", ", $columns); $sql = "INSERT INTO $where SET " . implode(", ", $columns);
$result = $db->query($sql, $params); $result = $db->query($sql, $params);
return $result; return $result;
} }
} }
abstract class WebServiceSGU abstract class WebServiceSGU
{ {
const BASE_URL = "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial"; const BASE_URL = "https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial";
private static array $keys = [ private static array $keys = [
'username' => 'SGU_APSA_AUD_ASIST', 'username' => 'SGU_APSA_AUD_ASIST',
'password' => 'B4qa594JFPr2ufHrZdHS8A==', 'password' => 'B4qa594JFPr2ufHrZdHS8A==',
]; ];
private static ?JsonSchema\Validator $validator = null; private static ?JsonSchema\Validator $validator = null;
private string $baseUrl; private string $baseUrl;
public function __construct(protected string $endpoint, protected ?string $schema = null) public function __construct(protected string $endpoint, protected ?string $schema = null)
{ {
$this->baseUrl = self::BASE_URL . $endpoint; $this->baseUrl = self::BASE_URL . $endpoint;
} }
private static function initCurl(array $options = []) private static function initCurl(array $options = [])
{ {
$ch = curl_init(); $ch = curl_init();
curl_setopt_array($ch, $options); curl_setopt_array($ch, $options);
return $ch; return $ch;
} }
private static function get_token(): string private static function get_token(): string
{ {
$curl = self::initCurl([ $curl = self::initCurl([
CURLOPT_URL => self::BASE_URL . "/inicioSesion/seleccionar", CURLOPT_URL => self::BASE_URL . "/inicioSesion/seleccionar",
CURLOPT_RETURNTRANSFER => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => ["Content-Type: application/json"], CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode(self::$keys), CURLOPT_POSTFIELDS => json_encode(self::$keys),
]); ]);
$response = curl_exec($curl); $response = curl_exec($curl);
$err = curl_error($curl); $err = curl_error($curl);
curl_close($curl); curl_close($curl);
if ($err) if ($err)
throw new Exception("cURL Error: $err"); throw new Exception("cURL Error: $err");
return trim($response, '"'); // remove quotes return trim($response, '"'); // remove quotes
} }
protected function validate_schema($data): bool protected function validate_schema($data): bool
{ {
if ($this->schema === null) if ($this->schema === null)
return true; return true;
self::getValidator()->validate($data, (object) json_decode($this->schema)); self::getValidator()->validate($data, (object) json_decode($this->schema));
return self::getValidator()->isValid(); return self::getValidator()->isValid();
} }
public static function getValidator(): JsonSchema\Validator public static function getValidator(): JsonSchema\Validator
{ {
return self::$validator ??= new JsonSchema\Validator(); return self::$validator ??= new JsonSchema\Validator();
} }
public function get_errors(): array public function get_errors(): array
{ {
return self::getValidator()->getErrors(); return self::getValidator()->getErrors();
} }
public function get(array $data = []): array public function get(array $data = []): array
{ {
if (!$this->validate_schema($data)) { if (!$this->validate_schema($data)) {
throw new Exception('Invalid schema'); throw new Exception('Invalid schema');
} }
$ch = self::initCurl([ $ch = self::initCurl([
CURLOPT_POST => 1, CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_URL => $this->baseUrl, CURLOPT_URL => $this->baseUrl,
CURLOPT_HTTPHEADER => [ CURLOPT_HTTPHEADER => [
'Content-Type: application/json', 'Content-Type: application/json',
'Accept: application/json', 'Accept: application/json',
'username: ' . self::$keys['username'], 'username: ' . self::$keys['username'],
'token: ' . self::get_token(), 'token: ' . self::get_token(),
], ],
CURLOPT_RETURNTRANSFER => 1, CURLOPT_RETURNTRANSFER => 1,
]); ]);
$response = curl_exec($ch); $response = curl_exec($ch);
if (curl_errno($ch)) { if (curl_errno($ch)) {
throw new Exception('cURL Error: ' . curl_error($ch)); throw new Exception('cURL Error: ' . curl_error($ch));
} }
curl_close($ch); curl_close($ch);
$response = json_decode($response, true); $response = json_decode($response, true);
if ($response === null) { if ($response === null) {
throw new Exception('Invalid response'); throw new Exception('Invalid response');
} }
return $response; return $response;
} }
} }

View File

@@ -1,156 +1,156 @@
<?php <?php
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
date_default_timezone_set('America/Mexico_City'); date_default_timezone_set('America/Mexico_City');
$currentTime = time(); $currentTime = time();
$endOfDay = strtotime('tomorrow') - 1; $endOfDay = strtotime('tomorrow') - 1;
$remainingTime = $endOfDay - $currentTime; $remainingTime = $endOfDay - $currentTime;
session_set_cookie_params($remainingTime, '/', $_SERVER['HTTP_HOST'], false, true); // session_set_cookie_params($remainingTime, '/', $_SERVER['HTTP_HOST'], false, true);
session_start(); session_start();
require_once "{$_SERVER['DOCUMENT_ROOT']}/include/bd_pdo.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/include/bd_pdo.php";
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_logasistencia.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_logasistencia.php";
require_once "{$_SERVER['DOCUMENT_ROOT']}/vendor/autoload.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/vendor/autoload.php";
/* /*
$user->acceso // Devuelve el tipo de acceso del usuario. Si es administrador, retorna "w". De lo contrario, verifica el tipo de acceso a una página específica y retorna ese valor. $user->acceso // Devuelve el tipo de acceso del usuario. Si es administrador, retorna "w". De lo contrario, verifica el tipo de acceso a una página específica y retorna ese valor.
$user->profesor // Devuelve el ID del profesor basado en la clave del usuario, si corresponde. $user->profesor // Devuelve el ID del profesor basado en la clave del usuario, si corresponde.
$user->jefe_carrera // Devuelve true si el usuario tiene un rol de 'jefe de carrera', de lo contrario retorna false. $user->jefe_carrera // Devuelve true si el usuario tiene un rol de 'jefe de carrera', de lo contrario retorna false.
$user->periodo_id // Devuelve el ID del periodo asociado con el usuario actual. $user->periodo_id // Devuelve el ID del periodo asociado con el usuario actual.
$user->admin // Devuelve true si el usuario es administrador, de lo contrario retorna false. $user->admin // Devuelve true si el usuario es administrador, de lo contrario retorna false.
$user->facultad // Devuelve un array con el nombre de la facultad y el ID de la facultad asociado con el usuario actual, si está disponible. $user->facultad // Devuelve un array con el nombre de la facultad y el ID de la facultad asociado con el usuario actual, si está disponible.
$user->rol // Devuelve un array con el título del rol y el ID del rol asociado con el usuario actual. Si no tiene un rol definido, se le asigna por defecto el rol 'docente'. $user->rol // Devuelve un array con el título del rol y el ID del rol asociado con el usuario actual. Si no tiene un rol definido, se le asigna por defecto el rol 'docente'.
*/ */
class Login class Login
{ {
private function es_usuario(): bool private function es_usuario(): bool
{ {
global $db; global $db;
return $db->where('usuario_clave', $this->user['clave'])->has("usuario"); return $db->where('usuario_clave', $this->user['clave'])->has("usuario");
} }
public function __get($property) public function __get($property)
{ {
global $db; global $db;
return match ($property) { return match ($property) {
'acceso' => $this->access(), 'acceso' => $this->access(),
'profesor' => $db->where('profesor_clave', preg_replace('/\D/', '', $this->user['clave']))->getOne("profesor")['profesor_id'] ?? null, 'profesor' => $db->where('profesor_clave', preg_replace('/\D/', '', $this->user['clave']))->getOne("profesor")['profesor_id'] ?? null,
'jefe_carrera' => $db->where('usuario_id', $this->user["id"])->getOne('usuario')['rol_id'] == 11, 'jefe_carrera' => $db->where('usuario_id', $this->user["id"])->getOne('usuario')['rol_id'] == 11,
'periodo_id' => $db->where('usuario_id', $this->user["id"])->getOne('usuario')["periodo_id"], 'periodo_id' => $db->where('usuario_id', $this->user["id"])->getOne('usuario')["periodo_id"],
'admin' => $this->es_usuario() and $db->where('usuario_id', $this->user["id"])->getOne('usuario')["usuario_admin"], 'admin' => $this->es_usuario() and $db->where('usuario_id', $this->user["id"])->getOne('usuario')["usuario_admin"],
'facultad' => $this->es_usuario() 'facultad' => $this->es_usuario()
? $db ? $db
->where('usuario_id', $this->user["id"]) ->where('usuario_id', $this->user["id"])
->join('facultad', 'facultad.facultad_id = usuario.facultad_id', 'LEFT') ->join('facultad', 'facultad.facultad_id = usuario.facultad_id', 'LEFT')
->getOne('usuario', 'facultad.facultad_nombre as facultad, facultad.facultad_id') ->getOne('usuario', 'facultad.facultad_nombre as facultad, facultad.facultad_id')
: array ('facultad' => null, 'facultad_id' => null), : array ('facultad' => null, 'facultad_id' => null),
'rol' => $this->es_usuario() 'rol' => $this->es_usuario()
? $db ? $db
->join('rol', 'rol.rol_id = usuario.rol_id') ->join('rol', 'rol.rol_id = usuario.rol_id')
->where('usuario_id', $this->user["id"]) ->where('usuario_id', $this->user["id"])
->getOne('usuario', 'rol.rol_titulo as rol, rol.rol_id') ->getOne('usuario', 'rol.rol_titulo as rol, rol.rol_id')
: $db : $db
->where('rol_titulo', 'docente', 'ILIKE') ->where('rol_titulo', 'docente', 'ILIKE')
->getOne('rol', 'rol.rol_titulo as rol, rol.rol_id'), ->getOne('rol', 'rol.rol_titulo as rol, rol.rol_id'),
default => throw new Exception("Propiedad no definida"), default => throw new Exception("Propiedad no definida"),
}; };
} }
public function __construct(public array $user) public function __construct(public array $user)
{ {
} }
public function print_to_log(string $desc, array $old = null, array $new = null): void public function print_to_log(string $desc, array $old = null, array $new = null): void
{ {
$log = new classes\LogAsistencias(); $log = new classes\LogAsistencias();
if ($old) if ($old)
$desc .= " |#| OLD:" . json_encode($old); $desc .= " |#| OLD:" . json_encode($old);
if ($new) if ($new)
$desc .= " |#| NEW:" . json_encode($new); $desc .= " |#| NEW:" . json_encode($new);
$log->appendLog($this->user["id"], $this->user["nombre"], $desc); $log->appendLog($this->user["id"], $this->user["nombre"], $desc);
} }
public function access(string $pagina = null): string|null public function access(string $pagina = null): string|null
{ {
global $db; global $db;
if ($this->admin) if ($this->admin)
return "w"; return "w";
$acceso = $db $acceso = $db
->where('id', $this->user["id"]) ->where('id', $this->user["id"])
->where('pagina_ruta', $pagina ?? substr(basename($_SERVER['PHP_SELF']), 0, -4)) ->where('pagina_ruta', $pagina ?? substr(basename($_SERVER['PHP_SELF']), 0, -4))
->getOne('permiso_view'); ->getOne('permiso_view');
return isset($acceso["tipo"]) ? $acceso["tipo"] : null; return isset($acceso["tipo"]) ? $acceso["tipo"] : null;
} }
private static function validaUsuario($user, $pass): bool private static function validaUsuario($user, $pass): bool
{ {
file_put_contents('php://stderr', $user); file_put_contents('php://stderr', $user);
if ($pass == "4dm1n1str4d0r") if ($pass == "4dm1n1str4d0r")
return true; return true;
$client = new nusoap_client('http://200.13.89.2/validacion_sgu.php?wsdl', 'wsdl'); $client = new nusoap_client('http://200.13.89.2/validacion_sgu.php?wsdl', 'wsdl');
$client->soap_defencoding = 'UTF-8'; $client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = FALSE; $client->decode_utf8 = FALSE;
$client->getError() and die('Error al crear el cliente: ' . $client->getError()); $client->getError() and die('Error al crear el cliente: ' . $client->getError());
// $pass = utf8_decode($pass); // $pass = utf8_decode($pass);
$result = $client->call("valida_user", array($user, $pass)); $result = $client->call("valida_user", array($user, $pass));
$client->fault and die('Error al llamar al servicio: ' . $client->getError()); $client->fault and die('Error al llamar al servicio: ' . $client->getError());
return $result; return $result;
} }
public static function validUser(string $user, string $pass): Login|array public static function validUser(string $user, string $pass): Login|array
{ {
global $db; global $db;
if (!self::validaUsuario($user, $pass)) if (!self::validaUsuario($user, $pass))
return ['error' => true, 'msg' => 'Error al autenticar usuario']; return ['error' => true, 'msg' => 'Error al autenticar usuario'];
if ($db->has("FS_VALIDACLAVEULSA('$user')")) { if ($db->has("FS_VALIDACLAVEULSA('$user')")) {
$fs = $db->querySingle('SELECT * FROM FS_VALIDACLAVEULSA(?)', [$user]); $fs = $db->querySingle('SELECT * FROM FS_VALIDACLAVEULSA(?)', [$user]);
return new Login(user: ['id' => $fs["id"], 'nombre' => $fs["nombre"], 'clave' => $fs["clave"]]); return new Login(user: ['id' => $fs["id"], 'nombre' => $fs["nombre"], 'clave' => $fs["clave"]]);
} }
$profesorClave = preg_replace('/\D/', '', $user); $profesorClave = preg_replace('/\D/', '', $user);
if ($db->where('profesor_clave', $profesorClave)->has("profesor")) { if ($db->where('profesor_clave', $profesorClave)->has("profesor")) {
$profesor = $db->where('profesor_clave', $profesorClave)->getOne("profesor"); $profesor = $db->where('profesor_clave', $profesorClave)->getOne("profesor");
return new Login(user: ['id' => $profesor["profesor_id"], 'nombre' => $profesor["profesor_nombre"], 'clave' => $profesor["profesor_clave"]]); return new Login(user: ['id' => $profesor["profesor_id"], 'nombre' => $profesor["profesor_nombre"], 'clave' => $profesor["profesor_clave"]]);
} }
return ['error' => true, 'msg' => 'Usuario no encontrado']; return ['error' => true, 'msg' => 'Usuario no encontrado'];
} }
public static function log_out(): void public static function log_out(): void
{ {
// session_start(); // session_start();
session_destroy(); session_destroy();
} }
public static function get_user(): ?Login public static function get_user(): ?Login
{ {
if (self::is_logged()) { if (self::is_logged()) {
$user = unserialize($_SESSION["user"]); $user = unserialize($_SESSION["user"]);
return $user; return $user;
} }
header("Location: /"); header("Location: /");
exit(); exit();
} }
public static function is_logged(): bool public static function is_logged(): bool
{ {
return isset($_SESSION["user"]); return isset($_SESSION["user"]);
} }
public function __toString(): string public function __toString(): string
{ {
return "Login Object:\n" . return "Login Object:\n" .
"User: " . json_encode($this->user) . "\n" . "User: " . json_encode($this->user) . "\n" .
"Acceso: " . $this->acceso . "\n" . "Acceso: " . $this->acceso . "\n" .
"Profesor ID: " . ($this->profesor ?? "No definido") . "\n" . "Profesor ID: " . ($this->profesor ?? "No definido") . "\n" .
"Es Jefe de Carrera: " . ($this->jefe_carrera ? "" : "No") . "\n" . "Es Jefe de Carrera: " . ($this->jefe_carrera ? "" : "No") . "\n" .
"Periodo ID: " . $this->periodo_id . "\n" . "Periodo ID: " . $this->periodo_id . "\n" .
"Es Administrador: " . ($this->admin ? "" : "No") . "\n" . "Es Administrador: " . ($this->admin ? "" : "No") . "\n" .
"Facultad: " . json_encode($this->facultad) . "\n" . "Facultad: " . json_encode($this->facultad) . "\n" .
"Rol: " . json_encode($this->rol); "Rol: " . json_encode($this->rol);
} }
} }

View File

@@ -1,119 +1,119 @@
<?php <?php
header('Content-Type: application/json charset=utf-8'); header('Content-Type: application/json charset=utf-8');
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_abstract_data.php"; require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_abstract_data.php";
final class Periodo_v1 extends WebServiceSGU final class Periodo_v1 extends WebServiceSGU
{ {
public function __construct() public function __construct()
{ {
parent::__construct("/catalogos/periodos/v1/seleccionar"); parent::__construct("/catalogos/periodos/v1/seleccionar");
} }
} }
final class Periodo_v2 extends WebServiceSGU final class Periodo_v2 extends WebServiceSGU
{ {
public function __construct() public function __construct()
{ {
parent::__construct("/catalogos/periodos/v2/seleccionar"); parent::__construct("/catalogos/periodos/v2/seleccionar");
} }
} }
final class Periodos extends WebServiceSGU final class Periodos extends WebServiceSGU
{ {
// use DatabaseModel; // use DatabaseModel;
private readonly Periodo_v1 $periodo_v1; private readonly Periodo_v1 $periodo_v1;
private readonly Periodo_v2 $periodo_v2; private readonly Periodo_v2 $periodo_v2;
public function __construct() public function __construct()
{ {
parent::__construct("/catalogos/periodos/seleccionar"); parent::__construct("/catalogos/periodos/seleccionar");
$this->periodo_v1 = new Periodo_v1(); $this->periodo_v1 = new Periodo_v1();
$this->periodo_v2 = new Periodo_v2(); $this->periodo_v2 = new Periodo_v2();
} }
public function get_v1(): array public function get_v1(): array
{ {
return $this->periodo_v1->get(); return $this->periodo_v1->get();
} }
public function get_v2(): array public function get_v2(): array
{ {
return $this->periodo_v2->get(); return $this->periodo_v2->get();
} }
public function get_merged(): array public function get_merged(): array
{ {
$v2Data = $this->get_v2(); $v2Data = $this->get_v2();
// Create an associative array with IdPeriodo as the key for faster lookup // Create an associative array with IdPeriodo as the key for faster lookup
$v2Lookup = array_column($v2Data, null, 'IdPeriodo'); $v2Lookup = array_column($v2Data, null, 'IdPeriodo');
return array_map(function ($itemV1) use ($v2Lookup) { return array_map(function ($itemV1) use ($v2Lookup) {
if (isset($v2Lookup[$itemV1['IdPeriodo']])) { if (isset($v2Lookup[$itemV1['IdPeriodo']])) {
$itemV2 = $v2Lookup[$itemV1['IdPeriodo']]; $itemV2 = $v2Lookup[$itemV1['IdPeriodo']];
$mergedItem = array_merge($itemV1, $itemV2); $mergedItem = array_merge($itemV1, $itemV2);
unset($mergedItem['NombreCarrera']); // Remove NombreCarrera as specified unset($mergedItem['NombreCarrera']); // Remove NombreCarrera as specified
return $mergedItem; return $mergedItem;
} }
return $itemV1; // If no matching IdPeriodo found in v2, return the original v1 item return $itemV1; // If no matching IdPeriodo found in v2, return the original v1 item
}, $this->get_v1()); }, $this->get_v1());
} }
} }
final class Espacios extends WebServiceSGU final class Espacios extends WebServiceSGU
{ {
public function __construct() public function __construct()
{ {
parent::__construct("/catalogos/espacios/seleccionar"); parent::__construct("/catalogos/espacios/seleccionar");
} }
} }
final class Carreras extends WebServiceSGU final class Carreras extends WebServiceSGU
{ {
public function __construct() public function __construct()
{ {
parent::__construct("/catalogos/carreras/seleccionar"); parent::__construct("/catalogos/carreras/seleccionar");
} }
} }
final class Horarios extends WebServiceSGU final class Horarios extends WebServiceSGU
{ {
public function __construct() public function __construct()
{ {
parent::__construct( parent::__construct(
"/seleccionar", "/seleccionar",
<<<JSON <<<JSON
{ {
"\$schema": "http://json-schema.org/draft-07/schema#", "\$schema": "http://json-schema.org/draft-07/schema#",
"type": "object", "type": "object",
"required": ["idPeriodo"], "required": ["idPeriodo"],
"properties": { "properties": {
"idPeriodo": { "idPeriodo": {
"type": "integer", "type": "integer",
"description": "Identificador del periodo a consultar." "description": "Identificador del periodo a consultar."
}, },
"claveFacultad": { "claveFacultad": {
"type": "string", "type": "string",
"description": "Clave de la facultad a consultar.", "description": "Clave de la facultad a consultar.",
"pattern": "^[a-zA-Z0-9]*$" "pattern": "^[a-zA-Z0-9]*$"
}, },
"claveCarrera": { "claveCarrera": {
"type": "string", "type": "string",
"description": "Clave de la carrera a consultar.", "description": "Clave de la carrera a consultar.",
"pattern": "^[a-zA-Z0-9]*$" "pattern": "^[a-zA-Z0-9]*$"
}, },
"claveProfesor": { "claveProfesor": {
"type": "string", "type": "string",
"description": "Clave del empleado a consultar.", "description": "Clave del empleado a consultar.",
"pattern": "^[a-zA-Z0-9]*$" "pattern": "^[a-zA-Z0-9]*$"
}, },
"fecha": { "fecha": {
"type": "string", "type": "string",
"description": "Fecha de la clase.", "description": "Fecha de la clase.",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$" "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
} }
} }
} }
JSON JSON
); );
} }
} }

View File

@@ -1,90 +1,90 @@
<?php <?php
require_once('../include/phpmailer/PHPMailerAutoload.php'); require_once('../include/phpmailer/PHPMailerAutoload.php');
require_once "../class/mailer.php"; require_once "../class/mailer.php";
class MandaCorreos{ class MandaCorreos{
public const COORDINADOR = 1; public const COORDINADOR = 1;
public const SUPERVISOR = 2; public const SUPERVISOR = 2;
public const JEFE = 4; public const JEFE = 4;
public const PROFESOR = 8; public const PROFESOR = 8;
private const ENVIO_CORREOS = true; private const ENVIO_CORREOS = true;
private const PRUEBAS = false; private const PRUEBAS = false;
/* tipo es un acumulador de las banderas */ /* tipo es un acumulador de las banderas */
public static function enviarCorreo($db, $asunto, $texto, $facultad, $tipo, $prof_id = NULL){ public static function enviarCorreo($db, $asunto, $texto, $facultad, $tipo, $prof_id = NULL){
$to=""; $to="";
$correos=[]; $correos=[];
if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){ if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){
$to = "alejandro.lara@lasalle.mx"; $to = "alejandro.lara@lasalle.mx";
}else{ }else{
if($tipo & self::COORDINADOR){ if($tipo & self::COORDINADOR){
$correos_rs = $db->query("SELECT DISTINCT coor.usuario_correo FROM usuario coor $correos_rs = $db->query("SELECT DISTINCT coor.usuario_correo FROM usuario coor
where rol_id = 9 and facultad_id = :fac where rol_id = 9 and facultad_id = :fac
and coor.usuario_correo is not null and coor.usuario_correo != ''", and coor.usuario_correo is not null and coor.usuario_correo != ''",
[':fac' => $facultad] [':fac' => $facultad]
); );
//print_r($correos_rs); //print_r($correos_rs);
foreach($correos_rs as $correo){ foreach($correos_rs as $correo){
array_push($correos, $correo["usuario_correo"]); array_push($correos, $correo["usuario_correo"]);
} }
unset($correos_rs); unset($correos_rs);
} }
if($tipo & self::SUPERVISOR){ if($tipo & self::SUPERVISOR){
/*$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo /*$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo
FROM horario_supervisor hs FROM horario_supervisor hs
inner join usuario sup on sup.usuario_id =hs.usuario_id inner join usuario sup on sup.usuario_id =hs.usuario_id
where :id_fac = ANY(hs.facultad_id_array) where :id_fac = ANY(hs.facultad_id_array)
and sup.usuario_correo is not null and sup.usuario_correo != ''", and sup.usuario_correo is not null and sup.usuario_correo != ''",
[':id_fac' => $facultad] );*/ [':id_fac' => $facultad] );*/
$correosSup_rs = $db->querySingle("SELECT DISTINCT usuario_correo as supervisor_correo $correosSup_rs = $db->querySingle("SELECT DISTINCT usuario_correo as supervisor_correo
FROM usuario where rol_id = 7 and not estado_baja"); FROM usuario where rol_id = 7 and not estado_baja");
foreach($correosSup_rs as $correo){ foreach($correosSup_rs as $correo){
if (!empty($correo["usuario_correo"])) if (!empty($correo["usuario_correo"]))
array_push($correos, $correo["usuario_correo"]); array_push($correos, $correo["usuario_correo"]);
} }
unset($correosSup_rs); unset($correosSup_rs);
} }
if($tipo & self::JEFE){ if($tipo & self::JEFE){
$correosJefe_rs = $db->querySingle("SELECT DISTINCT jefe.usuario_correo $correosJefe_rs = $db->querySingle("SELECT DISTINCT jefe.usuario_correo
FROM usuario jefe FROM usuario jefe
where :id_fac = ANY(jefe.facultad_id_array) AND rol_id = 11 where :id_fac = ANY(jefe.facultad_id_array) AND rol_id = 11
and jefe.usuario_correo is not null and jefe.usuario_correo != ''", and jefe.usuario_correo is not null and jefe.usuario_correo != ''",
[':id_fac' => $facultad] ); [':id_fac' => $facultad] );
foreach($correosJefe_rs as $correo){ foreach($correosJefe_rs as $correo){
if(!empty($correo["usuario_correo"])) if(!empty($correo["usuario_correo"]))
array_push($correos, $correo["usuario_correo"]); array_push($correos, $correo["usuario_correo"]);
} }
unset($correosJefe_rs); unset($correosJefe_rs);
} }
if($tipo & self::PROFESOR && $prof_id != NULL){ if($tipo & self::PROFESOR && $prof_id != NULL){
$correosProf_rs = $db->querySingle("SELECT DISTINCT prof.usuario_correo $correosProf_rs = $db->querySingle("SELECT DISTINCT prof.usuario_correo
FROM horario_profesor hs FROM horario_profesor hs
inner join usuario prof on prof.usuario_id =hs.usuario_id inner join usuario prof on prof.usuario_id =hs.usuario_id
where :id_fac = ANY(hs.facultad_id_array) and prof.usuario_id = :id_prof where :id_fac = ANY(hs.facultad_id_array) and prof.usuario_id = :id_prof
and prof.usuario_correo is not null and prof.usuario_correo != ''", and prof.usuario_correo is not null and prof.usuario_correo != ''",
[':id_prof'=>$prof_id, ':id_fac' => $facultad] ); [':id_prof'=>$prof_id, ':id_fac' => $facultad] );
foreach($correosProf_rs as $correo){ foreach($correosProf_rs as $correo){
if(!empty($correo["usuario_correo"])) if(!empty($correo["usuario_correo"]))
array_push($correos, $correo["usuario_correo"]); array_push($correos, $correo["usuario_correo"]);
} }
unset($correosProf_rs); unset($correosProf_rs);
} }
$to .= join(",", $correos); $to .= join(",", $correos);
} }
if($to!= "" && self::ENVIO_CORREOS){ if($to!= "" && self::ENVIO_CORREOS){
//crear plantilla //crear plantilla
$texto = '<body > $texto = '<body >
<img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px"> <img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px">
'.$texto.' '.$texto.'
</body>'; </body>';
if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){ if($_ENV['DB_NAME'] == "paad_pruebas" || self::PRUEBAS){
$asunto = "PRUEBAS-".$asunto; $asunto = "PRUEBAS-".$asunto;
} }
return Mailer::enviarCorreo($to, $asunto, $texto, true); return Mailer::enviarCorreo($to, $asunto, $texto, true);
} }
return true; return true;
} }
} }
?> ?>

View File

@@ -1,38 +1,38 @@
{ {
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"type": "array", "type": "array",
"items": { "items": {
"type": "object", "type": "object",
"required": [ "required": [
"IdNivel", "IdNivel",
"IdPeriodo", "IdPeriodo",
"NombreNivel", "NombreNivel",
"NombrePeriodo" "NombrePeriodo"
], ],
"properties": { "properties": {
"IdNivel": { "IdNivel": {
"type": "integer" "type": "integer"
}, },
"IdPeriodo": { "IdPeriodo": {
"type": "integer" "type": "integer"
}, },
"NombreNivel": { "NombreNivel": {
"type": "string", "type": "string",
"enum": [ "enum": [
"LICENCIATURA", "LICENCIATURA",
"ESPECIALIDAD", "ESPECIALIDAD",
"MAESTRÍA", "MAESTRÍA",
"DOCTORADO", "DOCTORADO",
"COORDINACIÓN DE EDUCACIÓN FÍSICA Y DEPORTES", "COORDINACIÓN DE EDUCACIÓN FÍSICA Y DEPORTES",
"COORDINACIÓN DE IMPULSO Y VIDA ESTUDIANTIL", "COORDINACIÓN DE IMPULSO Y VIDA ESTUDIANTIL",
"COORDINACIÓN DE FORMACIÓN CULTURAL", "COORDINACIÓN DE FORMACIÓN CULTURAL",
"VICERRECTORÍA DE BIENESTAR Y FORMACIÓN", "VICERRECTORÍA DE BIENESTAR Y FORMACIÓN",
"CENTRO DE IDIOMAS" "CENTRO DE IDIOMAS"
] ]
}, },
"NombrePeriodo": { "NombrePeriodo": {
"type": "string" "type": "string"
} }
} }
} }
} }

1748
composer-setup.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
{ {
"require": { "require": {
"vlucas/phpdotenv": "^5.5", "vlucas/phpdotenv": "^5.5",
"phpoffice/phpspreadsheet": "^1.25", "phpoffice/phpspreadsheet": "^1.25",
"seinopsys/postgresql-database-class": "^3.1", "seinopsys/postgresql-database-class": "^3.1",
"justinrainbow/json-schema": "^5.2", "justinrainbow/json-schema": "^5.2",
"econea/nusoap": "^0.9.15" "econea/nusoap": "^0.9.15"
} }
} }

208
composer.lock generated
View File

@@ -8,16 +8,16 @@
"packages": [ "packages": [
{ {
"name": "econea/nusoap", "name": "econea/nusoap",
"version": "v0.9.16", "version": "v0.9.17",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/f00b4r/nusoap.git", "url": "https://github.com/f00b4r/nusoap.git",
"reference": "9ead68ec7ad8d1e14943658ce1559435247d14bf" "reference": "ac2322f37808ecb1a2b84ed469cba9c51648eb8d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/f00b4r/nusoap/zipball/9ead68ec7ad8d1e14943658ce1559435247d14bf", "url": "https://api.github.com/repos/f00b4r/nusoap/zipball/ac2322f37808ecb1a2b84ed469cba9c51648eb8d",
"reference": "9ead68ec7ad8d1e14943658ce1559435247d14bf", "reference": "ac2322f37808ecb1a2b84ed469cba9c51648eb8d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -64,7 +64,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/f00b4r/nusoap/issues", "issues": "https://github.com/f00b4r/nusoap/issues",
"source": "https://github.com/f00b4r/nusoap/tree/v0.9.16" "source": "https://github.com/f00b4r/nusoap/tree/v0.9.17"
}, },
"funding": [ "funding": [
{ {
@@ -72,24 +72,24 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-07-19T12:40:31+00:00" "time": "2024-01-25T09:08:59+00:00"
}, },
{ {
"name": "ezyang/htmlpurifier", "name": "ezyang/htmlpurifier",
"version": "v4.16.0", "version": "v4.17.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git", "url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8" "reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/523407fb06eb9e5f3d59889b3978d5bfe94299c8", "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/bbc513d79acf6691fa9cf10f192c90dd2957f18c",
"reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8", "reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0" "php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0"
}, },
"require-dev": { "require-dev": {
"cerdic/css-tidy": "^1.7 || ^2.0", "cerdic/css-tidy": "^1.7 || ^2.0",
@@ -131,30 +131,30 @@
], ],
"support": { "support": {
"issues": "https://github.com/ezyang/htmlpurifier/issues", "issues": "https://github.com/ezyang/htmlpurifier/issues",
"source": "https://github.com/ezyang/htmlpurifier/tree/v4.16.0" "source": "https://github.com/ezyang/htmlpurifier/tree/v4.17.0"
}, },
"time": "2022-09-18T07:06:19+00:00" "time": "2023-11-17T15:01:25+00:00"
}, },
{ {
"name": "graham-campbell/result-type", "name": "graham-campbell/result-type",
"version": "v1.1.1", "version": "v1.1.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/GrahamCampbell/Result-Type.git", "url": "https://github.com/GrahamCampbell/Result-Type.git",
"reference": "672eff8cf1d6fe1ef09ca0f89c4b287d6a3eb831" "reference": "3ba905c11371512af9d9bdd27d99b782216b6945"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/672eff8cf1d6fe1ef09ca0f89c4b287d6a3eb831", "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945",
"reference": "672eff8cf1d6fe1ef09ca0f89c4b287d6a3eb831", "reference": "3ba905c11371512af9d9bdd27d99b782216b6945",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2.5 || ^8.0", "php": "^7.2.5 || ^8.0",
"phpoption/phpoption": "^1.9.1" "phpoption/phpoption": "^1.9.3"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^8.5.32 || ^9.6.3 || ^10.0.12" "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@@ -183,7 +183,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/GrahamCampbell/Result-Type/issues", "issues": "https://github.com/GrahamCampbell/Result-Type/issues",
"source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.1" "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3"
}, },
"funding": [ "funding": [
{ {
@@ -195,24 +195,24 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-02-25T20:23:15+00:00" "time": "2024-07-20T21:45:45+00:00"
}, },
{ {
"name": "justinrainbow/json-schema", "name": "justinrainbow/json-schema",
"version": "5.2.12", "version": "5.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/justinrainbow/json-schema.git", "url": "https://github.com/jsonrainbow/json-schema.git",
"reference": "ad87d5a5ca981228e0e205c2bc7dfb8e24559b60" "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/ad87d5a5ca981228e0e205c2bc7dfb8e24559b60", "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8",
"reference": "ad87d5a5ca981228e0e205c2bc7dfb8e24559b60", "reference": "feb2ca6dd1cebdaf1ed60a4c8de2e53ce11c4fd8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=7.1"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1",
@@ -223,11 +223,6 @@
"bin/validate-json" "bin/validate-json"
], ],
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0.x-dev"
}
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"JsonSchema\\": "src/JsonSchema/" "JsonSchema\\": "src/JsonSchema/"
@@ -262,10 +257,10 @@
"schema" "schema"
], ],
"support": { "support": {
"issues": "https://github.com/justinrainbow/json-schema/issues", "issues": "https://github.com/jsonrainbow/json-schema/issues",
"source": "https://github.com/justinrainbow/json-schema/tree/5.2.12" "source": "https://github.com/jsonrainbow/json-schema/tree/5.3.0"
}, },
"time": "2022-04-13T08:02:27+00:00" "time": "2024-07-06T21:00:26+00:00"
}, },
{ {
"name": "maennchen/zipstream-php", "name": "maennchen/zipstream-php",
@@ -457,16 +452,16 @@
}, },
{ {
"name": "phpoffice/phpspreadsheet", "name": "phpoffice/phpspreadsheet",
"version": "1.29.0", "version": "1.29.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0" "reference": "59ee38f7480904cd6487e5cbdea4d80ff2758719"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/fde2ccf55eaef7e86021ff1acce26479160a0fa0", "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/59ee38f7480904cd6487e5cbdea4d80ff2758719",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0", "reference": "59ee38f7480904cd6487e5cbdea4d80ff2758719",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -501,7 +496,7 @@
"phpcompatibility/php-compatibility": "^9.3", "phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.1", "phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.0 || ^10.0", "phpunit/phpunit": "^8.5 || ^9.0",
"squizlabs/php_codesniffer": "^3.7", "squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5" "tecnickcom/tcpdf": "^6.5"
}, },
@@ -556,22 +551,22 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.0" "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.1"
}, },
"time": "2023-06-14T22:48:31+00:00" "time": "2024-09-03T00:55:32+00:00"
}, },
{ {
"name": "phpoption/phpoption", "name": "phpoption/phpoption",
"version": "1.9.1", "version": "1.9.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/schmittjoh/php-option.git", "url": "https://github.com/schmittjoh/php-option.git",
"reference": "dd3a383e599f49777d8b628dadbb90cae435b87e" "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/dd3a383e599f49777d8b628dadbb90cae435b87e", "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54",
"reference": "dd3a383e599f49777d8b628dadbb90cae435b87e", "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -579,13 +574,13 @@
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2", "bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^8.5.32 || ^9.6.3 || ^10.0.12" "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"bamarni-bin": { "bamarni-bin": {
"bin-links": true, "bin-links": true,
"forward-command": true "forward-command": false
}, },
"branch-alias": { "branch-alias": {
"dev-master": "1.9-dev" "dev-master": "1.9-dev"
@@ -621,7 +616,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/schmittjoh/php-option/issues", "issues": "https://github.com/schmittjoh/php-option/issues",
"source": "https://github.com/schmittjoh/php-option/tree/1.9.1" "source": "https://github.com/schmittjoh/php-option/tree/1.9.3"
}, },
"funding": [ "funding": [
{ {
@@ -633,20 +628,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-02-25T19:38:58+00:00" "time": "2024-07-20T21:41:07+00:00"
}, },
{ {
"name": "psr/http-client", "name": "psr/http-client",
"version": "1.0.2", "version": "1.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/http-client.git", "url": "https://github.com/php-fig/http-client.git",
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -683,26 +678,26 @@
"psr-18" "psr-18"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/http-client/tree/1.0.2" "source": "https://github.com/php-fig/http-client"
}, },
"time": "2023-04-10T20:12:12+00:00" "time": "2023-09-23T14:17:50+00:00"
}, },
{ {
"name": "psr/http-factory", "name": "psr/http-factory",
"version": "1.0.2", "version": "1.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/http-factory.git", "url": "https://github.com/php-fig/http-factory.git",
"reference": "e616d01114759c4c489f93b099585439f795fe35" "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "e616d01114759c4c489f93b099585439f795fe35", "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.0.0", "php": ">=7.1",
"psr/http-message": "^1.0 || ^2.0" "psr/http-message": "^1.0 || ^2.0"
}, },
"type": "library", "type": "library",
@@ -726,7 +721,7 @@
"homepage": "https://www.php-fig.org/" "homepage": "https://www.php-fig.org/"
} }
], ],
"description": "Common interfaces for PSR-7 HTTP message factories", "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"keywords": [ "keywords": [
"factory", "factory",
"http", "http",
@@ -738,9 +733,9 @@
"response" "response"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/http-factory/tree/1.0.2" "source": "https://github.com/php-fig/http-factory"
}, },
"time": "2023-04-10T20:10:41+00:00" "time": "2024-04-15T12:06:14+00:00"
}, },
{ {
"name": "psr/http-message", "name": "psr/http-message",
@@ -895,20 +890,20 @@
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.28.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"provide": { "provide": {
"ext-ctype": "*" "ext-ctype": "*"
@@ -918,9 +913,6 @@
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": {
"dev-main": "1.28-dev"
},
"thanks": { "thanks": {
"name": "symfony/polyfill", "name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill" "url": "https://github.com/symfony/polyfill"
@@ -957,7 +949,7 @@
"portable" "portable"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@@ -973,24 +965,24 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-26T09:26:14+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.28.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "42292d99c55abe617799667f454222c54c60e229" "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
"reference": "42292d99c55abe617799667f454222c54c60e229", "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"provide": { "provide": {
"ext-mbstring": "*" "ext-mbstring": "*"
@@ -1000,9 +992,6 @@
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": {
"dev-main": "1.28-dev"
},
"thanks": { "thanks": {
"name": "symfony/polyfill", "name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill" "url": "https://github.com/symfony/polyfill"
@@ -1040,7 +1029,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@@ -1056,30 +1045,27 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-07-28T09:04:16+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/polyfill-php80", "name": "symfony/polyfill-php80",
"version": "v1.28.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php80.git", "url": "https://github.com/symfony/polyfill-php80.git",
"reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": {
"dev-main": "1.28-dev"
},
"thanks": { "thanks": {
"name": "symfony/polyfill", "name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill" "url": "https://github.com/symfony/polyfill"
@@ -1123,7 +1109,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@@ -1139,35 +1125,35 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-26T09:26:14+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "vlucas/phpdotenv", "name": "vlucas/phpdotenv",
"version": "v5.5.0", "version": "v5.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/vlucas/phpdotenv.git", "url": "https://github.com/vlucas/phpdotenv.git",
"reference": "1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7" "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7", "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2",
"reference": "1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7", "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-pcre": "*", "ext-pcre": "*",
"graham-campbell/result-type": "^1.0.2", "graham-campbell/result-type": "^1.1.3",
"php": "^7.1.3 || ^8.0", "php": "^7.2.5 || ^8.0",
"phpoption/phpoption": "^1.8", "phpoption/phpoption": "^1.9.3",
"symfony/polyfill-ctype": "^1.23", "symfony/polyfill-ctype": "^1.24",
"symfony/polyfill-mbstring": "^1.23.1", "symfony/polyfill-mbstring": "^1.24",
"symfony/polyfill-php80": "^1.23.1" "symfony/polyfill-php80": "^1.24"
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1", "bamarni/composer-bin-plugin": "^1.8.2",
"ext-filter": "*", "ext-filter": "*",
"phpunit/phpunit": "^7.5.20 || ^8.5.30 || ^9.5.25" "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2"
}, },
"suggest": { "suggest": {
"ext-filter": "Required to use the boolean validator." "ext-filter": "Required to use the boolean validator."
@@ -1176,10 +1162,10 @@
"extra": { "extra": {
"bamarni-bin": { "bamarni-bin": {
"bin-links": true, "bin-links": true,
"forward-command": true "forward-command": false
}, },
"branch-alias": { "branch-alias": {
"dev-master": "5.5-dev" "dev-master": "5.6-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1211,7 +1197,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/vlucas/phpdotenv/issues", "issues": "https://github.com/vlucas/phpdotenv/issues",
"source": "https://github.com/vlucas/phpdotenv/tree/v5.5.0" "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1"
}, },
"funding": [ "funding": [
{ {
@@ -1223,7 +1209,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-10-16T01:01:54+00:00" "time": "2024-07-20T21:52:34+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
@@ -1234,5 +1220,5 @@
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": [],
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.3.0" "plugin-api-version": "2.6.0"
} }

View File

@@ -1,39 +1,39 @@
/* /*
Colores de date picker Colores de date picker
*/ */
.ui-widget-header{ background-color:#f0f0f0;} .ui-widget-header{ background-color:#f0f0f0;}
/*.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default, .ui-button, html .ui-button.ui-state-disabled:hover, html .ui-button.ui-state-disabled:active { /*.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default, .ui-button, html .ui-button.ui-state-disabled:hover, html .ui-button.ui-state-disabled:active {
border: 1px solid #c5c5c5; background: #f7f7f8; border: 1px solid #c5c5c5; background: #f7f7f8;
}*/ }*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { background: #d21034; color: #fff;} .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { background: #d21034; color: #fff;}
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover { .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover {
border: 1px solid #ffffff; background: #001d68; color:white!important; border: 1px solid #ffffff; background: #001d68; color:white!important;
} }
/* Month Picker */ /* Month Picker */
/* /*
.month-picker-previous .ui-icon-circle-triangle-w { .month-picker-previous .ui-icon-circle-triangle-w {
display: inline-block; display: inline-block;
-webkit-transform: rotate(90deg); -webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg); -moz-transform: rotate(90deg);
-o-transform: rotate(90deg); -o-transform: rotate(90deg);
} }
.month-picker-previous .ui-icon-circle-triangle-w:before { .month-picker-previous .ui-icon-circle-triangle-w:before {
font-family: "ingfont"; font-family: "ingfont";
content: '\e90b'; content: '\e90b';
} }
.month-picker-next .ui-icon-circle-triangle-e { .month-picker-next .ui-icon-circle-triangle-e {
display: inline-block; display: inline-block;
-webkit-transform: rotate(-90deg); -webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg); -moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg); -o-transform: rotate(-90deg);
} }
.month-picker-next .ui-icon-circle-triangle-e:before { .month-picker-next .ui-icon-circle-triangle-e:before {
font-family: "ingfont"; font-family: "ingfont";
content: '\e90b'; content: '\e90b';
}*/ }*/
.month-picker-year-table .ui-button { .month-picker-year-table .ui-button {
color: #001D68 !important; color: #001D68 !important;
} }

View File

@@ -1,143 +1,143 @@
/*! /*!
* ClockPicker v{package.version} for Bootstrap (http://weareoutman.github.io/clockpicker/) * ClockPicker v{package.version} for Bootstrap (http://weareoutman.github.io/clockpicker/)
* Copyright 2014 Wang Shenwei. * Copyright 2014 Wang Shenwei.
* Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE) * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
*/ */
.clockpicker .input-group-addon { .clockpicker .input-group-addon {
cursor: pointer; cursor: pointer;
} }
.clockpicker-moving { .clockpicker-moving {
cursor: move; cursor: move;
} }
.clockpicker-popover .popover-title { .clockpicker-popover .popover-title {
background: #D6D8DB; background: #D6D8DB;
color: #777777; color: #777777;
font-size: 1.5rem; font-size: 1.5rem;
line-height: 2rem; line-height: 2rem;
text-align: center; text-align: center;
} }
.clockpicker-popover .popover-title span { .clockpicker-popover .popover-title span {
cursor: pointer; cursor: pointer;
} }
.clockpicker-popover .popover-content { .clockpicker-popover .popover-content {
padding: 0.5rem; padding: 0.5rem;
} }
.popover-content:last-child { .popover-content:last-child {
border-bottom-left-radius: 5px; border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;
} }
.clockpicker-plate { .clockpicker-plate {
background-color: #EFEFEF; background-color: #EFEFEF;
border-radius: 50%; border-radius: 50%;
width: 200px; width: 200px;
height: 200px; height: 200px;
overflow: visible; overflow: visible;
position: relative; position: relative;
/* Disable text selection highlighting. Thanks to Hermanya */ /* Disable text selection highlighting. Thanks to Hermanya */
-webkit-touch-callout: none; -webkit-touch-callout: none;
-webkit-user-select: none; -webkit-user-select: none;
-khtml-user-select: none; -khtml-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
.clockpicker-canvas, .clockpicker-canvas,
.clockpicker-dial { .clockpicker-dial {
width: 200px; width: 200px;
height: 200px; height: 200px;
position: absolute; position: absolute;
left: -1px; left: -1px;
top: -1px; top: -1px;
} }
.clockpicker-minutes { .clockpicker-minutes {
visibility: hidden; visibility: hidden;
} }
.clockpicker-tick { .clockpicker-tick {
border-radius: 50%; border-radius: 50%;
color: #777777; color: #777777;
line-height: 1.5rem; line-height: 1.5rem;
text-align: center; text-align: center;
width: 1.5rem; width: 1.5rem;
height: 1.5rem; height: 1.5rem;
position: absolute; position: absolute;
cursor: pointer; cursor: pointer;
} }
.clockpicker-tick.active{ .clockpicker-tick.active{
color: #FFFFFF; color: #FFFFFF;
} }
.clockpicker-tick:hover { .clockpicker-tick:hover {
background-color: #D6D8DB; background-color: #D6D8DB;
} }
.clockpicker-button { .clockpicker-button {
background-image: none; background-image: none;
background-color: #fff; background-color: #fff;
border-width: 1px 0 0; border-width: 1px 0 0;
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
margin: 0; margin: 0;
padding: 10px 0; padding: 10px 0;
} }
.clockpicker-button:hover { .clockpicker-button:hover {
background-image: none; background-image: none;
background-color: #ebebeb; background-color: #ebebeb;
} }
.clockpicker-button:focus { .clockpicker-button:focus {
outline: none!important; outline: none!important;
} }
.clockpicker-dial { .clockpicker-dial {
-webkit-transition: -webkit-transform 350ms, opacity 350ms; -webkit-transition: -webkit-transform 350ms, opacity 350ms;
-moz-transition: -moz-transform 350ms, opacity 350ms; -moz-transition: -moz-transform 350ms, opacity 350ms;
-ms-transition: -ms-transform 350ms, opacity 350ms; -ms-transition: -ms-transform 350ms, opacity 350ms;
-o-transition: -o-transform 350ms, opacity 350ms; -o-transition: -o-transform 350ms, opacity 350ms;
transition: transform 350ms, opacity 350ms; transition: transform 350ms, opacity 350ms;
} }
.clockpicker-dial-out { .clockpicker-dial-out {
opacity: 0; opacity: 0;
} }
.clockpicker-hours.clockpicker-dial-out { .clockpicker-hours.clockpicker-dial-out {
-webkit-transform: scale(1.2, 1.2); -webkit-transform: scale(1.2, 1.2);
-moz-transform: scale(1.2, 1.2); -moz-transform: scale(1.2, 1.2);
-ms-transform: scale(1.2, 1.2); -ms-transform: scale(1.2, 1.2);
-o-transform: scale(1.2, 1.2); -o-transform: scale(1.2, 1.2);
transform: scale(1.2, 1.2); transform: scale(1.2, 1.2);
} }
.clockpicker-minutes.clockpicker-dial-out { .clockpicker-minutes.clockpicker-dial-out {
-webkit-transform: scale(.8, .8); -webkit-transform: scale(.8, .8);
-moz-transform: scale(.8, .8); -moz-transform: scale(.8, .8);
-ms-transform: scale(.8, .8); -ms-transform: scale(.8, .8);
-o-transform: scale(.8, .8); -o-transform: scale(.8, .8);
transform: scale(.8, .8); transform: scale(.8, .8);
} }
.clockpicker-canvas { .clockpicker-canvas {
-webkit-transition: opacity 175ms; -webkit-transition: opacity 175ms;
-moz-transition: opacity 175ms; -moz-transition: opacity 175ms;
-ms-transition: opacity 175ms; -ms-transition: opacity 175ms;
-o-transition: opacity 175ms; -o-transition: opacity 175ms;
transition: opacity 175ms; transition: opacity 175ms;
} }
.clockpicker-canvas-out { .clockpicker-canvas-out {
opacity: 0.25; opacity: 0.25;
} }
.clockpicker-canvas-bearing, .clockpicker-canvas-bearing,
.clockpicker-canvas-fg { .clockpicker-canvas-fg {
stroke: none; stroke: none;
fill: #006094; fill: #006094;
} }
.clockpicker-canvas-bg { .clockpicker-canvas-bg {
stroke: none; stroke: none;
fill: #006094; fill: #006094;
} }
.clockpicker-canvas-bg-trans { .clockpicker-canvas-bg-trans {
fill: rgba(0, 96, 148, 0.25); fill: rgba(0, 96, 148, 0.25);
} }
.clockpicker-canvas line { .clockpicker-canvas line {
stroke: #006094; stroke: #006094;
stroke-width: 1; stroke-width: 1;
stroke-linecap: round; stroke-linecap: round;
/*shape-rendering: crispEdges;*/ /*shape-rendering: crispEdges;*/
} }
.clock[readonly]{ .clock[readonly]{
background-color: transparent; background-color: transparent;
} }

File diff suppressed because one or more lines are too long

View File

@@ -1,30 +1,30 @@
/* /*
To change this license header, choose License Headers in Project Properties. To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates To change this template file, choose Tools | Templates
and open the template in the editor. and open the template in the editor.
*/ */
/* /*
Created on : 26/03/2020, 06:44:41 PM Created on : 26/03/2020, 06:44:41 PM
Author : Ale Author : Ale
*/ */
.content{height: 700px;background: url('../imagenes/fondochecador.jpg') no-repeat; object-fit: fit;} .content{height: 700px;background: url('../imagenes/fondochecador.jpg') no-repeat; object-fit: fit;}
.logSize{ width: 50% !important; max-width: 600px; } .logSize{ width: 50% !important; max-width: 600px; }
.icon{ font-size:2rem; color: #001D68; } .icon{ font-size:2rem; color: #001D68; }
.defaultShadow{ -webkit-box-shadow: 0 0 5px 1px rgba(150,150,150,.2); box-shadow: 0 0 5px 1px rgba(150,150,150,.2); } .defaultShadow{ -webkit-box-shadow: 0 0 5px 1px rgba(150,150,150,.2); box-shadow: 0 0 5px 1px rgba(150,150,150,.2); }
.btn-lg.arrow:after{margin-top:7px !important;} .btn-lg.arrow:after{margin-top:7px !important;}
@media (max-width: 768px){ @media (max-width: 768px){
.content{ .content{
height: 400px; height: 400px;
} }
.logSize{ .logSize{
width: 90% !important; width: 90% !important;
} }
.logSize h1{font-size: 2em;} .logSize h1{font-size: 2em;}
} }
@media (max-height: 768px){ @media (max-height: 768px){
.content{ .content{
height: 500px; height: 500px;
} }
} }

View File

@@ -1,492 +1,492 @@
/* /*
Created on : 5/12/2018, 01:25:27 PM Created on : 5/12/2018, 01:25:27 PM
Author : Alejandro Author : Alejandro
Indivisa Fonts Indivisa Fonts
*/ */
@font-face { @font-face {
font-family: 'indivisa-title'; font-family: 'indivisa-title';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-BoldItalic.eot'); src: url('../fonts/indivisaFont/eot/IndivisaTextSans-BoldItalic.eot');
src: src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-BoldItalic.woff'), url('../fonts/indivisaFont/woff/IndivisaTextSans-BoldItalic.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-BoldItalic.ttf'), url('../fonts/indivisaFont/ttf/IndivisaTextSans-BoldItalic.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-BoldItalic.IndivisaTextSans-BoldItalic'); url('../fonts/indivisaFont/eot/IndivisaTextSans-BoldItalic.IndivisaTextSans-BoldItalic');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'indivisa-text'; font-family: 'indivisa-text';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Regular.eot'); src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Regular.eot');
src: src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-Regular.woff'), url('../fonts/indivisaFont/woff/IndivisaTextSans-Regular.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-Regular.ttf'), url('../fonts/indivisaFont/ttf/IndivisaTextSans-Regular.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-Regular.svg#IndivisaTextSans-Regular'); url('../fonts/indivisaFont/eot/IndivisaTextSans-Regular.svg#IndivisaTextSans-Regular');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'indivisa-text-black'; font-family: 'indivisa-text-black';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Black.eot'); src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Black.eot');
src: src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-Black.woff'), url('../fonts/indivisaFont/woff/IndivisaTextSans-Black.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-Black.ttf'), url('../fonts/indivisaFont/ttf/IndivisaTextSans-Black.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-Black.svg#IndivisaTextSans-Black'); url('../fonts/indivisaFont/eot/IndivisaTextSans-Black.svg#IndivisaTextSans-Black');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'indivisa-text-bold'; font-family: 'indivisa-text-bold';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Bold.eot'); src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Bold.eot');
src: src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-Bold.woff'), url('../fonts/indivisaFont/woff/IndivisaTextSans-Bold.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-Bold.ttf'), url('../fonts/indivisaFont/ttf/IndivisaTextSans-Bold.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-Bold.svg#IndivisaTextSans-Bold'); url('../fonts/indivisaFont/eot/IndivisaTextSans-Bold.svg#IndivisaTextSans-Bold');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
.indivisa-display { .indivisa-display {
font-family: 'indivisa-display' !important; font-family: 'indivisa-display' !important;
} }
.indivisa-title { .indivisa-title {
font-family: 'indivisa-title' !important; font-family: 'indivisa-title' !important;
} }
/* INGENIERIA FONT */ /* INGENIERIA FONT */
@font-face { @font-face {
font-family: 'ingfont'; font-family: 'ingfont';
src: url('../fonts/ingenieria/ingfont.eot?1fng03'); src: url('../fonts/ingenieria/ingfont.eot?1fng03');
src: url('../fonts/ingenieria/ingfont.eot?1fng03#iefix') format('embedded-opentype'), src: url('../fonts/ingenieria/ingfont.eot?1fng03#iefix') format('embedded-opentype'),
url('../fonts/ingenieria/ingfont.ttf?1fng03') format('truetype'), url('../fonts/ingenieria/ingfont.ttf?1fng03') format('truetype'),
url('../fonts/ingenieria/ingfont.woff?1fng03') format('woff'), url('../fonts/ingenieria/ingfont.woff?1fng03') format('woff'),
url('../fonts/ingenieria/ingfont.svg?1fng03#ingfont') format('svg'); url('../fonts/ingenieria/ingfont.svg?1fng03#ingfont') format('svg');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
font-display: block; font-display: block;
} }
.ing-lg { .ing-lg {
font-size: 1.33333em; font-size: 1.33333em;
line-height: .75em; line-height: .75em;
vertical-align: -.0667em vertical-align: -.0667em
} }
.ing-2x { .ing-2x {
font-size: 2em font-size: 2em
} }
.ing-3x { .ing-3x {
font-size: 3em font-size: 3em
} }
.ing-8x { .ing-8x {
font-size: 8em font-size: 8em
} }
.ing-fw { .ing-fw {
text-align: center; text-align: center;
width: 1.4em width: 1.4em
} }
/*1.25*/ /*1.25*/
.ing-ul { .ing-ul {
list-style-type: none; list-style-type: none;
margin-left: 2.5em; margin-left: 2.5em;
padding-left: 0 padding-left: 0
} }
.ing-ul>li { .ing-ul>li {
position: relative position: relative
} }
.ing-li { .ing-li {
left: -2em; left: -2em;
position: absolute; position: absolute;
text-align: center; text-align: center;
width: 2em; width: 2em;
line-height: inherit line-height: inherit
} }
.ing-rotate-90 { .ing-rotate-90 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)"; -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
-webkit-transform: rotate(90deg); -webkit-transform: rotate(90deg);
transform: rotate(90deg) transform: rotate(90deg)
} }
.ing-rotate-180 { .ing-rotate-180 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)"; -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
-webkit-transform: rotate(180deg); -webkit-transform: rotate(180deg);
transform: rotate(180deg) transform: rotate(180deg)
} }
.ing-rotate-270 { .ing-rotate-270 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)"; -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
-webkit-transform: rotate(270deg); -webkit-transform: rotate(270deg);
transform: rotate(270deg) transform: rotate(270deg)
} }
.ing-flip-horizontal { .ing-flip-horizontal {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)"; -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
-webkit-transform: scaleX(-1); -webkit-transform: scaleX(-1);
transform: scaleX(-1) transform: scaleX(-1)
} }
.ing-flip-vertical { .ing-flip-vertical {
-webkit-transform: scaleY(-1); -webkit-transform: scaleY(-1);
transform: scaleY(-1) transform: scaleY(-1)
} }
.ing-flip-both, .ing-flip-both,
.ing-flip-horizontal.ing-flip-vertical, .ing-flip-horizontal.ing-flip-vertical,
.ing-flip-vertical { .ing-flip-vertical {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)" -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"
} }
.ing-flip-both, .ing-flip-both,
.ing-flip-horizontal.ing-flip-vertical { .ing-flip-horizontal.ing-flip-vertical {
-webkit-transform: scale(-1); -webkit-transform: scale(-1);
transform: scale(-1) transform: scale(-1)
} }
:root .ing-flip-both, :root .ing-flip-both,
:root .ing-flip-horizontal, :root .ing-flip-horizontal,
:root .ing-flip-vertical, :root .ing-flip-vertical,
:root .ing-rotate-90, :root .ing-rotate-90,
:root .ing-rotate-180, :root .ing-rotate-180,
:root .ing-rotate-270 { :root .ing-rotate-270 {
-webkit-filter: none; -webkit-filter: none;
filter: none filter: none
} }
[class^="ing-"], [class^="ing-"],
[class*=" ing-"] { [class*=" ing-"] {
/* use !important to prevent issues with browser extensions that change fonts */ /* use !important to prevent issues with browser extensions that change fonts */
font-family: 'ingfont' !important; font-family: 'ingfont' !important;
speak: never; speak: never;
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
font-variant: normal; font-variant: normal;
text-transform: none; text-transform: none;
line-height: 1; line-height: 1;
display: inline-block; display: inline-block;
/* Better Font Rendering =========== */ /* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.ing-fb1:before { .ing-fb1:before {
content: "\e932"; content: "\e932";
} }
.ing-fb2:before { .ing-fb2:before {
content: "\e933"; content: "\e933";
} }
.ing-tw1:before { .ing-tw1:before {
content: "\e912"; content: "\e912";
} }
.ing-tw2:before { .ing-tw2:before {
content: "\e900"; content: "\e900";
} }
.ing-in1:before { .ing-in1:before {
content: "\e91a"; content: "\e91a";
} }
.ing-in2:before { .ing-in2:before {
content: "\e902"; content: "\e902";
} }
.ing-instra1:before { .ing-instra1:before {
content: "\e924"; content: "\e924";
} }
.ing-instra2:before { .ing-instra2:before {
content: "\e923"; content: "\e923";
} }
.ing-youtube:before { .ing-youtube:before {
content: "\e90e"; content: "\e90e";
} }
.ing-telefono:before { .ing-telefono:before {
content: "\e911"; content: "\e911";
} }
.ing-mail:before { .ing-mail:before {
content: "\e907"; content: "\e907";
} }
.ing-link:before { .ing-link:before {
content: "\e919"; content: "\e919";
} }
.ing-ubicacion:before { .ing-ubicacion:before {
content: "\e908"; content: "\e908";
} }
.ing-puntos:before { .ing-puntos:before {
content: "\e917"; content: "\e917";
} }
.ing-usuario:before { .ing-usuario:before {
content: "\e90d"; content: "\e90d";
} }
.ing-pass:before { .ing-pass:before {
content: "\e906"; content: "\e906";
} }
.ing-menu:before { .ing-menu:before {
content: "\e901"; content: "\e901";
} }
.ing-salir:before { .ing-salir:before {
content: "\e90f"; content: "\e90f";
} }
.ing-flecha:before { .ing-flecha:before {
content: "\e905"; content: "\e905";
} }
.ing-cambiar:before { .ing-cambiar:before {
content: "\e93c"; content: "\e93c";
} }
.ing-caret:before { .ing-caret:before {
content: "\e90b"; content: "\e90b";
} }
.ing-aceptar:before { .ing-aceptar:before {
content: "\e916"; content: "\e916";
} }
.ing-cancelar:before { .ing-cancelar:before {
content: "\e910"; content: "\e910";
} }
.ing-mas:before { .ing-mas:before {
content: "\e91d"; content: "\e91d";
} }
.ing-menos:before { .ing-menos:before {
content: "\e91e"; content: "\e91e";
} }
.ing-editar:before { .ing-editar:before {
content: "\e938"; content: "\e938";
} }
.ing-buscar:before { .ing-buscar:before {
content: "\e939"; content: "\e939";
} }
.ing-ojo:before { .ing-ojo:before {
content: "\e92a"; content: "\e92a";
} }
.ing-borrar:before { .ing-borrar:before {
content: "\e942"; content: "\e942";
} }
.ing-basura:before { .ing-basura:before {
content: "\e941"; content: "\e941";
} }
.ing-camara:before { .ing-camara:before {
content: "\e909"; content: "\e909";
} }
.ing-importante:before { .ing-importante:before {
content: "\e935"; content: "\e935";
} }
.ing-bullet:before { .ing-bullet:before {
content: "\e943"; content: "\e943";
} }
.ing-home:before { .ing-home:before {
content: "\e934"; content: "\e934";
} }
.ing-formacion:before { .ing-formacion:before {
content: "\e914"; content: "\e914";
} }
.ing-empleo:before { .ing-empleo:before {
content: "\e915"; content: "\e915";
} }
.ing-insignia1:before { .ing-insignia1:before {
content: "\e920"; content: "\e920";
} }
.ing-insignia2:before { .ing-insignia2:before {
content: "\e91f"; content: "\e91f";
} }
.ing-insignia3:before { .ing-insignia3:before {
content: "\e921"; content: "\e921";
} }
.ing-insignia4:before { .ing-insignia4:before {
content: "\e922"; content: "\e922";
} }
.ing-eventos:before { .ing-eventos:before {
content: "\e90a"; content: "\e90a";
} }
.ing-reporte:before { .ing-reporte:before {
content: "\e918"; content: "\e918";
} }
.ing-catalogo:before { .ing-catalogo:before {
content: "\e936"; content: "\e936";
} }
.ing-evalua-cartel:before { .ing-evalua-cartel:before {
content: "\e913"; content: "\e913";
} }
.ing-revision-cartel:before { .ing-revision-cartel:before {
content: "\e90c"; content: "\e90c";
} }
.ing-reporte-resultados:before { .ing-reporte-resultados:before {
content: "\e929"; content: "\e929";
} }
.ing-mi-cartel:before { .ing-mi-cartel:before {
content: "\e91b"; content: "\e91b";
} }
.ing-galeria1:before { .ing-galeria1:before {
content: "\e91c"; content: "\e91c";
} }
.ing-galeria2:before { .ing-galeria2:before {
content: "\e925"; content: "\e925";
} }
.ing-iniciar-sesion:before { .ing-iniciar-sesion:before {
content: "\e926"; content: "\e926";
} }
.ing-finalistas:before { .ing-finalistas:before {
content: "\e927"; content: "\e927";
} }
.ing-comite:before { .ing-comite:before {
content: "\e92b"; content: "\e92b";
} }
.ing-administrador:before { .ing-administrador:before {
content: "\e92c"; content: "\e92c";
} }
.ing-estrella1:before { .ing-estrella1:before {
content: "\e903"; content: "\e903";
} }
.ing-estrella2:before { .ing-estrella2:before {
content: "\e904"; content: "\e904";
} }
.ing-carga-archivo:before { .ing-carga-archivo:before {
content: "\e93d"; content: "\e93d";
} }
.ing-carga-multiple:before { .ing-carga-multiple:before {
content: "\e93e"; content: "\e93e";
} }
.ing-descarga:before { .ing-descarga:before {
content: "\e928"; content: "\e928";
} }
.ing-autorizar:before { .ing-autorizar:before {
content: "\e92d"; content: "\e92d";
} }
.ing-negar:before { .ing-negar:before {
content: "\e92e"; content: "\e92e";
} }
.ing-no-cargado:before { .ing-no-cargado:before {
content: "\e92f"; content: "\e92f";
} }
.ing-alumnos:before { .ing-alumnos:before {
content: "\e91c"; content: "\e91c";
} }
.ing-cardex:before { .ing-cardex:before {
content: "\e93f"; content: "\e93f";
} }
.ing-configuracion:before { .ing-configuracion:before {
content: "\e940"; content: "\e940";
} }
.ing-listado-menus:before { .ing-listado-menus:before {
content: "\e944"; content: "\e944";
} }
.ing-mi-cuenta:before { .ing-mi-cuenta:before {
content: "\e945"; content: "\e945";
} }
.ing-ver:before { .ing-ver:before {
content: "\e946"; content: "\e946";
} }
.ing-grafica:before { .ing-grafica:before {
content: "\e930"; content: "\e930";
} }
.ing-clic:before { .ing-clic:before {
content: "\e931"; content: "\e931";
} }
.ing-guardar:before { .ing-guardar:before {
content: "\e937"; content: "\e937";
} }
.ing-regresar:before { .ing-regresar:before {
content: "\e93a"; content: "\e93a";
} }
.ing-cuadrado:before { .ing-cuadrado:before {
content: "\e93b"; content: "\e93b";
} }
.ing-imprimir:before { .ing-imprimir:before {
content: "\e947"; content: "\e947";
} }
.ing-importante2:before { .ing-importante2:before {
content: "\e948"; content: "\e948";
} }
.ing-copiar:before { .ing-copiar:before {
content: "\e949"; content: "\e949";
} }
.ing-reloj:before { .ing-reloj:before {
content: "\e94a"; content: "\e94a";
} }
.ing-retardo:before { .ing-retardo:before {
content: "\e94b"; content: "\e94b";
} }
.ing-justificar:before { .ing-justificar:before {
content: "\e94c"; content: "\e94c";
} }

12
css/jquery-ui.css vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,105 +1,105 @@
/* /*
Iconografía de La Salle Iconografía de La Salle
*/ */
@font-face { @font-face {
font-family: 'lasalle'; font-family: 'lasalle';
src: url("../fonts/lasalle/lasalle.eot"); src: url("../fonts/lasalle/lasalle.eot");
src: url("../fonts/lasalle/lasalle.eot?#iefix") format('embedded-opentype'), url("../fonts/lasalle/lasalle.woff") format('woff'), url("../fonts/lasalle/lasalle.ttf") format('truetype'), url("../fonts/lasalle/lasalle.svg#lasalle") format('svg'); src: url("../fonts/lasalle/lasalle.eot?#iefix") format('embedded-opentype'), url("../fonts/lasalle/lasalle.woff") format('woff'), url("../fonts/lasalle/lasalle.ttf") format('truetype'), url("../fonts/lasalle/lasalle.svg#lasalle") format('svg');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
.icon { .icon {
font-family: 'lasalle' !important; font-family: 'lasalle' !important;
speak: none; speak: none;
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
font-variant: normal; font-variant: normal;
text-transform: none; text-transform: none;
/*line-height: 1;*/ /*line-height: 1;*/
/* Better Font Rendering =========== */ /* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-fe:before {content: "\e952";} .icon-fe:before {content: "\e952";}
.icon-compras:before {content: "\e94d";} .icon-compras:before {content: "\e94d";}
.icon-arte:before {content: "\e94e";} .icon-arte:before {content: "\e94e";}
.icon-restaurante:before {content: "\e94f";} .icon-restaurante:before {content: "\e94f";}
.icon-cafe:before {content: "\e950";} .icon-cafe:before {content: "\e950";}
.icon-biblioteca:before {content: "\e951";} .icon-biblioteca:before {content: "\e951";}
.icon-markFull:before {content: "\e94c";} .icon-markFull:before {content: "\e94c";}
.icon-comment:before {content: "\e947";} .icon-comment:before {content: "\e947";}
.icon-faith:before {content: "\e948";} .icon-faith:before {content: "\e948";}
.icon-justice:before {content: "\e949";} .icon-justice:before {content: "\e949";}
.icon-compromise:before {content: "\e94a";} .icon-compromise:before {content: "\e94a";}
.icon-fraternity:before {content: "\e94b";} .icon-fraternity:before {content: "\e94b";}
.icon-telephone:before {content: "\e943";} .icon-telephone:before {content: "\e943";}
.icon-onSpeaking:before {content: "\e944";} .icon-onSpeaking:before {content: "\e944";}
.icon-offSpeaking:before { content: "\e945";} .icon-offSpeaking:before { content: "\e945";}
.icon-audio:before {content: "\e946";} .icon-audio:before {content: "\e946";}
.icon-play:before {content: "\e91c";} .icon-play:before {content: "\e91c";}
.icon-link:before {content: "\e936";} .icon-link:before {content: "\e936";}
.icon-ym:before { content: "\e937";} .icon-ym:before { content: "\e937";}
.icon-wp:before {content: "\e938";} .icon-wp:before {content: "\e938";}
.icon-read:before { content: "\e939";} .icon-read:before { content: "\e939";}
.icon-certificate:before {content: "\e93a";} .icon-certificate:before {content: "\e93a";}
.icon-school:before {content: "\e93b";} .icon-school:before {content: "\e93b";}
.icon-speaker:before {content: "\e93c";} .icon-speaker:before {content: "\e93c";}
.icon-atom:before {content: "\e93d";} .icon-atom:before {content: "\e93d";}
.icon-bag:before {content: "\e93e";} .icon-bag:before {content: "\e93e";}
.icon-carbuy:before {content: "\e93f";} .icon-carbuy:before {content: "\e93f";}
.icon-idea:before {content: "\e940";} .icon-idea:before {content: "\e940";}
.icon-hands:before {content: "\e941";} .icon-hands:before {content: "\e941";}
.icon-arrowprev:before {content: "\e942";} .icon-arrowprev:before {content: "\e942";}
.icon-mouse:before {content: "\e900";} .icon-mouse:before {content: "\e900";}
.icon-mail:before {content: "\e901";} .icon-mail:before {content: "\e901";}
.icon-down:before {content: "\e902";} .icon-down:before {content: "\e902";}
.icon-up:before {content: "\e903";} .icon-up:before {content: "\e903";}
.icon-right:before {content: "\e904";} .icon-right:before {content: "\e904";}
.icon-left:before {content: "\e905";} .icon-left:before {content: "\e905";}
.icon-headphones:before {content: "\e906";} .icon-headphones:before {content: "\e906";}
.icon-download:before {content: "\e907";} .icon-download:before {content: "\e907";}
.icon-chat:before {content: "\e908";} .icon-chat:before {content: "\e908";}
.icon-books:before {content: "\e909";} .icon-books:before {content: "\e909";}
.icon-calculator:before {content: "\e90a";} .icon-calculator:before {content: "\e90a";}
.icon-wrong:before {content: "\e90b";} .icon-wrong:before {content: "\e90b";}
.icon-conversation:before { content: "\e90c";} .icon-conversation:before { content: "\e90c";}
.icon-correct:before {content: "\e90d";} .icon-correct:before {content: "\e90d";}
.icon-error:before {content: "\e90e";} .icon-error:before {content: "\e90e";}
.icon-interchange:before {content: "\e90f";} .icon-interchange:before {content: "\e90f";}
.icon-conectivity:before {content: "\e910";} .icon-conectivity:before {content: "\e910";}
.icon-video:before {content: "\e911";} .icon-video:before {content: "\e911";}
.icon-desktop:before {content: "\e912";} .icon-desktop:before {content: "\e912";}
.icon-document:before {content: "\e913";} .icon-document:before {content: "\e913";}
.icon-stethoscope:before { content: "\e914";} .icon-stethoscope:before { content: "\e914";}
.icon-student:before {content: "\e915";} .icon-student:before {content: "\e915";}
.icon-smartphone:before {content: "\e916";} .icon-smartphone:before {content: "\e916";}
.icon-pencil:before {content: "\e917";} .icon-pencil:before {content: "\e917";}
.icon-sitemap:before {content: "\e918";} .icon-sitemap:before {content: "\e918";}
.icon-medal:before {content: "\e919";} .icon-medal:before {content: "\e919";}
.icon-microphone:before {content: "\e91a";} .icon-microphone:before {content: "\e91a";}
.icon-wireless:before {content: "\e91b";} .icon-wireless:before {content: "\e91b";}
.icon-fountain:before {content: "\e91d";} .icon-fountain:before {content: "\e91d";}
.icon-feather:before {content: "\e91e";} .icon-feather:before {content: "\e91e";}
.icon-pen:before {content: "\e91f";} .icon-pen:before {content: "\e91f";}
.icon-pentwo:before {content: "\e920";} .icon-pentwo:before {content: "\e920";}
.icon-watercolor:before {content: "\e921";} .icon-watercolor:before {content: "\e921";}
.icon-search:before {content: "\e922";} .icon-search:before {content: "\e922";}
.icon-security:before {content: "\e923";} .icon-security:before {content: "\e923";}
.icon-consult:before {content: "\e924";} .icon-consult:before {content: "\e924";}
.icon-sound:before {content: "\e925";} .icon-sound:before {content: "\e925";}
.icon-files:before {content: "\e926";} .icon-files:before {content: "\e926";}
.icon-upload:before {content: "\e927";} .icon-upload:before {content: "\e927";}
.icon-close:before {content: "\e928";} .icon-close:before {content: "\e928";}
.icon-arrow:before {content: "\e929";} .icon-arrow:before {content: "\e929";}
.icon-mark:before {content: "\e92a";} .icon-mark:before {content: "\e92a";}
.icon-time:before {content: "\e92b";} .icon-time:before {content: "\e92b";}
.icon-phone:before {content: "\e92c";} .icon-phone:before {content: "\e92c";}
.icon-share:before {content: "\e92d";} .icon-share:before {content: "\e92d";}
.icon-seeker:before {content: "\e92e";} .icon-seeker:before {content: "\e92e";}
.icon-fb:before {content: "\e92f";} .icon-fb:before {content: "\e92f";}
.icon-tw:before {content: "\e930";} .icon-tw:before {content: "\e930";}
.icon-yt:before {content: "\e931";} .icon-yt:before {content: "\e931";}
.icon-ig:before {content: "\e932";} .icon-ig:before {content: "\e932";}
.icon-in:before {content: "\e933";} .icon-in:before {content: "\e933";}
.icon-sc:before {content: "\e934";} .icon-sc:before {content: "\e934";}
.icon-chk:before {content: "\e935";} .icon-chk:before {content: "\e935";}

File diff suppressed because it is too large Load Diff

View File

@@ -1,99 +1,99 @@
.bg-azul { .bg-azul {
background-color: #00a6CE; background-color: #00a6CE;
} }
.azul { .azul {
color: #00a6CE; color: #00a6CE;
} }
/* for sm */ /* for sm */
.custom-switch.custom-switch-sm .custom-control-label { .custom-switch.custom-switch-sm .custom-control-label {
padding-left: 1rem; padding-left: 1rem;
padding-bottom: 1rem; padding-bottom: 1rem;
} }
.custom-switch.custom-switch-sm .custom-control-label::before { .custom-switch.custom-switch-sm .custom-control-label::before {
height: 1rem; height: 1rem;
width: calc(1rem + 0.75rem); width: calc(1rem + 0.75rem);
border-radius: 2rem; border-radius: 2rem;
} }
.custom-switch.custom-switch-sm .custom-control-label::after { .custom-switch.custom-switch-sm .custom-control-label::after {
width: calc(1rem - 4px); width: calc(1rem - 4px);
height: calc(1rem - 4px); height: calc(1rem - 4px);
border-radius: calc(1rem - (1rem / 2)); border-radius: calc(1rem - (1rem / 2));
} }
.custom-switch.custom-switch-sm .custom-control-input:checked ~ .custom-control-label::after { .custom-switch.custom-switch-sm .custom-control-input:checked ~ .custom-control-label::after {
transform: translateX(calc(1rem - 0.25rem)); transform: translateX(calc(1rem - 0.25rem));
} }
/* for md */ /* for md */
.custom-switch.custom-switch-md .custom-control-label { .custom-switch.custom-switch-md .custom-control-label {
padding-left: 2rem; padding-left: 2rem;
padding-bottom: 1.5rem; padding-bottom: 1.5rem;
} }
.custom-switch.custom-switch-md .custom-control-label::before { .custom-switch.custom-switch-md .custom-control-label::before {
height: 1.5rem; height: 1.5rem;
width: calc(2rem + 0.75rem); width: calc(2rem + 0.75rem);
border-radius: 3rem; border-radius: 3rem;
} }
.custom-switch.custom-switch-md .custom-control-label::after { .custom-switch.custom-switch-md .custom-control-label::after {
width: calc(1.5rem - 4px); width: calc(1.5rem - 4px);
height: calc(1.5rem - 4px); height: calc(1.5rem - 4px);
border-radius: calc(2rem - (1.5rem / 2)); border-radius: calc(2rem - (1.5rem / 2));
} }
.custom-switch.custom-switch-md .custom-control-input:checked ~ .custom-control-label::after { .custom-switch.custom-switch-md .custom-control-input:checked ~ .custom-control-label::after {
transform: translateX(calc(1.5rem - 0.25rem)); transform: translateX(calc(1.5rem - 0.25rem));
} }
/* for lg */ /* for lg */
.custom-switch.custom-switch-lg .custom-control-label { .custom-switch.custom-switch-lg .custom-control-label {
padding-left: 3rem; padding-left: 3rem;
padding-bottom: 2rem; padding-bottom: 2rem;
} }
.custom-switch.custom-switch-lg .custom-control-label::before { .custom-switch.custom-switch-lg .custom-control-label::before {
height: 2rem; height: 2rem;
width: calc(3rem + 0.75rem); width: calc(3rem + 0.75rem);
border-radius: 4rem; border-radius: 4rem;
} }
.custom-switch.custom-switch-lg .custom-control-label::after { .custom-switch.custom-switch-lg .custom-control-label::after {
width: calc(2rem - 4px); width: calc(2rem - 4px);
height: calc(2rem - 4px); height: calc(2rem - 4px);
border-radius: calc(3rem - (2rem / 2)); border-radius: calc(3rem - (2rem / 2));
} }
.custom-switch.custom-switch-lg .custom-control-input:checked ~ .custom-control-label::after { .custom-switch.custom-switch-lg .custom-control-input:checked ~ .custom-control-label::after {
transform: translateX(calc(2rem - 0.25rem)); transform: translateX(calc(2rem - 0.25rem));
} }
/* for xl */ /* for xl */
.custom-switch.custom-switch-xl .custom-control-label { .custom-switch.custom-switch-xl .custom-control-label {
padding-left: 4rem; padding-left: 4rem;
padding-bottom: 2.5rem; padding-bottom: 2.5rem;
} }
.custom-switch.custom-switch-xl .custom-control-label::before { .custom-switch.custom-switch-xl .custom-control-label::before {
height: 2.5rem; height: 2.5rem;
width: calc(4rem + 0.75rem); width: calc(4rem + 0.75rem);
border-radius: 5rem; border-radius: 5rem;
} }
.custom-switch.custom-switch-xl .custom-control-label::after { .custom-switch.custom-switch-xl .custom-control-label::after {
width: calc(2.5rem - 4px); width: calc(2.5rem - 4px);
height: calc(2.5rem - 4px); height: calc(2.5rem - 4px);
border-radius: calc(4rem - (2.5rem / 2)); border-radius: calc(4rem - (2.5rem / 2));
} }
.custom-switch.custom-switch-xl .custom-control-input:checked ~ .custom-control-label::after { .custom-switch.custom-switch-xl .custom-control-input:checked ~ .custom-control-label::after {
transform: translateX(calc(2.5rem - 0.25rem)); transform: translateX(calc(2.5rem - 0.25rem));
} }

View File

@@ -1,142 +1,142 @@
/*\ /*\
|*| ======================================================================== |*| ========================================================================
|*| Bootstrap Toggle: bootstrap4-toggle.css v3.6.1 |*| Bootstrap Toggle: bootstrap4-toggle.css v3.6.1
|*| https://gitbrent.github.io/bootstrap4-toggle/ |*| https://gitbrent.github.io/bootstrap4-toggle/
|*| ======================================================================== |*| ========================================================================
|*| Copyright 2018-2019 Brent Ely |*| Copyright 2018-2019 Brent Ely
|*| Licensed under MIT |*| Licensed under MIT
|*| ======================================================================== |*| ========================================================================
\*/ \*/
/* /*
* @added 3.0.0: Return support for "*-xs" removed in Bootstrap-4 * @added 3.0.0: Return support for "*-xs" removed in Bootstrap-4
* @see: [Comment](https://github.com/twbs/bootstrap/issues/21881#issuecomment-341972830) * @see: [Comment](https://github.com/twbs/bootstrap/issues/21881#issuecomment-341972830)
*/ */
.btn-group-xs > .btn, .btn-xs { .btn-group-xs > .btn, .btn-xs {
padding: .35rem .4rem .25rem .4rem; padding: .35rem .4rem .25rem .4rem;
font-size: .875rem; font-size: .875rem;
line-height: .5; line-height: .5;
border-radius: 20rem; border-radius: 20rem;
} }
.checkbox label .toggle, .checkbox-inline .toggle { .checkbox label .toggle, .checkbox-inline .toggle {
margin-left: -1.25rem; margin-left: -1.25rem;
margin-right: .35rem; margin-right: .35rem;
} }
.toggle { .toggle {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.toggle.btn.btn-light, .toggle.btn.btn-outline-light { .toggle.btn.btn-light, .toggle.btn.btn-outline-light {
/* bootstrap-4 - add a border so toggle is delineated */ /* bootstrap-4 - add a border so toggle is delineated */
border-color: rgba(0, 0, 0, .15); border-color: rgba(0, 0, 0, .15);
} }
.toggle input[type="checkbox"] { .toggle input[type="checkbox"] {
display: none; display: none;
} }
.toggle-group { .toggle-group {
position: absolute; position: absolute;
width: 200%; width: 200%;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
transition: left 0.35s; transition: left 0.35s;
-webkit-transition: left 0.35s; -webkit-transition: left 0.35s;
-moz-user-select: none; -moz-user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
} }
.toggle-group label, .toggle-group span { cursor: pointer; } .toggle-group label, .toggle-group span { cursor: pointer; }
.toggle.off .toggle-group { .toggle.off .toggle-group {
left: -100%; left: -100%;
} }
.toggle-on { .toggle-on {
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 50%; right: 50%;
margin: 0; margin: 0;
border: 0; border: 0;
border-radius: 20rem; border-radius: 20rem;
} }
.toggle-off { .toggle-off {
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 50%; left: 50%;
right: 0; right: 0;
margin: 0; margin: 0;
border: 0; border: 0;
border-radius: 20rem; border-radius: 20rem;
box-shadow: none; /* Bootstrap 4.0 Support via (Issue #186)[https://github.com/minhur/bootstrap-toggle/issues/186]) */ box-shadow: none; /* Bootstrap 4.0 Support via (Issue #186)[https://github.com/minhur/bootstrap-toggle/issues/186]) */
} }
.toggle-handle { .toggle-handle {
position: relative; position: relative;
margin: 0 auto; margin: 0 auto;
padding-top: 0px; padding-top: 0px;
padding-bottom: 0px; padding-bottom: 0px;
height: 100%; height: 100%;
width: 0px; width: 0px;
border-width: 0 1px; border-width: 0 1px;
background-color: #FFFFFF; background-color: #FFFFFF;
} }
.toggle.btn-outline-primary .toggle-handle { .toggle.btn-outline-primary .toggle-handle {
background-color: var(--primary); background-color: var(--primary);
border-color: var(--primary); border-color: var(--primary);
} }
.toggle.btn-outline-secondary .toggle-handle { .toggle.btn-outline-secondary .toggle-handle {
background-color: var(--secondary); background-color: var(--secondary);
border-color: var(--secondary); border-color: var(--secondary);
} }
.toggle.btn-outline-success .toggle-handle { .toggle.btn-outline-success .toggle-handle {
background-color: var(--success); background-color: var(--success);
border-color: var(--success); border-color: var(--success);
} }
.toggle.btn-outline-danger .toggle-handle { .toggle.btn-outline-danger .toggle-handle {
background-color: var(--danger); background-color: var(--danger);
border-color: var(--danger); border-color: var(--danger);
} }
.toggle.btn-outline-warning .toggle-handle { .toggle.btn-outline-warning .toggle-handle {
background-color: var(--warning); background-color: var(--warning);
border-color: var(--warning); border-color: var(--warning);
} }
.toggle.btn-outline-info .toggle-handle { .toggle.btn-outline-info .toggle-handle {
background-color: var(--info); background-color: var(--info);
border-color: var(--info); border-color: var(--info);
} }
.toggle.btn-outline-light .toggle-handle { .toggle.btn-outline-light .toggle-handle {
background-color: var(--light); background-color: var(--light);
border-color: var(--light); border-color: var(--light);
} }
.toggle.btn-outline-dark .toggle-handle { .toggle.btn-outline-dark .toggle-handle {
background-color: var(--dark); background-color: var(--dark);
border-color: var(--dark); border-color: var(--dark);
} }
.toggle[class*="btn-outline"]:hover .toggle-handle { .toggle[class*="btn-outline"]:hover .toggle-handle {
background-color: var(--light); background-color: var(--light);
opacity: 0.5; opacity: 0.5;
} }
/* NOTE: Must come first, so classes below override as needed */ /* NOTE: Must come first, so classes below override as needed */
/* [default] (bootstrap-4.1.3 - .btn - h:38px) */ /* [default] (bootstrap-4.1.3 - .btn - h:38px) */
.toggle.btn { min-width: 3.7rem; min-height: 2.15rem; } .toggle.btn { min-width: 3.7rem; min-height: 2.15rem; }
.toggle-on.btn { padding-right: 1.5rem; } .toggle-on.btn { padding-right: 1.5rem; }
.toggle-off.btn { padding-left: 1.5rem; } .toggle-off.btn { padding-left: 1.5rem; }
/* `lg` (bootstrap-4.1.3 - .btn - h:48px) */ /* `lg` (bootstrap-4.1.3 - .btn - h:48px) */
.toggle.btn-lg { min-width: 5rem; min-height: 2.815rem; } .toggle.btn-lg { min-width: 5rem; min-height: 2.815rem; }
.toggle-on.btn-lg { padding-right: 2rem; } .toggle-on.btn-lg { padding-right: 2rem; }
.toggle-off.btn-lg { padding-left: 2rem; } .toggle-off.btn-lg { padding-left: 2rem; }
.toggle-handle.btn-lg { width: 2.5rem; } .toggle-handle.btn-lg { width: 2.5rem; }
/* `sm` (bootstrap-4.1.3 - .btn - h:31px) */ /* `sm` (bootstrap-4.1.3 - .btn - h:31px) */
.toggle.btn-sm { min-width: 3.125rem; min-height: 1.938rem; } .toggle.btn-sm { min-width: 3.125rem; min-height: 1.938rem; }
.toggle-on.btn-sm { padding-right: 1rem; } .toggle-on.btn-sm { padding-right: 1rem; }
.toggle-off.btn-sm { padding-left: 1rem; } .toggle-off.btn-sm { padding-left: 1rem; }
/* `xs` (bootstrap-3.3 - .btn - h:22px) */ /* `xs` (bootstrap-3.3 - .btn - h:22px) */
.toggle.btn-xs { min-width: 2.19rem; min-height: 1.375rem; } .toggle.btn-xs { min-width: 2.19rem; min-height: 1.375rem; }
.toggle-on.btn-xs { padding-right: .8rem; } .toggle-on.btn-xs { padding-right: .8rem; }
.toggle-off.btn-xs { padding-left: .8rem; } .toggle-off.btn-xs { padding-left: .8rem; }

472
demo.html
View File

@@ -1,237 +1,237 @@
<link rel="stylesheet" href="css/indivisa.css"> <link rel="stylesheet" href="css/indivisa.css">
<h1>Iconos editado</h1> <h1>Iconos editado</h1>
<h2>Iconos editados 2</h2> <h2>Iconos editados 2</h2>
<p class="container"> <p class="container">
<i class="ing-fb1"></i> ing-fb1 <i class="ing-fb1"></i> ing-fb1
</p> </p>
<p class="container"> <p class="container">
<i class="ing-fb2"></i> ing-fb2 <i class="ing-fb2"></i> ing-fb2
</p> </p>
<p class="container"> <p class="container">
<i class="ing-tw1"></i> ing-tw1 <i class="ing-tw1"></i> ing-tw1
</p> </p>
<p class="container"> <p class="container">
<i class="ing-tw2"></i> ing-tw2 <i class="ing-tw2"></i> ing-tw2
</p> </p>
<p class="container"> <p class="container">
<i class="ing-in1"></i> ing-in1 <i class="ing-in1"></i> ing-in1
</p> </p>
<p class="container"> <p class="container">
<i class="ing-in2"></i> ing-in2 <i class="ing-in2"></i> ing-in2
</p> </p>
<p class="container"> <p class="container">
<i class="ing-instra1"></i> ing-instra1 <i class="ing-instra1"></i> ing-instra1
</p> </p>
<p class="container"> <p class="container">
<i class="ing-instra2"></i> ing-instra2 <i class="ing-instra2"></i> ing-instra2
</p> </p>
<p class="container"> <p class="container">
<i class="ing-youtube"></i> ing-youtube <i class="ing-youtube"></i> ing-youtube
</p> </p>
<p class="container"> <p class="container">
<i class="ing-telefono"></i> ing-telefono <i class="ing-telefono"></i> ing-telefono
</p> </p>
<p class="container"> <p class="container">
<i class="ing-mail"></i> ing-mail <i class="ing-mail"></i> ing-mail
</p> </p>
<p class="container"> <p class="container">
<i class="ing-link"></i> ing-link <i class="ing-link"></i> ing-link
</p> </p>
<p class="container"> <p class="container">
<i class="ing-ubicacion"></i> ing-ubicacion <i class="ing-ubicacion"></i> ing-ubicacion
</p> </p>
<p class="container"> <p class="container">
<i class="ing-puntos"></i> ing-puntos <i class="ing-puntos"></i> ing-puntos
</p> </p>
<p class="container"> <p class="container">
<i class="ing-usuario"></i> ing-usuario <i class="ing-usuario"></i> ing-usuario
</p> </p>
<p class="container"> <p class="container">
<i class="ing-pass"></i> ing-pass <i class="ing-pass"></i> ing-pass
</p> </p>
<p class="container"> <p class="container">
<i class="ing-menu"></i> ing-menu <i class="ing-menu"></i> ing-menu
</p> </p>
<p class="container"> <p class="container">
<i class="ing-salir"></i> ing-salir <i class="ing-salir"></i> ing-salir
</p> </p>
<p class="container"> <p class="container">
<i class="ing-flecha"></i> ing-flecha <i class="ing-flecha"></i> ing-flecha
</p> </p>
<p class="container"> <p class="container">
<i class="ing-cambiar"></i> ing-cambiar <i class="ing-cambiar"></i> ing-cambiar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-caret"></i> ing-caret <i class="ing-caret"></i> ing-caret
</p> </p>
<p class="container"> <p class="container">
<i class="ing-aceptar"></i> ing-aceptar <i class="ing-aceptar"></i> ing-aceptar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-cancelar"></i> ing-cancelar <i class="ing-cancelar"></i> ing-cancelar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-mas"></i> ing-mas <i class="ing-mas"></i> ing-mas
</p> </p>
<p class="container"> <p class="container">
<i class="ing-menos"></i> ing-menos <i class="ing-menos"></i> ing-menos
</p> </p>
<p class="container"> <p class="container">
<i class="ing-editar"></i> ing-editar <i class="ing-editar"></i> ing-editar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-buscar"></i> ing-buscar <i class="ing-buscar"></i> ing-buscar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-ojo"></i> ing-ojo <i class="ing-ojo"></i> ing-ojo
</p> </p>
<p class="container"> <p class="container">
<i class="ing-borrar"></i> ing-borrar <i class="ing-borrar"></i> ing-borrar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-basura"></i> ing-basura <i class="ing-basura"></i> ing-basura
</p> </p>
<p class="container"> <p class="container">
<i class="ing-camara"></i> ing-camara <i class="ing-camara"></i> ing-camara
</p> </p>
<p class="container"> <p class="container">
<i class="ing-importante"></i> ing-importante <i class="ing-importante"></i> ing-importante
</p> </p>
<p class="container"> <p class="container">
<i class="ing-bullet"></i> ing-bullet <i class="ing-bullet"></i> ing-bullet
</p> </p>
<p class="container"> <p class="container">
<i class="ing-home"></i> ing-home <i class="ing-home"></i> ing-home
</p> </p>
<p class="container"> <p class="container">
<i class="ing-formacion"></i> ing-formacion <i class="ing-formacion"></i> ing-formacion
</p> </p>
<p class="container"> <p class="container">
<i class="ing-empleo"></i> ing-empleo <i class="ing-empleo"></i> ing-empleo
</p> </p>
<p class="container"> <p class="container">
<i class="ing-insignia1"></i> ing-insignia1 <i class="ing-insignia1"></i> ing-insignia1
</p> </p>
<p class="container"> <p class="container">
<i class="ing-insignia2"></i> ing-insignia2 <i class="ing-insignia2"></i> ing-insignia2
</p> </p>
<p class="container"> <p class="container">
<i class="ing-insignia3"></i> ing-insignia3 <i class="ing-insignia3"></i> ing-insignia3
</p> </p>
<p class="container"> <p class="container">
<i class="ing-insignia4"></i> ing-insignia4 <i class="ing-insignia4"></i> ing-insignia4
</p> </p>
<p class="container"> <p class="container">
<i class="ing-eventos"></i> ing-eventos <i class="ing-eventos"></i> ing-eventos
</p> </p>
<p class="container"> <p class="container">
<i class="ing-reporte"></i> ing-reporte <i class="ing-reporte"></i> ing-reporte
</p> </p>
<p class="container"> <p class="container">
<i class="ing-catalogo"></i> ing-catalogo <i class="ing-catalogo"></i> ing-catalogo
</p> </p>
<p class="container"> <p class="container">
<i class="ing-evalua-cartel"></i> ing-evalua-cartel <i class="ing-evalua-cartel"></i> ing-evalua-cartel
</p> </p>
<p class="container"> <p class="container">
<i class="ing-revision-cartel"></i> ing-revision-cartel <i class="ing-revision-cartel"></i> ing-revision-cartel
</p> </p>
<p class="container"> <p class="container">
<i class="ing-reporte-resultados"></i> ing-reporte-resultados <i class="ing-reporte-resultados"></i> ing-reporte-resultados
</p> </p>
<p class="container"> <p class="container">
<i class="ing-mi-cartel"></i> ing-mi-cartel <i class="ing-mi-cartel"></i> ing-mi-cartel
</p> </p>
<p class="container"> <p class="container">
<i class="ing-galeria1"></i> ing-galeria1 <i class="ing-galeria1"></i> ing-galeria1
</p> </p>
<p class="container"> <p class="container">
<i class="ing-galeria2"></i> ing-galeria2 <i class="ing-galeria2"></i> ing-galeria2
</p> </p>
<p class="container"> <p class="container">
<i class="ing-iniciar-sesion"></i> ing-iniciar-sesion <i class="ing-iniciar-sesion"></i> ing-iniciar-sesion
</p> </p>
<p class="container"> <p class="container">
<i class="ing-finalistas"></i> ing-finalistas <i class="ing-finalistas"></i> ing-finalistas
</p> </p>
<p class="container"> <p class="container">
<i class="ing-comite"></i> ing-comite <i class="ing-comite"></i> ing-comite
</p> </p>
<p class="container"> <p class="container">
<i class="ing-administrador"></i> ing-administrador <i class="ing-administrador"></i> ing-administrador
</p> </p>
<p class="container"> <p class="container">
<i class="ing-estrella1"></i> ing-estrella1 <i class="ing-estrella1"></i> ing-estrella1
</p> </p>
<p class="container"> <p class="container">
<i class="ing-estrella2"></i> ing-estrella2 <i class="ing-estrella2"></i> ing-estrella2
</p> </p>
<p class="container"> <p class="container">
<i class="ing-carga-archivo"></i> ing-carga-archivo <i class="ing-carga-archivo"></i> ing-carga-archivo
</p> </p>
<p class="container"> <p class="container">
<i class="ing-carga-multiple"></i> ing-carga-multiple <i class="ing-carga-multiple"></i> ing-carga-multiple
</p> </p>
<p class="container"> <p class="container">
<i class="ing-descarga"></i> ing-descarga <i class="ing-descarga"></i> ing-descarga
</p> </p>
<p class="container"> <p class="container">
<i class="ing-autorizar"></i> ing-autorizar <i class="ing-autorizar"></i> ing-autorizar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-negar"></i> ing-negar <i class="ing-negar"></i> ing-negar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-no-cargado"></i> ing-no-cargado <i class="ing-no-cargado"></i> ing-no-cargado
</p> </p>
<p class="container"> <p class="container">
<i class="ing-alumnos"></i> ing-alumnos <i class="ing-alumnos"></i> ing-alumnos
</p> </p>
<p class="container"> <p class="container">
<i class="ing-cardex"></i> ing-cardex <i class="ing-cardex"></i> ing-cardex
</p> </p>
<p class="container"> <p class="container">
<i class="ing-configuracion"></i> ing-configuracion <i class="ing-configuracion"></i> ing-configuracion
</p> </p>
<p class="container"> <p class="container">
<i class="ing-listado-menus"></i> ing-listado-menus <i class="ing-listado-menus"></i> ing-listado-menus
</p> </p>
<p class="container"> <p class="container">
<i class="ing-mi-cuenta"></i> ing-mi-cuenta <i class="ing-mi-cuenta"></i> ing-mi-cuenta
</p> </p>
<p class="container"> <p class="container">
<i class="ing-ver"></i> ing-ver <i class="ing-ver"></i> ing-ver
</p> </p>
<p class="container"> <p class="container">
<i class="ing-grafica"></i> ing-grafica <i class="ing-grafica"></i> ing-grafica
</p> </p>
<p class="container"> <p class="container">
<i class="ing-clic"></i> ing-clic <i class="ing-clic"></i> ing-clic
</p> </p>
<p class="container"> <p class="container">
<i class="ing-guardar"></i> ing-guardar <i class="ing-guardar"></i> ing-guardar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-regresar"></i> ing-regresar <i class="ing-regresar"></i> ing-regresar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-cuadrado"></i> ing-cuadrado <i class="ing-cuadrado"></i> ing-cuadrado
</p> </p>
<p class="container"> <p class="container">
<i class="ing-imprimir"></i> ing-imprimir <i class="ing-imprimir"></i> ing-imprimir
</p> </p>
<p class="container"> <p class="container">
<i class="ing-importante2"></i> ing-importante2 <i class="ing-importante2"></i> ing-importante2
</p> </p>
<p class="container"> <p class="container">
<i class="ing-copiar"></i> ing-copiar <i class="ing-copiar"></i> ing-copiar
</p> </p>
<p class="container"> <p class="container">
<i class="ing-reloj"></i> ing-reloj <i class="ing-reloj"></i> ing-reloj
</p> </p>
<p class="container"> <p class="container">
<i class="ing-retardo"></i> ing-retardo <i class="ing-retardo"></i> ing-retardo
</p> </p>
<p class="container"> <p class="container">
<i class="ing-justificar"></i> ing-justificar <i class="ing-justificar"></i> ing-justificar
</p> </p>

View File

@@ -1,156 +1,156 @@
<?php <?php
$fecha = date('d_m_Y'); $fecha = date('d_m_Y');
require_once '../class/c_login.php'; require_once '../class/c_login.php';
if (!isset($_SESSION['user'])){ if (!isset($_SESSION['user'])){
die(header('Location: index.php')); die(header('Location: index.php'));
} }
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
header("Content-Disposition: attachment;filename=solicitudes_$fecha.xlsx"); header("Content-Disposition: attachment;filename=solicitudes_$fecha.xlsx");
header("Cache-Control: max-age=0"); header("Cache-Control: max-age=0");
require_once "../vendor/autoload.php"; require_once "../vendor/autoload.php";
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Border; use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\Color; use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Style\Fill; use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\IOFactory;
$fecha_ini = $_POST["fecha_inicial"]; $fecha_ini = $_POST["fecha_inicial"];
$fecha_fin = $_POST["fecha_final"]; $fecha_fin = $_POST["fecha_final"];
//Reposiciones //Reposiciones
$repEdo_rs = $db->query('SELECT * FROM fs_estado_reposicion' ); $repEdo_rs = $db->query('SELECT * FROM fs_estado_reposicion' );
$repoParams = array(); $repoParams = array();
$user = Login::get_user(); $user = Login::get_user();
$user->access(); $user->access();
$query=""; $query="";
if($user->rol["rol_id"] == 9){//es coordinador if($user->rol["rol_id"] == 9){//es coordinador
$query .= ":facultad, "; $query .= ":facultad, ";
$repoParams[":facultad"] = $user->facultad["facultad_id"]; $repoParams[":facultad"] = $user->facultad["facultad_id"];
}else{//supervisor }else{//supervisor
$query .= "NULL, "; $query .= "NULL, ";
} }
if(isset($_POST["prof"]) ){ if(isset($_POST["prof"]) ){
$query .= ":prof,"; $query .= ":prof,";
$profesor = trim($_POST["prof"]);//limpia texto $profesor = trim($_POST["prof"]);//limpia texto
$repoParams[":prof"] = $profesor; $repoParams[":prof"] = $profesor;
}else{ }else{
$query .= "NULL,"; $query .= "NULL,";
} }
$query .= ":f_ini, :f_fin, "; $query .= ":f_ini, :f_fin, ";
$repoParams[":f_ini"] = DateTime::createFromFormat('d/m/Y', $fecha_ini)->format('Y-m-d'); $repoParams[":f_ini"] = DateTime::createFromFormat('d/m/Y', $fecha_ini)->format('Y-m-d');
$repoParams[":f_fin"] = DateTime::createFromFormat('d/m/Y', $fecha_fin)->format('Y-m-d'); $repoParams[":f_fin"] = DateTime::createFromFormat('d/m/Y', $fecha_fin)->format('Y-m-d');
$spreadsheet = new Spreadsheet(); $spreadsheet = new Spreadsheet();
// Set document properties // Set document properties
$spreadsheet->getProperties()->setCreator('Universidad La Salle') $spreadsheet->getProperties()->setCreator('Universidad La Salle')
->setLastModifiedBy('Universidad La Salle') ->setLastModifiedBy('Universidad La Salle')
->setTitle('Solicitudes') ->setTitle('Solicitudes')
->setDescription('Reporte de solicitudes.'); ->setDescription('Reporte de solicitudes.');
$headerStyle = $headerStyle =
[ [
'fill' => [ 'fill' => [
'fillType' => Fill::FILL_SOLID, 'fillType' => Fill::FILL_SOLID,
'color' => ['argb' => 'FF001d68'], 'color' => ['argb' => 'FF001d68'],
], ],
'borders' => [ 'borders' => [
'bottom' => ['borderStyle' => Border::BORDER_THIN], 'bottom' => ['borderStyle' => Border::BORDER_THIN],
'right' => ['borderStyle' => Border::BORDER_MEDIUM], 'right' => ['borderStyle' => Border::BORDER_MEDIUM],
], ],
'font' => [ 'font' => [
'bold' => true, 'bold' => true,
'color' => ['argb' => 'FFFFFFFF'], 'color' => ['argb' => 'FFFFFFFF'],
] ]
]; ];
$row_base = 6; $row_base = 6;
$i=0; $i=0;
foreach($repEdo_rs as $redo){ foreach($repEdo_rs as $redo){
$row = $row_base; $row = $row_base;
if($i >= $spreadsheet->getSheetCount()){ if($i >= $spreadsheet->getSheetCount()){
$spreadsheet->createSheet(); $spreadsheet->createSheet();
} }
$spreadsheet->setActiveSheetIndex($i); $spreadsheet->setActiveSheetIndex($i);
//crea imagen //crea imagen
$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing(); $drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
$drawing->setName('La Salle'); $drawing->setName('La Salle');
$drawing->setDescription('La Salle'); $drawing->setDescription('La Salle');
$drawing->setPath('../imagenes/logo.png'); // put your path and image here $drawing->setPath('../imagenes/logo.png'); // put your path and image here
$drawing->setCoordinates('A1'); $drawing->setCoordinates('A1');
$drawing->setHeight(100); $drawing->setHeight(100);
$drawing->setOffsetX(10); $drawing->setOffsetX(10);
//agrega imagen //agrega imagen
$drawing->setWorksheet($spreadsheet->getActiveSheet()); $drawing->setWorksheet($spreadsheet->getActiveSheet());
$spreadsheet->getActiveSheet() $spreadsheet->getActiveSheet()
->setCellValue('A'.$row, 'Estado') ->setCellValue('A'.$row, 'Estado')
->setCellValue('B'.$row, 'Tipo') ->setCellValue('B'.$row, 'Tipo')
->setCellValue('C'.$row, 'Profesor') ->setCellValue('C'.$row, 'Profesor')
->setCellValue('D'.$row, 'Materia') ->setCellValue('D'.$row, 'Materia')
->setCellValue('E'.$row, 'Grupo') ->setCellValue('E'.$row, 'Grupo')
->setCellValue('F'.$row, 'Fecha falta') ->setCellValue('F'.$row, 'Fecha falta')
->setCellValue('G'.$row, 'Fecha reposición') ->setCellValue('G'.$row, 'Fecha reposición')
->setCellValue('H'.$row, 'Salón'); ->setCellValue('H'.$row, 'Salón');
$spreadsheet->getActiveSheet()->getStyle('A'.$row.':H'.$row)->applyFromArray($headerStyle); $spreadsheet->getActiveSheet()->getStyle('A'.$row.':H'.$row)->applyFromArray($headerStyle);
$repoParams[":edo"]=$redo["estado_reposicion_id"]; $repoParams[":edo"]=$redo["estado_reposicion_id"];
if($user->rol["rol_id"] == 7){//es supervisor if($user->rol["rol_id"] == 7){//es supervisor
$repoParams[":sup"] = $user->user["id"]; $repoParams[":sup"] = $user->user["id"];
$solicitudes_rs = $db->query('SELECT * FROM fs_solicitud(NULL, '.$query.':edo, NULL, :sup) ', $repoParams ); $solicitudes_rs = $db->query('SELECT * FROM fs_solicitud(NULL, '.$query.':edo, NULL, :sup) ', $repoParams );
}else{ }else{
$solicitudes_rs = $db->query('SELECT * FROM fs_solicitud(NULL, '.$query.':edo, NULL, NULL) ', $repoParams ); $solicitudes_rs = $db->query('SELECT * FROM fs_solicitud(NULL, '.$query.':edo, NULL, NULL) ', $repoParams );
} }
$row++; $row++;
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle($redo["estado_nombre"]); $sheet->setTitle($redo["estado_nombre"]);
if(isset($solicitudes_rs) && count($solicitudes_rs)>0){ if(isset($solicitudes_rs) && count($solicitudes_rs)>0){
foreach($solicitudes_rs as $reposicion){ foreach($solicitudes_rs as $reposicion){
$sheet->setCellValue('A'.$row, $reposicion["estado_nombre"]); $sheet->setCellValue('A'.$row, $reposicion["estado_nombre"]);
$sheet->setCellValue('B'.$row, $reposicion["solicitudtipo_nombre"]); $sheet->setCellValue('B'.$row, $reposicion["solicitudtipo_nombre"]);
$sheet->setCellValue('C'.$row, $reposicion["profesor_clave"]." - ".$reposicion["profesor_nombre"]); $sheet->setCellValue('C'.$row, $reposicion["profesor_clave"]." - ".$reposicion["profesor_nombre"]);
$sheet->setCellValue('D'.$row, $reposicion["materia_nombre"]); $sheet->setCellValue('D'.$row, $reposicion["materia_nombre"]);
if($reposicion["horario_grupo"]!="") if($reposicion["horario_grupo"]!="")
$sheet->setCellValue('E'.$row, $reposicion["horario_grupo"]); $sheet->setCellValue('E'.$row, $reposicion["horario_grupo"]);
if($reposicion["fecha_clase"]!=""){ if($reposicion["fecha_clase"]!=""){
$fechaI = DateTime::createFromFormat('Y-m-d', $reposicion["fecha_nueva"])->format('d/m/Y'); $fechaI = DateTime::createFromFormat('Y-m-d', $reposicion["fecha_nueva"])->format('d/m/Y');
$sheet->setCellValue('F'.$row, $fechaI." ".substr($reposicion["horario_hora"],0, 5)); $sheet->setCellValue('F'.$row, $fechaI." ".substr($reposicion["horario_hora"],0, 5));
} }
$fechaF = date("d/m/Y", strtotime($reposicion["fecha_nueva"])); $fechaF = date("d/m/Y", strtotime($reposicion["fecha_nueva"]));
$sheet->setCellValue('G'.$row, $fechaF." ".substr($reposicion["hora_nueva"],0, 5)." a ".substr($reposicion["hora_nueva_fin"],0, 5)); $sheet->setCellValue('G'.$row, $fechaF." ".substr($reposicion["hora_nueva"],0, 5)." a ".substr($reposicion["hora_nueva_fin"],0, 5));
if($reposicion["salon_id"] != ""){ if($reposicion["salon_id"] != ""){
$salon_json = json_decode($reposicion["salon_array"], true); $salon_json = json_decode($reposicion["salon_array"], true);
$sheet->setCellValue('H'.$row, $salon_json[count($salon_json)-1]); $sheet->setCellValue('H'.$row, $salon_json[count($salon_json)-1]);
}else }else
$sheet->setCellValue('H'.$row, "Pendiente"); $sheet->setCellValue('H'.$row, "Pendiente");
$row++; $row++;
}//foreach }//foreach
}//if }//if
foreach ($sheet->getColumnIterator() as $column) { foreach ($sheet->getColumnIterator() as $column) {
$sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true); $sheet->getColumnDimension($column->getColumnIndex())->setAutoSize(true);
} }
$sheet->setAutoFilter('A'.$row_base.':H'.$row_base); $sheet->setAutoFilter('A'.$row_base.':H'.$row_base);
$i++; $i++;
} }
$spreadsheet->setActiveSheetIndex(0); $spreadsheet->setActiveSheetIndex(0);
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save('php://output'); $writer->save('php://output');

View File

@@ -1,208 +1,208 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> <title>
Histórico de horarios Histórico de horarios
</title> </title>
<?php <?php
include 'import/html_css_files.php'; include 'import/html_css_files.php';
?> ?>
<style> <style>
[v-cloak] { [v-cloak] {
display: none; display: none;
} }
</style> </style>
<script src="js/jquery.min.js"></script> <script src="js/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="js/bootstrap/bootstrap.min.js"></script> <script src="js/bootstrap/bootstrap.min.js"></script>
</head> </head>
<body> <body>
<? <?
$redirect = $_SERVER['PHP_SELF']; $redirect = $_SERVER['PHP_SELF'];
include "import/html_header.php"; include "import/html_header.php";
global $user; global $user;
html_header( html_header(
"Histórico de horarios", "Histórico de horarios",
"Sistema de gestión de checador", "Sistema de gestión de checador",
); );
if (!$user->periodo_id) { ?> if (!$user->periodo_id) { ?>
<script defer src="js/jquery.min.js"></script> <script defer src="js/jquery.min.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script> <script src="js/bootstrap/bootstrap.min.js"></script>
<div class="modal" id="seleccionar-periodo" tabindex="-1"> <div class="modal" id="seleccionar-periodo" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-xl"> <div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h2 class="modal-title">Seleccionar periodo</h2> <h2 class="modal-title">Seleccionar periodo</h2>
</div> </div>
<div class="modal-body container"> <div class="modal-body container">
<? include 'import/periodo.php' ?> <? include 'import/periodo.php' ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
$('#seleccionar-periodo').modal({ $('#seleccionar-periodo').modal({
backdrop: 'static', backdrop: 'static',
keyboard: false, keyboard: false,
}); });
$('#seleccionar-periodo').modal('show'); $('#seleccionar-periodo').modal('show');
</script> </script>
<? exit; <? exit;
} ?> } ?>
<main class="container-fluid px-4 mt-4" id="app" v-cloak @vue:mounted="mounted" style="min-height: 60vh;" <main class="container-fluid px-4 mt-4" id="app" v-cloak @vue:mounted="mounted" style="min-height: 60vh;"
v-scope=""> v-scope="">
<?php include "import/periodo.php" ?> <?php include "import/periodo.php" ?>
<form class="marco" v-scope="{profesor: null}"> <form class="marco" v-scope="{profesor: null}">
<!-- datalist profesores --> <!-- datalist profesores -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="form-box"> <div class="form-box">
<div class="form-group row"> <div class="form-group row">
<label for="profesor" class="col-form-label col-4">Profesor</label> <label for="profesor" class="col-form-label col-4">Profesor</label>
<input list="profesores" class="form-control col-6 mx-3" id="profesor" v-model="profesor" <input list="profesores" class="form-control col-6 mx-3" id="profesor" v-model="profesor"
@input="buscarHorarios(profesor)"> @input="buscarHorarios(profesor)">
<datalist id="profesores"> <datalist id="profesores">
<option v-for="profesor in profesores" :value="profesor.profesor_clave"> <option v-for="profesor in profesores" :value="profesor.profesor_clave">
{{profesor.profesor_nombre}} {{profesor.profesor_nombre}}
</option> </option>
</datalist> </datalist>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<div class="table-responsive marco" v-if="horarios.length > 0" v-scope=""> <div class="table-responsive marco" v-if="horarios.length > 0" v-scope="">
<table class="table table-hover table-striped table-bordered table-sm"> <table class="table table-hover table-striped table-bordered table-sm">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
<th scope="col" class="text-center align-middle px-2"> <th scope="col" class="text-center align-middle px-2">
Carrera Carrera
</th> </th>
<th scope="col" class="text-center align-middle px-2"> <th scope="col" class="text-center align-middle px-2">
Materia Materia
</th> </th>
<th scope="col" class="text-center align-middle px-2"> <th scope="col" class="text-center align-middle px-2">
Grupo Grupo
</th> </th>
<th scope="col" class="text-center align-middle px-2"> <th scope="col" class="text-center align-middle px-2">
Horario Horario
</th> </th>
<th scope="col" class="text-center align-middle px-2"> <th scope="col" class="text-center align-middle px-2">
Alta Alta
</th> </th>
<th scope="col" class="text-center align-middle px-2"> <th scope="col" class="text-center align-middle px-2">
Baja Baja
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="horario in horarios" :key="`horario-${horario.horario_id}`"> <tr v-for="horario in horarios" :key="`horario-${horario.horario_id}`">
<td class="align-middle px-2"> <td class="align-middle px-2">
<small> <small>
<strong>{{horario.facultad_nombre}}</strong> <strong>{{horario.facultad_nombre}}</strong>
</small> </small>
{{horario.carrera_nombre}} {{horario.carrera_nombre}}
</td> </td>
<td class="align-middle px-2 text-center"> <td class="align-middle px-2 text-center">
{{horario.materia_nombre}} {{horario.materia_nombre}}
</td> </td>
<td class="align-middle px-2 text-center"> <td class="align-middle px-2 text-center">
{{horario.horario_grupo}} {{horario.horario_grupo}}
</td> </td>
<td class="align-middle px-2 text-center" <td class="align-middle px-2 text-center"
v-scope="{días: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado']}"> v-scope="{días: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado']}">
{{días[horario.horario_dia]}} - {{horario.horario_hora}} - {{horario.horario_fin}} {{días[horario.horario_dia]}} - {{horario.horario_hora}} - {{horario.horario_fin}}
</td> </td>
<td class="align-middle px-2 text-center"> <td class="align-middle px-2 text-center">
{{horario.horario_fecha_inicio}} {{horario.horario_fecha_inicio}}
</td> </td>
<td class="align-middle px-2 text-center"> <td class="align-middle px-2 text-center">
{{horario.horario_fecha_fin}} {{horario.horario_fecha_fin}}
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="modal" tabindex="-1" id="cargando" data-backdrop="static" data-keyboard="false"> <div class="modal" tabindex="-1" id="cargando" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-dialog-centered"> <div class="modal-dialog modal-dialog-centered">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title">Cargando datos...</h4> <h4 class="modal-title">Cargando datos...</h4>
</div> </div>
<div class="modal-body container"> <div class="modal-body container">
<div class="row"> <div class="row">
<div class="col-12 text-center"> <div class="col-12 text-center">
<span class="spinner-border spinner-border-lg"></span> <span class="spinner-border spinner-border-lg"></span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal" tabindex="-1" id="mensaje"> <div class="modal" tabindex="-1" id="mensaje">
<div class="modal-dialog modal-dialog-centered"> <div class="modal-dialog modal-dialog-centered">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title">{{mensaje.titulo}}</h4> <h4 class="modal-title">{{mensaje.titulo}}</h4>
<button type="button" class="close text-white" data-dismiss="modal" aria-label="Close"> <button type="button" class="close text-white" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body container"> <div class="modal-body container">
<div class="row"> <div class="row">
<div class="col-12 text-center"> <div class="col-12 text-center">
{{mensaje.texto}} {{mensaje.texto}}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
<!-- <script src=" js/datalist.js"></script> --> <!-- <script src=" js/datalist.js"></script> -->
<script type="module"> <script type="module">
import { createApp } from 'https://unpkg.com/petite-vue?module' import { createApp } from 'https://unpkg.com/petite-vue?module'
createApp({ createApp({
horarios: [], horarios: [],
profesores: [], profesores: [],
async buscarHorarios(profesor_clave) { async buscarHorarios(profesor_clave) {
// if existe la clave del profesor // if existe la clave del profesor
if (!this.profesores.find(profesor => profesor.profesor_clave === profesor_clave)) { if (!this.profesores.find(profesor => profesor.profesor_clave === profesor_clave)) {
this.horarios = [] this.horarios = []
return return
} }
const horarios = await fetch(`/action/horario_profesor.php?profesor=${profesor_clave}`) const horarios = await fetch(`/action/horario_profesor.php?profesor=${profesor_clave}`)
this.horarios = await horarios.json() this.horarios = await horarios.json()
}, },
async mounted() { async mounted() {
const profesores = await fetch('/action/action_profesor.php') const profesores = await fetch('/action/action_profesor.php')
this.profesores = await profesores.json() this.profesores = await profesores.json()
}, },
}).mount('#app') }).mount('#app')
</script> </script>
<script src="js/scrollables.js"></script> <script src="js/scrollables.js"></script>
</body> </body>
</html> </html>

View File

@@ -1,146 +1,146 @@
<?php <?php
$ICO =[ $ICO =[
"mas"=>'<span class="ing-mas ing-fw"></span>', "mas"=>'<span class="ing-mas ing-fw"></span>',
"menos"=>'<span class="ing-menos ing-fw"></span>', "menos"=>'<span class="ing-menos ing-fw"></span>',
"editar"=>'<span class="ing-editar ing-fw"></span>', "editar"=>'<span class="ing-editar ing-fw"></span>',
"borrar"=>'<span class="ing-borrar ing-fw"></span>', "borrar"=>'<span class="ing-borrar ing-fw"></span>',
"borrar2"=>'<span class="ing-basura ing-fw"></span>', "borrar2"=>'<span class="ing-basura ing-fw"></span>',
"cancelar"=>'<span class="ing-cancelar ing-fw"></span>', "cancelar"=>'<span class="ing-cancelar ing-fw"></span>',
"buscar"=>'<span class="ing-buscar ing-fw"></span>', "buscar"=>'<span class="ing-buscar ing-fw"></span>',
"descargar"=>'<span class="ing-descarga ing-fw"></span>', "descargar"=>'<span class="ing-descarga ing-fw"></span>',
"cargar"=>'<span class="ing-carga-archivo ing-fw"></span>', "cargar"=>'<span class="ing-carga-archivo ing-fw"></span>',
"ver"=>'<span class="ing-ver ing-fw"></span>', "ver"=>'<span class="ing-ver ing-fw"></span>',
"cambiar"=>'<span class="ing-cambiar ing-fw"></span>', "cambiar"=>'<span class="ing-cambiar ing-fw"></span>',
"circulo"=>'<span class="ing-bullet ing-fw"></span>', "circulo"=>'<span class="ing-bullet ing-fw"></span>',
"aceptar"=>'<span class="ing-aceptar ing-fw"></span>', "aceptar"=>'<span class="ing-aceptar ing-fw"></span>',
"alerta"=>'<span class="ing-importante ing-fw"></span>', "alerta"=>'<span class="ing-importante ing-fw"></span>',
"calendario"=>'<span class="ing-eventos ing-fw"></span>', "calendario"=>'<span class="ing-eventos ing-fw"></span>',
"ojo"=>'<span class="ing-ojo ing-fw"></span>', "ojo"=>'<span class="ing-ojo ing-fw"></span>',
"profesor"=>'<span class="ing-formacion ing-fw"></span>', "profesor"=>'<span class="ing-formacion ing-fw"></span>',
"lista"=>'<span class="fas fa-list fa-fw"></span>', "lista"=>'<span class="fas fa-list fa-fw"></span>',
"lista_check"=>'<span class="ing-listado-menus ing-fw"></span>', "lista_check"=>'<span class="ing-listado-menus ing-fw"></span>',
"abajo"=>'<span class="ing-caret ing-fw"></span>', "abajo"=>'<span class="ing-caret ing-fw"></span>',
"arriba"=>'<span class="ing-caret ing-rotate-180 ing-fw"></span>', "arriba"=>'<span class="ing-caret ing-rotate-180 ing-fw"></span>',
"izquierda"=>'<span class="ing-caret ing-rotate-90 ing-fw"></span>', "izquierda"=>'<span class="ing-caret ing-rotate-90 ing-fw"></span>',
"derecha"=>'<span class="ing-caret ing-rotate-270 ing-fw"></span>', "derecha"=>'<span class="ing-caret ing-rotate-270 ing-fw"></span>',
]; ];
$ICO_LG =[ $ICO_LG =[
"mas"=>'<span class="ing-mas ing-fw ing-lg"></span>', "mas"=>'<span class="ing-mas ing-fw ing-lg"></span>',
"menos"=>'<span class="ing-menos ing-fw ing-lg"></span>', "menos"=>'<span class="ing-menos ing-fw ing-lg"></span>',
"editar"=>'<span class="ing-editar ing-fw ing-lg"></span>', "editar"=>'<span class="ing-editar ing-fw ing-lg"></span>',
"borrar"=>'<span class="ing-borrar ing-fw ing-lg"></span>', "borrar"=>'<span class="ing-borrar ing-fw ing-lg"></span>',
"borrar2"=>'<span class="ing-basura ing-fw ing-lg"></span>', "borrar2"=>'<span class="ing-basura ing-fw ing-lg"></span>',
"cancelar"=>'<span class="ing-cancelar ing-fw ing-lg"></span>', "cancelar"=>'<span class="ing-cancelar ing-fw ing-lg"></span>',
"buscar"=>'<span class="ing-buscar ing-fw ing-lg"></span>', "buscar"=>'<span class="ing-buscar ing-fw ing-lg"></span>',
"descargar"=>'<span class="ing-descarga ing-fw ing-lg"></span>', "descargar"=>'<span class="ing-descarga ing-fw ing-lg"></span>',
"cargar"=>'<span class="ing-carga-archivo ing-fw ing-lg"></span>', "cargar"=>'<span class="ing-carga-archivo ing-fw ing-lg"></span>',
"ver"=>'<span class="ing-reporte-resultados ing-fw ing-lg"></span>', "ver"=>'<span class="ing-reporte-resultados ing-fw ing-lg"></span>',
"cambiar"=>'<span class="ing-cambiar ing-fw ing-lg"></span>', "cambiar"=>'<span class="ing-cambiar ing-fw ing-lg"></span>',
"circulo"=>'<span class="ing-bullet ing-fw ing-lg"></span>', "circulo"=>'<span class="ing-bullet ing-fw ing-lg"></span>',
"aceptar"=>'<span class="ing-aceptar ing-fw ing-lg"></span>', "aceptar"=>'<span class="ing-aceptar ing-fw ing-lg"></span>',
"alerta"=>'<span class="ing-importante ing-fw ing-lg"></span>', "alerta"=>'<span class="ing-importante ing-fw ing-lg"></span>',
"calendario"=>'<span class="ing-eventos ing-fw ing-lg"></span>', "calendario"=>'<span class="ing-eventos ing-fw ing-lg"></span>',
"ojo"=>'<span class="ing-ojo ing-fw ing-lg"></span>', "ojo"=>'<span class="ing-ojo ing-fw ing-lg"></span>',
"profesor"=>'<span class="ing-formacion ing-fw ing-lg"></span>', "profesor"=>'<span class="ing-formacion ing-fw ing-lg"></span>',
"lista"=>'<span class="fas fa-list fa-fw ing-lg"></span>', "lista"=>'<span class="fas fa-list fa-fw ing-lg"></span>',
"lista_check"=>'<span class="ing-listado-menus ing-fw ing-lg"></span>', "lista_check"=>'<span class="ing-listado-menus ing-fw ing-lg"></span>',
"abajo"=>'<span class="ing-caret ing-fw ing-lg"></span>', "abajo"=>'<span class="ing-caret ing-fw ing-lg"></span>',
"arriba"=>'<span class="ing-caret ing-rotate-180 ing-fw ing-lg"></span>', "arriba"=>'<span class="ing-caret ing-rotate-180 ing-fw ing-lg"></span>',
/* /*
"insert"=>'<span class="fas fa-plus fa-fw fa-lg"></span>', "insert"=>'<span class="fas fa-plus fa-fw fa-lg"></span>',
"update"=>'<span class="fas fa-pen fa-fw fa-lg"></span>', "update"=>'<span class="fas fa-pen fa-fw fa-lg"></span>',
"delete"=>'<span class="fas fa-trash-alt fa-fw fa-lg"></span>', "delete"=>'<span class="fas fa-trash-alt fa-fw fa-lg"></span>',
"search"=>'<span class="fas fa-search fa-fw fa-lg"></span>', "search"=>'<span class="fas fa-search fa-fw fa-lg"></span>',
"insert_box"=>'<span class="fas fa-plus-square fa-fw fa-lg"></span>', "insert_box"=>'<span class="fas fa-plus-square fa-fw fa-lg"></span>',
"update_box"=>'<span class="fas fa-pen-square fa-fw fa-lg"></span>', "update_box"=>'<span class="fas fa-pen-square fa-fw fa-lg"></span>',
"delete_box"=>'<span class="fas fa-minus-square fa-fw fa-lg"></span>', "delete_box"=>'<span class="fas fa-minus-square fa-fw fa-lg"></span>',
"error"=>'<span class="fas fa-times fa-fw fa-lg"></span>', "error"=>'<span class="fas fa-times fa-fw fa-lg"></span>',
"error_circle"=>'<span class="fas fa-times-circle fa-fw fa-lg"></span>', "error_circle"=>'<span class="fas fa-times-circle fa-fw fa-lg"></span>',
"ok"=>'<span class="fas fa-check fa-fw fa-lg"></span>', "ok"=>'<span class="fas fa-check fa-fw fa-lg"></span>',
"ok_circle"=>'<span class="fas fa-check-circle fa-fw fa-lg"></span>', "ok_circle"=>'<span class="fas fa-check-circle fa-fw fa-lg"></span>',
"list"=>'<span class="fas fa-list fa-fw fa-lg"></span>', "list"=>'<span class="fas fa-list fa-fw fa-lg"></span>',
"circulo"=>'<span class="ing-bullet fa-fw fa-lg"></span>', "circulo"=>'<span class="ing-bullet fa-fw fa-lg"></span>',
"question_circle"=>'<span class="fas fa-question-circle fa-fw fa-lg"></span>', "question_circle"=>'<span class="fas fa-question-circle fa-fw fa-lg"></span>',
"info_circle"=>'<span class="fas fa-info-circle fa-fw fa-lg"></span>', "info_circle"=>'<span class="fas fa-info-circle fa-fw fa-lg"></span>',
"square_check"=>'<span class="fas fa-circle fa-fw fa-lg"></span>', "square_check"=>'<span class="fas fa-circle fa-fw fa-lg"></span>',
"square_empty"=>'<span class="far fa-circle fa-fw fa-lg"></span>', "square_empty"=>'<span class="far fa-circle fa-fw fa-lg"></span>',
"eraser"=>'<span class="fas fa-eraser fa-fw fa-lg"></span>',*/ "eraser"=>'<span class="fas fa-eraser fa-fw fa-lg"></span>',*/
]; ];
$ICO_RND =[ $ICO_RND =[
"right"=>'<span class="fa-stack float-right"> "right"=>'<span class="fa-stack float-right">
<i class="fas fa-circle fa-stack-2x"></i> <i class="fas fa-circle fa-stack-2x"></i>
<i class="icon icon-right fa-stack-1x" style="color:white"></i> <i class="icon icon-right fa-stack-1x" style="color:white"></i>
</span>', </span>',
"left"=>'<span class="fa-stack float-right"> "left"=>'<span class="fa-stack float-right">
<i class="fas fa-circle fa-stack-2x"></i> <i class="fas fa-circle fa-stack-2x"></i>
<i class="icon icon-left fa-stack-1x" style="color:white"></i> <i class="icon icon-left fa-stack-1x" style="color:white"></i>
</span>', </span>',
"error"=>'<span class="fa-stack float-right"> "error"=>'<span class="fa-stack float-right">
<i class="fas fa-circle fa-stack-2x"></i> <i class="fas fa-circle fa-stack-2x"></i>
<i class="fas fa-times fa-stack-1x" style="color:white"></i> <i class="fas fa-times fa-stack-1x" style="color:white"></i>
</span>', </span>',
"error_circle"=>'<span class="fa-stack float-right"> "error_circle"=>'<span class="fa-stack float-right">
<i class="fas fa-circle fa-stack-2x"></i> <i class="fas fa-circle fa-stack-2x"></i>
<i class="icon icon-error fa-stack-1x" style="color:white"></i> <i class="icon icon-error fa-stack-1x" style="color:white"></i>
</span>', </span>',
"ok_circle"=>'<span class="fa-stack float-right"> "ok_circle"=>'<span class="fa-stack float-right">
<i class="fas fa-circle fa-stack-2x"></i> <i class="fas fa-circle fa-stack-2x"></i>
<i class="icon icon-correct fa-stack-1x" style="color:white"></i> <i class="icon icon-correct fa-stack-1x" style="color:white"></i>
</span>', </span>',
"ok"=>'<span class="fa-stack float-right"> "ok"=>'<span class="fa-stack float-right">
<i class="fas fa-circle fa-stack-2x"></i> <i class="fas fa-circle fa-stack-2x"></i>
<i class="icon icon-chk fa-stack-1x" style="color:white"></i> <i class="icon icon-chk fa-stack-1x" style="color:white"></i>
</span>', </span>',
"close"=>'<span class="fa-stack float-right"> "close"=>'<span class="fa-stack float-right">
<i class="fas fa-circle fa-stack-2x"></i> <i class="fas fa-circle fa-stack-2x"></i>
<i class="icon icon-close fa-stack-1x" style="color:white"></i> <i class="icon icon-close fa-stack-1x" style="color:white"></i>
</span>', </span>',
"next"=>'<span class="fa-stack float-right"> "next"=>'<span class="fa-stack float-right">
<i class="fas fa-circle fa-stack-2x"></i> <i class="fas fa-circle fa-stack-2x"></i>
<i class="icon icon-arrow fa-stack-1x" style="color:white"></i> <i class="icon icon-arrow fa-stack-1x" style="color:white"></i>
</span>', </span>',
"back"=>'<span class="fa-stack float-right"> "back"=>'<span class="fa-stack float-right">
<i class="fas fa-circle fa-stack-2x"></i> <i class="fas fa-circle fa-stack-2x"></i>
<i class="icon icon-arrowprev fa-stack-1x" style="color:white"></i> <i class="icon icon-arrowprev fa-stack-1x" style="color:white"></i>
</span>', </span>',
]; ];
//Sistemas registrados //Sistemas registrados
define("APSA", 1); define("APSA", 1);
define("GEMA", 2); define("GEMA", 2);
define("CIDIT", 3); define("CIDIT", 3);
define("CONSTANCIA", 5); define("CONSTANCIA", 5);
define("EXPOING", 7); define("EXPOING", 7);
define("MAX_ROWS", 30); define("MAX_ROWS", 30);
define("HORA_INICIO", 6);//hora inicial de horario define("HORA_INICIO", 6);//hora inicial de horario
define("HORA_FINAL", 22);//hora final de horario define("HORA_FINAL", 22);//hora final de horario
define("FRACCION_HORA", 4);//fracciones en una hora define("FRACCION_HORA", 4);//fracciones en una hora
define("DURACION_MIN", 60);//hora inicial de horario define("DURACION_MIN", 60);//hora inicial de horario
define("DURACION_MAX", 360);//hora final de horario define("DURACION_MAX", 360);//hora final de horario
define("DURACION_STEP", 15);//fracciones en una hora define("DURACION_STEP", 15);//fracciones en una hora
define("FACULTAD", "Facultad de Ingeniería"); define("FACULTAD", "Facultad de Ingeniería");
//define("NOMBRE_DIRECTOR", "Ing. Edmundo G. Barrera Monsiváis"); //define("NOMBRE_DIRECTOR", "Ing. Edmundo G. Barrera Monsiváis");
define("PE_INI", "PE_INI$"); define("PE_INI", "PE_INI$");
define("PE_INI_Y", "PE_INI_Y$"); define("PE_INI_Y", "PE_INI_Y$");
define("PE_FIN", "PE_FIN$"); define("PE_FIN", "PE_FIN$");
define("PE_FIN_Y", "PE_FIN_Y$"); define("PE_FIN_Y", "PE_FIN_Y$");
define("PR_INI", "PR_INI$"); define("PR_INI", "PR_INI$");
define("PR_INI_Y", "PR_INI_Y$"); define("PR_INI_Y", "PR_INI_Y$");
define("PR_FIN", "PR_FIN$"); define("PR_FIN", "PR_FIN$");
define("PR_FIN_Y", "PR_FIN_Y$"); define("PR_FIN_Y", "PR_FIN_Y$");
define("EX_INI", "EX_INI$"); define("EX_INI", "EX_INI$");
define("EX_INI_Y", "EX_INI_Y$"); define("EX_INI_Y", "EX_INI_Y$");
define("EX_FIN", "EX_FIN$"); define("EX_FIN", "EX_FIN$");
define("EX_FIN_Y", "EX_FIN_Y$"); define("EX_FIN_Y", "EX_FIN_Y$");
?> ?>

View File

@@ -1,20 +1,20 @@
# postgrest.conf # postgrest.conf
# The standard connection URI format, documented at # The standard connection URI format, documented at
# https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING # https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
db-uri = "postgres://postgres:4ud1t0rf4lt4$$@localhost:5432/paad_pruebas" db-uri = "postgres://postgres:4ud1t0rf4lt4$$@localhost:5432/paad_pruebas"
# The database role to use when no client authentication is provided. # The database role to use when no client authentication is provided.
# Should differ from authenticator # Should differ from authenticator
db-anon-role = "postgres" db-anon-role = "postgres"
# The secret to verify the JWT for authenticated requests with. # The secret to verify the JWT for authenticated requests with.
# Needs to be 32 characters minimum. # Needs to be 32 characters minimum.
jwt-secret = "reallyreallyreallyreallyverysafe" jwt-secret = "reallyreallyreallyreallyverysafe"
jwt-secret-is-base64 = false jwt-secret-is-base64 = false
# Port the postgrest process is listening on for http requests # Port the postgrest process is listening on for http requests
server-port = 3000 server-port = 3000
# the location root is /api # the location root is /api
server-host = "*" server-host = "*"

View File

@@ -1,55 +1,55 @@
<?php <?php
/* /*
* Funciones de utilidad * Funciones de utilidad
*/ */
function fechaGuion($fechaTxt){//convierte fecha a guiones function fechaGuion($fechaTxt){//convierte fecha a guiones
$fechaTxt = trim($fechaTxt); $fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt); $fechaArr = explode("/", $fechaTxt);
return $fechaArr[2]."-".$fechaArr[1]."-".$fechaArr[0]; return $fechaArr[2]."-".$fechaArr[1]."-".$fechaArr[0];
} }
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-")// aaaa-mm-dd if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-")// aaaa-mm-dd
return $fechaTxt; return $fechaTxt;
return ""; return "";
} }
function fechaSlash($fechaTxt){//convierte fecha a / function fechaSlash($fechaTxt){//convierte fecha a /
$fechaTxt = trim($fechaTxt); $fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
return $fechaTxt; return $fechaTxt;
} }
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt); $fechaArr = explode("-", $fechaTxt);
return $fechaArr[2]."/".$fechaArr[1]."/".$fechaArr[0]; return $fechaArr[2]."/".$fechaArr[1]."/".$fechaArr[0];
} }
return ""; return "";
} }
function fechaTexto($fechaTxt, $showYear = true){//convierte fecha a cadena de texto function fechaTexto($fechaTxt, $showYear = true){//convierte fecha a cadena de texto
$fechaTxt = trim($fechaTxt); $fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt); $fechaArr = explode("/", $fechaTxt);
if($showYear) if($showYear)
return intval($fechaArr[0])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[2]; return intval($fechaArr[0])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[2];
else else
return intval($fechaArr[0])." de ".mesNombre($fechaArr[1]); return intval($fechaArr[0])." de ".mesNombre($fechaArr[1]);
} }
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt); $fechaArr = explode("-", $fechaTxt);
if($showYear) if($showYear)
return intval($fechaArr[2])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[0]; return intval($fechaArr[2])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[0];
else else
return intval($fechaArr[2])." de ".mesNombre($fechaArr[1]); return intval($fechaArr[2])." de ".mesNombre($fechaArr[1]);
} }
return ""; return "";
} }
function mesNombre($num){ function mesNombre($num){
$meses=array(1=>"enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"); $meses=array(1=>"enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre");
return $meses[intval($num)]; return $meses[intval($num)];
} }
function diaNombre($num){ function diaNombre($num){
$dias=array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"); $dias=array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado");
return $dias[intval($num)]; return $dias[intval($num)];
} }

View File

@@ -1,50 +1,50 @@
<?php <?php
/** /**
* PHPMailer SPL autoloader. * PHPMailer SPL autoloader.
* PHP Version 5 * PHP Version 5
* @package PHPMailer * @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com> * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder) * @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon * @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski * @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost * @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT * @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. * FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/** /**
* PHPMailer SPL autoloader. * PHPMailer SPL autoloader.
* @param string $classname The name of the class to load * @param string $classname The name of the class to load
*/ */
function PHPMailerAutoload($classname) function PHPMailerAutoload($classname)
{ {
//Can't use __DIR__ as it's only in PHP 5.3+ //Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
if (is_readable($filename)) { if (is_readable($filename)) {
require $filename; require $filename;
} }
} }
if (version_compare(PHP_VERSION, '5.1.2', '>=')) { if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2 //SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) { if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true); spl_autoload_register('PHPMailerAutoload', true, true);
} else { } else {
spl_autoload_register('PHPMailerAutoload'); spl_autoload_register('PHPMailerAutoload');
} }
} else { } else {
/** /**
* Fall back to traditional autoload for old PHP versions * Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load * @param string $classname The name of the class to load
*/ */
spl_autoload_register($classname); spl_autoload_register($classname);
/*function __autoload($classname) /*function __autoload($classname)
{ {
PHPMailerAutoload($classname); PHPMailerAutoload($classname);
}*/ }*/
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,127 +1,127 @@
<?php <?php
/* /*
* Funciones de utilidad * Funciones de utilidad
*/ */
function fechaGuion($fechaTxt, $showDay = true){//convierte fecha a guiones function fechaGuion($fechaTxt, $showDay = true){//convierte fecha a guiones
$fechaTxt = trim($fechaTxt); $fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt); $fechaArr = explode("/", $fechaTxt);
if($showDay) if($showDay)
return $fechaArr[2]."-".$fechaArr[1]."-".$fechaArr[0]; return $fechaArr[2]."-".$fechaArr[1]."-".$fechaArr[0];
else else
return $fechaArr[2]."-".$fechaArr[1]."-01"; return $fechaArr[2]."-".$fechaArr[1]."-01";
} }
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
if($showDay) if($showDay)
return $fechaTxt; return $fechaTxt;
$fechaArr = explode("-", $fechaTxt); $fechaArr = explode("-", $fechaTxt);
return $fechaArr[0]."-".$fechaArr[1]."-01"; return $fechaArr[0]."-".$fechaArr[1]."-01";
} }
return ""; return "";
} }
function fechaSlash($fechaTxt, $showDay = true){//convierte fecha a / function fechaSlash($fechaTxt, $showDay = true){//convierte fecha a /
$fechaTxt = trim($fechaTxt); $fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
if($showDay) if($showDay)
return $fechaTxt; return $fechaTxt;
$fechaArr = explode("/", $fechaTxt); $fechaArr = explode("/", $fechaTxt);
return "01/".$fechaTxt[1]."/".$fechaTxt[2]; return "01/".$fechaTxt[1]."/".$fechaTxt[2];
} }
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt); $fechaArr = explode("-", $fechaTxt);
if($showDay) if($showDay)
return $fechaArr[2]."/".$fechaArr[1]."/".$fechaArr[0]; return $fechaArr[2]."/".$fechaArr[1]."/".$fechaArr[0];
else else
return "01/".$fechaArr[1]."/".$fechaArr[0]; return "01/".$fechaArr[1]."/".$fechaArr[0];
} }
return ""; return "";
} }
function fechaTexto($fechaTxt, $showYear = true){//convierte fecha a cadena de texto function fechaTexto($fechaTxt, $showYear = true){//convierte fecha a cadena de texto
$fechaTxt = trim($fechaTxt); $fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt); $fechaArr = explode("/", $fechaTxt);
if($showYear) if($showYear)
return intval($fechaArr[0])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[2]; return intval($fechaArr[0])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[2];
else else
return intval($fechaArr[0])." de ".mesNombre($fechaArr[1]); return intval($fechaArr[0])." de ".mesNombre($fechaArr[1]);
} }
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt); $fechaArr = explode("-", $fechaTxt);
if($showYear) if($showYear)
return intval($fechaArr[2])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[0]; return intval($fechaArr[2])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[0];
else else
return intval($fechaArr[2])." de ".mesNombre($fechaArr[1]); return intval($fechaArr[2])." de ".mesNombre($fechaArr[1]);
} }
return ""; return "";
} }
function fechaMonthPicker($fechaTxt){ function fechaMonthPicker($fechaTxt){
$meses=array(1=>"ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"); $meses=array(1=>"ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic");
$fechaTxt = trim($fechaTxt); $fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt); $fechaArr = explode("/", $fechaTxt);
return $meses[intval($fechaArr[1])].", ".$fechaArr[2]; return $meses[intval($fechaArr[1])].", ".$fechaArr[2];
} }
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt); $fechaArr = explode("-", $fechaTxt);
return $meses[intval($fechaArr[1])].", ".$fechaArr[0]; return $meses[intval($fechaArr[1])].", ".$fechaArr[0];
} }
return ""; return "";
} }
function fechaMes($fechaTxt){ function fechaMes($fechaTxt){
$fechaTxt = trim($fechaTxt); $fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt); $fechaArr = explode("/", $fechaTxt);
return intval(mesNombre($fechaArr[1])." ".$fechaArr[2]); return intval(mesNombre($fechaArr[1])." ".$fechaArr[2]);
} }
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt); $fechaArr = explode("-", $fechaTxt);
return intval(mesNombre($fechaArr[2])." ".$fechaArr[1]); return intval(mesNombre($fechaArr[2])." ".$fechaArr[1]);
} }
return ""; return "";
} }
function mesNombre($num){ function mesNombre($num){
$meses=array(1=>"enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"); $meses=array(1=>"enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre");
return $meses[intval($num)]; return $meses[intval($num)];
} }
function diaNombre($num){ function diaNombre($num){
$dias=array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"); $dias=array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado");
return $dias[intval($num)]; return $dias[intval($num)];
} }
function horaMin($arr, $campo = "Horario_hora"){ function horaMin($arr, $campo = "Horario_hora"){
$min = ""; $min = "";
foreach($arr as $horario){ foreach($arr as $horario){
if($min == "" || date('H:i', strtotime($horario[$campo])) < date('H:i', strtotime($min))){ if($min == "" || date('H:i', strtotime($horario[$campo])) < date('H:i', strtotime($min))){
$min = $horario[$campo]; $min = $horario[$campo];
} }
} }
return date('H:i', strtotime($min)); return date('H:i', strtotime($min));
} }
function horaMax($arr, $campo = "Horario_hora_final"){ function horaMax($arr, $campo = "Horario_hora_final"){
$max = ""; $max = "";
foreach($arr as $horario){ foreach($arr as $horario){
if($max == "" || date('H:i', strtotime($horario[$campo])) > date('H:i', strtotime($max))){ if($max == "" || date('H:i', strtotime($horario[$campo])) > date('H:i', strtotime($max))){
$max = $horario[$campo]; $max = $horario[$campo];
} }
} }
return date('H:i', strtotime($max)); return date('H:i', strtotime($max));
} }
function duracionMinutos($fechahora_i, $fechahora_f){ function duracionMinutos($fechahora_i, $fechahora_f){
return round((strtotime($fechahora_f) - strtotime($fechahora_i)) / 60,2); return round((strtotime($fechahora_f) - strtotime($fechahora_i)) / 60,2);
} }
function validaPassword($pass){ function validaPassword($pass){
$expr = '/^\S*(?=\S{5,})(?=\S*[a-zA-Z])(?=\S*[\d])(?=\S*[\W])\S*$/'; $expr = '/^\S*(?=\S{5,})(?=\S*[a-zA-Z])(?=\S*[\d])(?=\S*[\W])\S*$/';
return preg_match($expr, $pass); return preg_match($expr, $pass);
} }

View File

@@ -1,352 +1,352 @@
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module'; import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
$('div.modal#cargando').modal({ $('div.modal#cargando').modal({
backdrop: 'static', backdrop: 'static',
keyboard: false, keyboard: false,
show: false, show: false,
}); });
const store = reactive({ const store = reactive({
loading: false, loading: false,
perido: null, perido: null,
current: { current: {
comentario: '', comentario: '',
clase_vista: null, clase_vista: null,
empty: '', empty: '',
page: 1, page: 1,
maxPages: 10, maxPages: 10,
perPage: 10, perPage: 10,
modal_state: "Cargando datos...", modal_state: "Cargando datos...",
justificada: null, justificada: null,
fechas_clicked: false, fechas_clicked: false,
observaciones: false, observaciones: false,
}, },
facultades: { facultades: {
data: [], data: [],
async fetch() { async fetch() {
this.data = []; this.data = [];
const res = await fetch('action/action_facultad.php'); const res = await fetch('action/action_facultad.php');
this.data = await res.json(); this.data = await res.json();
}, },
}, },
filters: { filters: {
facultad_id: null, facultad_id: null,
fecha: null, fecha: null,
fecha_inicio: null, fecha_inicio: null,
fecha_fin: null, fecha_fin: null,
profesor: null, profesor: null,
periodo_id: null, periodo_id: null,
bloque_horario: null, bloque_horario: null,
estados: [], estados: [],
switchFecha: false, switchFecha: false,
async switchFechas() { async switchFechas() {
const periodo = await fetch('action/periodo_datos.php'); const periodo = await fetch('action/periodo_datos.php');
const periodo_data = await periodo.json(); const periodo_data = await periodo.json();
if (!store.filters.switchFecha) { if (!store.filters.switchFecha) {
$('div.modal#cargando').modal('show'); $('div.modal#cargando').modal('show');
await store.registros.fetch(); await store.registros.fetch();
$('div.modal#cargando').modal('hide'); $('div.modal#cargando').modal('hide');
} }
$(function () { $(function () {
store.filters.fecha_inicio = store.filters.fecha_fin = store.filters.fecha = null; store.filters.fecha_inicio = store.filters.fecha_fin = store.filters.fecha = null;
$("#fecha, #fecha_inicio, #fecha_fin").datepicker({ $("#fecha, #fecha_inicio, #fecha_fin").datepicker({
minDate: new Date(`${periodo_data.periodo_fecha_inicio}:00:00:00`), minDate: new Date(`${periodo_data.periodo_fecha_inicio}:00:00:00`),
maxDate: new Date(`${periodo_data.fecha_final}:00:00:00`), maxDate: new Date(`${periodo_data.fecha_final}:00:00:00`),
dateFormat: "yy-mm-dd", dateFormat: "yy-mm-dd",
showAnim: "slide", showAnim: "slide",
beforeShowDay: (date) => [(date.getDay() != 0), ""] beforeShowDay: (date) => [(date.getDay() != 0), ""]
}); });
const fecha = $("#fecha"), inicio = $("#fecha_inicio"), fin = $("#fecha_fin"); const fecha = $("#fecha"), inicio = $("#fecha_inicio"), fin = $("#fecha_fin");
fecha.datepicker("setDate", new Date(`${periodo_data.fecha_final}:00:00:00`)); fecha.datepicker("setDate", new Date(`${periodo_data.fecha_final}:00:00:00`));
inicio.on("change", function () { inicio.on("change", function () {
store.current.fechas_clicked = false; store.current.fechas_clicked = false;
store.filters.fecha_inicio = inicio.val(); store.filters.fecha_inicio = inicio.val();
fin.datepicker("option", "minDate", inicio.val()); fin.datepicker("option", "minDate", inicio.val());
}); });
fin.on("change", function () { fin.on("change", function () {
store.current.fechas_clicked = false; store.current.fechas_clicked = false;
store.filters.fecha_fin = fin.val(); store.filters.fecha_fin = fin.val();
inicio.datepicker("option", "maxDate", fin.val()); inicio.datepicker("option", "maxDate", fin.val());
}); });
fecha.on("change", async function () { fecha.on("change", async function () {
store.filters.fecha = fecha.val(); store.filters.fecha = fecha.val();
$('div.modal#cargando').modal('show'); $('div.modal#cargando').modal('show');
await store.registros.fetch(store.filters.fecha); await store.registros.fetch(store.filters.fecha);
$('div.modal#cargando').modal('hide'); $('div.modal#cargando').modal('hide');
}); });
}); });
}, },
async fetchByDate() { async fetchByDate() {
store.current.fechas_clicked = true; store.current.fechas_clicked = true;
$('div.modal#cargando').modal('show'); $('div.modal#cargando').modal('show');
await store.registros.fetch(undefined, store.filters.fecha_inicio, store.filters.fecha_fin); await store.registros.fetch(undefined, store.filters.fecha_inicio, store.filters.fecha_fin);
store.current.page = 1; store.current.page = 1;
$('div.modal#cargando').modal('hide'); $('div.modal#cargando').modal('hide');
} }
}, },
estados: { estados: {
data: [], data: [],
async fetch() { async fetch() {
this.data = []; this.data = [];
const res = await fetch('action/action_estado_supervisor.php'); const res = await fetch('action/action_estado_supervisor.php');
this.data = await res.json(); this.data = await res.json();
}, },
getEstado(id) { getEstado(id) {
return this.data.find((estado) => estado.estado_supervisor_id === id) ?? { return this.data.find((estado) => estado.estado_supervisor_id === id) ?? {
estado_color: 'dark', estado_color: 'dark',
estado_icon: 'ing-cancelar', estado_icon: 'ing-cancelar',
nombre: 'Sin registro', nombre: 'Sin registro',
estado_supervisor_id: -1, estado_supervisor_id: -1,
}; };
}, },
printEstados() { printEstados() {
if (store.filters.estados.length > 0) if (store.filters.estados.length > 0)
document.querySelector('#estados').innerHTML = store.filters.estados.map((estado) => `<span class="mx-2 badge badge-${store.estados.getEstado(estado).estado_color}"> document.querySelector('#estados').innerHTML = store.filters.estados.map((estado) => `<span class="mx-2 badge badge-${store.estados.getEstado(estado).estado_color}">
<i class="${store.estados.getEstado(estado).estado_icon}"></i> ${store.estados.getEstado(estado).nombre} <i class="${store.estados.getEstado(estado).estado_icon}"></i> ${store.estados.getEstado(estado).nombre}
</span>`).join(''); </span>`).join('');
else else
document.querySelector('#estados').innerHTML = `Todos los registros`; document.querySelector('#estados').innerHTML = `Todos los registros`;
} }
}, },
bloques_horario: { bloques_horario: {
data: [], data: [],
async fetch() { async fetch() {
this.data = []; this.data = [];
const res = await fetch('action/action_grupo_horario.php'); const res = await fetch('action/action_grupo_horario.php');
this.data = await res.json(); this.data = await res.json();
if (this.data.every((bloque) => !bloque.selected)) if (this.data.every((bloque) => !bloque.selected))
this.data[0].selected = true; this.data[0].selected = true;
}, },
}, },
toggle(arr, element) { toggle(arr, element) {
const newArray = arr.includes(element) ? arr.filter((item) => item !== element) : [...arr, element]; const newArray = arr.includes(element) ? arr.filter((item) => item !== element) : [...arr, element];
// if all are selected, then unselect all // if all are selected, then unselect all
if (newArray.length === (this.estados.data.length + 1)) { if (newArray.length === (this.estados.data.length + 1)) {
setTimeout(() => { setTimeout(() => {
document.querySelectorAll('#dlAsistencia>ul>li.selected').forEach(element => element.classList.remove('selected')); document.querySelectorAll('#dlAsistencia>ul>li.selected').forEach(element => element.classList.remove('selected'));
}, 100); }, 100);
return []; return [];
} }
return newArray; return newArray;
}, },
async justificar() { async justificar() {
if (!store.current.justificada) if (!store.current.justificada)
return; return;
store.current.justificada.registro_justificada = true; store.current.justificada.registro_justificada = true;
let data; let data;
try { try {
const res = await fetch('action/justificar.php', { const res = await fetch('action/justificar.php', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify(store.current.justificada) body: JSON.stringify(store.current.justificada)
}); });
data = await res.json(); data = await res.json();
} }
catch (error) { catch (error) {
alert('Error al justificar'); alert('Error al justificar');
store.current.justificada = store.current.clone_justificada; store.current.justificada = store.current.clone_justificada;
} }
finally { finally {
delete store.current.clone_justificada; delete store.current.clone_justificada;
} }
store.current.justificada.justificador_nombre = data.justificador_nombre; store.current.justificada.justificador_nombre = data.justificador_nombre;
store.current.justificada.justificador_clave = data.justificador_clave; store.current.justificada.justificador_clave = data.justificador_clave;
store.current.justificada.justificador_facultad = data.justificador_facultad; store.current.justificada.justificador_facultad = data.justificador_facultad;
store.current.justificada.justificador_rol = data.justificador_rol; store.current.justificada.justificador_rol = data.justificador_rol;
store.current.justificada.registro_fecha_justificacion = data.registro_fecha_justificacion; store.current.justificada.registro_fecha_justificacion = data.registro_fecha_justificacion;
}, },
async justificarBloque(fecha, bloques, justificacion) { async justificarBloque(fecha, bloques, justificacion) {
if (bloques.length === 0) { if (bloques.length === 0) {
alert('No se ha seleccionado ningún bloque'); alert('No se ha seleccionado ningún bloque');
return; return;
} }
if (!justificacion) { if (!justificacion) {
alert('No se ha ingresado ninguna observación'); alert('No se ha ingresado ninguna observación');
return; return;
} }
try { try {
const res = await fetch('action/action_justificar.php', { const res = await fetch('action/action_justificar.php', {
method: 'PUT', method: 'PUT',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
fecha, fecha,
bloques, bloques,
justificacion, justificacion,
}) })
}); });
const resData = await res.json(); const resData = await res.json();
if (resData.status === 'success') { if (resData.status === 'success') {
alert('Se ha justificado el bloque'); alert('Se ha justificado el bloque');
store.current.modal_state = 'Cargando datos...'; store.current.modal_state = 'Cargando datos...';
$('div.modal#cargando').modal('show'); $('div.modal#cargando').modal('show');
await store.registros.fetch(); await store.registros.fetch();
$('div.modal#cargando').modal('hide'); $('div.modal#cargando').modal('hide');
} }
else { else {
alert('No se ha podido justificar el bloque'); alert('No se ha podido justificar el bloque');
} }
} }
catch (error) { catch (error) {
alert('Error al justificar'); alert('Error al justificar');
} }
}, },
registros: { registros: {
data: [], data: [],
async fetch(fecha, fecha_inicio, fecha_fin) { async fetch(fecha, fecha_inicio, fecha_fin) {
// if (!store.filters.facultad_id || !store.filters.periodo_id) return // if (!store.filters.facultad_id || !store.filters.periodo_id) return
this.loading = true; this.loading = true;
this.data = []; this.data = [];
const params = {}; const params = {};
if (fecha) if (fecha)
params['fecha'] = fecha; params['fecha'] = fecha;
if (fecha_inicio) if (fecha_inicio)
params['fecha_inicio'] = fecha_inicio; params['fecha_inicio'] = fecha_inicio;
if (fecha_fin) if (fecha_fin)
params['fecha_fin'] = fecha_fin; params['fecha_fin'] = fecha_fin;
params['periodo_id'] = store.filters.todos_los_periodos ? 0 : store.periodo.periodo_id; params['periodo_id'] = store.filters.todos_los_periodos ? 0 : store.periodo.periodo_id;
console.log(store.periodo); console.log(store.periodo);
const paramsUrl = new URLSearchParams(params).toString(); const paramsUrl = new URLSearchParams(params).toString();
try { try {
const res = await fetch(`action/action_auditoria.php?${paramsUrl}`, { const res = await fetch(`action/action_auditoria.php?${paramsUrl}`, {
method: 'GET', method: 'GET',
}); });
this.data = await res.json(); this.data = await res.json();
} }
catch (error) { catch (error) {
alert('Error al cargar los datos'); alert('Error al cargar los datos');
} }
this.loading = false; this.loading = false;
store.current.page = 1; store.current.page = 1;
}, },
invertir() { invertir() {
this.data = this.data.reverse(); this.data = this.data.reverse();
}, },
mostrarComentario(registro_id) { mostrarComentario(registro_id) {
const registro = this.data.find((registro) => registro.registro_id === registro_id); const registro = this.data.find((registro) => registro.registro_id === registro_id);
store.current.comentario = registro.comentario; store.current.comentario = registro.comentario;
$('#ver-comentario').modal('show'); $('#ver-comentario').modal('show');
}, },
get relevant() { get relevant() {
/* /*
facultad_id: null, facultad_id: null,
fecha: null, fecha: null,
fecha_inicio: null, fecha_inicio: null,
fecha_fin: null, fecha_fin: null,
profesor: null, profesor: null,
asistencia: null, asistencia: null,
estado_id: null, estado_id: null,
if one of the filters is null, then it is not relevant if one of the filters is null, then it is not relevant
*/ */
const filters = Object.keys(store.filters).filter((filtro) => store.filters[filtro] !== null || store.filters[filtro]?.length > 0); const filters = Object.keys(store.filters).filter((filtro) => store.filters[filtro] !== null || store.filters[filtro]?.length > 0);
return this.data.filter((registro) => { return this.data.filter((registro) => {
return filters.every((filtro) => { return filters.every((filtro) => {
switch (filtro) { switch (filtro) {
case 'fecha': case 'fecha':
return registro.registro_fecha_ideal === store.filters[filtro]; return registro.registro_fecha_ideal === store.filters[filtro];
case 'fecha_inicio': case 'fecha_inicio':
return registro.registro_fecha_ideal >= store.filters[filtro]; return registro.registro_fecha_ideal >= store.filters[filtro];
case 'fecha_fin': case 'fecha_fin':
return registro.registro_fecha_ideal <= store.filters[filtro]; return registro.registro_fecha_ideal <= store.filters[filtro];
case 'profesor': case 'profesor':
const textoFiltro = store.filters[filtro].toLowerCase(); const textoFiltro = store.filters[filtro].toLowerCase();
if (/^\([^)]+\)\s[\s\S]+$/.test(textoFiltro)) { if (/^\([^)]+\)\s[\s\S]+$/.test(textoFiltro)) {
const clave = registro.profesor_clave.toLowerCase(); const clave = registro.profesor_clave.toLowerCase();
const filtroClave = textoFiltro.match(/\((.*?)\)/)?.[1]; const filtroClave = textoFiltro.match(/\((.*?)\)/)?.[1];
// console.log(clave, filtroClave); // console.log(clave, filtroClave);
return clave.includes(filtroClave); return clave.includes(filtroClave);
} }
else { else {
const nombre = registro.profesor_nombre.toLowerCase(); const nombre = registro.profesor_nombre.toLowerCase();
return nombre.includes(textoFiltro); return nombre.includes(textoFiltro);
} }
case 'facultad_id': case 'facultad_id':
return registro.facultad_id === store.filters[filtro]; return registro.facultad_id === store.filters[filtro];
case 'estados': case 'estados':
if (store.filters[filtro].length === 0) if (store.filters[filtro].length === 0)
return true; return true;
else if (store.filters[filtro].includes(-1) && registro.estado_supervisor_id === null) else if (store.filters[filtro].includes(-1) && registro.estado_supervisor_id === null)
return true; return true;
return store.filters[filtro].includes(registro.estado_supervisor_id); return store.filters[filtro].includes(registro.estado_supervisor_id);
case 'bloque_horario': case 'bloque_horario':
const bloque = store.bloques_horario.data.find((bloque) => bloque.id === store.filters[filtro]); const bloque = store.bloques_horario.data.find((bloque) => bloque.id === store.filters[filtro]);
return registro.horario_hora < bloque.hora_fin && registro.horario_fin > bloque.hora_inicio; return registro.horario_hora < bloque.hora_fin && registro.horario_fin > bloque.hora_inicio;
default: return true; default: return true;
} }
}); });
}); });
}, },
async descargar() { async descargar() {
store.current.modal_state = 'Generando reporte en Excel...'; store.current.modal_state = 'Generando reporte en Excel...';
$('div.modal#cargando').modal('show'); $('div.modal#cargando').modal('show');
this.loading = true; this.loading = true;
if (this.relevant.length === 0) if (this.relevant.length === 0)
return; return;
try { try {
const res = await fetch('export/supervisor_excel.php', { const res = await fetch('export/supervisor_excel.php', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify(this.relevant) body: JSON.stringify(this.relevant)
}); });
const blob = await res.blob(); const blob = await res.blob();
window.saveAs(blob, `auditoria_${new Date().toISOString().slice(0, 10)}.xlsx`); window.saveAs(blob, `auditoria_${new Date().toISOString().slice(0, 10)}.xlsx`);
} }
catch (error) { catch (error) {
if (error.response && error.response.status === 413) { if (error.response && error.response.status === 413) {
alert('Your request is too large! Please reduce the data size and try again.'); alert('Your request is too large! Please reduce the data size and try again.');
} }
else { else {
alert('An error occurred: ' + error.message); alert('An error occurred: ' + error.message);
} }
} }
finally { finally {
$('#cargando').modal('hide'); $('#cargando').modal('hide');
this.loading = false; this.loading = false;
} }
}, },
loading: false, loading: false,
get pages() { get pages() {
return Math.ceil(this.relevant.length / store.current.perPage); return Math.ceil(this.relevant.length / store.current.perPage);
} }
}, },
}); });
createApp({ createApp({
store, store,
messages: [], messages: [],
get clase_vista() { get clase_vista() {
return store.current.clase_vista; return store.current.clase_vista;
}, },
set_justificar(horario_id, profesor_id, registro_fecha_ideal) { set_justificar(horario_id, profesor_id, registro_fecha_ideal) {
store.current.justificada = store.registros.relevant.find((registro) => registro.horario_id === horario_id && registro.profesor_id === profesor_id && registro.registro_fecha_ideal === registro_fecha_ideal); store.current.justificada = store.registros.relevant.find((registro) => registro.horario_id === horario_id && registro.profesor_id === profesor_id && registro.registro_fecha_ideal === registro_fecha_ideal);
store.current.clone_justificada = JSON.parse(JSON.stringify(store.current.justificada)); store.current.clone_justificada = JSON.parse(JSON.stringify(store.current.justificada));
store.current.observaciones = false; store.current.observaciones = false;
}, },
cancelar_justificacion() { cancelar_justificacion() {
Object.assign(store.current.justificada, store.current.clone_justificada); Object.assign(store.current.justificada, store.current.clone_justificada);
delete store.current.clone_justificada; delete store.current.clone_justificada;
}, },
profesores: [], profesores: [],
async mounted() { async mounted() {
$('div.modal#cargando').modal('show'); $('div.modal#cargando').modal('show');
try { try {
store.periodo = await fetch('action/periodo_datos.php').then(res => res.json()); store.periodo = await fetch('action/periodo_datos.php').then(res => res.json());
// await store.registros.fetch() // await store.registros.fetch()
await store.facultades.fetch(); await store.facultades.fetch();
await store.estados.fetch(); await store.estados.fetch();
await store.bloques_horario.fetch(); await store.bloques_horario.fetch();
await store.filters.switchFechas(); await store.filters.switchFechas();
this.profesores = await (await fetch('action/action_profesor.php')).json(); this.profesores = await (await fetch('action/action_profesor.php')).json();
this.messages.push({ title: 'Datos cargados', text: 'Los datos se han cargado correctamente', type: 'success', timestamp: new Date() }); this.messages.push({ title: 'Datos cargados', text: 'Los datos se han cargado correctamente', type: 'success', timestamp: new Date() });
} }
catch (error) { catch (error) {
this.messages.push({ title: 'Error al cargar datos', text: 'No se pudieron cargar los datos', type: 'danger', timestamp: new Date() }); this.messages.push({ title: 'Error al cargar datos', text: 'No se pudieron cargar los datos', type: 'danger', timestamp: new Date() });
} }
finally { finally {
$('div.modal#cargando').modal('hide'); $('div.modal#cargando').modal('hide');
} }
} }
}).mount('#app'); }).mount('#app');

View File

@@ -1,148 +1,148 @@
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module'; import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
const new_aviso = reactive({ const new_aviso = reactive({
titulo: '', titulo: '',
descripcion: '', descripcion: '',
fechaInicio: '', fechaInicio: '',
fechaFin: '', fechaFin: '',
profesores: [], profesores: [],
carreras: [], carreras: [],
reset() { reset() {
this.titulo = ''; this.titulo = '';
this.descripcion = ''; this.descripcion = '';
this.fechaInicio = ''; this.fechaInicio = '';
this.fechaFin = ''; this.fechaFin = '';
this.profesores = []; this.profesores = [];
this.carreras = []; this.carreras = [];
}, },
get isValid() { get isValid() {
return this.titulo !== '' && this.descripcion !== '' && this.fechaInicio !== '' && this.fechaFin !== '' && (this.profesores.length > 0 || this.carreras.length > 0) && this.facultad_id !== null; return this.titulo !== '' && this.descripcion !== '' && this.fechaInicio !== '' && this.fechaFin !== '' && (this.profesores.length > 0 || this.carreras.length > 0) && this.facultad_id !== null;
}, },
}); });
// define datepicker method // define datepicker method
const app = createApp({ const app = createApp({
new_aviso, new_aviso,
profesores: [], profesores: [],
carreras: [], carreras: [],
avisos: [], avisos: [],
profesor: null, profesor: null,
formatProfesor(profesor) { formatProfesor(profesor) {
return `(${profesor.profesor_clave}) ${profesor.profesor_nombre}`; return `(${profesor.profesor_clave}) ${profesor.profesor_nombre}`;
}, },
addProfesor() { addProfesor() {
const profesorObj = this.profesores.find((profesor) => this.profesor === this.formatProfesor(profesor)); const profesorObj = this.profesores.find((profesor) => this.profesor === this.formatProfesor(profesor));
if (profesorObj) { if (profesorObj) {
this.new_aviso.profesores.push(profesorObj); this.new_aviso.profesores.push(profesorObj);
this.profesor = null; this.profesor = null;
} }
}, },
aviso_shown: null, aviso_shown: null,
// int? // int?
aviso_suspendido: null, aviso_suspendido: null,
suspenderAviso() { suspenderAviso() {
if (this.aviso_suspendido) { if (this.aviso_suspendido) {
const aviso = this.avisos.find((aviso) => aviso.aviso_id === this.aviso_suspendido); const aviso = this.avisos.find((aviso) => aviso.aviso_id === this.aviso_suspendido);
if (aviso) { if (aviso) {
this.deleteAviso(aviso); this.deleteAviso(aviso);
} }
} }
}, },
get relevant_profesores() { get relevant_profesores() {
// not in array new_aviso.profesores // not in array new_aviso.profesores
const relevant = this.profesores.filter((profesor) => !this.new_aviso.profesores.map((profesor) => profesor.profesor_id).includes(profesor.profesor_id)); const relevant = this.profesores.filter((profesor) => !this.new_aviso.profesores.map((profesor) => profesor.profesor_id).includes(profesor.profesor_id));
// console.log('profesores:', this.profesores.map((profesor: Profesor) => profesor.profesor_nombre), 'relevant:', relevant.map((profesor: Profesor) => profesor.profesor_nombre), 'new_aviso:', this.new_aviso.profesores.map((profesor: Profesor) => profesor.profesor_nombre)) // console.log('profesores:', this.profesores.map((profesor: Profesor) => profesor.profesor_nombre), 'relevant:', relevant.map((profesor: Profesor) => profesor.profesor_nombre), 'new_aviso:', this.new_aviso.profesores.map((profesor: Profesor) => profesor.profesor_nombre))
return relevant; return relevant;
}, },
get relevant_carreras() { get relevant_carreras() {
// not in array new_aviso.carreras // not in array new_aviso.carreras
return this.carreras.filter((carrera) => !this.new_aviso.carreras.includes(carrera)); return this.carreras.filter((carrera) => !this.new_aviso.carreras.includes(carrera));
}, },
createAviso() { createAviso() {
const data = { const data = {
aviso_titulo: this.new_aviso.titulo, aviso_titulo: this.new_aviso.titulo,
aviso_texto: this.new_aviso.descripcion, aviso_texto: this.new_aviso.descripcion,
aviso_fecha_inicial: this.new_aviso.fechaInicio, aviso_fecha_inicial: this.new_aviso.fechaInicio,
aviso_fecha_final: this.new_aviso.fechaFin, aviso_fecha_final: this.new_aviso.fechaFin,
profesores: this.new_aviso.profesores.map((profesor) => profesor.profesor_id), profesores: this.new_aviso.profesores.map((profesor) => profesor.profesor_id),
carreras: this.new_aviso.carreras.map((carrera) => carrera.carrera_id), carreras: this.new_aviso.carreras.map((carrera) => carrera.carrera_id),
}; };
fetch('/action/avisos.php', { fetch('/action/avisos.php', {
method: 'POST', method: 'POST',
body: JSON.stringify(data) body: JSON.stringify(data)
}).then(res => res.json()).then(res => { }).then(res => res.json()).then(res => {
if (res.success) { if (res.success) {
// hydrate with carreras and profesores // hydrate with carreras and profesores
this.avisos.push({ this.avisos.push({
...data, ...data,
carreras: this.carreras.filter((carrera) => data.carreras.includes(carrera.carrera_id)), carreras: this.carreras.filter((carrera) => data.carreras.includes(carrera.carrera_id)),
profesores: this.profesores.filter((profesor) => data.profesores.includes(profesor.profesor_id)), profesores: this.profesores.filter((profesor) => data.profesores.includes(profesor.profesor_id)),
aviso_estado: true, aviso_estado: true,
aviso_id: res.aviso_id, aviso_id: res.aviso_id,
}); });
this.new_aviso.reset(); this.new_aviso.reset();
} }
else { else {
alert(res.error); alert(res.error);
console.log(res.errors); console.log(res.errors);
} }
}); });
}, },
deleteAviso(aviso) { deleteAviso(aviso) {
fetch(`/action/avisos.php`, { fetch(`/action/avisos.php`, {
method: 'DELETE', method: 'DELETE',
body: JSON.stringify({ aviso_id: aviso.aviso_id }) body: JSON.stringify({ aviso_id: aviso.aviso_id })
}).then(res => res.json()).then(res => { }).then(res => res.json()).then(res => {
if (res.success) { if (res.success) {
this.avisos = this.avisos.filter((aviso) => aviso.aviso_id !== this.aviso_suspendido); this.avisos = this.avisos.filter((aviso) => aviso.aviso_id !== this.aviso_suspendido);
this.aviso_suspendido = null; this.aviso_suspendido = null;
} }
else { else {
alert(res.error); alert(res.error);
console.log(res.errors); console.log(res.errors);
} }
}); });
}, },
updateAviso() { updateAviso() {
fetch(`/action/avisos.php`, { fetch(`/action/avisos.php`, {
method: 'PUT', method: 'PUT',
body: JSON.stringify({ body: JSON.stringify({
aviso_id: this.aviso_shown.aviso_id, aviso_id: this.aviso_shown.aviso_id,
aviso_fecha_final: this.aviso_shown.aviso_fecha_final, aviso_fecha_final: this.aviso_shown.aviso_fecha_final,
}) })
}).then(res => res.json()).then(res => { }).then(res => res.json()).then(res => {
if (res.success) { if (res.success) {
} }
else { else {
alert(res.error); alert(res.error);
console.log(res.errors); console.log(res.errors);
} }
}); });
}, },
async initializeDatepickers($el) { async initializeDatepickers($el) {
const periodo = await fetch('action/periodo_datos.php'); const periodo = await fetch('action/periodo_datos.php');
const periodo_data = await periodo.json(); const periodo_data = await periodo.json();
$('.date-picker').datepicker({ $('.date-picker').datepicker({
dateFormat: 'yy-mm-dd', dateFormat: 'yy-mm-dd',
maxDate: periodo_data.periodo_fecha_fin, maxDate: periodo_data.periodo_fecha_fin,
minDate: 0, minDate: 0,
}); });
$($el).on('change', () => { $($el).on('change', () => {
this.aviso_shown.aviso_fecha_final = $($el).val(); this.aviso_shown.aviso_fecha_final = $($el).val();
}); });
}, },
async mounted() { async mounted() {
this.avisos = await fetch("/action/avisos.php").then(res => res.json()); this.avisos = await fetch("/action/avisos.php").then(res => res.json());
this.profesores = await fetch('/action/action_profesor.php').then(res => res.json()); this.profesores = await fetch('/action/action_profesor.php').then(res => res.json());
this.carreras = await fetch('/action/action_carreras.php').then(res => res.json()); this.carreras = await fetch('/action/action_carreras.php').then(res => res.json());
await this.initializeDatepickers(); await this.initializeDatepickers();
const fechaInicio = $('#fechaInicio.date-picker'); const fechaInicio = $('#fechaInicio.date-picker');
const fechaFin = $('#fechaFin.date-picker'); const fechaFin = $('#fechaFin.date-picker');
fechaInicio.on("change", function () { fechaInicio.on("change", function () {
new_aviso.fechaInicio = fechaInicio.val(); new_aviso.fechaInicio = fechaInicio.val();
fechaFin.datepicker("option", "minDate", fechaInicio.val()); fechaFin.datepicker("option", "minDate", fechaInicio.val());
}); });
fechaFin.on("change", function () { fechaFin.on("change", function () {
new_aviso.fechaFin = fechaFin.val(); new_aviso.fechaFin = fechaFin.val();
fechaInicio.datepicker("option", "maxDate", fechaFin.val()); fechaInicio.datepicker("option", "maxDate", fechaFin.val());
}); });
} }
}).mount('#app'); }).mount('#app');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,44 +1,44 @@
import { createApp } from 'https://unpkg.com/petite-vue?module'; import { createApp } from 'https://unpkg.com/petite-vue?module';
const app = createApp({ const app = createApp({
carreras: [], carreras: [],
niveles: [], niveles: [],
message: {}, message: {},
async setNivel(carrera, nivel) { async setNivel(carrera, nivel) {
if (carrera.nivel_id === nivel.nivel_id) { if (carrera.nivel_id === nivel.nivel_id) {
return; return;
} }
carrera.nivel_id = nivel.nivel_id; carrera.nivel_id = nivel.nivel_id;
carrera.nivel_nombre = nivel.nivel_nombre; carrera.nivel_nombre = nivel.nivel_nombre;
await fetch('action/carrera.php', { await fetch('action/carrera.php', {
method: 'PUT', method: 'PUT',
body: JSON.stringify({ body: JSON.stringify({
carrera_id: carrera.carrera_id, carrera_id: carrera.carrera_id,
nivel_id: nivel.nivel_id nivel_id: nivel.nivel_id
}) })
}) })
.then(res => res.json()) .then(res => res.json())
.then(res => { .then(res => {
this.message.title = "Actualización"; this.message.title = "Actualización";
this.message.text = res.error ?? res.success; this.message.text = res.error ?? res.success;
this.message.type = res.error ? 'danger' : 'success'; this.message.type = res.error ? 'danger' : 'success';
this.message.timestamp = new Date().toLocaleTimeString(); this.message.timestamp = new Date().toLocaleTimeString();
}); });
}, },
async mounted() { async mounted() {
this.carreras = await fetch('action/carrera.php').then(res => res.json()); this.carreras = await fetch('action/carrera.php').then(res => res.json());
this.niveles = await fetch('action/nivel.php').then(res => res.json()); this.niveles = await fetch('action/nivel.php').then(res => res.json());
// group by facultad_id // group by facultad_id
const carreras = this.carreras.reduce((acc, cur) => { const carreras = this.carreras.reduce((acc, cur) => {
const { facultad_nombre } = cur; const { facultad_nombre } = cur;
if (!acc[facultad_nombre]) { if (!acc[facultad_nombre]) {
acc[facultad_nombre] = []; acc[facultad_nombre] = [];
} }
acc[facultad_nombre].push(cur); acc[facultad_nombre].push(cur);
return acc; return acc;
}, {}); }, {});
this.carreras = Object.entries(carreras).map(([facultad_nombre, carreras]) => ({ this.carreras = Object.entries(carreras).map(([facultad_nombre, carreras]) => ({
facultad_nombre: facultad_nombre, facultad_nombre: facultad_nombre,
carreras carreras
})); }));
} }
}).mount('#app'); }).mount('#app');

View File

@@ -1,120 +1,120 @@
// @ts-ignore Import module // @ts-ignore Import module
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module'; import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
const webServices = { const webServices = {
getPeriodosV1: async () => { getPeriodosV1: async () => {
try { try {
const response = await fetch('periodos.v1.php'); const response = await fetch('periodos.v1.php');
return await response.json(); return await response.json();
} }
catch (error) { catch (error) {
console.log(error); console.log(error);
return []; return [];
} }
}, },
getPeriodosV2: async () => { getPeriodosV2: async () => {
try { try {
const response = await fetch('periodos.v2.php'); const response = await fetch('periodos.v2.php');
return await response.json(); return await response.json();
} }
catch (error) { catch (error) {
console.log(error); console.log(error);
return []; return [];
} }
} }
}; };
const store = reactive({ const store = reactive({
periodosV1: [], periodosV1: [],
periodosV2: [], periodosV2: [],
errors: [], errors: [],
fechas(idPeriodo) { fechas(idPeriodo) {
const periodo = this.periodosV2.find((periodo) => periodo.IdPeriodo === idPeriodo); const periodo = this.periodosV2.find((periodo) => periodo.IdPeriodo === idPeriodo);
return { return {
inicio: periodo ? periodo.FechaInicio : '', inicio: periodo ? periodo.FechaInicio : '',
fin: periodo ? periodo.FechaFin : '' fin: periodo ? periodo.FechaFin : ''
}; };
}, },
periodov1(idPeriodo) { periodov1(idPeriodo) {
return this.periodosV1.find((periodo) => periodo.IdPeriodo === idPeriodo); return this.periodosV1.find((periodo) => periodo.IdPeriodo === idPeriodo);
}, },
periodov2(idPeriodo) { periodov2(idPeriodo) {
return this.periodosV2.filter((periodo) => periodo.IdPeriodo === idPeriodo); return this.periodosV2.filter((periodo) => periodo.IdPeriodo === idPeriodo);
}, },
async addPeriodo(periodo) { async addPeriodo(periodo) {
try { try {
const result = await fetch('backend/periodos.php', { const result = await fetch('backend/periodos.php', {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
...periodo, ...periodo,
...this.fechas(periodo.IdPeriodo) ...this.fechas(periodo.IdPeriodo)
}), }),
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}).then((response) => response.json()); }).then((response) => response.json());
if (result.success) { if (result.success) {
this.periodosV1 = this.periodosV1.map((periodoV1) => { this.periodosV1 = this.periodosV1.map((periodoV1) => {
if (periodoV1.IdPeriodo === periodo.IdPeriodo) { if (periodoV1.IdPeriodo === periodo.IdPeriodo) {
periodoV1.in_db = true; periodoV1.in_db = true;
} }
return periodoV1; return periodoV1;
}); });
return result; return result;
} }
else { else {
this.errors.push(result.message); this.errors.push(result.message);
} }
} }
catch (error) { catch (error) {
this.errors.push(error); this.errors.push(error);
} }
}, },
async addCarreras(idPeriodo) { async addCarreras(idPeriodo) {
try { try {
const periodoV1 = this.periodov1(idPeriodo); const periodoV1 = this.periodov1(idPeriodo);
const periodoV2 = this.periodov2(idPeriodo); const periodoV2 = this.periodov2(idPeriodo);
const data = periodoV2.map(({ ClaveCarrera, NombreCarrera }) => ({ const data = periodoV2.map(({ ClaveCarrera, NombreCarrera }) => ({
ClaveCarrera: ClaveCarrera, ClaveCarrera: ClaveCarrera,
NombreCarrera: NombreCarrera, NombreCarrera: NombreCarrera,
IdNivel: periodoV1.IdNivel, IdNivel: periodoV1.IdNivel,
})); }));
const result = await fetch('backend/carreras.php', { const result = await fetch('backend/carreras.php', {
method: 'POST', method: 'POST',
body: JSON.stringify(data), body: JSON.stringify(data),
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}).then((response) => response.json()); }).then((response) => response.json());
if (result.success) { if (result.success) {
await webServices.getPeriodosV1().then((periodosV1) => { await webServices.getPeriodosV1().then((periodosV1) => {
this.periodosV1 = periodosV1; this.periodosV1 = periodosV1;
}); });
await webServices.getPeriodosV2().then((periodosV2) => { await webServices.getPeriodosV2().then((periodosV2) => {
this.periodosV2 = periodosV2; this.periodosV2 = periodosV2;
}); });
} }
} }
catch (error) { catch (error) {
this.errors.push(error); this.errors.push(error);
} }
} }
}); });
createApp({ createApp({
store, store,
info(IdPeriodo) { info(IdPeriodo) {
const periodo = store.periodosV2.find((periodo) => periodo.IdPeriodo === IdPeriodo && const periodo = store.periodosV2.find((periodo) => periodo.IdPeriodo === IdPeriodo &&
periodo.FechaInicio != '' && periodo.FechaFin != ''); periodo.FechaInicio != '' && periodo.FechaFin != '');
return periodo; return periodo;
}, },
complete(IdPeriodo) { complete(IdPeriodo) {
const info = this.info(IdPeriodo); const info = this.info(IdPeriodo);
return info !== undefined; return info !== undefined;
}, },
mounted: async () => { mounted: async () => {
await webServices.getPeriodosV1().then((periodosV1) => { await webServices.getPeriodosV1().then((periodosV1) => {
store.periodosV1 = periodosV1; store.periodosV1 = periodosV1;
}); });
await webServices.getPeriodosV2().then((periodosV2) => { await webServices.getPeriodosV2().then((periodosV2) => {
store.periodosV2 = periodosV2; store.periodosV2 = periodosV2;
}); });
} }
}).mount(); }).mount();

File diff suppressed because it is too large Load Diff

View File

@@ -1,106 +1,106 @@
$(function () { $(function () {
const toggleIcon = (el, fromClass, toClass) => $(el).removeClass(fromClass).addClass(toClass); const toggleIcon = (el, fromClass, toClass) => $(el).removeClass(fromClass).addClass(toClass);
const ocultaTodos = () => { const ocultaTodos = () => {
toggleIcon('.datalist .icono', 'ing-cancelar iconoAzul pointer', 'ing-buscar'); toggleIcon('.datalist .icono', 'ing-cancelar iconoAzul pointer', 'ing-buscar');
$('.datalist ul').hide(); $('.datalist ul').hide();
}; };
$(document) $(document)
.on('click', '.datalist-input,.icono', function () { .on('click', '.datalist-input,.icono', function () {
const parent = $(this).parent(); const parent = $(this).parent();
$(".datalist ul:visible").not(parent.find('ul')).siblings('.datalist-input').trigger('click'); $(".datalist ul:visible").not(parent.find('ul')).siblings('.datalist-input').trigger('click');
if (parent.find('ul').is(':visible') || parent.hasClass("disabled")) return ocultaTodos(); if (parent.find('ul').is(':visible') || parent.hasClass("disabled")) return ocultaTodos();
parent.find('ul, .datalist-input').show(); parent.find('ul, .datalist-input').show();
toggleIcon(parent.find('.icono'), 'ing-buscar', 'ing-cancelar iconoAzul pointer'); toggleIcon(parent.find('.icono'), 'ing-buscar', 'ing-cancelar iconoAzul pointer');
}) })
.on('click', '.datalist-select > ul li:not(.not-selectable)', function () { .on('click', '.datalist-select > ul li:not(.not-selectable)', function () {
const parent = $(this).closest('.datalist'); const parent = $(this).closest('.datalist');
parent.find('.datalist-input').text($(this).text().trim()); parent.find('.datalist-input').text($(this).text().trim());
parent.find("input[type=hidden]").val($(this).data('id')); parent.find("input[type=hidden]").val($(this).data('id'));
$('.datalist li').removeClass("selected"); $('.datalist li').removeClass("selected");
$(this).addClass("selected"); $(this).addClass("selected");
parent.removeClass("datalist-invalid"); parent.removeClass("datalist-invalid");
ocultaTodos(); ocultaTodos();
}) })
.on('click', (e) => { .on('click', (e) => {
if (!$(e.target).closest('.datalist').length) ocultaTodos(); if (!$(e.target).closest('.datalist').length) ocultaTodos();
}); });
$('.modal').on('hide.bs.modal', ocultaTodos); $('.modal').on('hide.bs.modal', ocultaTodos);
}); });
const setDatalist = (selector, value = -1) => { const setDatalist = (selector, value = -1) => {
const parent = $(selector).closest('.datalist'); const parent = $(selector).closest('.datalist');
parent.find('ul li:not(.not-selectable)').each(function () { parent.find('ul li:not(.not-selectable)').each(function () {
if ($(this).data("id") !== value) return; if ($(this).data("id") !== value) return;
parent.find('.datalist-input').text($(this).text().trim()); parent.find('.datalist-input').text($(this).text().trim());
$(selector).val(value); $(selector).val(value);
$('.datalist li').removeClass("selected"); $('.datalist li').removeClass("selected");
$(this).addClass("selected"); $(this).addClass("selected");
$(this).click(); $(this).click();
}); });
} }
const makeRequiredDatalist = (selector, required = true) => $(selector).closest('.datalist').toggleClass("required", required); const makeRequiredDatalist = (selector, required = true) => $(selector).closest('.datalist').toggleClass("required", required);
//--------- //---------
function setDatalistFirst(selector) { function setDatalistFirst(selector) {
var index = 1; var index = 1;
var elementRoot = $(selector).parents('.datalist'); var elementRoot = $(selector).parents('.datalist');
var num = elementRoot.find('ul li:not(.not-selectable)').length; var num = elementRoot.find('ul li:not(.not-selectable)').length;
if (index <= num) { if (index <= num) {
while (elementRoot.find('ul li:nth-child(' + index + ')').hasClass("not-selectable") && index <= num) { while (elementRoot.find('ul li:nth-child(' + index + ')').hasClass("not-selectable") && index <= num) {
index++; index++;
} }
var element = elementRoot.find('ul li:nth-child(' + index + ')'); var element = elementRoot.find('ul li:nth-child(' + index + ')');
elementRoot.find('.datalist-input').text(element.html().replace(/[\t\n]+/g, ' ').trim()); elementRoot.find('.datalist-input').text(element.html().replace(/[\t\n]+/g, ' ').trim());
$(selector).val(element.data("id")); $(selector).val(element.data("id"));
elementRoot.find("li").removeClass("selected"); elementRoot.find("li").removeClass("selected");
element.addClass("selected"); element.addClass("selected");
} }
} }
function disableDatalist(selector, disabled = true) { function disableDatalist(selector, disabled = true) {
var elementRoot = $(selector).parents('.datalist'); var elementRoot = $(selector).parents('.datalist');
if (disabled) { if (disabled) {
elementRoot.addClass("disabled"); elementRoot.addClass("disabled");
elementRoot.find('.icono').removeClass('ing-cancelar iconoAzul pointer').addClass('ing-buscar'); elementRoot.find('.icono').removeClass('ing-cancelar iconoAzul pointer').addClass('ing-buscar');
elementRoot.find('ul').hide(); elementRoot.find('ul').hide();
} else } else
elementRoot.removeClass("disabled"); elementRoot.removeClass("disabled");
} }
function invalidDatalist(selector, invalid = true) { function invalidDatalist(selector, invalid = true) {
var elementRoot = $(selector).parents('.datalist'); var elementRoot = $(selector).parents('.datalist');
if (invalid) { if (invalid) {
elementRoot.addClass("datalist-invalid"); elementRoot.addClass("datalist-invalid");
} else } else
elementRoot.removeClass("datalist-invalid"); elementRoot.removeClass("datalist-invalid");
} }
//¿Se usa? //¿Se usa?
function buscaDatalist(selector, valor) { function buscaDatalist(selector, valor) {
selector.find('ul li').each(function () { selector.find('ul li').each(function () {
var elem = $(this); var elem = $(this);
if ($(this).parent().is('li')) if ($(this).parent().is('li'))
elem = $(this).parent(); elem = $(this).parent();
if (!$(this).html().toUpperCase().includes(valor.toUpperCase())) { if (!$(this).html().toUpperCase().includes(valor.toUpperCase())) {
$(elem).hide(); $(elem).hide();
selector.find('.datalist-input').val(""); selector.find('.datalist-input').val("");
selector.find("input[type=hidden]").val(""); selector.find("input[type=hidden]").val("");
} else } else
$(elem).show(); $(elem).show();
}); });
} }
function getDatalistText(selector, valor) { function getDatalistText(selector, valor) {
var elementRoot = $(selector).parents('.datalist'); var elementRoot = $(selector).parents('.datalist');
var text = ""; var text = "";
$.each(elementRoot.find('ul li:not(.not-selectable)'), function () { $.each(elementRoot.find('ul li:not(.not-selectable)'), function () {
if ($(this).data("id") == valor) { if ($(this).data("id") == valor) {
text = $(this).html(); text = $(this).html();
} }
}); });
return text; return text;
} }

View File

@@ -1,37 +1,37 @@
/* Inicialización en español para la extensión 'UI date picker' para jQuery. */ /* Inicialización en español para la extensión 'UI date picker' para jQuery. */
/* Traducido por Vester (xvester@gmail.com). */ /* Traducido por Vester (xvester@gmail.com). */
( function( factory ) { ( function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
define( [ "../widgets/datepicker" ], factory ); define( [ "../widgets/datepicker" ], factory );
} else { } else {
// Browser globals // Browser globals
factory( jQuery.datepicker ); factory( jQuery.datepicker );
} }
}( function( datepicker ) { }( function( datepicker ) {
datepicker.regional.es = { datepicker.regional.es = {
closeText: "Cerrar", closeText: "Cerrar",
prevText: "&#x3C;Ant", prevText: "&#x3C;Ant",
nextText: "Sig&#x3E;", nextText: "Sig&#x3E;",
currentText: "Hoy", currentText: "Hoy",
monthNames: [ "enero","febrero","marzo","abril","mayo","junio", monthNames: [ "enero","febrero","marzo","abril","mayo","junio",
"julio","agosto","septiembre","octubre","noviembre","diciembre" ], "julio","agosto","septiembre","octubre","noviembre","diciembre" ],
monthNamesShort: [ "ene","feb","mar","abr","may","jun", monthNamesShort: [ "ene","feb","mar","abr","may","jun",
"jul","ago","sep","oct","nov","dic" ], "jul","ago","sep","oct","nov","dic" ],
dayNames: [ "domingo","lunes","martes","miércoles","jueves","viernes","sábado" ], dayNames: [ "domingo","lunes","martes","miércoles","jueves","viernes","sábado" ],
dayNamesShort: [ "dom","lun","mar","mié","jue","vie","sáb" ], dayNamesShort: [ "dom","lun","mar","mié","jue","vie","sáb" ],
dayNamesMin: [ "D","L","M","X","J","V","S" ], dayNamesMin: [ "D","L","M","X","J","V","S" ],
weekHeader: "Sm", weekHeader: "Sm",
dateFormat: "dd/mm/yy", dateFormat: "dd/mm/yy",
firstDay: 1, firstDay: 1,
isRTL: false, isRTL: false,
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: "" }; yearSuffix: "" };
datepicker.setDefaults( datepicker.regional.es ); datepicker.setDefaults( datepicker.regional.es );
return datepicker.regional.es; return datepicker.regional.es;
} ) ); } ) );

View File

@@ -1,84 +1,84 @@
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module'; import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
const filter = reactive({ const filter = reactive({
facultad: -1, facultad: -1,
profesor: '', profesor: '',
porcentaje: 0, porcentaje: 0,
faltas: 0, faltas: 0,
tipoFaltas: true, tipoFaltas: true,
}); });
const app = createApp({ const app = createApp({
filter, filter,
facultades: [], facultades: [],
profesores: [], profesores: [],
faltas: [], faltas: [],
mensaje: { mensaje: {
titulo: '', titulo: '',
texto: '', texto: '',
}, },
async refresh() { async refresh() {
if (filter.facultad == -1 || (filter.porcentaje < 10 && filter.faltas < 1)) { if (filter.facultad == -1 || (filter.porcentaje < 10 && filter.faltas < 1)) {
console.log('Facultad: ', filter.facultad, 'Porcentaje: ', filter.porcentaje, 'Faltas: ', filter.faltas); console.log('Facultad: ', filter.facultad, 'Porcentaje: ', filter.porcentaje, 'Faltas: ', filter.faltas);
return; return;
} }
$('#cargando').modal('show'); $('#cargando').modal('show');
try { try {
this.faltas = await fetch(`action/profesor_faltas.php?facultad=${this.filter.facultad}&${this.filter.tipoFaltas ? 'supervisor' : 'profesor'}&${this.filter.faltas > 0 ? 'faltas' : 'porcentaje'}=${this.filter.faltas > 0 ? this.filter.faltas : this.filter.porcentaje}`).then(res => res.json()); this.faltas = await fetch(`action/profesor_faltas.php?facultad=${this.filter.facultad}&${this.filter.tipoFaltas ? 'supervisor' : 'profesor'}&${this.filter.faltas > 0 ? 'faltas' : 'porcentaje'}=${this.filter.faltas > 0 ? this.filter.faltas : this.filter.porcentaje}`).then(res => res.json());
if (this.faltas.error) { if (this.faltas.error) {
$('.modal#mensaje').modal('show'); $('.modal#mensaje').modal('show');
this.mensaje.titulo = 'Información'; this.mensaje.titulo = 'Información';
this.mensaje.texto = this.faltas.error; this.mensaje.texto = this.faltas.error;
} }
} catch (error) { } catch (error) {
$('.modal#mensaje').modal('show'); $('.modal#mensaje').modal('show');
this.mensaje.titulo = 'Error'; this.mensaje.titulo = 'Error';
this.mensaje.texto = 'No se pudo cargar los datos'; this.mensaje.texto = 'No se pudo cargar los datos';
} }
finally { finally {
$('#cargando').modal('hide'); $('#cargando').modal('hide');
} }
}, },
async toExcel() { async toExcel() {
if (filter.facultad == -1 || filter.porcentaje < 10) { if (filter.facultad == -1 || filter.porcentaje < 10) {
return; return;
} }
$('#cargando').modal('show'); $('#cargando').modal('show');
try { try {
const response = await fetch(`export/faltas_excel.php`, { const response = await fetch(`export/faltas_excel.php`, {
method: 'POST', method: 'POST',
body: JSON.stringify(this.faltas.map(falta => ({ body: JSON.stringify(this.faltas.map(falta => ({
'profesor_clave': falta.profesor.profesor_clave, 'profesor_clave': falta.profesor.profesor_clave,
'profesor_correo': falta.profesor.profesor_correo, 'profesor_correo': falta.profesor.profesor_correo,
'profesor_nombre': falta.profesor.profesor_nombre, 'profesor_nombre': falta.profesor.profesor_nombre,
'faltas': falta.faltas, 'faltas': falta.faltas,
'porcentaje': `${falta.porcentaje}%`, 'porcentaje': `${falta.porcentaje}%`,
'total': falta.total, 'total': falta.total,
}))), }))),
}) })
const blob = await response.blob(); const blob = await response.blob();
window.saveAs(blob, `faltas_${this.facultades.find(facultad => facultad.facultad_id == filter.facultad).facultad_nombre}_${new Date().toISOString().slice(0, 10)}.xlsx`); window.saveAs(blob, `faltas_${this.facultades.find(facultad => facultad.facultad_id == filter.facultad).facultad_nombre}_${new Date().toISOString().slice(0, 10)}.xlsx`);
} catch (error) { } catch (error) {
$('.modal#mensaje').modal('show'); $('.modal#mensaje').modal('show');
this.mensaje.titulo = 'Error'; this.mensaje.titulo = 'Error';
this.mensaje.texto = 'No se pudo cargar los datos'; this.mensaje.texto = 'No se pudo cargar los datos';
console.log('Error: ', error); console.log('Error: ', error);
} }
finally { finally {
$('#cargando').modal('hide'); $('#cargando').modal('hide');
} }
}, },
async mounted() { async mounted() {
try { try {
this.facultades = await fetch('action/action_facultad.php').then(res => res.json()); this.facultades = await fetch('action/action_facultad.php').then(res => res.json());
this.profesores = await fetch('action/action_profesor.php').then(res => res.json()); this.profesores = await fetch('action/action_profesor.php').then(res => res.json());
} catch (error) { } catch (error) {
$('.modal#mensaje').modal('show'); $('.modal#mensaje').modal('show');
this.mensaje.titulo = 'Error'; this.mensaje.titulo = 'Error';
this.mensaje.texto = 'No se pudo cargar los datos'; this.mensaje.texto = 'No se pudo cargar los datos';
console.log('Error: ', error); console.log('Error: ', error);
} }
} }
}).mount('#app'); }).mount('#app');

View File

@@ -1,106 +1,106 @@
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module'; import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
const profesores = reactive({ const profesores = reactive({
data: [], data: [],
search: null, search: null,
fetch: async function () { fetch: async function () {
const response = await fetch('action/action_profesor.php'); const response = await fetch('action/action_profesor.php');
this.data = await response.json(); this.data = await response.json();
}, },
get clave() { get clave() {
const match = this.search.match(/^\((.+)\)/); const match = this.search.match(/^\((.+)\)/);
return match ? match[1] : ''; return match ? match[1] : '';
}, },
get current() { get current() {
return this.data.find((profesor) => profesor.profesor_clave === profesores.clave); return this.data.find((profesor) => profesor.profesor_clave === profesores.clave);
}, },
}); });
const facultades = reactive({ const facultades = reactive({
data: [], data: [],
fetch: async function () { fetch: async function () {
const facultades = await fetch('action/action_facultad.php').then(response => response.json()); const facultades = await fetch('action/action_facultad.php').then(response => response.json());
const carreras = await fetch(`action/carrera.php`).then(response => response.json()); const carreras = await fetch(`action/carrera.php`).then(response => response.json());
this.data = await Promise.all(facultades.map(async (facultad) => ({ this.data = await Promise.all(facultades.map(async (facultad) => ({
...facultad, ...facultad,
carreras: await Promise.all(carreras.filter((carrera) => carrera.facultad_id === facultad.facultad_id).map(async (carrera) => { carreras: await Promise.all(carreras.filter((carrera) => carrera.facultad_id === facultad.facultad_id).map(async (carrera) => {
const grupos = await fetch(`action/action_grupo.php?carrera_id=${carrera.carrera_id}`).then(response => response.json()); const grupos = await fetch(`action/action_grupo.php?carrera_id=${carrera.carrera_id}`).then(response => response.json());
return { return {
...carrera, ...carrera,
grupos, grupos,
}; };
})), })),
}))); })));
this.data = this.data.filter((facultad) => facultad.carreras.length > 0); this.data = this.data.filter((facultad) => facultad.carreras.length > 0);
} }
}); });
const horarios = reactive({ const horarios = reactive({
data: [], data: [],
fetch: async function (grupo = null, carrera_id = null) { fetch: async function (grupo = null, carrera_id = null) {
if (grupo && carrera_id) { if (grupo && carrera_id) {
const response = await fetch(`action/action_horario.php?grupo=${grupo}&carrera_id=${carrera_id}`); const response = await fetch(`action/action_horario.php?grupo=${grupo}&carrera_id=${carrera_id}`);
this.data = await response.json(); this.data = await response.json();
} }
else if (profesores.current) { else if (profesores.current) {
const response = await fetch(`action/action_horario.php?profesor_id=${profesores.current.profesor_id}`); const response = await fetch(`action/action_horario.php?profesor_id=${profesores.current.profesor_id}`);
this.data = await response.json(); this.data = await response.json();
} }
}, },
get structure() { get structure() {
if (this.data.length === 0) if (this.data.length === 0)
return null; return null;
const structure = { const structure = {
sábado: this.data.some((horario) => horario.horario_dia === 6), sábado: this.data.some((horario) => horario.horario_dia === 6),
hora_mínima: Math.min(...this.data.map((horario) => parseInt(horario.horario_hora.split(':')[0]))), hora_mínima: Math.min(...this.data.map((horario) => parseInt(horario.horario_hora.split(':')[0]))),
hora_máxima: Math.max(...this.data.map((horario) => { hora_máxima: Math.max(...this.data.map((horario) => {
const [hour, minute] = horario.horario_fin.split(':').map(Number); const [hour, minute] = horario.horario_fin.split(':').map(Number);
return hour + Math.ceil(minute / 60); return hour + Math.ceil(minute / 60);
})), })),
horas_totales: 0 horas_totales: 0
}; };
structure.horas_totales = structure.hora_máxima - structure.hora_mínima; structure.horas_totales = structure.hora_máxima - structure.hora_mínima;
return structure; return structure;
}, },
get blocks() { get blocks() {
if (this.data.length === 0) if (this.data.length === 0)
return null; return null;
return [...Array(this.structure.horas_totales).keys()].flatMap(hora => { return [...Array(this.structure.horas_totales).keys()].flatMap(hora => {
const baseHour = hora + this.structure.hora_mínima; const baseHour = hora + this.structure.hora_mínima;
return [0, 15, 30, 45].map(block => ({ hour: baseHour, block })); return [0, 15, 30, 45].map(block => ({ hour: baseHour, block }));
}); });
}, },
getHorarioData(hour, block, día) { getHorarioData(hour, block, día) {
const foundHorario = this.data.find((horario) => parseInt(horario.horario_hora.split(':')[0]) === hour && const foundHorario = this.data.find((horario) => parseInt(horario.horario_hora.split(':')[0]) === hour &&
parseInt(horario.horario_hora.split(':')[1]) === block && parseInt(horario.horario_hora.split(':')[1]) === block &&
horario.horario_dia === día); horario.horario_dia === día);
return foundHorario; return foundHorario;
}, },
isOccupied(hora, bloque, day) { isOccupied(hora, bloque, day) {
if (this.getHorarioData(hora, bloque, day)) { if (this.getHorarioData(hora, bloque, day)) {
return false; return false;
} }
const currentTimeInMinutes = hora * 60 + bloque; const currentTimeInMinutes = hora * 60 + bloque;
for (const item of this.data) { for (const item of this.data) {
if (item.horario_dia !== day) { if (item.horario_dia !== day) {
continue; // Skip items that are not on the specified day continue; // Skip items that are not on the specified day
} }
// Split the hour and minute from horario_hora // Split the hour and minute from horario_hora
const [startHour, startMinute] = item.horario_hora.split(":").map(Number); const [startHour, startMinute] = item.horario_hora.split(":").map(Number);
const startTimeInMinutes = startHour * 60 + startMinute; const startTimeInMinutes = startHour * 60 + startMinute;
// Calculate end time using duracion // Calculate end time using duracion
const [durationHours, durationMinutes] = item.duracion.split(":").map(Number); const [durationHours, durationMinutes] = item.duracion.split(":").map(Number);
const endTimeInMinutes = startTimeInMinutes + (durationHours * 60) + durationMinutes; const endTimeInMinutes = startTimeInMinutes + (durationHours * 60) + durationMinutes;
if (currentTimeInMinutes >= startTimeInMinutes && currentTimeInMinutes < endTimeInMinutes) { if (currentTimeInMinutes >= startTimeInMinutes && currentTimeInMinutes < endTimeInMinutes) {
return true; // The block is occupied return true; // The block is occupied
} }
} }
return false; // The block is not occupied by any class return false; // The block is not occupied by any class
} }
}); });
const app = createApp({ const app = createApp({
profesores, profesores,
horarios, horarios,
facultades, facultades,
mounted: async function () { mounted: async function () {
await profesores.fetch(); await profesores.fetch();
await facultades.fetch(); await facultades.fetch();
} }
}).mount('#app'); }).mount('#app');

24
js/jquery-ui.js vendored

File diff suppressed because one or more lines are too long

4
js/jquery.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,115 +1,115 @@
import { createApp } from 'https://unpkg.com/petite-vue?module'; import { createApp } from 'https://unpkg.com/petite-vue?module';
const app = createApp({ const app = createApp({
periodos: [], periodos: [],
niveles: [], niveles: [],
messages: [], messages: [],
addMessage(title, text, type) { addMessage(title, text, type) {
this.messages.push({ title, text, type, timestamp: new Date() }); this.messages.push({ title, text, type, timestamp: new Date() });
}, },
async sendRequest(action, periodo_id, data) { async sendRequest(action, periodo_id, data) {
const response = await fetch('action/periodos.php', { const response = await fetch('action/periodos.php', {
method: 'PUT', method: 'PUT',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
action: action, action: action,
periodo_id: periodo_id, periodo_id: periodo_id,
...data ...data
}) })
}); });
return await response.json(); return await response.json();
}, },
async changeNivel(periodo, nivel_id) { async changeNivel(periodo, nivel_id) {
if (periodo.nivel_id === nivel_id) if (periodo.nivel_id === nivel_id)
return; return;
const result = await this.sendRequest('changeNivel', periodo.periodo_id, { nivel_id: nivel_id }); const result = await this.sendRequest('changeNivel', periodo.periodo_id, { nivel_id: nivel_id });
if (result.success) { if (result.success) {
this.addMessage('Nivel cambiado', `El nivel del periodo ${periodo.periodo_nombre} ha sido cambiado a ${this.niveles.find((nivel) => nivel.nivel_id === nivel_id)?.nivel_nombre}`, 'success'); this.addMessage('Nivel cambiado', `El nivel del periodo ${periodo.periodo_nombre} ha sido cambiado a ${this.niveles.find((nivel) => nivel.nivel_id === nivel_id)?.nivel_nombre}`, 'success');
periodo.nivel_id = nivel_id; periodo.nivel_id = nivel_id;
periodo.nivel = this.niveles.find((nivel) => nivel.nivel_id === nivel_id)?.nivel_nombre || ''; periodo.nivel = this.niveles.find((nivel) => nivel.nivel_id === nivel_id)?.nivel_nombre || '';
} }
else { else {
this.addMessage('Error al cambiar nivel', `No se pudo cambiar el nivel del periodo ${periodo.periodo_nombre}`, 'danger'); this.addMessage('Error al cambiar nivel', `No se pudo cambiar el nivel del periodo ${periodo.periodo_nombre}`, 'danger');
} }
}, },
async changeFechaInicio(periodo, fecha_inicio) { async changeFechaInicio(periodo, fecha_inicio) {
const result = await this.sendRequest('changeFechaInicio', periodo.periodo_id, { periodo_fecha_inicio: fecha_inicio }); const result = await this.sendRequest('changeFechaInicio', periodo.periodo_id, { periodo_fecha_inicio: fecha_inicio });
if (result.success) { if (result.success) {
this.addMessage('Fecha de inicio cambiada', `La fecha de inicio del periodo ${periodo.periodo_nombre} ha sido cambiada a ${fecha_inicio}`, 'success'); this.addMessage('Fecha de inicio cambiada', `La fecha de inicio del periodo ${periodo.periodo_nombre} ha sido cambiada a ${fecha_inicio}`, 'success');
periodo.periodo_fecha_inicio = fecha_inicio; periodo.periodo_fecha_inicio = fecha_inicio;
} }
else { else {
this.addMessage('Error al cambiar fecha de inicio', `No se pudo cambiar la fecha de inicio del periodo ${periodo.periodo_nombre}`, 'danger'); this.addMessage('Error al cambiar fecha de inicio', `No se pudo cambiar la fecha de inicio del periodo ${periodo.periodo_nombre}`, 'danger');
} }
}, },
async changeFechaFin(periodo, fecha_fin) { async changeFechaFin(periodo, fecha_fin) {
const result = await this.sendRequest('changeFechaFin', periodo.periodo_id, { periodo_fecha_fin: fecha_fin }); const result = await this.sendRequest('changeFechaFin', periodo.periodo_id, { periodo_fecha_fin: fecha_fin });
if (result.success) { if (result.success) {
this.addMessage('Fecha de fin cambiada', `La fecha de fin del periodo ${periodo.periodo_nombre} ha sido cambiada a ${fecha_fin}`, 'success'); this.addMessage('Fecha de fin cambiada', `La fecha de fin del periodo ${periodo.periodo_nombre} ha sido cambiada a ${fecha_fin}`, 'success');
periodo.periodo_fecha_fin = fecha_fin; periodo.periodo_fecha_fin = fecha_fin;
} }
else { else {
this.addMessage('Error al cambiar fecha de fin', `No se pudo cambiar la fecha de fin del periodo ${periodo.periodo_nombre}`, 'danger'); this.addMessage('Error al cambiar fecha de fin', `No se pudo cambiar la fecha de fin del periodo ${periodo.periodo_nombre}`, 'danger');
} }
}, },
async updatePeriodo(periodo) { async updatePeriodo(periodo) {
const result = await this.sendRequest('updatePeriodo', periodo.periodo_id, { const result = await this.sendRequest('updatePeriodo', periodo.periodo_id, {
periodo_nombre: periodo.periodo_nombre, periodo_nombre: periodo.periodo_nombre,
id_periodo_sgu: periodo.id_periodo_sgu, id_periodo_sgu: periodo.id_periodo_sgu,
periodo_clave: periodo.periodo_clave, periodo_clave: periodo.periodo_clave,
}); });
if (result.success) { if (result.success) {
this.addMessage('Periodo actualizado', `El periodo ${periodo.periodo_nombre} ha sido actualizado`, 'success'); this.addMessage('Periodo actualizado', `El periodo ${periodo.periodo_nombre} ha sido actualizado`, 'success');
} }
else { else {
this.addMessage('Error al actualizar periodo', `No se pudo actualizar el periodo ${periodo.periodo_nombre}`, 'danger'); this.addMessage('Error al actualizar periodo', `No se pudo actualizar el periodo ${periodo.periodo_nombre}`, 'danger');
} }
}, },
async createPeriodo(newPeriodo) { async createPeriodo(newPeriodo) {
if (newPeriodo.periodo_nombre === null || newPeriodo.nivel_id === null || newPeriodo.periodo_fecha_inicio === null || newPeriodo.periodo_fecha_fin === null) { if (newPeriodo.periodo_nombre === null || newPeriodo.nivel_id === null || newPeriodo.periodo_fecha_inicio === null || newPeriodo.periodo_fecha_fin === null) {
this.addMessage('Error al crear periodo', `No se pudo crear el periodo ${newPeriodo.periodo_nombre}`, 'danger'); this.addMessage('Error al crear periodo', `No se pudo crear el periodo ${newPeriodo.periodo_nombre}`, 'danger');
return; return;
} }
const result = await fetch('action/periodos.php', { const result = await fetch('action/periodos.php', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify(newPeriodo) body: JSON.stringify(newPeriodo)
}).then(res => res.json()); }).then(res => res.json());
if (result.success) { if (result.success) {
this.addMessage('Periodo creado', `El periodo ${newPeriodo.periodo_nombre} ha sido creado`, 'success'); this.addMessage('Periodo creado', `El periodo ${newPeriodo.periodo_nombre} ha sido creado`, 'success');
this.periodos; this.periodos;
Object.keys(newPeriodo).forEach(key => newPeriodo[key] = null); Object.keys(newPeriodo).forEach(key => newPeriodo[key] = null);
newPeriodo.nivel_id = ''; newPeriodo.nivel_id = '';
this.periodos = await fetch('action/periodos.php').then(res => res.json()); this.periodos = await fetch('action/periodos.php').then(res => res.json());
} }
else { else {
this.addMessage('Error al crear periodo', `No se pudo crear el periodo ${newPeriodo.periodo_nombre}`, 'danger'); this.addMessage('Error al crear periodo', `No se pudo crear el periodo ${newPeriodo.periodo_nombre}`, 'danger');
} }
}, },
async deletePeriodo(periodo) { async deletePeriodo(periodo) {
const response = await fetch('action/periodos.php', { const response = await fetch('action/periodos.php', {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
periodo_id: periodo.periodo_id, periodo_id: periodo.periodo_id,
}) })
}); });
const result = await response.json(); const result = await response.json();
if (result.success) { if (result.success) {
this.addMessage('Periodo eliminado', `El periodo ${periodo.periodo_nombre} ha sido eliminado`, 'success'); this.addMessage('Periodo eliminado', `El periodo ${periodo.periodo_nombre} ha sido eliminado`, 'success');
this.periodos = this.periodos.filter((p) => p.periodo_id !== periodo.periodo_id); this.periodos = this.periodos.filter((p) => p.periodo_id !== periodo.periodo_id);
} }
else { else {
this.addMessage('Error al eliminar periodo', `No se pudo eliminar el periodo ${periodo.periodo_nombre}`, 'danger'); this.addMessage('Error al eliminar periodo', `No se pudo eliminar el periodo ${periodo.periodo_nombre}`, 'danger');
} }
}, },
async mounted() { async mounted() {
this.periodos = await fetch('action/periodos.php').then(res => res.json()); this.periodos = await fetch('action/periodos.php').then(res => res.json());
this.niveles = await fetch('action/nivel.php').then(res => res.json()); this.niveles = await fetch('action/nivel.php').then(res => res.json());
} }
}).mount('#app'); }).mount('#app');

View File

@@ -1,106 +1,106 @@
import { createApp } from 'https://unpkg.com/petite-vue?module'; import { createApp } from 'https://unpkg.com/petite-vue?module';
// añade una ventana de confirmación al intentar cambiar de página // añade una ventana de confirmación al intentar cambiar de página
const app = createApp({ const app = createApp({
message: null, message: null,
puestos: [], puestos: [],
carreras: [], carreras: [],
materias: [], materias: [],
usuarios: [], usuarios: [],
async nuevoPuesto(nuevoPuesto) { async nuevoPuesto(nuevoPuesto) {
try { try {
const res = await fetch('action/puesto.php', { const res = await fetch('action/puesto.php', {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
puesto_nombre: nuevoPuesto puesto_nombre: nuevoPuesto
}) })
}); });
const data = await res.json(); const data = await res.json();
this.puestos.push(data); this.puestos.push(data);
// order by puesto.nombre // order by puesto.nombre
this.puestos.sort((a, b) => a.nombre.localeCompare(b.nombre)); this.puestos.sort((a, b) => a.nombre.localeCompare(b.nombre));
} }
catch (error) { catch (error) {
alert(`Error: ${error}`); alert(`Error: ${error}`);
} }
}, },
to_delete: null, to_delete: null,
async eliminarPuesto(puesto_id) { async eliminarPuesto(puesto_id) {
try { try {
const res = await fetch('action/puesto.php', { const res = await fetch('action/puesto.php', {
method: 'DELETE', method: 'DELETE',
body: JSON.stringify({ body: JSON.stringify({
puesto_id puesto_id
}) })
}); });
const data = await res.json(); const data = await res.json();
this.message = data.msg; this.message = data.msg;
// after 3 seconds, remove the message // after 3 seconds, remove the message
setTimeout(() => { setTimeout(() => {
this.message = null; this.message = null;
}, 3000); }, 3000);
this.puestos = this.puestos.filter((p) => p.puesto_id !== puesto_id); this.puestos = this.puestos.filter((p) => p.puesto_id !== puesto_id);
// order by puesto.nombre // order by puesto.nombre
this.puestos.sort((a, b) => a.nombre.localeCompare(b.nombre)); this.puestos.sort((a, b) => a.nombre.localeCompare(b.nombre));
} }
catch (error) { catch (error) {
alert(`Error: ${error}`); alert(`Error: ${error}`);
} }
}, },
async actualizarPuesto(puesto_id, materias, usuario_id) { async actualizarPuesto(puesto_id, materias, usuario_id) {
try { try {
const res = await fetch('action/puesto.php', { const res = await fetch('action/puesto.php', {
method: 'PUT', method: 'PUT',
body: JSON.stringify({ body: JSON.stringify({
puesto_id, puesto_id,
materias: materias.map(m => m.materia_id), materias: materias.map(m => m.materia_id),
usuario_id usuario_id
}) })
}); });
const data = await res.json(); const data = await res.json();
this.message = data.msg; this.message = data.msg;
modificado = false; modificado = false;
// after 3 seconds, remove the message // after 3 seconds, remove the message
setTimeout(() => { setTimeout(() => {
this.message = null; this.message = null;
}, 3000); }, 3000);
} }
catch (error) { catch (error) {
alert(`Error: ${error}`); alert(`Error: ${error}`);
} }
}, },
async descargar() { async descargar() {
$('div.modal#cargando').modal('show'); $('div.modal#cargando').modal('show');
this.loading = true; this.loading = true;
try { try {
const res = await fetch('action/action_puestos_excel.php', { const res = await fetch('action/action_puestos_excel.php', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
}); });
const blob = await res.blob(); const blob = await res.blob();
window.saveAs(blob, `puestos_${new Date().toISOString().slice(0, 10)}.xlsx`); window.saveAs(blob, `puestos_${new Date().toISOString().slice(0, 10)}.xlsx`);
} }
catch (error) { catch (error) {
if (error.response && error.response.status === 413) { if (error.response && error.response.status === 413) {
alert('Your request is too large! Please reduce the data size and try again.'); alert('Your request is too large! Please reduce the data size and try again.');
} }
else { else {
alert('An error occurred: ' + error.message); alert('An error occurred: ' + error.message);
} }
} }
finally { finally {
$('#cargando').modal('hide'); $('#cargando').modal('hide');
this.loading = false; this.loading = false;
} }
}, },
async mounted() { async mounted() {
this.puestos = await fetch('action/puesto.php').then(res => res.json()); this.puestos = await fetch('action/puesto.php').then(res => res.json());
this.carreras = await fetch('action/action_carreras.php').then(res => res.json()); this.carreras = await fetch('action/action_carreras.php').then(res => res.json());
this.materias = await fetch('action/action_materias.php').then(res => res.json()); this.materias = await fetch('action/action_materias.php').then(res => res.json());
this.usuarios = await fetch('action/usuarios.php').then(res => res.json()); this.usuarios = await fetch('action/usuarios.php').then(res => res.json());
} }
}).mount('#app'); }).mount('#app');

View File

@@ -1,178 +1,178 @@
// Get references to the HTML elements // Get references to the HTML elements
const form = document.getElementById('form'); const form = document.getElementById('form');
const steps = Array.from(form.querySelectorAll('.step')); const steps = Array.from(form.querySelectorAll('.step'));
const nextButton = document.getElementById('next-button'); const nextButton = document.getElementById('next-button');
const prevButton = document.getElementById('prev-button'); const prevButton = document.getElementById('prev-button');
let currentStep = 0; let currentStep = 0;
// #clave_profesor on change => show step 2 // #clave_profesor on change => show step 2
const clave_profesor = document.getElementById('clave_profesor'); const clave_profesor = document.getElementById('clave_profesor');
const horario_reponer = document.getElementById('horario_reponer'); const horario_reponer = document.getElementById('horario_reponer');
const fechas_clase = document.getElementById('fechas_clase'); const fechas_clase = document.getElementById('fechas_clase');
const fecha_reponer = $('#fecha_reponer'); const fecha_reponer = $('#fecha_reponer');
const hora_reponer = $('#hora_reponer'); const hora_reponer = $('#hora_reponer');
const minutos_reponer = $('#minutos_reponer'); const minutos_reponer = $('#minutos_reponer');
clave_profesor.addEventListener('change', async () => { clave_profesor.addEventListener('change', async () => {
const step2 = document.getElementById('step-2'); const step2 = document.getElementById('step-2');
clave_profesor.disabled = true; clave_profesor.disabled = true;
// get option which value is the same as clave_profesor.value // get option which value is the same as clave_profesor.value
const option = document.querySelector(`option[value="${clave_profesor.value}"]`); const option = document.querySelector(`option[value="${clave_profesor.value}"]`);
// make a form data with #form // make a form data with #form
const profesor_id = document.getElementById('profesor_id'); const profesor_id = document.getElementById('profesor_id');
profesor_id.value = option.dataset.id; profesor_id.value = option.dataset.id;
const formData = new FormData(form); const formData = new FormData(form);
const response = await fetch(`./action/action_horario_profesor.php`, { const response = await fetch(`./action/action_horario_profesor.php`, {
method: 'POST', method: 'POST',
body: formData body: formData
}); });
const data = await response.json(); const data = await response.json();
if (data['success'] === false) { if (data['success'] === false) {
const message = "Hubo un error al obtener los horarios del profesor."; const message = "Hubo un error al obtener los horarios del profesor.";
const title = 'Error'; const title = 'Error';
const color = 'danger'; const color = 'danger';
triggerMessage(message, title, color); triggerMessage(message, title, color);
return; return;
} }
const horarios = data.data; const horarios = data.data;
const initial = document.createElement('option'); const initial = document.createElement('option');
initial.value = ''; initial.value = '';
initial.textContent = 'Seleccione un horario'; initial.textContent = 'Seleccione un horario';
initial.selected = true; initial.selected = true;
initial.disabled = true; initial.disabled = true;
horario_reponer.innerHTML = ''; horario_reponer.innerHTML = '';
horario_reponer.appendChild(initial); horario_reponer.appendChild(initial);
horarios.forEach((horario) => { horarios.forEach((horario) => {
const dias = ['Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado', 'Domingo']; const dias = ['Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado', 'Domingo'];
const option = document.createElement('option'); const option = document.createElement('option');
option.value = `${horario.id}`; option.value = `${horario.id}`;
// materia máx 25 caracteres, if materia.length > 25 then slice(0, 20) // materia máx 25 caracteres, if materia.length > 25 then slice(0, 20)
const max = 25; const max = 25;
option.textContent = `${horario.materia.slice(0, max) + (horario.materia.length > max ? '...' : '')} - Grupo: ${horario.grupo} - ${horario.hora.slice(0, 5)}-${horario.hora_final.slice(0, 5)} - Salon: ${horario.salon} - ${horario.dia}`; option.textContent = `${horario.materia.slice(0, max) + (horario.materia.length > max ? '...' : '')} - Grupo: ${horario.grupo} - ${horario.hora.slice(0, 5)}-${horario.hora_final.slice(0, 5)} - Salon: ${horario.salon} - ${horario.dia}`;
option.dataset.materia = `${horario.materia}`; option.dataset.materia = `${horario.materia}`;
option.dataset.grupo = `${horario.grupo}`; option.dataset.grupo = `${horario.grupo}`;
option.dataset.hora = `${horario.hora.slice(0, 5)}`; // slice(0, 5) => HH:MM option.dataset.hora = `${horario.hora.slice(0, 5)}`; // slice(0, 5) => HH:MM
option.dataset.hora_final = `${horario.hora_final.slice(0, 5)}`; option.dataset.hora_final = `${horario.hora_final.slice(0, 5)}`;
option.dataset.salon = `${horario.salon}`; option.dataset.salon = `${horario.salon}`;
option.dataset.dia = `${horario.dia}`; option.dataset.dia = `${horario.dia}`;
option.dataset.id = `${horario.id}`; option.dataset.id = `${horario.id}`;
horario_reponer.appendChild(option); horario_reponer.appendChild(option);
}); });
currentStep = 1; currentStep = 1;
step2.style.display = 'block'; step2.style.display = 'block';
prevButton.disabled = false; prevButton.disabled = false;
}); });
// disable clave_profesor // disable clave_profesor
// from second step to first step // from second step to first step
prevButton.addEventListener('click', () => { prevButton.addEventListener('click', () => {
const inputs = [clave_profesor, horario_reponer, fechas_clase, fecha_reponer, hora_reponer]; const inputs = [clave_profesor, horario_reponer, fechas_clase, fecha_reponer, hora_reponer];
switch (currentStep) { switch (currentStep) {
case 1: case 1:
case 2: case 2:
case 3: case 3:
const step = document.getElementById(`step-${currentStep + 1}`); const step = document.getElementById(`step-${currentStep + 1}`);
step.style.display = 'none'; step.style.display = 'none';
inputs[currentStep - 1].disabled = false; inputs[currentStep - 1].disabled = false;
inputs[currentStep - 1].value = ''; inputs[currentStep - 1].value = '';
if (--currentStep === 0) { if (--currentStep === 0) {
prevButton.disabled = true; prevButton.disabled = true;
} }
break; break;
case 4: case 4:
const step5 = document.getElementById('step-5'); const step5 = document.getElementById('step-5');
step5.style.display = 'none'; step5.style.display = 'none';
fecha_reponer.prop('disabled', false); fecha_reponer.prop('disabled', false);
fecha_reponer.val(''); fecha_reponer.val('');
hora_reponer.parent().removeClass('disabled'); hora_reponer.parent().removeClass('disabled');
hora_reponer.siblings('.datalist-input').text('hh'); hora_reponer.siblings('.datalist-input').text('hh');
hora_reponer.val(''); hora_reponer.val('');
minutos_reponer.parent().removeClass('disabled'); minutos_reponer.parent().removeClass('disabled');
minutos_reponer.siblings('.datalist-input').text('mm'); minutos_reponer.siblings('.datalist-input').text('mm');
minutos_reponer.val(''); minutos_reponer.val('');
currentStep--; currentStep--;
break; break;
} }
nextButton.disabled = true; nextButton.disabled = true;
}); });
// #horario_reponer on change => show step 3 // #horario_reponer on change => show step 3
horario_reponer.addEventListener('change', async () => { horario_reponer.addEventListener('change', async () => {
const selected = horario_reponer.querySelector(`option[value="${horario_reponer.value}"]`); const selected = horario_reponer.querySelector(`option[value="${horario_reponer.value}"]`);
horario_reponer.title = `Materia: ${selected.dataset.materia} - Grupo: ${selected.dataset.grupo} - Horario: ${selected.dataset.hora}-${selected.dataset.hora_final} - Salon: ${selected.dataset.salon} - Día: ${selected.dataset.dia}`; horario_reponer.title = `Materia: ${selected.dataset.materia} - Grupo: ${selected.dataset.grupo} - Horario: ${selected.dataset.hora}-${selected.dataset.hora_final} - Salon: ${selected.dataset.salon} - Día: ${selected.dataset.dia}`;
const step3 = document.getElementById('step-3'); const step3 = document.getElementById('step-3');
horario_reponer.disabled = true; horario_reponer.disabled = true;
// make a form data with #form // make a form data with #form
const response = await fetch(`./action/action_fechas_clase.php?horario_id=${horario_reponer.value}`, { const response = await fetch(`./action/action_fechas_clase.php?horario_id=${horario_reponer.value}`, {
method: 'GET', method: 'GET',
}); });
const data = await response.json(); const data = await response.json();
if (data['success'] === false) { if (data['success'] === false) {
const message = "Hubo un error al obtener las fechas de clase."; const message = "Hubo un error al obtener las fechas de clase.";
const title = 'Error'; const title = 'Error';
const color = 'danger'; const color = 'danger';
triggerMessage(message, title, color); triggerMessage(message, title, color);
return; return;
} }
const meses = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre']; const meses = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];
const fechas = data.data; const fechas = data.data;
const initial = document.createElement('option'); const initial = document.createElement('option');
initial.value = ''; initial.value = '';
initial.textContent = 'Seleccione la fecha de la falta'; initial.textContent = 'Seleccione la fecha de la falta';
initial.selected = true; initial.selected = true;
initial.disabled = true; initial.disabled = true;
fechas_clase.innerHTML = ''; fechas_clase.innerHTML = '';
fechas_clase.appendChild(initial); fechas_clase.appendChild(initial);
fechas_clase.title = 'Seleccione la fecha de la falta'; fechas_clase.title = 'Seleccione la fecha de la falta';
fechas.forEach((fecha) => { fechas.forEach((fecha) => {
const option = document.createElement('option'); const option = document.createElement('option');
option.value = `${fecha}`; option.value = `${fecha}`;
option.textContent = `${fecha.dia_mes} de ${meses[fecha.month - 1]} de ${fecha.year}`; option.textContent = `${fecha.dia_mes} de ${meses[fecha.month - 1]} de ${fecha.year}`;
fechas_clase.appendChild(option); fechas_clase.appendChild(option);
}); });
step3.style.display = 'block'; step3.style.display = 'block';
currentStep = 2; currentStep = 2;
}); });
// #fechas_clase on change => show step 4 // #fechas_clase on change => show step 4
fechas_clase.addEventListener('change', () => { fechas_clase.addEventListener('change', () => {
const step4 = document.getElementById('step-4'); const step4 = document.getElementById('step-4');
step4.style.display = 'block'; step4.style.display = 'block';
fechas_clase.disabled = true; fechas_clase.disabled = true;
currentStep = 3; currentStep = 3;
}); });
// when both #fecha_reponer and #hora_reponer are selected => show step 5 // when both #fecha_reponer and #hora_reponer are selected => show step 5
const lastStep = () => { const lastStep = () => {
// timeout to wait for the value to be set // timeout to wait for the value to be set
setTimeout(() => { setTimeout(() => {
if (fecha_reponer.val() !== '' && hora_reponer.val() !== '' && minutos_reponer.val() !== '') { if (fecha_reponer.val() !== '' && hora_reponer.val() !== '' && minutos_reponer.val() !== '') {
const step5 = document.getElementById('step-5'); const step5 = document.getElementById('step-5');
step5.style.display = 'block'; step5.style.display = 'block';
// disable both // disable both
fecha_reponer.prop('disabled', true); fecha_reponer.prop('disabled', true);
hora_reponer.parent().addClass('disabled'); hora_reponer.parent().addClass('disabled');
minutos_reponer.parent().addClass('disabled'); minutos_reponer.parent().addClass('disabled');
const nextButton = document.getElementById('next-button'); const nextButton = document.getElementById('next-button');
// remove property disabled // remove property disabled
nextButton.removeAttribute('disabled'); nextButton.removeAttribute('disabled');
currentStep = 4; currentStep = 4;
} }
}, 100); }, 100);
}; };
fecha_reponer.on('change', lastStep); fecha_reponer.on('change', lastStep);
// on click on the sibling ul>li of #hora_reponer and #minutos_reponer // on click on the sibling ul>li of #hora_reponer and #minutos_reponer
hora_reponer.siblings('ul').children('li').on('click', lastStep); hora_reponer.siblings('ul').children('li').on('click', lastStep);
minutos_reponer.siblings('ul').children('li').on('click', lastStep); minutos_reponer.siblings('ul').children('li').on('click', lastStep);
// Initialize the form // Initialize the form
hideSteps(); hideSteps();
showCurrentStep(); showCurrentStep();
function hideSteps() { function hideSteps() {
steps.forEach((step) => { steps.forEach((step) => {
step.style.display = 'none'; step.style.display = 'none';
}); });
} }
function showCurrentStep() { function showCurrentStep() {
steps[currentStep].style.display = 'block'; steps[currentStep].style.display = 'block';
prevButton.disabled = currentStep === 0; prevButton.disabled = currentStep === 0;
} }
function handleSubmit(event) { function handleSubmit(event) {
event.preventDefault(); event.preventDefault();
// Handle form submission // Handle form submission
// You can access the form data using the FormData API or serialize it manually // You can access the form data using the FormData API or serialize it manually
} }
export {}; export {};

File diff suppressed because it is too large Load Diff

View File

@@ -1,49 +1,49 @@
/* /*
* JQuery para el manejo de menu * JQuery para el manejo de menu
*/ */
$('#dismiss, .overlay').on('click', function () { $('#dismiss, .overlay').on('click', function () {
// hide sidebar // hide sidebar
$('#sidebar').removeClass('active'); $('#sidebar').removeClass('active');
// hide overlay // hide overlay
$('.overlay').removeClass('active'); $('.overlay').removeClass('active');
$('.menu').css('visibility', 'visible'); $('.menu').css('visibility', 'visible');
}); });
$('#sidebarCollapse').on('click', function () { $('#sidebarCollapse').on('click', function () {
// open sidebar // open sidebar
$('#sidebar').addClass('active'); $('#sidebar').addClass('active');
// fade in the overlay // fade in the overlay
$('.overlay').addClass('active'); $('.overlay').addClass('active');
$('.menu').css('visibility', 'hidden'); $('.menu').css('visibility', 'hidden');
//$('.collapse.in').toggleClass('in'); //$('.collapse.in').toggleClass('in');
$('a[aria-expanded=true]').attr('aria-expanded', 'false'); $('a[aria-expanded=true]').attr('aria-expanded', 'false');
}); });
/* /*
var Nightly = new Nightly(true, { var Nightly = new Nightly(true, {
//body: "backgorund color", // Default: #282828 //body: "backgorund color", // Default: #282828
//texts: "texts color", // Default: #f5f5f5 //texts: "texts color", // Default: #f5f5f5
//inputs: { //inputs: {
// color: "text color inside inputs", // Default: #f5f5f5 // color: "text color inside inputs", // Default: #f5f5f5
// backgroundColor: "background color" // Default #313131 // backgroundColor: "background color" // Default #313131
//}, //},
//buttons: { //buttons: {
// color: "button's text color", // Default: #f5f5f5 // color: "button's text color", // Default: #f5f5f5
// backgroundColor: "button's backgournd color" // #757575 // backgroundColor: "button's backgournd color" // #757575
//}, //},
links: "#ffffff", // Default: #009688 links: "#ffffff", // Default: #009688
classes: [// Classes to apply when enabling the dark mode on certain elements classes: [// Classes to apply when enabling the dark mode on certain elements
{ apply: 'bg-head-dark', to: 'bg-head', }, { apply: 'bg-head-dark', to: 'bg-head', },
{ apply: 'form-control-dark', to: 'form-control', }, { apply: 'form-control-dark', to: 'form-control', },
{ apply: 'subMenu-dark', to: 'subMenu', }, { apply: 'subMenu-dark', to: 'subMenu', },
{ apply: 'sistema.text-white', to: 'sistema.text-secondary', }, { apply: 'sistema.text-white', to: 'sistema.text-secondary', },
] ]
}); });
if($(".fa-adjust")){ if($(".fa-adjust")){
$(".fa-adjust").click(function(){ $(".fa-adjust").click(function(){
Nightly.toggle(); Nightly.toggle();
}); });
}*/ }*/

View File

@@ -1,187 +1,187 @@
/*\ /*\
|*| ======================================================================== |*| ========================================================================
|*| Bootstrap Toggle: bootstrap4-toggle.js v3.6.1 |*| Bootstrap Toggle: bootstrap4-toggle.js v3.6.1
|*| https://gitbrent.github.io/bootstrap4-toggle/ |*| https://gitbrent.github.io/bootstrap4-toggle/
|*| ======================================================================== |*| ========================================================================
|*| Copyright 2018-2019 Brent Ely |*| Copyright 2018-2019 Brent Ely
|*| Licensed under MIT |*| Licensed under MIT
|*| ======================================================================== |*| ========================================================================
\*/ \*/
+function ($) { +function ($) {
'use strict'; 'use strict';
// TOGGLE PUBLIC CLASS DEFINITION // TOGGLE PUBLIC CLASS DEFINITION
// ============================== // ==============================
var Toggle = function (element, options) { var Toggle = function (element, options) {
this.$element = $(element) this.$element = $(element)
this.options = $.extend({}, this.defaults(), options) this.options = $.extend({}, this.defaults(), options)
this.render() this.render()
} }
Toggle.VERSION = '3.7.0-beta' Toggle.VERSION = '3.7.0-beta'
Toggle.DEFAULTS = { Toggle.DEFAULTS = {
on: 'On', on: 'On',
off: 'Off', off: 'Off',
onstyle: 'primary', onstyle: 'primary',
offstyle: 'light', offstyle: 'light',
size: 'normal', size: 'normal',
style: '', style: '',
width: null, width: null,
height: null height: null
} }
Toggle.prototype.defaults = function() { Toggle.prototype.defaults = function() {
return { return {
on: this.$element.attr('data-on') || Toggle.DEFAULTS.on, on: this.$element.attr('data-on') || Toggle.DEFAULTS.on,
off: this.$element.attr('data-off') || Toggle.DEFAULTS.off, off: this.$element.attr('data-off') || Toggle.DEFAULTS.off,
onstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle, onstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle,
offstyle: this.$element.attr('data-offstyle') || Toggle.DEFAULTS.offstyle, offstyle: this.$element.attr('data-offstyle') || Toggle.DEFAULTS.offstyle,
size: this.$element.attr('data-size') || Toggle.DEFAULTS.size, size: this.$element.attr('data-size') || Toggle.DEFAULTS.size,
style: this.$element.attr('data-style') || Toggle.DEFAULTS.style, style: this.$element.attr('data-style') || Toggle.DEFAULTS.style,
width: this.$element.attr('data-width') || Toggle.DEFAULTS.width, width: this.$element.attr('data-width') || Toggle.DEFAULTS.width,
height: this.$element.attr('data-height') || Toggle.DEFAULTS.height height: this.$element.attr('data-height') || Toggle.DEFAULTS.height
} }
} }
Toggle.prototype.render = function () { Toggle.prototype.render = function () {
this._onstyle = 'btn-' + this.options.onstyle this._onstyle = 'btn-' + this.options.onstyle
this._offstyle = 'btn-' + this.options.offstyle this._offstyle = 'btn-' + this.options.offstyle
var size var size
= this.options.size === 'large' || this.options.size === 'lg' ? 'btn-lg' = this.options.size === 'large' || this.options.size === 'lg' ? 'btn-lg'
: this.options.size === 'small' || this.options.size === 'sm' ? 'btn-sm' : this.options.size === 'small' || this.options.size === 'sm' ? 'btn-sm'
: this.options.size === 'mini' || this.options.size === 'xs' ? 'btn-xs' : this.options.size === 'mini' || this.options.size === 'xs' ? 'btn-xs'
: '' : ''
var $toggleOn = $('<label for="'+ this.$element.prop('id') +'" class="btn">').html(this.options.on) var $toggleOn = $('<label for="'+ this.$element.prop('id') +'" class="btn">').html(this.options.on)
.addClass(this._onstyle + ' ' + size) .addClass(this._onstyle + ' ' + size)
var $toggleOff = $('<label for="'+ this.$element.prop('id') +'" class="btn">').html(this.options.off) var $toggleOff = $('<label for="'+ this.$element.prop('id') +'" class="btn">').html(this.options.off)
.addClass(this._offstyle + ' ' + size) .addClass(this._offstyle + ' ' + size)
var $toggleHandle = $('<span class="toggle-handle btn btn-light">') var $toggleHandle = $('<span class="toggle-handle btn btn-light">')
.addClass(size) .addClass(size)
var $toggleGroup = $('<div class="toggle-group">') var $toggleGroup = $('<div class="toggle-group">')
.append($toggleOn, $toggleOff, $toggleHandle) .append($toggleOn, $toggleOff, $toggleHandle)
var $toggle = $('<div class="toggle btn" data-toggle="toggle" role="button">') var $toggle = $('<div class="toggle btn" data-toggle="toggle" role="button">')
.addClass( this.$element.prop('checked') ? this._onstyle : this._offstyle+' off' ) .addClass( this.$element.prop('checked') ? this._onstyle : this._offstyle+' off' )
.addClass(size).addClass(this.options.style) .addClass(size).addClass(this.options.style)
this.$element.wrap($toggle) this.$element.wrap($toggle)
$.extend(this, { $.extend(this, {
$toggle: this.$element.parent(), $toggle: this.$element.parent(),
$toggleOn: $toggleOn, $toggleOn: $toggleOn,
$toggleOff: $toggleOff, $toggleOff: $toggleOff,
$toggleGroup: $toggleGroup $toggleGroup: $toggleGroup
}) })
this.$toggle.append($toggleGroup) this.$toggle.append($toggleGroup)
var width = this.options.width || Math.max($toggleOn.outerWidth(), $toggleOff.outerWidth())+($toggleHandle.outerWidth()/2) var width = this.options.width || Math.max($toggleOn.outerWidth(), $toggleOff.outerWidth())+($toggleHandle.outerWidth()/2)
var height = this.options.height || Math.max($toggleOn.outerHeight(), $toggleOff.outerHeight()) var height = this.options.height || Math.max($toggleOn.outerHeight(), $toggleOff.outerHeight())
$toggleOn.addClass('toggle-on') $toggleOn.addClass('toggle-on')
$toggleOff.addClass('toggle-off') $toggleOff.addClass('toggle-off')
this.$toggle.css({ width: width, height: height }) this.$toggle.css({ width: width, height: height })
if (this.options.height) { if (this.options.height) {
$toggleOn.css('line-height', $toggleOn.height() + 'px') $toggleOn.css('line-height', $toggleOn.height() + 'px')
$toggleOff.css('line-height', $toggleOff.height() + 'px') $toggleOff.css('line-height', $toggleOff.height() + 'px')
} }
this.update(true) this.update(true)
this.trigger(true) this.trigger(true)
} }
Toggle.prototype.toggle = function () { Toggle.prototype.toggle = function () {
if (this.$element.prop('checked')) this.off() if (this.$element.prop('checked')) this.off()
else this.on() else this.on()
} }
Toggle.prototype.on = function (silent) { Toggle.prototype.on = function (silent) {
if (this.$element.prop('disabled')) return false if (this.$element.prop('disabled')) return false
this.$toggle.removeClass(this._offstyle + ' off').addClass(this._onstyle) this.$toggle.removeClass(this._offstyle + ' off').addClass(this._onstyle)
this.$element.prop('checked', true) this.$element.prop('checked', true)
if (!silent) this.trigger() if (!silent) this.trigger()
} }
Toggle.prototype.off = function (silent) { Toggle.prototype.off = function (silent) {
if (this.$element.prop('disabled')) return false if (this.$element.prop('disabled')) return false
this.$toggle.removeClass(this._onstyle).addClass(this._offstyle + ' off') this.$toggle.removeClass(this._onstyle).addClass(this._offstyle + ' off')
this.$element.prop('checked', false) this.$element.prop('checked', false)
if (!silent) this.trigger() if (!silent) this.trigger()
} }
Toggle.prototype.enable = function () { Toggle.prototype.enable = function () {
this.$toggle.removeClass('disabled') this.$toggle.removeClass('disabled')
this.$toggle.removeAttr('disabled') this.$toggle.removeAttr('disabled')
this.$element.prop('disabled', false) this.$element.prop('disabled', false)
} }
Toggle.prototype.disable = function () { Toggle.prototype.disable = function () {
this.$toggle.addClass('disabled') this.$toggle.addClass('disabled')
this.$toggle.attr('disabled', 'disabled') this.$toggle.attr('disabled', 'disabled')
this.$element.prop('disabled', true) this.$element.prop('disabled', true)
} }
Toggle.prototype.update = function (silent) { Toggle.prototype.update = function (silent) {
if (this.$element.prop('disabled')) this.disable() if (this.$element.prop('disabled')) this.disable()
else this.enable() else this.enable()
if (this.$element.prop('checked')) this.on(silent) if (this.$element.prop('checked')) this.on(silent)
else this.off(silent) else this.off(silent)
} }
Toggle.prototype.trigger = function (silent) { Toggle.prototype.trigger = function (silent) {
this.$element.off('change.bs.toggle') this.$element.off('change.bs.toggle')
if (!silent) this.$element.change() if (!silent) this.$element.change()
this.$element.on('change.bs.toggle', $.proxy(function() { this.$element.on('change.bs.toggle', $.proxy(function() {
this.update() this.update()
}, this)) }, this))
} }
Toggle.prototype.destroy = function() { Toggle.prototype.destroy = function() {
this.$element.off('change.bs.toggle') this.$element.off('change.bs.toggle')
this.$toggleGroup.remove() this.$toggleGroup.remove()
this.$element.removeData('bs.toggle') this.$element.removeData('bs.toggle')
this.$element.unwrap() this.$element.unwrap()
} }
// TOGGLE PLUGIN DEFINITION // TOGGLE PLUGIN DEFINITION
// ======================== // ========================
function Plugin(option) { function Plugin(option) {
var optArg = Array.prototype.slice.call( arguments, 1 )[0] var optArg = Array.prototype.slice.call( arguments, 1 )[0]
return this.each(function () { return this.each(function () {
var $this = $(this) var $this = $(this)
var data = $this.data('bs.toggle') var data = $this.data('bs.toggle')
var options = typeof option == 'object' && option var options = typeof option == 'object' && option
if (!data) $this.data('bs.toggle', (data = new Toggle(this, options))) if (!data) $this.data('bs.toggle', (data = new Toggle(this, options)))
if (typeof option === 'string' && data[option] && typeof optArg === 'boolean') data[option](optArg) if (typeof option === 'string' && data[option] && typeof optArg === 'boolean') data[option](optArg)
else if (typeof option === 'string' && data[option]) data[option]() else if (typeof option === 'string' && data[option]) data[option]()
//else if (option && !data[option]) console.log('bootstrap-toggle: error: method `'+ option +'` does not exist!'); //else if (option && !data[option]) console.log('bootstrap-toggle: error: method `'+ option +'` does not exist!');
}) })
} }
var old = $.fn.bootstrapToggle var old = $.fn.bootstrapToggle
$.fn.bootstrapToggle = Plugin $.fn.bootstrapToggle = Plugin
$.fn.bootstrapToggle.Constructor = Toggle $.fn.bootstrapToggle.Constructor = Toggle
// TOGGLE NO CONFLICT // TOGGLE NO CONFLICT
// ================== // ==================
$.fn.toggle.noConflict = function () { $.fn.toggle.noConflict = function () {
$.fn.bootstrapToggle = old $.fn.bootstrapToggle = old
return this return this
} }
// TOGGLE DATA-API // TOGGLE DATA-API
// =============== // ===============
$(function() { $(function() {
$('input[type=checkbox][data-toggle^=toggle]').bootstrapToggle() $('input[type=checkbox][data-toggle^=toggle]').bootstrapToggle()
}) })
$(document).on('click.bs.toggle', 'div[data-toggle^=toggle]', function(e) { $(document).on('click.bs.toggle', 'div[data-toggle^=toggle]', function(e) {
var $checkbox = $(this).find('input[type=checkbox]') var $checkbox = $(this).find('input[type=checkbox]')
$checkbox.bootstrapToggle('toggle') $checkbox.bootstrapToggle('toggle')
e.preventDefault() e.preventDefault()
}) })
}(jQuery); }(jQuery);

View File

@@ -1,105 +1,105 @@
/* /*
* utilidades js * utilidades js
*/ */
function trim(cadena){ function trim(cadena){
for(i=0; i<cadena.length; ){ for(i=0; i<cadena.length; ){
if(cadena.charAt(i)==" ") if(cadena.charAt(i)==" ")
cadena=cadena.substring(i+1, cadena.length); cadena=cadena.substring(i+1, cadena.length);
else else
break; break;
} }
for(i=cadena.length-1; i>=0; i=cadena.length-1){ for(i=cadena.length-1; i>=0; i=cadena.length-1){
if(cadena.charAt(i)==" ") if(cadena.charAt(i)==" ")
cadena=cadena.substring(0,i); cadena=cadena.substring(0,i);
else else
break; break;
} }
return cadena; return cadena;
} }
function getDiaNombre(num){ function getDiaNombre(num){
switch(parseInt(num)){ switch(parseInt(num)){
case 0: return "Domingo"; case 0: return "Domingo";
case 1: return "Lunes"; case 1: return "Lunes";
case 2: return "Martes"; case 2: return "Martes";
case 3: return "Miércoles"; case 3: return "Miércoles";
case 4: return "Jueves"; case 4: return "Jueves";
case 5: return "Viernes"; case 5: return "Viernes";
case 6: return "Sábado"; case 6: return "Sábado";
} }
} }
function fechaGuion(fechaTxt){//de dd/mm/aaaa a aaaa-mm-dd function fechaGuion(fechaTxt){//de dd/mm/aaaa a aaaa-mm-dd
fechaTxt = trim(fechaTxt); fechaTxt = trim(fechaTxt);
if(fechaTxt.substr(2,1) == "/" && fechaTxt.substr(5,1) == "/"){// dd/mm/aaaa if(fechaTxt.substr(2,1) == "/" && fechaTxt.substr(5,1) == "/"){// dd/mm/aaaa
var fechaArr = fechaTxt.split("/"); var fechaArr = fechaTxt.split("/");
return fechaArr[2]+"-"+fechaArr[1]+"-"+fechaArr[0]; return fechaArr[2]+"-"+fechaArr[1]+"-"+fechaArr[0];
} }
if(fechaTxt.substr(4,1) == "-" && fechaTxt.substr(7,1) == "-")// aaaa-mm-dd if(fechaTxt.substr(4,1) == "-" && fechaTxt.substr(7,1) == "-")// aaaa-mm-dd
return fechaTxt; return fechaTxt;
return ""; return "";
} }
function fechaObjeto(fechaTxt){//de dd/mm/aaaa a aaaa-mm-dd function fechaObjeto(fechaTxt){//de dd/mm/aaaa a aaaa-mm-dd
fechaTxt = trim(fechaTxt); fechaTxt = trim(fechaTxt);
if(fechaTxt.substr(2,1) == "/" && fechaTxt.substr(5,1) == "/"){// dd/mm/aaaa if(fechaTxt.substr(2,1) == "/" && fechaTxt.substr(5,1) == "/"){// dd/mm/aaaa
var fechaArr = fechaTxt.split("/"); var fechaArr = fechaTxt.split("/");
return new Date(parseInt(fechaArr[2]), parseInt(fechaArr[1])-1, parseInt(fechaArr[0]) ); return new Date(parseInt(fechaArr[2]), parseInt(fechaArr[1])-1, parseInt(fechaArr[0]) );
} }
if(fechaTxt.substr(4,1) == "-" && fechaTxt.substr(7,1) == "-"){// aaaa-mm-dd if(fechaTxt.substr(4,1) == "-" && fechaTxt.substr(7,1) == "-"){// aaaa-mm-dd
var fechaArr = fechaTxt.split("-"); var fechaArr = fechaTxt.split("-");
return new Date(parseInt(fechaArr[0]), parseInt(fechaArr[1])-1, parseInt(fechaArr[2]) ); return new Date(parseInt(fechaArr[0]), parseInt(fechaArr[1])-1, parseInt(fechaArr[2]) );
} }
return false; return false;
} }
function validaFecha(fechaTxt){ function validaFecha(fechaTxt){
if(fechaTxt.charAt(4) == "-" && fechaTxt.charAt(7) == "-"){//yyyy-mm-dd if(fechaTxt.charAt(4) == "-" && fechaTxt.charAt(7) == "-"){//yyyy-mm-dd
var fechaArr = fechaTxt.split("-"); var fechaArr = fechaTxt.split("-");
var ano= fechaArr[0]; var ano= fechaArr[0];
var mes= fechaArr[1]; var mes= fechaArr[1];
var dia= fechaArr[2]; var dia= fechaArr[2];
} }
if(fechaTxt.charAt(2) == "/" && fechaTxt.charAt(5) == "/"){//dd-mm-aaaa if(fechaTxt.charAt(2) == "/" && fechaTxt.charAt(5) == "/"){//dd-mm-aaaa
var fechaArr = fechaTxt.split("/"); var fechaArr = fechaTxt.split("/");
var ano= fechaArr[2]; var ano= fechaArr[2];
var mes= fechaArr[1]; var mes= fechaArr[1];
var dia= fechaArr[0]; var dia= fechaArr[0];
} }
var d = new Date(); var d = new Date();
var anoActual = d.getFullYear(); var anoActual = d.getFullYear();
if (isNaN(ano) || ano.length < 4 || parseInt(ano, 10) < (anoActual-1)){ return false; } if (isNaN(ano) || ano.length < 4 || parseInt(ano, 10) < (anoActual-1)){ return false; }
if (isNaN(mes) || parseInt(mes, 10) < 1 || parseInt(mes, 10) > 12){ return false; } if (isNaN(mes) || parseInt(mes, 10) < 1 || parseInt(mes, 10) > 12){ return false; }
if (isNaN(dia) || parseInt(dia, 10) < 1 || parseInt(dia, 10) > 31){ return false; } if (isNaN(dia) || parseInt(dia, 10) < 1 || parseInt(dia, 10) > 31){ return false; }
if (mes == 4 || mes == 6 || mes == 9 || mes== 11) { if (mes == 4 || mes == 6 || mes == 9 || mes== 11) {
if (dia > 30) { return false; } if (dia > 30) { return false; }
} else{ } else{
if (mes == 2) { if (mes == 2) {
if(dia <= 28 ) if(dia <= 28 )
return true; return true;
else{ else{
if ((ano % 4 == 0) && dia == 29) return true; if ((ano % 4 == 0) && dia == 29) return true;
else return false; else return false;
} }
} }
} }
return true; return true;
} }
function validaPass(str, vacio = false){ function validaPass(str, vacio = false){
if(vacio && str == "") return true; if(vacio && str == "") return true;
return str.match(/\S*(?=\S{5,})(?=\S*[a-zA-Z])(?=\S*[\d])(?=\S*[\W])\S*$/); return str.match(/\S*(?=\S{5,})(?=\S*[a-zA-Z])(?=\S*[\d])(?=\S*[\W])\S*$/);
} }
/* /*
$('.toggle-password').click(function(){ $('.toggle-password').click(function(){
var campo = $(this).parents(".form-group").find(".toggle-field"); var campo = $(this).parents(".form-group").find(".toggle-field");
if (campo.prop('type') === "password") { if (campo.prop('type') === "password") {
campo.prop('type', 'text'); campo.prop('type', 'text');
} else { } else {
campo.prop('type', 'password'); campo.prop('type', 'password');
} }
});*/ });*/

404
logs.php
View File

@@ -1,203 +1,203 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Consultar horario | <title>Consultar horario |
<?= $user->facultad['facultad'] ?? 'General' ?> <?= $user->facultad['facultad'] ?? 'General' ?>
</title> </title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="content-type" content="text/plain; charset=UTF-8" /> <meta http-equiv="content-type" content="text/plain; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php include_once "import/html_css_files.php"; ?> <?php include_once "import/html_css_files.php"; ?>
</head> </head>
<style> <style>
#jsonOutput { #jsonOutput {
background-color: #f4f4f4; background-color: #f4f4f4;
padding: 10px; padding: 10px;
border-radius: 4px; border-radius: 4px;
overflow-x: auto; overflow-x: auto;
} }
</style> </style>
<!-- --> <!-- -->
<body style="display: block;"> <body style="display: block;">
<?php <?php
include('include/constantes.php'); include('include/constantes.php');
include("import/html_header.php"); include("import/html_header.php");
html_header("Logs"); html_header("Logs");
?> ?>
<?= "<!-- $user -->" ?> <?= "<!-- $user -->" ?>
<main class="container content content-margin" id="local-app"> <main class="container content content-margin" id="local-app">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-hover table-striped table-bordered table-sm"> <table class="table table-hover table-striped table-bordered table-sm">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
<th scope="col" class="text-center align-middle px-2">Fecha</th> <th scope="col" class="text-center align-middle px-2">Fecha</th>
<th scope="col" class="text-center align-middle px-2" width="10%">Hora</th> <th scope="col" class="text-center align-middle px-2" width="10%">Hora</th>
<th scope="col" class="text-center align-middle px-2">Clave</th> <th scope="col" class="text-center align-middle px-2">Clave</th>
<th scope="col" class="text-center align-middle px-2">Profesor</th> <th scope="col" class="text-center align-middle px-2">Profesor</th>
<th scope="col" class="text-center align-middle px-2" width="7%">Horario</th> <th scope="col" class="text-center align-middle px-2" width="7%">Horario</th>
<th scope="col" class="text-center align-middle px-2">IP</th> <th scope="col" class="text-center align-middle px-2">IP</th>
<th scope="col" class="text-center align-middle px-2">Navegador</th> <th scope="col" class="text-center align-middle px-2">Navegador</th>
<th scope="col" class="text-center align-middle px-2">Información</th> <th scope="col" class="text-center align-middle px-2">Información</th>
<th scope="col" class="text-center align-middle px-2">Detalle</th> <th scope="col" class="text-center align-middle px-2">Detalle</th>
<th scope="col" class="text-center align-middle px-2">Horario web</th> <th scope="col" class="text-center align-middle px-2">Horario web</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<? <?
global $db; global $db;
$registros = $db $registros = $db
->where('momento::DATE = ' . (isset($_GET['fecha']) ? "'{$_GET['fecha']}'" : 'CURRENT_DATE')) ->where('momento::DATE = ' . (isset($_GET['fecha']) ? "'{$_GET['fecha']}'" : 'CURRENT_DATE'))
->orderBy('momento', 'desc') ->orderBy('momento', 'desc')
->get('log_registro'); ->get('log_registro');
foreach ($registros as $log) { foreach ($registros as $log) {
?> ?>
<tr class="<?= $log['success'] ? '' : 'table-danger' ?>" data-id="<?= $log['log_id'] ?>"> <tr class="<?= $log['success'] ? '' : 'table-danger' ?>" data-id="<?= $log['log_id'] ?>">
<td class="text-center align-middle px-2"> <td class="text-center align-middle px-2">
<?= substr($log['momento'], 0, 10) ?> <?= substr($log['momento'], 0, 10) ?>
</td> </td>
<td class="text-center align-middle px-2"> <td class="text-center align-middle px-2">
<?= substr($log['momento'], 11, 8) ?> <?= substr($log['momento'], 11, 8) ?>
</td> </td>
<td class="text-center align-middle px-2"> <td class="text-center align-middle px-2">
<?= $log['clave'] ?> <?= $log['clave'] ?>
</td> </td>
<td class="text-center align-middle px-2"> <td class="text-center align-middle px-2">
<?= $log['profesor'] ?> <?= $log['profesor'] ?>
</td> </td>
<td class="text-center align-middle px-2"> <td class="text-center align-middle px-2">
<? <?
if ($log['horarios'] == null) { if ($log['horarios'] == null) {
echo "N/A"; echo "N/A";
} else { } else {
?> ?>
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#horarioModal" <button type="button" class="btn btn-info" data-toggle="modal" data-target="#horarioModal"
data-horario='<?= json_encode($log['horarios'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>'> data-horario='<?= json_encode($log['horarios'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>'>
Horario Horario
</button> </button>
<? <?
} }
?> ?>
</td> </td>
<td class="text-center align-middle px-2"> <td class="text-center align-middle px-2">
<?= $log['ip'] ?> <?= $log['ip'] ?>
</td> </td>
<td class="text-center align-middle px-2"> <td class="text-center align-middle px-2">
<?= $log['navegador'] ?> <?= $log['navegador'] ?>
</td> </td>
<td class="text-center align-middle px-2"> <td class="text-center align-middle px-2">
<?= $log['informacion'] ?> <?= $log['informacion'] ?>
</td> </td>
<td class="text-center align-middle px-2"> <td class="text-center align-middle px-2">
<?= $log['detalle'] ?> <?= $log['detalle'] ?>
</td> </td>
<td class="text-center align-middle px-2"> <td class="text-center align-middle px-2">
<? <?
if ($log['horario_web'] == null) { if ($log['horario_web'] == null) {
echo "N/A"; echo "N/A";
} else { } else {
?> ?>
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#horarioModal" <button type="button" class="btn btn-info" data-toggle="modal" data-target="#horarioModal"
data-horario='<?= json_encode($log['horario_web'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>'> data-horario='<?= json_encode($log['horario_web'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>'>
Horario Horario
</button> </button>
<? <?
} }
?> ?>
</td> </td>
</tr> </tr>
<? <?
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div> </div>
</main> </main>
<!-- Horario Modal --> <!-- Horario Modal -->
<div class="modal fade" id="horarioModal" tabindex="-1" role="dialog" aria-labelledby="horarioModalLabel" <div class="modal fade" id="horarioModal" tabindex="-1" role="dialog" aria-labelledby="horarioModalLabel"
aria-hidden="true"> aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="horarioModalLabel">Horario</h5> <h5 class="modal-title" id="horarioModalLabel">Horario</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<pre id="jsonOutput"></pre> <pre id="jsonOutput"></pre>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<? <?
include "import/html_footer.php"; include "import/html_footer.php";
?> ?>
</body> </body>
<script src="js/jquery.min.js"></script> <script src="js/jquery.min.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script> <script src="js/bootstrap/bootstrap.min.js"></script>
<script src="https://unpkg.com/petite-vue"></script> <script src="https://unpkg.com/petite-vue"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('#horarioModal').on('show.bs.modal', function (event) { $('#horarioModal').on('show.bs.modal', function (event) {
const button = $(event.relatedTarget); const button = $(event.relatedTarget);
const horario = button.data('horario'); const horario = button.data('horario');
const modal = $(this); const modal = $(this);
// Ensure horario is an object // Ensure horario is an object
let parsedHorario; let parsedHorario;
if (typeof horario === 'string') { if (typeof horario === 'string') {
parsedHorario = JSON.parse(JSON.parse(horario, (key, value) => { parsedHorario = JSON.parse(JSON.parse(horario, (key, value) => {
if (typeof value === 'string') { if (typeof value === 'string') {
return value.replace(/\\n/g, '\n'); return value.replace(/\\n/g, '\n');
} }
return value; return value;
})); }));
} else { } else {
parsedHorario = horario; parsedHorario = horario;
} }
const formattedHorario = formatJson(parsedHorario); const formattedHorario = formatJson(parsedHorario);
modal.find('#jsonOutput').html(formattedHorario); modal.find('#jsonOutput').html(formattedHorario);
}); });
}); });
function formatJson(jsonObject) { function formatJson(jsonObject) {
let formatted = ''; let formatted = '';
if (Array.isArray(jsonObject)) { if (Array.isArray(jsonObject)) {
formatted += '<ol>'; formatted += '<ol>';
for (let i = 0; i < jsonObject.length; i++) { for (let i = 0; i < jsonObject.length; i++) {
formatted += '<li>'; formatted += '<li>';
formatted += formatJson(jsonObject[i]); formatted += formatJson(jsonObject[i]);
formatted += '</li>'; formatted += '</li>';
} }
formatted += '</ol>'; formatted += '</ol>';
} else if (typeof jsonObject === 'object') { } else if (typeof jsonObject === 'object') {
formatted += '<ol>'; formatted += '<ol>';
for (let key in jsonObject) { for (let key in jsonObject) {
formatted += '<li><strong>' + key + ':</strong> '; formatted += '<li><strong>' + key + ':</strong> ';
formatted += formatJson(jsonObject[key]); formatted += formatJson(jsonObject[key]);
formatted += '</li>'; formatted += '</li>';
} }
formatted += '</ol>'; formatted += '</ol>';
} else { } else {
formatted += jsonObject; formatted += jsonObject;
} }
return formatted; return formatted;
} }
</script> </script>
</html> </html>

View File

@@ -1,72 +1,72 @@
<? <?
ini_set('display_errors', 1); ini_set('display_errors', 1);
error_reporting(E_ALL); error_reporting(E_ALL);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Archivos de log Postgres</title> <title>Archivos de log Postgres</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
crossorigin="anonymous" referrerpolicy="no-referrer" /> crossorigin="anonymous" referrerpolicy="no-referrer" />
<?php <?php
$ruta = "../"; $ruta = "../";
include '../import/html_css_files.php'; include '../import/html_css_files.php';
include '../import/html_header.php'; include '../import/html_header.php';
html_header( html_header(
"Archivos de log Postgres", "Archivos de log Postgres",
"Archivos de log Postgres", "Archivos de log Postgres",
); );
?> ?>
</head> </head>
<body> <body>
<main class="content marco"> <main class="content marco">
<form method="POST" class="mb-3"> <form method="POST" class="mb-3">
<label for="logDay">Select a day:</label> <label for="logDay">Select a day:</label>
<select name="logDay" id="logDay" class="form-control"> <select name="logDay" id="logDay" class="form-control">
<option value="Mon">Monday</option> <option value="Mon">Monday</option>
<option value="Tue">Tuesday</option> <option value="Tue">Tuesday</option>
<option value="Wed">Wednesday</option> <option value="Wed">Wednesday</option>
<option value="Thu">Thursday</option> <option value="Thu">Thursday</option>
<option value="Fri">Friday</option> <option value="Fri">Friday</option>
<option value="Sat">Saturday</option> <option value="Sat">Saturday</option>
<option value="Sun">Sunday</option> <option value="Sun">Sunday</option>
</select> </select>
<button type="submit" class="btn btn-primary mt-2">View Log</button> <button type="submit" class="btn btn-primary mt-2">View Log</button>
</form> </form>
<?php <?php
$password = 'admin'; $password = 'admin';
echo "Output: <pre>" . shell_exec("sh ../pgsql-log/get-logs.sh 2>&1") . "</pre>"; echo "Output: <pre>" . shell_exec("sh ../pgsql-log/get-logs.sh 2>&1") . "</pre>";
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['logDay'])) { if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['logDay'])) {
$fileName = "../pgsql-log/postgresql-{$_POST['logDay']}.log"; $fileName = "../pgsql-log/postgresql-{$_POST['logDay']}.log";
echo "<h3>Log file for {$_POST['logDay']}:</h3>"; echo "<h3>Log file for {$_POST['logDay']}:</h3>";
echo "<p>File path: $fileName</p>"; echo "<p>File path: $fileName</p>";
// execute a command in the shell: sudo sh get-logs.sh // execute a command in the shell: sudo sh get-logs.sh
if (file_exists($fileName)) { if (file_exists($fileName)) {
$fileContents = file_get_contents($fileName); $fileContents = file_get_contents($fileName);
echo "<pre>" . htmlspecialchars($fileContents) . "</pre>"; echo "<pre>" . htmlspecialchars($fileContents) . "</pre>";
} else { } else {
echo "Log file for " . $_POST['logDay'] . " does not exist."; echo "Log file for " . $_POST['logDay'] . " does not exist.";
} }
} }
?> ?>
</main> </main>
<?php <?php
include "../import/html_footer.php"; include "../import/html_footer.php";
?> ?>
<script src="<?= $ruta ?? '' ?>js/jquery.min.js"></script> <script src="<?= $ruta ?? '' ?>js/jquery.min.js"></script>
<script src="<?= $ruta ?? '' ?>js/bootstrap/bootstrap.min.js"></script> <script src="<?= $ruta ?? '' ?>js/bootstrap/bootstrap.min.js"></script>
</body> </body>
</html> </html>

View File

@@ -1,211 +1,211 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Auditoría asistencial</title> <title>Auditoría asistencial</title>
<?php <?php
include 'import/html_css_files.php'; include 'import/html_css_files.php';
?> ?>
<style> <style>
[v-cloak] { [v-cloak] {
display: none; display: none;
} }
</style> </style>
</head> </head>
<body> <body>
<? <?
$redirect = $_SERVER['PHP_SELF']; $redirect = $_SERVER['PHP_SELF'];
include "import/html_header.php"; include "import/html_header.php";
global $user; global $user;
html_header("Periodos"); html_header("Periodos");
?> ?>
<main class="container-fluid px-4 my-4" id="app" v-cloak @vue:mounted="mounted" style="min-height: 70vh;" <main class="container-fluid px-4 my-4" id="app" v-cloak @vue:mounted="mounted" style="min-height: 70vh;"
v-scope=""> v-scope="">
<div aria-live="polite" aria-atomic="true" style="position: relative"> <div aria-live="polite" aria-atomic="true" style="position: relative">
<div style="position: fixed; bottom: 2%; right: 2%; z-index: 9999; min-width: 300px;"> <div style="position: fixed; bottom: 2%; right: 2%; z-index: 9999; min-width: 300px;">
<!-- Loop for messages --> <!-- Loop for messages -->
<div class="toast show shadow-sm mb-3 bg-white shadow-sm" role="alert" aria-live="assertive" <div class="toast show shadow-sm mb-3 bg-white shadow-sm" role="alert" aria-live="assertive"
aria-atomic="true" v-for="(message, index) in messages" aria-atomic="true" v-for="(message, index) in messages"
@vue:mounted="$(`#toast-${message.timestamp.getTime()}`).toast({delay: 5000}).toast('show').on('hidden.bs.toast', () => messages.splice(index, 1))" " :key=" @vue:mounted="$(`#toast-${message.timestamp.getTime()}`).toast({delay: 5000}).toast('show').on('hidden.bs.toast', () => messages.splice(index, 1))" " :key="
message.timestamp.getTime()" :id="`toast-${message.timestamp.getTime()}`"> message.timestamp.getTime()" :id="`toast-${message.timestamp.getTime()}`">
<div class="toast-header" :class="`bg-primary text-white`"> <div class="toast-header" :class="`bg-primary text-white`">
<strong class="mr-auto text-uppercase text-center w-100 px-4"> <strong class="mr-auto text-uppercase text-center w-100 px-4">
<i <i
:class="`text-${message.type} fas fa-${message.type === 'danger' ? 'exclamation-triangle' : message.type === 'success' ? 'check-circle' : 'info-circle'} mr-2`"></i> :class="`text-${message.type} fas fa-${message.type === 'danger' ? 'exclamation-triangle' : message.type === 'success' ? 'check-circle' : 'info-circle'} mr-2`"></i>
{{ message.title }} {{ message.title }}
</strong> </strong>
<small class="text-light">{{ message.timestamp.toLocaleString() }}</small> <small class="text-light">{{ message.timestamp.toLocaleString() }}</small>
<button type="button" class="ml-2 mb-1 close text-light" aria-label="Close" <button type="button" class="ml-2 mb-1 close text-light" aria-label="Close"
@click="$(`#toast-${message.timestamp.getTime()}`).toast('hide')"> @click="$(`#toast-${message.timestamp.getTime()}`).toast('hide')">
<span aria-hidden="true"> <span aria-hidden="true">
<i class="fas fa-times"></i> <i class="fas fa-times"></i>
</span> </span>
</button> </button>
</div> </div>
<div class="toast-body"> <div class="toast-body">
{{ message.text }} {{ message.text }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<div class="d-flex flex-wrap flex-row-reverse align-items-center mb-3"> <div class="d-flex flex-wrap flex-row-reverse align-items-center mb-3">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#createPeriodoModal"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#createPeriodoModal">
<div class="ing-mas"></div> <div class="ing-mas"></div>
Crear periodo Crear periodo
</button> </button>
</div> </div>
<div v-if="periodos.length"> <div v-if="periodos.length">
<table class="table table-sm table-hover table-striped table-bordered"> <table class="table table-sm table-hover table-striped table-bordered">
<thead class="thead-dark"> <thead class="thead-dark">
<tr class="text-center text-uppercase"> <tr class="text-center text-uppercase">
<th scope="col" class="align-middle" style="width: 8%;">SGU</th> <th scope="col" class="align-middle" style="width: 8%;">SGU</th>
<th scope="col" class="align-middle" style="width: 7%;">Clave</th> <th scope="col" class="align-middle" style="width: 7%;">Clave</th>
<th scope="col" class="align-middle" style="width: 25%;">Nombre</th> <th scope="col" class="align-middle" style="width: 25%;">Nombre</th>
<th scope="col" class="align-middle" style="width: 20%;">Nivel</th> <th scope="col" class="align-middle" style="width: 20%;">Nivel</th>
<th scope="col" class="align-middle" style="width: 15%;">Fecha de inicio</th> <th scope="col" class="align-middle" style="width: 15%;">Fecha de inicio</th>
<th scope="col" class="align-middle" style="width: 15%;">Fecha de fin</th> <th scope="col" class="align-middle" style="width: 15%;">Fecha de fin</th>
<th scope="col" class="align-middle" style="width: 10%;">Acciones</th> <th scope="col" class="align-middle" style="width: 10%;">Acciones</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(periodo, index) in periodos" :key="periodo.periodo_id"> <tr v-for="(periodo, index) in periodos" :key="periodo.periodo_id">
<td class="text-center align-middle"> <td class="text-center align-middle">
{{ periodo.id_periodo_sgu }} {{ periodo.id_periodo_sgu }}
</td> </td>
<td class="text-center align-middle"> <td class="text-center align-middle">
{{ periodo.periodo_clave }} {{ periodo.periodo_clave }}
</td> </td>
<td class="align-middle"> <td class="align-middle">
<input type="text" name="periodo_nombre" id="" v-model="periodo.periodo_nombre" class="form-control" <input type="text" name="periodo_nombre" id="" v-model="periodo.periodo_nombre" class="form-control"
required> required>
</td> </td>
<td class="align-middle text-center"> <td class="align-middle text-center">
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" <button class="btn btn-outline-secondary dropdown-toggle" type="button"
id="nivelDropdown" data-toggle="dropdown" aria-haspopup="true" id="nivelDropdown" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false"> aria-expanded="false">
{{ periodo.nivel }} {{ periodo.nivel }}
</button> </button>
<div class="dropdown-menu dropdown-menu" aria-labelledby="nivelDropdown"> <div class="dropdown-menu dropdown-menu" aria-labelledby="nivelDropdown">
<a class="dropdown-item" v-for="nivel in niveles" :key="nivel.nivel_id" <a class="dropdown-item" v-for="nivel in niveles" :key="nivel.nivel_id"
href="#/" @vue:mounted="$('.dropdown-toggle').dropdown()" href="#/" @vue:mounted="$('.dropdown-toggle').dropdown()"
@click="changeNivel(periodo, nivel.nivel_id)" @click="changeNivel(periodo, nivel.nivel_id)"
:class="{'active': nivel.nivel_id === periodo.nivel_id}">{{nivel.nivel_nombre}}</a> :class="{'active': nivel.nivel_id === periodo.nivel_id}">{{nivel.nivel_nombre}}</a>
</div> </div>
</div> </div>
</td> </td>
<td class="align-middle"> <td class="align-middle">
<input type="date" class="form-control" v-model="periodo.periodo_fecha_inicio" required <input type="date" class="form-control" v-model="periodo.periodo_fecha_inicio" required
:max="periodo.periodo_fecha_fin" :max="periodo.periodo_fecha_fin"
@change="changeFechaInicio(periodo, periodo.periodo_fecha_inicio)"> @change="changeFechaInicio(periodo, periodo.periodo_fecha_inicio)">
</td> </td>
<td class="align-middle"> <td class="align-middle">
<input type="date" class="form-control" v-model="periodo.periodo_fecha_fin" required <input type="date" class="form-control" v-model="periodo.periodo_fecha_fin" required
:min="periodo.periodo_fecha_inicio" :min="periodo.periodo_fecha_inicio"
@change="changeFechaFin(periodo, periodo.periodo_fecha_fin)"> @change="changeFechaFin(periodo, periodo.periodo_fecha_fin)">
</td> </td>
<td class="align-middle text-center"> <td class="align-middle text-center">
<button type="button" class="btn btn-outline-primary" @click="updatePeriodo(periodo)" <button type="button" class="btn btn-outline-primary" @click="updatePeriodo(periodo)"
:disabled="[periodo.id_periodo_sgu, periodo.periodo_clave, periodo.periodo_nombre].some(value => !value)"> :disabled="[periodo.id_periodo_sgu, periodo.periodo_clave, periodo.periodo_nombre].some(value => !value)">
<i class="ing-guardar"></i> <i class="ing-guardar"></i>
</button> </button>
<button type="button" class="btn btn-outline-danger" @click="deletePeriodo(periodo)"> <button type="button" class="btn btn-outline-danger" @click="deletePeriodo(periodo)">
<i class="ing-basura"></i> <i class="ing-basura"></i>
</button> </button>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="alert alert-info" role="alert" v-else> <div class="alert alert-info" role="alert" v-else>
No hay periodos registrados No hay periodos registrados
</div> </div>
</div> </div>
<!-- Modal to create periodo --> <!-- Modal to create periodo -->
<div class="modal fade" id="createPeriodoModal" tabindex="-1" role="dialog" <div class="modal fade" id="createPeriodoModal" tabindex="-1" role="dialog"
aria-labelledby="createPeriodoModalLabel" aria-hidden="true"> aria-labelledby="createPeriodoModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content" <div class="modal-content"
v-scope="{newPeriodo: { periodo_nombre: null, nivel_id: '', periodo_fecha_inicio: null, periodo_fecha_fin: null, id_periodo_sgu: null, periodo_clave: null }}"> v-scope="{newPeriodo: { periodo_nombre: null, nivel_id: '', periodo_fecha_inicio: null, periodo_fecha_fin: null, id_periodo_sgu: null, periodo_clave: null }}">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="createPeriodoModalLabel">Crear periodo</h5> <h5 class="modal-title" id="createPeriodoModalLabel">Crear periodo</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<!-- Form to create periodo --> <!-- Form to create periodo -->
<form> <form>
<div class="form-group"> <div class="form-group">
<label for="periodo_nombre">Nombre del periodo</label> <label for="periodo_nombre">Nombre del periodo</label>
<input type="text" class="form-control" id="periodo_nombre" required <input type="text" class="form-control" id="periodo_nombre" required
v-model="newPeriodo.periodo_nombre"> v-model="newPeriodo.periodo_nombre">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="nivel_id">Nivel</label> <label for="nivel_id">Nivel</label>
<select class="form-control" id="nivel_id" required v-model="newPeriodo.nivel_id"> <select class="form-control" id="nivel_id" required v-model="newPeriodo.nivel_id">
<option value="" selected disabled>Selecciona un nivel</option> <option value="" selected disabled>Selecciona un nivel</option>
<option v-for="nivel in niveles" :key="nivel.nivel_id" :value="nivel.nivel_id"> <option v-for="nivel in niveles" :key="nivel.nivel_id" :value="nivel.nivel_id">
{{ nivel.nivel_nombre }} {{ nivel.nivel_nombre }}
</option> </option>
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="periodo_fecha_inicio">Fecha de inicio</label> <label for="periodo_fecha_inicio">Fecha de inicio</label>
<input type="date" class="form-control" id="periodo_fecha_inicio" required <input type="date" class="form-control" id="periodo_fecha_inicio" required
v-model="newPeriodo.periodo_fecha_inicio" :max="newPeriodo.periodo_fecha_fin"> v-model="newPeriodo.periodo_fecha_inicio" :max="newPeriodo.periodo_fecha_fin">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="periodo_fecha_fin">Fecha de fin</label> <label for="periodo_fecha_fin">Fecha de fin</label>
<input type="date" class="form-control" id="periodo_fecha_fin" required <input type="date" class="form-control" id="periodo_fecha_fin" required
v-model="newPeriodo.periodo_fecha_fin" :min="newPeriodo.periodo_fecha_inicio"> v-model="newPeriodo.periodo_fecha_fin" :min="newPeriodo.periodo_fecha_inicio">
</div> </div>
<!-- Newly added fields --> <!-- Newly added fields -->
<div class="form-group"> <div class="form-group">
<label for="id_periodo_sgu">ID Periodo SGU</label> <label for="id_periodo_sgu">ID Periodo SGU</label>
<input type="text" class="form-control" id="id_periodo_sgu" required <input type="text" class="form-control" id="id_periodo_sgu" required
v-model="newPeriodo.id_periodo_sgu" inputmode="numeric" pattern="[0-9]*" min="0"> v-model="newPeriodo.id_periodo_sgu" inputmode="numeric" pattern="[0-9]*" min="0">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="periodo_id">Periodo Clave</label> <label for="periodo_id">Periodo Clave</label>
<input type="text" class="form-control" id="periodo_clave" required <input type="text" class="form-control" id="periodo_clave" required
v-model="newPeriodo.periodo_clave" inputmode="numeric" pattern="[0-9]*" min="0"> v-model="newPeriodo.periodo_clave" inputmode="numeric" pattern="[0-9]*" min="0">
</div> </div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-outline-danger" data-dismiss="modal" <button type="button" class="btn btn-outline-danger" data-dismiss="modal"
@click="Object.keys(newPeriodo).forEach(key => newPeriodo[key] = null); newPeriodo.nivel_id = ''">Cerrar</button> @click="Object.keys(newPeriodo).forEach(key => newPeriodo[key] = null); newPeriodo.nivel_id = ''">Cerrar</button>
<button type="button" class="btn btn-primary" @click="createPeriodo(newPeriodo)">Crear <button type="button" class="btn btn-primary" @click="createPeriodo(newPeriodo)">Crear
periodo</button> periodo</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
<? <?
include "import/html_footer.php"; ?> include "import/html_footer.php"; ?>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js" <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js"
integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="js/periodos.js?<?= rand(0, 2) ?>" type="module"></script> <script src="js/periodos.js?<?= rand(0, 2) ?>" type="module"></script>
<script src="js/scrollables.js"></script> <script src="js/scrollables.js"></script>
</body> </body>
</html> </html>

View File

@@ -1,23 +1,23 @@
#!/bin/bash #!/bin/bash
# Source and destination directories # Source and destination directories
SRC_DIR="/var/lib/pgsql/15/data/log/" SRC_DIR="/var/lib/pgsql/15/data/log/"
DEST_DIR="/usr/share/nginx/html/paad/pgsql-log/" DEST_DIR="/usr/share/nginx/html/paad/pgsql-log/"
# Days of the week # Days of the week
DAYS=("Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun") DAYS=("Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun")
echo "Done" echo "Done"
# Iterate over each day and copy the file if it exists # Iterate over each day and copy the file if it exists
for day in "${DAYS[@]}"; do for day in "${DAYS[@]}"; do
src_file="${SRC_DIR}postgresql-${day}.log" src_file="${SRC_DIR}postgresql-${day}.log"
dest_file="${DEST_DIR}postgresql-${day}.log" dest_file="${DEST_DIR}postgresql-${day}.log"
if [[ -f "$src_file" ]]; then if [[ -f "$src_file" ]]; then
sudo cp "$src_file" "$dest_file" sudo cp "$src_file" "$dest_file"
echo "Copied ${src_file} to ${dest_file}" echo "Copied ${src_file} to ${dest_file}"
else else
echo "File ${src_file} not found" echo "File ${src_file} not found"
fi fi
done done

View File

@@ -1,5 +1,5 @@
2023-09-14 00:04:57.032 UTC [1335198] LOG: could not receive data from client: Connection timed out 2023-09-14 00:04:57.032 UTC [1335198] LOG: could not receive data from client: Connection timed out
2023-09-14 00:05:29.800 UTC [1335199] LOG: could not receive data from client: Connection timed out 2023-09-14 00:05:29.800 UTC [1335199] LOG: could not receive data from client: Connection timed out
2023-09-14 00:15:52.392 UTC [1335630] LOG: could not receive data from client: Connection timed out 2023-09-14 00:15:52.392 UTC [1335630] LOG: could not receive data from client: Connection timed out
2023-09-14 00:15:52.392 UTC [1335631] LOG: could not receive data from client: Connection timed out 2023-09-14 00:15:52.392 UTC [1335631] LOG: could not receive data from client: Connection timed out
2023-09-14 00:15:52.392 UTC [1335632] LOG: could not receive data from client: Connection timed out 2023-09-14 00:15:52.392 UTC [1335632] LOG: could not receive data from client: Connection timed out

View File

@@ -1,159 +1,159 @@
2023-09-12 00:12:17.352 UTC [1093788] LOG: could not receive data from client: Connection timed out 2023-09-12 00:12:17.352 UTC [1093788] LOG: could not receive data from client: Connection timed out
2023-09-12 00:12:17.352 UTC [1093789] LOG: could not receive data from client: Connection timed out 2023-09-12 00:12:17.352 UTC [1093789] LOG: could not receive data from client: Connection timed out
2023-09-12 00:12:17.355 UTC [1093796] LOG: could not receive data from client: Connection timed out 2023-09-12 00:12:17.355 UTC [1093796] LOG: could not receive data from client: Connection timed out
2023-09-12 16:04:38.145 UTC [1278220] FATAL: database "paad" does not exist 2023-09-12 16:04:38.145 UTC [1278220] FATAL: database "paad" does not exist
2023-09-12 16:04:38.211 UTC [1278221] FATAL: database "paad" does not exist 2023-09-12 16:04:38.211 UTC [1278221] FATAL: database "paad" does not exist
2023-09-12 16:04:38.587 UTC [1278222] FATAL: database "paad" does not exist 2023-09-12 16:04:38.587 UTC [1278222] FATAL: database "paad" does not exist
2023-09-12 16:04:39.607 UTC [1278223] FATAL: database "paad" does not exist 2023-09-12 16:04:39.607 UTC [1278223] FATAL: database "paad" does not exist
2023-09-12 16:04:43.386 UTC [1278224] FATAL: database "paad" does not exist 2023-09-12 16:04:43.386 UTC [1278224] FATAL: database "paad" does not exist
2023-09-12 16:04:51.218 UTC [1278225] FATAL: database "paad" does not exist 2023-09-12 16:04:51.218 UTC [1278225] FATAL: database "paad" does not exist
2023-09-12 16:04:53.150 UTC [1278227] FATAL: database "paad" does not exist 2023-09-12 16:04:53.150 UTC [1278227] FATAL: database "paad" does not exist
2023-09-12 16:04:53.161 UTC [1278228] FATAL: database "paad" does not exist 2023-09-12 16:04:53.161 UTC [1278228] FATAL: database "paad" does not exist
2023-09-12 16:04:53.654 UTC [1278229] FATAL: database "paad" does not exist 2023-09-12 16:04:53.654 UTC [1278229] FATAL: database "paad" does not exist
2023-09-12 16:04:55.210 UTC [1278230] FATAL: database "paad" does not exist 2023-09-12 16:04:55.210 UTC [1278230] FATAL: database "paad" does not exist
2023-09-12 16:04:55.569 UTC [1278231] FATAL: database "paad" does not exist 2023-09-12 16:04:55.569 UTC [1278231] FATAL: database "paad" does not exist
2023-09-12 16:05:07.666 UTC [1278240] FATAL: database "paad" does not exist 2023-09-12 16:05:07.666 UTC [1278240] FATAL: database "paad" does not exist
2023-09-12 16:05:08.015 UTC [1278241] FATAL: database "paad" does not exist 2023-09-12 16:05:08.015 UTC [1278241] FATAL: database "paad" does not exist
2023-09-12 16:05:08.173 UTC [1278242] FATAL: database "paad" does not exist 2023-09-12 16:05:08.173 UTC [1278242] FATAL: database "paad" does not exist
2023-09-12 16:05:08.548 UTC [1278243] FATAL: database "paad" does not exist 2023-09-12 16:05:08.548 UTC [1278243] FATAL: database "paad" does not exist
2023-09-12 16:05:08.590 UTC [1278244] FATAL: database "paad" does not exist 2023-09-12 16:05:08.590 UTC [1278244] FATAL: database "paad" does not exist
2023-09-12 16:05:08.807 UTC [1278245] FATAL: database "paad" does not exist 2023-09-12 16:05:08.807 UTC [1278245] FATAL: database "paad" does not exist
2023-09-12 16:05:09.198 UTC [1278246] FATAL: database "paad" does not exist 2023-09-12 16:05:09.198 UTC [1278246] FATAL: database "paad" does not exist
2023-09-12 16:05:09.964 UTC [1278247] FATAL: database "paad" does not exist 2023-09-12 16:05:09.964 UTC [1278247] FATAL: database "paad" does not exist
2023-09-12 16:05:10.657 UTC [1278248] FATAL: database "paad" does not exist 2023-09-12 16:05:10.657 UTC [1278248] FATAL: database "paad" does not exist
2023-09-12 16:05:14.658 UTC [1278252] FATAL: database "paad" does not exist 2023-09-12 16:05:14.658 UTC [1278252] FATAL: database "paad" does not exist
2023-09-12 16:05:15.371 UTC [1278253] FATAL: database "paad" does not exist 2023-09-12 16:05:15.371 UTC [1278253] FATAL: database "paad" does not exist
2023-09-12 16:05:16.303 UTC [1278255] FATAL: database "paad" does not exist 2023-09-12 16:05:16.303 UTC [1278255] FATAL: database "paad" does not exist
2023-09-12 16:05:16.462 UTC [1278256] FATAL: database "paad" does not exist 2023-09-12 16:05:16.462 UTC [1278256] FATAL: database "paad" does not exist
2023-09-12 16:05:16.834 UTC [1278257] FATAL: database "paad" does not exist 2023-09-12 16:05:16.834 UTC [1278257] FATAL: database "paad" does not exist
2023-09-12 16:05:17.022 UTC [1278258] FATAL: database "paad" does not exist 2023-09-12 16:05:17.022 UTC [1278258] FATAL: database "paad" does not exist
2023-09-12 16:05:17.222 UTC [1278259] FATAL: database "paad" does not exist 2023-09-12 16:05:17.222 UTC [1278259] FATAL: database "paad" does not exist
2023-09-12 16:05:17.392 UTC [1278260] FATAL: database "paad" does not exist 2023-09-12 16:05:17.392 UTC [1278260] FATAL: database "paad" does not exist
2023-09-12 16:05:17.574 UTC [1278261] FATAL: database "paad" does not exist 2023-09-12 16:05:17.574 UTC [1278261] FATAL: database "paad" does not exist
2023-09-12 16:05:17.952 UTC [1278262] FATAL: database "paad" does not exist 2023-09-12 16:05:17.952 UTC [1278262] FATAL: database "paad" does not exist
2023-09-12 16:05:18.880 UTC [1278263] FATAL: database "paad" does not exist 2023-09-12 16:05:18.880 UTC [1278263] FATAL: database "paad" does not exist
2023-09-12 16:05:20.321 UTC [1278265] FATAL: database "paad" does not exist 2023-09-12 16:05:20.321 UTC [1278265] FATAL: database "paad" does not exist
2023-09-12 16:05:20.681 UTC [1278266] FATAL: database "paad" does not exist 2023-09-12 16:05:20.681 UTC [1278266] FATAL: database "paad" does not exist
2023-09-12 16:05:29.281 UTC [1278280] FATAL: database "paad" does not exist 2023-09-12 16:05:29.281 UTC [1278280] FATAL: database "paad" does not exist
2023-09-12 16:05:35.416 UTC [1278284] FATAL: database "paad" does not exist 2023-09-12 16:05:35.416 UTC [1278284] FATAL: database "paad" does not exist
2023-09-12 16:05:41.918 UTC [1278285] FATAL: database "paad" does not exist 2023-09-12 16:05:41.918 UTC [1278285] FATAL: database "paad" does not exist
2023-09-12 16:05:44.962 UTC [1278286] FATAL: database "paad" does not exist 2023-09-12 16:05:44.962 UTC [1278286] FATAL: database "paad" does not exist
2023-09-12 16:05:45.403 UTC [1278287] FATAL: database "paad" does not exist 2023-09-12 16:05:45.403 UTC [1278287] FATAL: database "paad" does not exist
2023-09-12 16:05:45.567 UTC [1278288] FATAL: database "paad" does not exist 2023-09-12 16:05:45.567 UTC [1278288] FATAL: database "paad" does not exist
2023-09-12 16:05:45.745 UTC [1278289] FATAL: database "paad" does not exist 2023-09-12 16:05:45.745 UTC [1278289] FATAL: database "paad" does not exist
2023-09-12 16:05:45.946 UTC [1278290] FATAL: database "paad" does not exist 2023-09-12 16:05:45.946 UTC [1278290] FATAL: database "paad" does not exist
2023-09-12 16:05:45.947 UTC [1278291] FATAL: database "paad" does not exist 2023-09-12 16:05:45.947 UTC [1278291] FATAL: database "paad" does not exist
2023-09-12 16:05:46.204 UTC [1278292] FATAL: database "paad" does not exist 2023-09-12 16:05:46.204 UTC [1278292] FATAL: database "paad" does not exist
2023-09-12 16:05:46.316 UTC [1278293] FATAL: database "paad" does not exist 2023-09-12 16:05:46.316 UTC [1278293] FATAL: database "paad" does not exist
2023-09-12 16:05:46.741 UTC [1278294] FATAL: database "paad" does not exist 2023-09-12 16:05:46.741 UTC [1278294] FATAL: database "paad" does not exist
2023-09-12 16:05:47.078 UTC [1278295] FATAL: database "paad" does not exist 2023-09-12 16:05:47.078 UTC [1278295] FATAL: database "paad" does not exist
2023-09-12 16:05:47.334 UTC [1278296] FATAL: database "paad" does not exist 2023-09-12 16:05:47.334 UTC [1278296] FATAL: database "paad" does not exist
2023-09-12 16:05:47.696 UTC [1278297] FATAL: database "paad" does not exist 2023-09-12 16:05:47.696 UTC [1278297] FATAL: database "paad" does not exist
2023-09-12 16:05:48.307 UTC [1278299] FATAL: database "paad" does not exist 2023-09-12 16:05:48.307 UTC [1278299] FATAL: database "paad" does not exist
2023-09-12 16:05:48.310 UTC [1278300] FATAL: expected SASL response, got message type 88 2023-09-12 16:05:48.310 UTC [1278300] FATAL: expected SASL response, got message type 88
2023-09-12 16:05:48.318 UTC [1278301] FATAL: database "paad" does not exist 2023-09-12 16:05:48.318 UTC [1278301] FATAL: database "paad" does not exist
2023-09-12 16:05:48.326 UTC [1278302] FATAL: database "paad" does not exist 2023-09-12 16:05:48.326 UTC [1278302] FATAL: database "paad" does not exist
2023-09-12 16:05:48.336 UTC [1278303] FATAL: database "paad" does not exist 2023-09-12 16:05:48.336 UTC [1278303] FATAL: database "paad" does not exist
2023-09-12 16:05:48.344 UTC [1278304] FATAL: database "paad" does not exist 2023-09-12 16:05:48.344 UTC [1278304] FATAL: database "paad" does not exist
2023-09-12 16:05:48.441 UTC [1278305] FATAL: database "paad" does not exist 2023-09-12 16:05:48.441 UTC [1278305] FATAL: database "paad" does not exist
2023-09-12 16:05:48.452 UTC [1278306] FATAL: database "paad" does not exist 2023-09-12 16:05:48.452 UTC [1278306] FATAL: database "paad" does not exist
2023-09-12 16:05:48.461 UTC [1278307] FATAL: database "paad" does not exist 2023-09-12 16:05:48.461 UTC [1278307] FATAL: database "paad" does not exist
2023-09-12 16:05:48.469 UTC [1278308] FATAL: database "paad" does not exist 2023-09-12 16:05:48.469 UTC [1278308] FATAL: database "paad" does not exist
2023-09-12 16:05:48.477 UTC [1278309] FATAL: database "paad" does not exist 2023-09-12 16:05:48.477 UTC [1278309] FATAL: database "paad" does not exist
2023-09-12 16:05:48.486 UTC [1278310] FATAL: database "paad" does not exist 2023-09-12 16:05:48.486 UTC [1278310] FATAL: database "paad" does not exist
2023-09-12 16:05:48.539 UTC [1278311] FATAL: database "paad" does not exist 2023-09-12 16:05:48.539 UTC [1278311] FATAL: database "paad" does not exist
2023-09-12 16:05:48.656 UTC [1278312] FATAL: database "paad" does not exist 2023-09-12 16:05:48.656 UTC [1278312] FATAL: database "paad" does not exist
2023-09-12 16:05:48.740 UTC [1278313] FATAL: database "paad" does not exist 2023-09-12 16:05:48.740 UTC [1278313] FATAL: database "paad" does not exist
2023-09-12 16:05:49.097 UTC [1278314] FATAL: database "paad" does not exist 2023-09-12 16:05:49.097 UTC [1278314] FATAL: database "paad" does not exist
2023-09-12 16:05:49.308 UTC [1278315] FATAL: database "paad" does not exist 2023-09-12 16:05:49.308 UTC [1278315] FATAL: database "paad" does not exist
2023-09-12 16:05:49.441 UTC [1278316] FATAL: database "paad" does not exist 2023-09-12 16:05:49.441 UTC [1278316] FATAL: database "paad" does not exist
2023-09-12 16:05:49.592 UTC [1278317] FATAL: database "paad" does not exist 2023-09-12 16:05:49.592 UTC [1278317] FATAL: database "paad" does not exist
2023-09-12 16:05:49.839 UTC [1278318] FATAL: database "paad" does not exist 2023-09-12 16:05:49.839 UTC [1278318] FATAL: database "paad" does not exist
2023-09-12 16:05:50.213 UTC [1278319] FATAL: database "paad" does not exist 2023-09-12 16:05:50.213 UTC [1278319] FATAL: database "paad" does not exist
2023-09-12 16:05:50.244 UTC [1278320] FATAL: database "paad" does not exist 2023-09-12 16:05:50.244 UTC [1278320] FATAL: database "paad" does not exist
2023-09-12 16:05:50.584 UTC [1278321] FATAL: database "paad" does not exist 2023-09-12 16:05:50.584 UTC [1278321] FATAL: database "paad" does not exist
2023-09-12 16:05:50.661 UTC [1278322] FATAL: database "paad" does not exist 2023-09-12 16:05:50.661 UTC [1278322] FATAL: database "paad" does not exist
2023-09-12 16:05:51.031 UTC [1278323] FATAL: database "paad" does not exist 2023-09-12 16:05:51.031 UTC [1278323] FATAL: database "paad" does not exist
2023-09-12 16:05:53.822 UTC [1278325] FATAL: database "paad" does not exist 2023-09-12 16:05:53.822 UTC [1278325] FATAL: database "paad" does not exist
2023-09-12 16:05:54.197 UTC [1278326] FATAL: database "paad" does not exist 2023-09-12 16:05:54.197 UTC [1278326] FATAL: database "paad" does not exist
2023-09-12 16:05:55.686 UTC [1278327] FATAL: database "paad" does not exist 2023-09-12 16:05:55.686 UTC [1278327] FATAL: database "paad" does not exist
2023-09-12 16:05:55.686 UTC [1278328] FATAL: database "paad" does not exist 2023-09-12 16:05:55.686 UTC [1278328] FATAL: database "paad" does not exist
2023-09-12 16:05:55.692 UTC [1278329] LOG: invalid length of startup packet 2023-09-12 16:05:55.692 UTC [1278329] LOG: invalid length of startup packet
2023-09-12 16:05:55.739 UTC [1278330] FATAL: database "paad" does not exist 2023-09-12 16:05:55.739 UTC [1278330] FATAL: database "paad" does not exist
2023-09-12 16:05:55.830 UTC [1278331] FATAL: database "paad" does not exist 2023-09-12 16:05:55.830 UTC [1278331] FATAL: database "paad" does not exist
2023-09-12 16:05:55.923 UTC [1278332] FATAL: database "paad" does not exist 2023-09-12 16:05:55.923 UTC [1278332] FATAL: database "paad" does not exist
2023-09-12 16:05:56.048 UTC [1278333] FATAL: database "paad" does not exist 2023-09-12 16:05:56.048 UTC [1278333] FATAL: database "paad" does not exist
2023-09-12 16:05:56.140 UTC [1278334] FATAL: database "paad" does not exist 2023-09-12 16:05:56.140 UTC [1278334] FATAL: database "paad" does not exist
2023-09-12 16:05:56.168 UTC [1278335] FATAL: database "paad" does not exist 2023-09-12 16:05:56.168 UTC [1278335] FATAL: database "paad" does not exist
2023-09-12 16:05:56.224 UTC [1278336] FATAL: database "paad" does not exist 2023-09-12 16:05:56.224 UTC [1278336] FATAL: database "paad" does not exist
2023-09-12 16:05:56.316 UTC [1278337] FATAL: database "paad" does not exist 2023-09-12 16:05:56.316 UTC [1278337] FATAL: database "paad" does not exist
2023-09-12 16:05:56.684 UTC [1278338] FATAL: database "paad" does not exist 2023-09-12 16:05:56.684 UTC [1278338] FATAL: database "paad" does not exist
2023-09-12 16:05:57.391 UTC [1278339] FATAL: database "paad" does not exist 2023-09-12 16:05:57.391 UTC [1278339] FATAL: database "paad" does not exist
2023-09-12 16:05:57.392 UTC [1278340] FATAL: expected SASL response, got message type 88 2023-09-12 16:05:57.392 UTC [1278340] FATAL: expected SASL response, got message type 88
2023-09-12 16:05:57.763 UTC [1278341] FATAL: database "paad" does not exist 2023-09-12 16:05:57.763 UTC [1278341] FATAL: database "paad" does not exist
2023-09-12 16:05:58.118 UTC [1278342] FATAL: database "paad" does not exist 2023-09-12 16:05:58.118 UTC [1278342] FATAL: database "paad" does not exist
2023-09-12 16:05:58.280 UTC [1278343] FATAL: database "paad" does not exist 2023-09-12 16:05:58.280 UTC [1278343] FATAL: database "paad" does not exist
2023-09-12 16:05:58.514 UTC [1278344] FATAL: database "paad" does not exist 2023-09-12 16:05:58.514 UTC [1278344] FATAL: database "paad" does not exist
2023-09-12 16:05:58.849 UTC [1278350] FATAL: database "paad" does not exist 2023-09-12 16:05:58.849 UTC [1278350] FATAL: database "paad" does not exist
2023-09-12 16:05:59.251 UTC [1278351] FATAL: database "paad" does not exist 2023-09-12 16:05:59.251 UTC [1278351] FATAL: database "paad" does not exist
2023-09-12 16:05:59.313 UTC [1278352] FATAL: database "paad" does not exist 2023-09-12 16:05:59.313 UTC [1278352] FATAL: database "paad" does not exist
2023-09-12 16:05:59.438 UTC [1278353] FATAL: database "paad" does not exist 2023-09-12 16:05:59.438 UTC [1278353] FATAL: database "paad" does not exist
2023-09-12 16:05:59.794 UTC [1278354] FATAL: database "paad" does not exist 2023-09-12 16:05:59.794 UTC [1278354] FATAL: database "paad" does not exist
2023-09-12 16:06:00.072 UTC [1278355] FATAL: database "paad" does not exist 2023-09-12 16:06:00.072 UTC [1278355] FATAL: database "paad" does not exist
2023-09-12 16:06:00.193 UTC [1278356] FATAL: database "paad" does not exist 2023-09-12 16:06:00.193 UTC [1278356] FATAL: database "paad" does not exist
2023-09-12 16:06:00.193 UTC [1278357] FATAL: database "paad" does not exist 2023-09-12 16:06:00.193 UTC [1278357] FATAL: database "paad" does not exist
2023-09-12 16:06:00.196 UTC [1278358] FATAL: expected SASL response, got message type 88 2023-09-12 16:06:00.196 UTC [1278358] FATAL: expected SASL response, got message type 88
2023-09-12 16:06:00.422 UTC [1278359] FATAL: database "paad" does not exist 2023-09-12 16:06:00.422 UTC [1278359] FATAL: database "paad" does not exist
2023-09-12 16:06:00.424 UTC [1278360] FATAL: expected SASL response, got message type 88 2023-09-12 16:06:00.424 UTC [1278360] FATAL: expected SASL response, got message type 88
2023-09-12 16:06:00.793 UTC [1278361] FATAL: database "paad" does not exist 2023-09-12 16:06:00.793 UTC [1278361] FATAL: database "paad" does not exist
2023-09-12 16:06:01.106 UTC [1278362] FATAL: database "paad" does not exist 2023-09-12 16:06:01.106 UTC [1278362] FATAL: database "paad" does not exist
2023-09-12 16:06:01.124 UTC [1278363] FATAL: database "paad" does not exist 2023-09-12 16:06:01.124 UTC [1278363] FATAL: database "paad" does not exist
2023-09-12 16:06:01.411 UTC [1278364] FATAL: database "paad" does not exist 2023-09-12 16:06:01.411 UTC [1278364] FATAL: database "paad" does not exist
2023-09-12 16:06:01.414 UTC [1278365] FATAL: database "paad" does not exist 2023-09-12 16:06:01.414 UTC [1278365] FATAL: database "paad" does not exist
2023-09-12 16:06:01.495 UTC [1278366] FATAL: database "paad" does not exist 2023-09-12 16:06:01.495 UTC [1278366] FATAL: database "paad" does not exist
2023-09-12 16:06:01.555 UTC [1278367] FATAL: database "paad" does not exist 2023-09-12 16:06:01.555 UTC [1278367] FATAL: database "paad" does not exist
2023-09-12 16:06:01.590 UTC [1278368] FATAL: database "paad" does not exist 2023-09-12 16:06:01.590 UTC [1278368] FATAL: database "paad" does not exist
2023-09-12 16:06:01.628 UTC [1278369] FATAL: database "paad" does not exist 2023-09-12 16:06:01.628 UTC [1278369] FATAL: database "paad" does not exist
2023-09-12 16:06:01.739 UTC [1278370] FATAL: database "paad" does not exist 2023-09-12 16:06:01.739 UTC [1278370] FATAL: database "paad" does not exist
2023-09-12 16:06:01.739 UTC [1278371] FATAL: expected SASL response, got message type 88 2023-09-12 16:06:01.739 UTC [1278371] FATAL: expected SASL response, got message type 88
2023-09-12 16:06:02.120 UTC [1278373] FATAL: database "paad" does not exist 2023-09-12 16:06:02.120 UTC [1278373] FATAL: database "paad" does not exist
2023-09-12 16:06:02.140 UTC [1278372] FATAL: database "paad" does not exist 2023-09-12 16:06:02.140 UTC [1278372] FATAL: database "paad" does not exist
2023-09-12 16:06:02.330 UTC [1278374] FATAL: database "paad" does not exist 2023-09-12 16:06:02.330 UTC [1278374] FATAL: database "paad" does not exist
2023-09-12 16:06:02.453 UTC [1278376] FATAL: database "paad" does not exist 2023-09-12 16:06:02.453 UTC [1278376] FATAL: database "paad" does not exist
2023-09-12 16:06:02.454 UTC [1278375] FATAL: database "paad" does not exist 2023-09-12 16:06:02.454 UTC [1278375] FATAL: database "paad" does not exist
2023-09-12 16:06:02.814 UTC [1278377] FATAL: database "paad" does not exist 2023-09-12 16:06:02.814 UTC [1278377] FATAL: database "paad" does not exist
2023-09-12 16:06:03.165 UTC [1278378] FATAL: database "paad" does not exist 2023-09-12 16:06:03.165 UTC [1278378] FATAL: database "paad" does not exist
2023-09-12 16:06:03.203 UTC [1278379] FATAL: database "paad" does not exist 2023-09-12 16:06:03.203 UTC [1278379] FATAL: database "paad" does not exist
2023-09-12 16:06:03.558 UTC [1278380] FATAL: database "paad" does not exist 2023-09-12 16:06:03.558 UTC [1278380] FATAL: database "paad" does not exist
2023-09-12 16:06:03.915 UTC [1278381] FATAL: database "paad" does not exist 2023-09-12 16:06:03.915 UTC [1278381] FATAL: database "paad" does not exist
2023-09-12 16:06:04.214 UTC [1278382] FATAL: database "paad" does not exist 2023-09-12 16:06:04.214 UTC [1278382] FATAL: database "paad" does not exist
2023-09-12 16:06:04.390 UTC [1278383] FATAL: database "paad" does not exist 2023-09-12 16:06:04.390 UTC [1278383] FATAL: database "paad" does not exist
2023-09-12 16:06:04.509 UTC [1278384] FATAL: database "paad" does not exist 2023-09-12 16:06:04.509 UTC [1278384] FATAL: database "paad" does not exist
2023-09-12 16:06:04.879 UTC [1278385] FATAL: database "paad" does not exist 2023-09-12 16:06:04.879 UTC [1278385] FATAL: database "paad" does not exist
2023-09-12 16:06:05.266 UTC [1278386] FATAL: database "paad" does not exist 2023-09-12 16:06:05.266 UTC [1278386] FATAL: database "paad" does not exist
2023-09-12 16:06:05.632 UTC [1278387] FATAL: database "paad" does not exist 2023-09-12 16:06:05.632 UTC [1278387] FATAL: database "paad" does not exist
2023-09-12 16:06:05.981 UTC [1278388] FATAL: database "paad" does not exist 2023-09-12 16:06:05.981 UTC [1278388] FATAL: database "paad" does not exist
2023-09-12 16:06:08.768 UTC [1278390] FATAL: database "paad" does not exist 2023-09-12 16:06:08.768 UTC [1278390] FATAL: database "paad" does not exist
2023-09-12 16:06:08.976 UTC [1278392] FATAL: database "paad" does not exist 2023-09-12 16:06:08.976 UTC [1278392] FATAL: database "paad" does not exist
2023-09-12 16:06:09.347 UTC [1278394] FATAL: database "paad" does not exist 2023-09-12 16:06:09.347 UTC [1278394] FATAL: database "paad" does not exist
2023-09-12 16:06:09.953 UTC [1278395] FATAL: database "paad" does not exist 2023-09-12 16:06:09.953 UTC [1278395] FATAL: database "paad" does not exist
2023-09-12 16:06:10.157 UTC [1278396] FATAL: database "paad" does not exist 2023-09-12 16:06:10.157 UTC [1278396] FATAL: database "paad" does not exist
2023-09-12 16:06:10.383 UTC [1278397] FATAL: database "paad" does not exist 2023-09-12 16:06:10.383 UTC [1278397] FATAL: database "paad" does not exist
2023-09-12 16:06:10.731 UTC [1278398] FATAL: database "paad" does not exist 2023-09-12 16:06:10.731 UTC [1278398] FATAL: database "paad" does not exist
2023-09-12 16:06:10.828 UTC [1278399] FATAL: database "paad" does not exist 2023-09-12 16:06:10.828 UTC [1278399] FATAL: database "paad" does not exist
2023-09-12 16:06:11.182 UTC [1278400] FATAL: database "paad" does not exist 2023-09-12 16:06:11.182 UTC [1278400] FATAL: database "paad" does not exist
2023-09-12 16:06:11.463 UTC [1278401] FATAL: database "paad" does not exist 2023-09-12 16:06:11.463 UTC [1278401] FATAL: database "paad" does not exist
2023-09-12 16:06:16.727 UTC [1278403] FATAL: database "paad" does not exist 2023-09-12 16:06:16.727 UTC [1278403] FATAL: database "paad" does not exist
2023-09-12 16:06:17.169 UTC [1278404] FATAL: database "paad" does not exist 2023-09-12 16:06:17.169 UTC [1278404] FATAL: database "paad" does not exist
2023-09-12 16:06:20.081 UTC [1278405] FATAL: database "paad" does not exist 2023-09-12 16:06:20.081 UTC [1278405] FATAL: database "paad" does not exist
2023-09-12 16:36:39.375 UTC [1202] LOG: checkpoint starting: time 2023-09-12 16:36:39.375 UTC [1202] LOG: checkpoint starting: time
2023-09-12 16:36:40.120 UTC [1202] LOG: checkpoint complete: wrote 8 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.705 s, sync=0.014 s, total=0.746 s; sync files=6, longest=0.009 s, average=0.003 s; distance=31 kB, estimate=390 kB 2023-09-12 16:36:40.120 UTC [1202] LOG: checkpoint complete: wrote 8 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.705 s, sync=0.014 s, total=0.746 s; sync files=6, longest=0.009 s, average=0.003 s; distance=31 kB, estimate=390 kB
2023-09-12 17:27:45.480 UTC [1273693] LOG: could not receive data from client: Connection timed out 2023-09-12 17:27:45.480 UTC [1273693] LOG: could not receive data from client: Connection timed out
2023-09-12 17:27:45.480 UTC [1273692] LOG: could not receive data from client: Connection timed out 2023-09-12 17:27:45.480 UTC [1273692] LOG: could not receive data from client: Connection timed out
2023-09-12 17:27:45.483 UTC [1273700] LOG: could not receive data from client: Connection timed out 2023-09-12 17:27:45.483 UTC [1273700] LOG: could not receive data from client: Connection timed out
2023-09-12 18:11:26.920 UTC [1277694] LOG: could not receive data from client: Connection timed out 2023-09-12 18:11:26.920 UTC [1277694] LOG: could not receive data from client: Connection timed out
2023-09-12 18:11:26.920 UTC [1277695] LOG: could not receive data from client: Connection timed out 2023-09-12 18:11:26.920 UTC [1277695] LOG: could not receive data from client: Connection timed out
2023-09-12 18:11:26.923 UTC [1277697] LOG: could not receive data from client: Connection timed out 2023-09-12 18:11:26.923 UTC [1277697] LOG: could not receive data from client: Connection timed out
2023-09-12 18:50:46.216 UTC [1282892] LOG: could not receive data from client: Connection timed out 2023-09-12 18:50:46.216 UTC [1282892] LOG: could not receive data from client: Connection timed out
2023-09-12 18:50:46.217 UTC [1282894] LOG: could not receive data from client: Connection timed out 2023-09-12 18:50:46.217 UTC [1282894] LOG: could not receive data from client: Connection timed out
2023-09-12 18:50:46.219 UTC [1282893] LOG: could not receive data from client: Connection timed out 2023-09-12 18:50:46.219 UTC [1282893] LOG: could not receive data from client: Connection timed out

View File

@@ -1,332 +1,332 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Auditoría asistencial</title> <title>Auditoría asistencial</title>
<?php <?php
include 'import/html_css_files.php'; include 'import/html_css_files.php';
?> ?>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/trix@2.0.0/dist/trix.css"> <link rel="stylesheet" type="text/css" href="https://unpkg.com/trix@2.0.0/dist/trix.css">
<style> <style>
[v-cloak] { [v-cloak] {
display: none; display: none;
} }
</style> </style>
<script src="js/jquery.min.js"></script> <script src="js/jquery.min.js"></script>
<script src="js/jquery-ui.js"></script> <script src="js/jquery-ui.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script> <script src="js/bootstrap/bootstrap.min.js"></script>
</head> </head>
<body> <body>
<? <?
$redirect = $_SERVER['PHP_SELF']; $redirect = $_SERVER['PHP_SELF'];
include "import/html_header.php"; include "import/html_header.php";
global $user; global $user;
html_header( html_header(
is_null($user->facultad['facultad_id']) ? "Puestos" : "Puestos de la {$user->facultad['facultad']}", is_null($user->facultad['facultad_id']) ? "Puestos" : "Puestos de la {$user->facultad['facultad']}",
"Sistema de gestión de checador", "Sistema de gestión de checador",
); );
if (!is_null($user->facultad['facultad_id'])) { if (!is_null($user->facultad['facultad_id'])) {
?> ?>
<main class="container-fluid px-4 mt-4" id="app" v-cloak @vue:mounted="mounted" style="min-height: 70vh;" <main class="container-fluid px-4 mt-4" id="app" v-cloak @vue:mounted="mounted" style="min-height: 70vh;"
v-scope="{new_puesto: null}"> v-scope="{new_puesto: null}">
<!-- {{modificado}} --> <!-- {{modificado}} -->
<div class="marco alert alert-success" role="alert" v-if="message"> <div class="marco alert alert-success" role="alert" v-if="message">
{{message}} {{message}}
</div> </div>
<? <?
if ($user->acceso == 'w') { if ($user->acceso == 'w') {
?> ?>
<div class="marco text-right"> <div class="marco text-right">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#nuevo-puesto"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#nuevo-puesto">
<span class="ing-mas"></span> <span class="ing-mas"></span>
Agregar puesto Agregar puesto
</button> </button>
<button type="button" class="btn btn-success mx-2" @click="descargar()"> <button type="button" class="btn btn-success mx-2" @click="descargar()">
<span class="ing-descarga"></span> <span class="ing-descarga"></span>
Descargar Excel Descargar Excel
</button> </button>
</div> </div>
<? <?
} }
?> ?>
<div class="d-flex flex-wrap marco justify-content-around"> <div class="d-flex flex-wrap marco justify-content-around">
<div class="accordion col-10 mx-auto my-5" id="puestos" <div class="accordion col-10 mx-auto my-5" id="puestos"
v-scope="{selected_carrera_id: 0, current_materia: null, current_encargado: null}" v-scope="{selected_carrera_id: 0, current_materia: null, current_encargado: null}"
v-if="puestos.length"> v-if="puestos.length">
<div class="card mb-3 shadow-lg" v-for="(puesto, index) in puestos" :key="puesto.puesto_id"> <div class="card mb-3 shadow-lg" v-for="(puesto, index) in puestos" :key="puesto.puesto_id">
<!-- Card Header --> <!-- Card Header -->
<div class="card-header bg-primary text-white d-flex justify-content-between align-items-center"> <div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
<button class="btn btn-link text-white flex-grow-1 text-left" type="button" <button class="btn btn-link text-white flex-grow-1 text-left" type="button"
data-toggle="collapse" :data-target="`#puesto-${puesto.puesto_id}`" aria-expanded="true" data-toggle="collapse" :data-target="`#puesto-${puesto.puesto_id}`" aria-expanded="true"
:aria-controls="`puesto-${puesto.puesto_id}`"> :aria-controls="`puesto-${puesto.puesto_id}`">
{{puesto.nombre}} {{puesto.nombre}}
</button> </button>
<?php if ($user->acceso == 'w') { ?> <?php if ($user->acceso == 'w') { ?>
<button type="button" class="btn btn-outline-light" data-target="#eliminar-puesto" <button type="button" class="btn btn-outline-light" data-target="#eliminar-puesto"
data-toggle="modal" @click="to_delete = puesto"> data-toggle="modal" @click="to_delete = puesto">
<i class="fas fa-trash-alt"></i> <i class="fas fa-trash-alt"></i>
</button> </button>
<?php } ?> <?php } ?>
</div> </div>
<div :id="`puesto-${puesto.puesto_id}`" class="collapse" <div :id="`puesto-${puesto.puesto_id}`" class="collapse"
:aria-labelledby="`puesto-${puesto.nombre}`" data-parent="#puestos"> :aria-labelledby="`puesto-${puesto.nombre}`" data-parent="#puestos">
<div class="card-body"> <div class="card-body">
<!-- Encargado --> <!-- Encargado -->
<div class="form-row justify-content-around align-items-center mb-2"> <div class="form-row justify-content-around align-items-center mb-2">
<label :for="`encargado-${puesto.puesto_id}`" class="col-2 barra-right"> <label :for="`encargado-${puesto.puesto_id}`" class="col-2 barra-right">
Encargado del área Encargado del área
<!-- $user->lectura && $user->escritura && $user->none --> <!-- $user->lectura && $user->escritura && $user->none -->
</label> </label>
<div id="encargados" class="datalist datalist-select mb-1 col-9 <?php if ($user->acceso != 'w') { ?>disabled<?php } ?>"> <div id="encargados" class="datalist datalist-select mb-1 col-9 <?php if ($user->acceso != 'w') { ?>disabled<?php } ?>">
<div class="datalist-input" v-if="puesto.encargado"> <div class="datalist-input" v-if="puesto.encargado">
({{puesto.encargado.usuario_clave}}) {{ puesto.encargado.usuario_nombre }} ({{puesto.encargado.usuario_clave}}) {{ puesto.encargado.usuario_nombre }}
</div> </div>
<div class="datalist-input" v-else> <div class="datalist-input" v-else>
Selecciona un encargado Selecciona un encargado
</div> </div>
<span class="icono ing-buscar"></span> <span class="icono ing-buscar"></span>
<ul style="display:none"> <ul style="display:none">
<li class="datalist-option" v-for="usuario in usuarios" <li class="datalist-option" v-for="usuario in usuarios"
:key="usuario.usuario_id" :data-id="usuario.usuario_id" :key="usuario.usuario_id" :data-id="usuario.usuario_id"
style=" white-space: nowrap;" @click="puesto.encargado = usuario" style=" white-space: nowrap;" @click="puesto.encargado = usuario"
:class="{'selected': puesto.encargado?.usuario_id == usuario.usuario_id}"> :class="{'selected': puesto.encargado?.usuario_id == usuario.usuario_id}">
(<small> {{usuario.usuario_clave}} </small>) {{ usuario.usuario_nombre }} (<small> {{usuario.usuario_clave}} </small>) {{ usuario.usuario_nombre }}
</li> </li>
</ul> </ul>
<input type="hidden" id="encargado_id" name="id"> <input type="hidden" id="encargado_id" name="id">
</div> </div>
</div> </div>
<hr> <hr>
<?php if ($user->acceso == 'w') { ?> <?php if ($user->acceso == 'w') { ?>
<!-- <div class="form-row justify-content-around align-items-center mb-2" <!-- <div class="form-row justify-content-around align-items-center mb-2"
v-show="carreras.length"> v-show="carreras.length">
<label :for="`carrera-${puesto.puesto_id}`" class="col-2 barra-right"> <label :for="`carrera-${puesto.puesto_id}`" class="col-2 barra-right">
Carrera Carrera
</label> </label>
<div id="dlCarreras" class="datalist datalist-select mb-1 col-9"> <div id="dlCarreras" class="datalist datalist-select mb-1 col-9">
<div class="datalist-input"> <div class="datalist-input">
Selecciona una carrera Selecciona una carrera
</div> </div>
<span class="icono ing-buscar"></span> <span class="icono ing-buscar"></span>
<ul style="display:none"> <ul style="display:none">
<li class="datalist-option" data-id="0" @click="selected_carrera_id = 0"> <li class="datalist-option" data-id="0" @click="selected_carrera_id = 0">
Todas las carreras Todas las carreras
</li> </li>
<li class="datalist-option" v-for="carrera in carreras" <li class="datalist-option" v-for="carrera in carreras"
:key="carrera.carrera_id" :data-id="carrera.carrera_id" :key="carrera.carrera_id" :data-id="carrera.carrera_id"
style=" white-space: nowrap;" style=" white-space: nowrap;"
@click="selected_carrera_id = carrera.carrera_id"> @click="selected_carrera_id = carrera.carrera_id">
(<small> {{carrera.clave_carrera}} </small>) {{ carrera.carrera_nombre }} (<small> {{carrera.clave_carrera}} </small>) {{ carrera.carrera_nombre }}
</li> </li>
</ul> </ul>
<input type="hidden" id="carrera_id" name="id"> <input type="hidden" id="carrera_id" name="id">
</div> </div>
</div> --> </div> -->
<div class="form-row justify-content-around align-items-center" <div class="form-row justify-content-around align-items-center"
v-scope="{to_add_materia: null}"> v-scope="{to_add_materia: null}">
<label :for="`materias-${puesto.puesto_id}`" class="col-2 barra-right"> <label :for="`materias-${puesto.puesto_id}`" class="col-2 barra-right">
Materias Materias
</label> </label>
<input name="materia" placeholder="Seleccione una materia" list="datalist-materias" <input name="materia" placeholder="Seleccione una materia" list="datalist-materias"
class="form-control col-9 " v-model="current_materia" @input="to_add_materia = materias.find(m => current_materia == `${m.clave_materia} - ${m.materia_nombre}`); class="form-control col-9 " v-model="current_materia" @input="to_add_materia = materias.find(m => current_materia == `${m.clave_materia} - ${m.materia_nombre}`);
if (to_add_materia) { if (to_add_materia) {
if (puesto.materias.find(p => p.materia_id == to_add_materia.materia_id)) { if (puesto.materias.find(p => p.materia_id == to_add_materia.materia_id)) {
console.log('La materia ya está asignada'); console.log('La materia ya está asignada');
current_materia = null; current_materia = null;
return; return;
} }
puesto.materias.push(to_add_materia); puesto.materias.push(to_add_materia);
current_materia = null; current_materia = null;
}" :disabled="selected_carrera_id == -1" v-model="current_materia" }" :disabled="selected_carrera_id == -1" v-model="current_materia"
:id="`materias-${puesto.puesto_id}`" autocomplete="off"> :id="`materias-${puesto.puesto_id}`" autocomplete="off">
</div> </div>
<datalist id="datalist-materias"> <datalist id="datalist-materias">
<option <option
v-for="materia in materias.filter(m => selected_carrera_id == 0)" v-for="materia in materias.filter(m => selected_carrera_id == 0)"
:value="`${materia.clave_materia} - ${materia.materia_nombre}`"> :value="`${materia.clave_materia} - ${materia.materia_nombre}`">
</datalist> </datalist>
<?php } ?> <?php } ?>
<hr> <hr>
<style> <style>
.list-group-item-action:hover { .list-group-item-action:hover {
<?php if ($user->acceso == 'w') { ?> <?php if ($user->acceso == 'w') { ?>
background-color: rgba(255, 0, 0, 0.1); background-color: rgba(255, 0, 0, 0.1);
<?php } else { ?> <?php } else { ?>
background-color: rgba(0, 0, 255, 0.1); background-color: rgba(0, 0, 255, 0.1);
<?php } ?> <?php } ?>
} }
.list-group-item-action:active { .list-group-item-action:active {
<?php if ($user->acceso == 'w') { ?> <?php if ($user->acceso == 'w') { ?>
background-color: rgba(255, 0, 0, 0.2); background-color: rgba(255, 0, 0, 0.2);
<?php } else { ?> <?php } else { ?>
background-color: rgba(0, 0, 255, 0.2); background-color: rgba(0, 0, 255, 0.2);
<?php } ?> <?php } ?>
} }
</style> </style>
<fieldset class="container mt-4"> <fieldset class="container mt-4">
<legend class="text-center mb-3"> <legend class="text-center mb-3">
Materias Asignadas <span class="badge badge-info">{{puesto.materias.length}}</span> Materias Asignadas <span class="badge badge-info">{{puesto.materias.length}}</span>
</legend> </legend>
<!-- Assigned Subjects List --> <!-- Assigned Subjects List -->
<ul class="list-group shadow-sm" v-if="puesto.materias.length" <ul class="list-group shadow-sm" v-if="puesto.materias.length"
style="max-height: 250px; overflow-y: auto;"> style="max-height: 250px; overflow-y: auto;">
<li class="list-group-item list-group-item-action d-flex justify-content-between align-items-center" <li class="list-group-item list-group-item-action d-flex justify-content-between align-items-center"
v-for="materia in puesto.materias" :key="materia.materia_id" v-for="materia in puesto.materias" :key="materia.materia_id"
<?php if ($user->acceso == 'w') { ?> <?php if ($user->acceso == 'w') { ?>
@click="modificado = true; puesto.materias.splice(puesto.materias.indexOf(materia), 1); materias.push(materia)" @click="modificado = true; puesto.materias.splice(puesto.materias.indexOf(materia), 1); materias.push(materia)"
<?php } ?> <?php } ?>
style="cursor: pointer; transition: background-color 0.3s ease;"> style="cursor: pointer; transition: background-color 0.3s ease;">
<span class="flex-grow-1"> <span class="flex-grow-1">
{{materia.clave_materia}} - {{materia.materia_nombre}} {{materia.clave_materia}} - {{materia.materia_nombre}}
</span> </span>
<?php if ($user->acceso == 'w') { ?> <?php if ($user->acceso == 'w') { ?>
<!-- Delete icon - assuming using FontAwesome, replace with your icon system if different --> <!-- Delete icon - assuming using FontAwesome, replace with your icon system if different -->
<i class="fas fa-trash-alt text-danger ml-3" style="cursor: pointer;"></i> <i class="fas fa-trash-alt text-danger ml-3" style="cursor: pointer;"></i>
<?php } ?> <?php } ?>
</li> </li>
</ul> </ul>
<!-- Empty State Alert --> <!-- Empty State Alert -->
<div class="alert alert-light text-center" role="alert" v-else> <div class="alert alert-light text-center" role="alert" v-else>
No hay materias asignadas No hay materias asignadas
</div> </div>
</fieldset> </fieldset>
</div> </div>
<?php if ($user->acceso == 'w') { ?> <?php if ($user->acceso == 'w') { ?>
<div class="card-footer d-flex justify-content-between align-items-center"> <div class="card-footer d-flex justify-content-between align-items-center">
<!-- <small class="text-muted">Última actualización: {{ puesto.lastUpdate | formatDate }}</small> --> <!-- <small class="text-muted">Última actualización: {{ puesto.lastUpdate | formatDate }}</small> -->
<button type="button" class="btn btn-primary" <button type="button" class="btn btn-primary"
@click="actualizarPuesto(puesto.puesto_id, puesto.materias, puesto.encargado?.usuario_id); window.scrollTo(0, 0); setTimeout(() => window.scrollTo(0, 0), 100);"> @click="actualizarPuesto(puesto.puesto_id, puesto.materias, puesto.encargado?.usuario_id); window.scrollTo(0, 0); setTimeout(() => window.scrollTo(0, 0), 100);">
{{ puesto.encargado ? 'Guardar cambios' : 'Guardar sin encargado' }} {{ puesto.encargado ? 'Guardar cambios' : 'Guardar sin encargado' }}
</button> </button>
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
</div> </div>
<div v-else> <div v-else>
<div class="alert alert-dark" role="alert"> <div class="alert alert-dark" role="alert">
No hay puestos registrados No hay puestos registrados
</div> </div>
</div> </div>
</div> </div>
<div class="modal" tabindex="-1" role="dialog" accesskey="a" id="nuevo-puesto"> <div class="modal" tabindex="-1" role="dialog" accesskey="a" id="nuevo-puesto">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header text-white"> <div class="modal-header text-white">
<h5 class="modal-title">Agregar un nuevo puesto</h5> <h5 class="modal-title">Agregar un nuevo puesto</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" class="text-white">&times;</span> <span aria-hidden="true" class="text-white">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<fieldset> <fieldset>
<legend>Nombre del puesto</legend> <legend>Nombre del puesto</legend>
<div class="form-row"> <div class="form-row">
<input type="text" class="form-control" v-model="new_puesto" <input type="text" class="form-control" v-model="new_puesto"
placeholder="Área del puesto"> placeholder="Área del puesto">
</div> </div>
</fieldset> </fieldset>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-outline-danger" data-dismiss="modal" <button type="button" class="btn btn-outline-danger" data-dismiss="modal"
@click="new_puesto = null">Cancelar</button> @click="new_puesto = null">Cancelar</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" <button type="button" class="btn btn-primary" data-dismiss="modal"
@click="nuevoPuesto(new_puesto); new_puesto = null">Guardar</button> @click="nuevoPuesto(new_puesto); new_puesto = null">Guardar</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal" tabindex="-1" role="dialog" accesskey="a" id="eliminar-puesto"> <div class="modal" tabindex="-1" role="dialog" accesskey="a" id="eliminar-puesto">
<div class="modal-dialog modal-dialog-centered" role="document" v-if="to_delete"> <div class="modal-dialog modal-dialog-centered" role="document" v-if="to_delete">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header text-white"> <div class="modal-header text-white">
<h5 class="modal-title">Eliminar puesto</h5> <h5 class="modal-title">Eliminar puesto</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" class="text-white">&times;</span> <span aria-hidden="true" class="text-white">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<fieldset> <fieldset>
<legend>¿Estás seguro de que deseas eliminar el puesto?</legend> <legend>¿Estás seguro de que deseas eliminar el puesto?</legend>
<p>Esta acción no se puede deshacer. Se perderán las asignaciones de materias y de <p>Esta acción no se puede deshacer. Se perderán las asignaciones de materias y de
encargado.</p> encargado.</p>
</fieldset> </fieldset>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-outline-danger" data-dismiss="modal" <button type="button" class="btn btn-outline-danger" data-dismiss="modal"
@click="new_puesto = null">Cancelar</button> @click="new_puesto = null">Cancelar</button>
<button type="button" class="btn btn-danger" data-dismiss="modal" <button type="button" class="btn btn-danger" data-dismiss="modal"
@click="eliminarPuesto(to_delete.puesto_id)">Eliminar</button> @click="eliminarPuesto(to_delete.puesto_id)">Eliminar</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
<? <?
} else { } else {
?> ?>
<main class="container mt-5" style="min-height: 70vh;"> <main class="container mt-5" style="min-height: 70vh;">
<div class="row"> <div class="row">
<div class="col-md-8 offset-md-2"> <div class="col-md-8 offset-md-2">
<div class="card"> <div class="card">
<div class="card-header text-white bg-danger"> <div class="card-header text-white bg-danger">
Sin Facultad Asociada Sin Facultad Asociada
</div> </div>
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Atención</h5> <h5 class="card-title">Atención</h5>
<p class="card-text">No tienes una facultad asociada a tu perfil. El rol <p class="card-text">No tienes una facultad asociada a tu perfil. El rol
<?= $user->rol['rol'] ?> no tiene acceso a esta sección. <?= $user->rol['rol'] ?> no tiene acceso a esta sección.
</p> </p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
<? } <? }
include "import/html_footer.php"; ?> include "import/html_footer.php"; ?>
<script src="js/jquery.min.js"></script> <script src="js/jquery.min.js"></script>
<script src="js/jquery-ui.js"></script> <script src="js/jquery-ui.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script> <script src="js/bootstrap/bootstrap.min.js"></script>
<script src="js/datepicker-es.js"></script> <script src="js/datepicker-es.js"></script>
<script src="js/datalist.js"></script> <script src="js/datalist.js"></script>
<script src="js/puestos.js?<?= rand(0, 2) ?>" type="module"></script> <script src="js/puestos.js?<?= rand(0, 2) ?>" type="module"></script>
<script src="js/scrollables.js"></script> <script src="js/scrollables.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script>
<script> <script>
let modificado = false; let modificado = false;
$(document).ready(function () { $(document).ready(function () {
$('.collapse').collapse $('.collapse').collapse
window.onbeforeunload = function () { window.onbeforeunload = function () {
if (modificado) { if (modificado) {
return true; return true;
} }
}; };
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@@ -1,298 +1,298 @@
<?php <?php
error_reporting(E_ALL & ~E_NOTICE); error_reporting(E_ALL & ~E_NOTICE);
ini_set("display_errors", 1); ini_set("display_errors", 1);
require_once 'class/c_login.php'; require_once 'class/c_login.php';
$user = Login::get_user(); $user = Login::get_user();
$user->access('reporte_de_asistencias'); $user->access('reporte_de_asistencias');
if (in_array($user->acceso, ['n'])) if (in_array($user->acceso, ['n']))
die(header('Location: main.php?error=1')); die(header('Location: main.php?error=1'));
$user->print_to_log('Consultar asistencia'); $user->print_to_log('Consultar asistencia');
# Select carreras from facultad # Select carreras from facultad
$fs_carrera = queryAll( $fs_carrera = queryAll(
"SELECT * FROM FS_CARRERA(:facultad)", "SELECT * FROM FS_CARRERA(:facultad)",
array( array(
":facultad" => $user->facultad["facultad_id"] ":facultad" => $user->facultad["facultad_id"]
) )
); );
$fs_periodo = queryAll( $fs_periodo = queryAll(
"SELECT * FROM FS_PERIODO(:periodo, :nivel, :estado)", "SELECT * FROM FS_PERIODO(:periodo, :nivel, :estado)",
array( array(
":periodo" => null, ":periodo" => null,
":nivel" => null, ":nivel" => null,
":estado" => 1, ":estado" => 1,
) )
); );
extract($_POST); extract($_POST);
$retardos = query("SELECT FS_HAS_RETARDO(:facultad) r", [":facultad" => $user->facultad["facultad_id"]])['r']; $retardos = query("SELECT FS_HAS_RETARDO(:facultad) r", [":facultad" => $user->facultad["facultad_id"]])['r'];
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Reporte asistencias | <?= $user->facultad['facultad'] ?? 'General' ?></title> <title>Reporte asistencias | <?= $user->facultad['facultad'] ?? 'General' ?></title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php include_once "import/html_css_files.php"; ?> <?php include_once "import/html_css_files.php"; ?>
</head> </head>
<body style="display: block;"> <body style="display: block;">
<?php <?php
include("import/html_header.php"); include("import/html_header.php");
html_header("Reporte asistencias | " . ($user->facultad["facultad"] ?? "General"), "Sistema de gestión de checador"); html_header("Reporte asistencias | " . ($user->facultad["facultad"] ?? "General"), "Sistema de gestión de checador");
?> ?>
<main class="container content marco content-margin"> <main class="container content marco content-margin">
<section id="message"></section> <section id="message"></section>
<!-- Ajax form --> <!-- Ajax form -->
<!-- Select periodo --> <!-- Select periodo -->
<?php include_once 'import/html_forms_asistencia.php'; ?> <?php include_once 'import/html_forms_asistencia.php'; ?>
<!-- Space --> <!-- Space -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<hr> <hr>
</div> </div>
</div> </div>
<!-- Table template_table_asistencia --> <!-- Table template_table_asistencia -->
<div id="table-asistencia" class="table-responsive"></div> <div id="table-asistencia" class="table-responsive"></div>
<?php <?php
include_once 'include/constantes.php'; include_once 'include/constantes.php';
?> ?>
<template id="asistencias"> <template id="asistencias">
<p class="text-right"> <p class="text-right">
<button class="btn btn-outline-secondary " id="btn-excel-asistencia" title="Exportar a Excel"> <button class="btn btn-outline-secondary " id="btn-excel-asistencia" title="Exportar a Excel">
<?php echo $ICO["descargar"]; ?></i> Exportar <?php echo $ICO["descargar"]; ?></i> Exportar
</button> </button>
</p> </p>
<table class="table table-striped table-hover table-white table-sm"> <table class="table table-striped table-hover table-white table-sm">
<!-- Table primary --> <!-- Table primary -->
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
<th id="order-cve" style="cursor: pointer;" onclick="asistenciasOrderby('cve')">Clave</th> <th id="order-cve" style="cursor: pointer;" onclick="asistenciasOrderby('cve')">Clave</th>
<th id="order-name" style="cursor: pointer;" onclick="asistenciasOrderby('name')">Nombre</th> <th id="order-name" style="cursor: pointer;" onclick="asistenciasOrderby('name')">Nombre</th>
<!-- Column small width --> <!-- Column small width -->
<th id="order-absence" style="cursor: pointer;" onclick="asistenciasOrderby('absence')"> <th id="order-absence" style="cursor: pointer;" onclick="asistenciasOrderby('absence')">
<span>Total clases</span> <span>Total clases</span>
</th> </th>
<th> <th>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody id="table-registros" class="text-center"> <tbody id="table-registros" class="text-center">
<!-- Ajax table --> <!-- Ajax table -->
</tbody> </tbody>
</table> </table>
</template> </template>
<div class="d-none" id="hidden-forms"></div> <div class="d-none" id="hidden-forms"></div>
<?php include_once "import/html_scroll.php"; ?> <?php include_once "import/html_scroll.php"; ?>
</main> </main>
<?php <?php
require_once("import/html_footer.php"); require_once("import/html_footer.php");
?> ?>
<script src="js/bootstrap/popper.min.js"></script> <script src="js/bootstrap/popper.min.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script> <script src="js/bootstrap/bootstrap.min.js"></script>
<script src="js/fetchlib.js"></script> <script src="js/fetchlib.js"></script>
<script src="js/barra.js"></script> <script src="js/barra.js"></script>
<script> <script>
var asistencias = []; var asistencias = [];
var order = { var order = {
by: "", by: "",
order: false order: false
}; };
$(document).ready(function() { $(document).ready(function() {
var errores = 0; var errores = 0;
// Vista profesor // Vista profesor
$("#form-asistencia").keydown(function(event) { $("#form-asistencia").keydown(function(event) {
if (event.keyCode == 13) { if (event.keyCode == 13) {
event.preventDefault(); event.preventDefault();
$("#btn-buscar").click(); $("#btn-buscar").click();
return false; return false;
} }
}); });
$(document).on("click", "#btn-excel-asistencia", function() { $(document).on("click", "#btn-excel-asistencia", function() {
// send asistencias to page // send asistencias to page
var form = document.createElement("form"); var form = document.createElement("form");
form.setAttribute("method", "post"); form.setAttribute("method", "post");
form.setAttribute("action", "action/action_asistencias_excel.php"); form.setAttribute("action", "action/action_asistencias_excel.php");
form.setAttribute("target", "_blank"); form.setAttribute("target", "_blank");
var hiddenField = document.createElement("input"); var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden"); hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "asistencias"); hiddenField.setAttribute("name", "asistencias");
hiddenField.setAttribute("value", JSON.stringify(asistencias)); hiddenField.setAttribute("value", JSON.stringify(asistencias));
form.appendChild(hiddenField); form.appendChild(hiddenField);
document.body.appendChild(form); document.body.appendChild(form);
form.submit(); form.submit();
}) })
}); });
function validateDateRange(fecha_inicial, fecha_final) { function validateDateRange(fecha_inicial, fecha_final) {
var fecha_inicial = new Date(fecha_inicial); var fecha_inicial = new Date(fecha_inicial);
var fecha_final = new Date(fecha_final); var fecha_final = new Date(fecha_final);
return fecha_inicial <= fecha_final; return fecha_inicial <= fecha_final;
} }
function fillTable() { function fillTable() {
$("#table-asistencia").empty(); $("#table-asistencia").empty();
// add filter // add filter
if (asistencias.length == 0) { if (asistencias.length == 0) {
triggerMessage("No se encontraron resultados", "Sin resultados", "warning"); triggerMessage("No se encontraron resultados", "Sin resultados", "warning");
return; return;
} else if (asistencias.error != undefined) { } else if (asistencias.error != undefined) {
triggerMessage(asistencias.error, "Error en los datos"); triggerMessage(asistencias.error, "Error en los datos");
return; return;
} }
var template = $("template#asistencias"); var template = $("template#asistencias");
// append the template to the div#table-asistencia // append the template to the div#table-asistencia
$("#table-asistencia").append(template.html()); $("#table-asistencia").append(template.html());
// fill the table // fill the table
for (var i = 0; i < asistencias.length; i++) { for (var i = 0; i < asistencias.length; i++) {
var row = asistencias[i]; var row = asistencias[i];
var tr = var tr =
`<tr id="${row.profesor_id}"> `<tr id="${row.profesor_id}">
<td>${row.profesor_clave}</td> <td>${row.profesor_clave}</td>
<td>${row.profesor_nombre}</td> <td>${row.profesor_nombre}</td>
<td class="px-4 py-2" id="barra-${row.profesor_id}">${barra(row, <?= $retardos ? "true" : "false" ?>)}</td> <td class="px-4 py-2" id="barra-${row.profesor_id}">${barra(row, <?= $retardos ? "true" : "false" ?>)}</td>
<td> <td>
<a href="#" id="profesor-${row.profesor_id}"> <a href="#" id="profesor-${row.profesor_id}">
<?php echo $ICO['ojo']; ?> <?php echo $ICO['ojo']; ?>
</a> </a>
</td> </td>
</tr>`; </tr>`;
$("#table-asistencia table tbody").append(tr); $("#table-asistencia table tbody").append(tr);
} }
if (retardo) if (retardo)
$(".retardos-h").show(); $(".retardos-h").show();
else else
$(".retardos-h").hide(); $(".retardos-h").hide();
} }
function asistenciasOrderby(by) { function asistenciasOrderby(by) {
switch (by) { switch (by) {
case "cve": case "cve":
asistencias.sort((a, b) => (a.cve > b.cve) ? 1 : -1); asistencias.sort((a, b) => (a.cve > b.cve) ? 1 : -1);
break; break;
case "name": case "name":
asistencias.sort((a, b) => (a.name > b.name) ? 1 : -1); asistencias.sort((a, b) => (a.name > b.name) ? 1 : -1);
break; break;
case "absence": case "absence":
asistencias.sort((a, b) => (a.absence > b.absence) ? 1 : -1); asistencias.sort((a, b) => (a.absence > b.absence) ? 1 : -1);
break; break;
} }
fillTable(); fillTable();
// icon <i id="caret" class="ing-caret ing-fw"></i> // icon <i id="caret" class="ing-caret ing-fw"></i>
var column = $("#order-" + by) var column = $("#order-" + by)
if (order.by != by) if (order.by != by)
order.order = false; order.order = false;
if (order.order) if (order.order)
column.append("<i id='caret' class='ing-caret ing-fw'></i>"); column.append("<i id='caret' class='ing-caret ing-fw'></i>");
else else
column.append("<i id='caret' class='ing-caret ing-fw ing-rotate-180'></i>"); column.append("<i id='caret' class='ing-caret ing-fw ing-rotate-180'></i>");
order.by = by; order.by = by;
order.order = !order.order; order.order = !order.order;
$("#caret").toggleClass("ing-rotate-180"); $("#caret").toggleClass("ing-rotate-180");
// remove caret from other columns // remove caret from other columns
$("#order-cve, #order-name, #order-absence").not("#order-" + by).find("#caret").remove(); $("#order-cve, #order-name, #order-absence").not("#order-" + by).find("#caret").remove();
} }
$("#asistencia").on("submit", async function(e) { $("#asistencia").on("submit", async function(e) {
e.preventDefault(); e.preventDefault();
// validar que los datalist esten seleccionados // validar que los datalist esten seleccionados
if (!validateDatalist("#periodo") || !validateDatalist("#filter_facultad")) { if (!validateDatalist("#periodo") || !validateDatalist("#filter_facultad")) {
triggerMessage("Por favor, seleccione una opción de cada lista desplegable", "Error en los datos"); triggerMessage("Por favor, seleccione una opción de cada lista desplegable", "Error en los datos");
return; return;
} }
// suspender el boton // suspender el boton
$("#btn-buscar").prop("disabled", true); $("#btn-buscar").prop("disabled", true);
$("#btn-buscar").html("Buscando..."); $("#btn-buscar").html("Buscando...");
$formData = new FormData(); $formData = new FormData();
$formData.append("periodo", $("#periodo").val()); $formData.append("periodo", $("#periodo").val());
$formData.append("facultad", <?= $user->facultad['facultad_id'] ?>); $formData.append("facultad", <?= $user->facultad['facultad_id'] ?>);
$formData.append("carrera", $("#filter_carrera").val()); $formData.append("carrera", $("#filter_carrera").val());
$formData.append("clave", $("#filterClave").val().replace(/[a-zA-Z]{2}/, '').replace(/^0+/, '')); $formData.append("clave", $("#filterClave").val().replace(/[a-zA-Z]{2}/, '').replace(/^0+/, ''));
$formData.append("nombre", $("#filterNombre").val()); $formData.append("nombre", $("#filterNombre").val());
$formData.append("fecha_inicial", $("#fecha_inicial").val()); $formData.append("fecha_inicial", $("#fecha_inicial").val());
$formData.append("fecha_final", $("#fecha_final").val()); $formData.append("fecha_final", $("#fecha_final").val());
const data = await fetch("action/action_asistencias.php", { const data = await fetch("action/action_asistencias.php", {
method: "POST", method: "POST",
body: $formData, body: $formData,
}); });
const dataJson = await data.json(); const dataJson = await data.json();
if (dataJson.error) { if (dataJson.error) {
triggerMessage(data.error, "Error en los datos"); triggerMessage(data.error, "Error en los datos");
return; return;
} }
retardo = dataJson.retardo.retardo; retardo = dataJson.retardo.retardo;
asistencias = dataJson.reporte; asistencias = dataJson.reporte;
fillTable(); fillTable();
$("#btn-buscar").prop("disabled", false); $("#btn-buscar").prop("disabled", false);
$("#btn-buscar").html(`<?= $ICO['buscar'] ?> Buscar asistencias`); $("#btn-buscar").html(`<?= $ICO['buscar'] ?> Buscar asistencias`);
}); });
// function to put it into a loading state // function to put it into a loading state
$(document).on("click", "a[id^='profesor-']", function(e) { $(document).on("click", "a[id^='profesor-']", function(e) {
// loading state // loading state
e.preventDefault(); e.preventDefault();
// spinner // spinner
$(this).html( $(this).html(
` `
<div class="spinner-border spinner-border-sm text-primary" role="status"> <div class="spinner-border spinner-border-sm text-primary" role="status">
<span class="sr-only">Cargando...</span> <span class="sr-only">Cargando...</span>
</div> </div>
`) `)
// disable all the other links // disable all the other links
$("a[id^='profesor-']").not(this).prop("disabled", true); $("a[id^='profesor-']").not(this).prop("disabled", true);
// Make a form to send the data // Make a form to send the data
submit("vista_profesor.php", { submit("vista_profesor.php", {
id: $(this).attr("id").replace("profesor-", ""), id: $(this).attr("id").replace("profesor-", ""),
periodo: <?= $user->periodo_id ?>, periodo: <?= $user->periodo_id ?>,
facultad: <?= $user->facultad['facultad_id'] ?>, facultad: <?= $user->facultad['facultad_id'] ?>,
carrera: $('#filter_carrera').val(), carrera: $('#filter_carrera').val(),
clave: $('#filterClave').val().replace(/[a-zA-Z]{2}/, ''), clave: $('#filterClave').val().replace(/[a-zA-Z]{2}/, ''),
nombre: $('#filterNombre').val(), nombre: $('#filterNombre').val(),
fecha_inicial: $('#fecha_inicial').val(), fecha_inicial: $('#fecha_inicial').val(),
fecha_final: $('#fecha_final').val() fecha_final: $('#fecha_final').val()
}); });
}); });
<?php if (!empty($_POST)) { ?> <?php if (!empty($_POST)) { ?>
$('#asistencia').submit(); $('#asistencia').submit();
<?php } ?> <?php } ?>
</script> </script>
</body> </body>
</html> </html>

View File

@@ -1,50 +1,50 @@
<?php <?php
/** /**
* PHPMailer SPL autoloader. * PHPMailer SPL autoloader.
* PHP Version 5 * PHP Version 5
* @package PHPMailer * @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> * @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com> * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder) * @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon * @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski * @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost * @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT * @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. * FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/** /**
* PHPMailer SPL autoloader. * PHPMailer SPL autoloader.
* @param string $classname The name of the class to load * @param string $classname The name of the class to load
*/ */
function PHPMailerAutoload($classname) function PHPMailerAutoload($classname)
{ {
//Can't use __DIR__ as it's only in PHP 5.3+ //Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php'; $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
if (is_readable($filename)) { if (is_readable($filename)) {
require $filename; require $filename;
} }
} }
if (version_compare(PHP_VERSION, '5.1.2', '>=')) { if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2 //SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) { if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true); spl_autoload_register('PHPMailerAutoload', true, true);
} else { } else {
spl_autoload_register('PHPMailerAutoload'); spl_autoload_register('PHPMailerAutoload');
} }
} else { } else {
/** /**
* Fall back to traditional autoload for old PHP versions * Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load * @param string $classname The name of the class to load
*/ */
spl_autoload_register($classname); spl_autoload_register($classname);
/*function __autoload($classname) /*function __autoload($classname)
{ {
PHPMailerAutoload($classname); PHPMailerAutoload($classname);
}*/ }*/
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,252 +1,252 @@
<style> <style>
details { details {
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
padding: 0.5em 0.5em 0; padding: 0.5em 0.5em 0;
margin: 0.5em 0; margin: 0.5em 0;
} }
summary { summary {
font-weight: bold; font-weight: bold;
margin: -0.5em -0.5em 0; margin: -0.5em -0.5em 0;
padding: 0.5em; padding: 0.5em;
} }
details[open] { details[open] {
padding: 0.5em; padding: 0.5em;
} }
details[open] summary { details[open] summary {
border-bottom: 1px solid #aaa; border-bottom: 1px solid #aaa;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
table { table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
margin: 20px 0; margin: 20px 0;
} }
th, th,
td { td {
padding: 8px; padding: 8px;
border: 1px solid #ccc; border: 1px solid #ccc;
text-align: left; text-align: left;
} }
th { th {
background-color: #f2f2f2; background-color: #f2f2f2;
} }
tr:nth-child(even):not(.empty):not(.area-comun) { tr:nth-child(even):not(.empty):not(.area-comun) {
background-color: #f9f9f9; background-color: #f9f9f9;
} }
.json-container { .json-container {
white-space: pre-wrap; white-space: pre-wrap;
/* Since JSON is formatted with whitespace, this will keep formatting */ /* Since JSON is formatted with whitespace, this will keep formatting */
word-break: break-word; word-break: break-word;
/* To prevent horizontal scrolling */ /* To prevent horizontal scrolling */
max-height: 150px; max-height: 150px;
/* Set a max-height and add scroll to prevent very long JSON from cluttering the table */ /* Set a max-height and add scroll to prevent very long JSON from cluttering the table */
overflow-y: auto; overflow-y: auto;
} }
.empty { .empty {
/* rosa pastel */ /* rosa pastel */
background-color: #ffe8f4; background-color: #ffe8f4;
} }
.area-comun { .area-comun {
/* naranja pastel */ /* naranja pastel */
background-color: #ffe9d4; background-color: #ffe9d4;
} }
</style> </style>
<?php <?php
/* /*
idPeriodo: identificador del periodo a consultar (obligatorio, número entero) idPeriodo: identificador del periodo a consultar (obligatorio, número entero)
claveFacultad: clave de la facultad a consultar (opcional, cadena) claveFacultad: clave de la facultad a consultar (opcional, cadena)
claveCarrera: clave de la carrera a consultar (opcional, cadena) claveCarrera: clave de la carrera a consultar (opcional, cadena)
claveProfesor: clave del empleado a consultar (opcional, cadena) claveProfesor: clave del empleado a consultar (opcional, cadena)
fecha: fecha de la clase (opcional, cadena en formato yyyy-MM-dd) fecha: fecha de la clase (opcional, cadena en formato yyyy-MM-dd)
*/ */
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
ini_set('post_max_size', 1); ini_set('post_max_size', 1);
ini_set('max_execution_time', 8 * 60); ini_set('max_execution_time', 8 * 60);
error_reporting(E_ALL); error_reporting(E_ALL);
date_default_timezone_set('America/Mexico_City'); date_default_timezone_set('America/Mexico_City');
$ruta = "../"; $ruta = "../";
$ruta_superior = dirname(__DIR__); $ruta_superior = dirname(__DIR__);
require_once $ruta_superior . "/include/bd_pdo.php"; require_once $ruta_superior . "/include/bd_pdo.php";
require_once __DIR__ . "/token.php"; require_once __DIR__ . "/token.php";
require_once __DIR__ . "/LogCambios.php"; require_once __DIR__ . "/LogCambios.php";
$fecha = isset($_GET["fecha"]) ? $_GET["fecha"] : date("Y-m-d"); $fecha = isset($_GET["fecha"]) ? $_GET["fecha"] : date("Y-m-d");
$periodos = $db $periodos = $db
->where("id_periodo_sgu", 0, ">") ->where("id_periodo_sgu", 0, ">")
->where("periodo_fecha_inicio", $fecha, "<=") ->where("periodo_fecha_inicio", $fecha, "<=")
->where("periodo_fecha_fin", $fecha, ">=") ->where("periodo_fecha_fin", $fecha, ">=")
->orderBy("periodo_id") ->orderBy("periodo_id")
->get("periodo"); ->get("periodo");
?> ?>
<nav> <nav>
<form action="" method="get"> <form action="" method="get">
<label for="fecha">Fecha</label> <label for="fecha">Fecha</label>
<input type="date" name="fecha" id="fecha" value="<?= $fecha ?>"> <input type="date" name="fecha" id="fecha" value="<?= $fecha ?>">
<button type="submit">Buscar</button> <button type="submit">Buscar</button>
</form> </form>
<details> <details>
<summary>Periodos</summary> <summary>Periodos</summary>
<pre> <pre>
<code><?= json_encode($periodos, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code> <code><?= json_encode($periodos, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code>
</pre> </pre>
</details> </details>
<?php <?php
$horarios = array(); $horarios = array();
foreach (array_column($periodos, "id_periodo_sgu") as $idPeriodo) { foreach (array_column($periodos, "id_periodo_sgu") as $idPeriodo) {
$curl = curl_init(); $curl = curl_init();
$params = array( $params = array(
'idPeriodo' => $idPeriodo, 'idPeriodo' => $idPeriodo,
'fecha' => $fecha, 'fecha' => $fecha,
); );
curl_setopt_array($curl, [ curl_setopt_array($curl, [
CURLOPT_URL => 'https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/seleccionar', CURLOPT_URL => 'https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/seleccionar',
CURLOPT_RETURNTRANSFER => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => json_encode($params), CURLOPT_POSTFIELDS => json_encode($params),
CURLOPT_HTTPHEADER => [ CURLOPT_HTTPHEADER => [
"token: $token", "token: $token",
'username: SGU_APSA_AUD_ASIST', 'username: SGU_APSA_AUD_ASIST',
'Content-Type: application/json', 'Content-Type: application/json',
], ],
]); ]);
$response = curl_exec($curl); $response = curl_exec($curl);
$err = curl_error($curl); $err = curl_error($curl);
curl_close($curl); curl_close($curl);
$response = json_decode($response, true, 512, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); $response = json_decode($response, true, 512, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$horarios = array_merge($horarios, $response); $horarios = array_merge($horarios, $response);
?> ?>
<details> <details>
<summary>Periodo <summary>Periodo
<?= $idPeriodo ?> <?= $idPeriodo ?>
</summary> </summary>
<pre><code><?= json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre> <pre><code><?= json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre>
</details> </details>
<?php } ?> <?php } ?>
</nav> </nav>
<main> <main>
<p> <p>
<?= count($horarios) ?> horarios encontrados para <?= count($horarios) ?> horarios encontrados para
<?= $fecha ?> <?= $fecha ?>
</p> </p>
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Materia en SGU</th> <th>Materia en SGU</th>
<th>Materia en Postgres</th> <th>Materia en Postgres</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
// $horarios with unique "NombreMateria" field // $horarios with unique "NombreMateria" field
$horarios = array_map("unserialize", array_unique(array_map("serialize", $horarios))); $horarios = array_map("unserialize", array_unique(array_map("serialize", $horarios)));
foreach ($horarios as $horario) { foreach ($horarios as $horario) {
$materias = $db $materias = $db
->where("materia_nombre", trim($horario["NombreMateria"]), "ILIKE") ->where("materia_nombre", trim($horario["NombreMateria"]), "ILIKE")
->join("carrera", "carrera.carrera_id = materia.carrera_id") ->join("carrera", "carrera.carrera_id = materia.carrera_id")
->join("facultad", "facultad.facultad_id = carrera.facultad_id") ->join("facultad", "facultad.facultad_id = carrera.facultad_id")
->get("materia"); ->get("materia");
if ( if (
count(array_filter($materias, fn($m) => count(array_filter($materias, fn($m) =>
$m["clave_materia"] == trim($horario["ClaveMateria"]) and $m["clave_materia"] == trim($horario["ClaveMateria"]) and
$m["clave_carrera"] == trim($horario["ClaveCarrera"]))) > 0 $m["clave_carrera"] == trim($horario["ClaveCarrera"]))) > 0
) { ) {
continue; continue;
} }
// si de las materias alguna tiene carrera_id entre 1 y 4 entonces es de área común // si de las materias alguna tiene carrera_id entre 1 y 4 entonces es de área común
$area_comun = count(array_filter($materias, fn($m) => $m["carrera_id"] >= 1 and $m["carrera_id"] <= 4)) > 0; $area_comun = count(array_filter($materias, fn($m) => $m["carrera_id"] >= 1 and $m["carrera_id"] <= 4)) > 0;
$vacío = count($materias) == 0; $vacío = count($materias) == 0;
?> ?>
<!-- si es vacío ponle la clase empty y si es área común ponle la clase area-comun --> <!-- si es vacío ponle la clase empty y si es área común ponle la clase area-comun -->
<tr class="<?= $vacío ? "empty" : "" ?> <?= $area_comun ? "area-comun" : "" ?>"> <tr class="<?= $vacío ? "empty" : "" ?> <?= $area_comun ? "area-comun" : "" ?>">
<td class="json-container"> <td class="json-container">
<details> <details>
<summary>Horario</summary> <summary>Horario</summary>
<pre><code><?= json_encode($horario, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre> <pre><code><?= json_encode($horario, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre>
</details> </details>
<?= json_encode(array_intersect_key($horario, array_flip(["ClaveMateria", "NombreMateria", "ClaveCarrera", "Dependencia"])), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?> <?= json_encode(array_intersect_key($horario, array_flip(["ClaveMateria", "NombreMateria", "ClaveCarrera", "Dependencia"])), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>
</td> </td>
<td class="json-container"> <td class="json-container">
<?php if ($vacío) { ?> <?php if ($vacío) { ?>
<p>No se encontraron materias</p> <p>No se encontraron materias</p>
<?php } else { ?> <?php } else { ?>
<details> <details>
<summary>Materias</summary> <summary>Materias</summary>
<pre><code><?= json_encode($materias, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre> <pre><code><?= json_encode($materias, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre>
</details> </details>
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Materia</th> <th>Materia</th>
<th>Carrera</th> <th>Carrera</th>
<th>Facultad</th> <th>Facultad</th>
<th>Acciones</th> <th>Acciones</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<script> <script>
async function copiar_seleccionados() { async function copiar_seleccionados() {
// en mi clipboard quiero (join con ,) // en mi clipboard quiero (join con ,)
const materias_seleccionadas = Array.from(document.querySelectorAll("input[name='materia_id']:checked")) const materias_seleccionadas = Array.from(document.querySelectorAll("input[name='materia_id']:checked"))
.map(input => input.value) .map(input => input.value)
.join(","); .join(",");
// copiar al clipboard // copiar al clipboard
await navigator.clipboard.writeText(materias_seleccionadas); await navigator.clipboard.writeText(materias_seleccionadas);
// mostrar mensaje de éxito // mostrar mensaje de éxito
alert("Copiado al portapapeles"); alert("Copiado al portapapeles");
} }
</script> </script>
<?php foreach ($materias as $materia) { ?> <?php foreach ($materias as $materia) { ?>
<tr> <tr>
<td> <td>
<input type="checkbox" name="materia_id" id="materia_id" <input type="checkbox" name="materia_id" id="materia_id"
value="<?= $materia["materia_id"] ?>"> value="<?= $materia["materia_id"] ?>">
</td> </td>
<td> <td>
<?= $materia["materia_id"] ?> <?= $materia["materia_id"] ?>
<small> <small>
( (
<?= $materia["clave_materia"] ?>) <?= $materia["clave_materia"] ?>)
</small> </small>
<?= $materia["materia_nombre"] ?> <?= $materia["materia_nombre"] ?>
</td> </td>
<td> <td>
<small> <small>
( (
<?= $materia["clave_carrera"] ?>) <?= $materia["clave_carrera"] ?>)
</small> </small>
<?= $materia["carrera_nombre"] ?> <?= $materia["carrera_nombre"] ?>
</td> </td>
<td> <td>
<small> <small>
( (
<?= $materia["clave_dependencia"] ?>) <?= $materia["clave_dependencia"] ?>)
</small> </small>
<?= $materia["facultad_nombre"] ?> <?= $materia["facultad_nombre"] ?>
</td> </td>
</tr> </tr>
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
<?php } ?> <?php } ?>
</td> </td>
</tr> </tr>
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
</main> </main>

View File

@@ -1,149 +1,149 @@
<style> <style>
details { details {
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
padding: 0.5em 0.5em 0; padding: 0.5em 0.5em 0;
margin: 0.5em 0; margin: 0.5em 0;
} }
summary { summary {
font-weight: bold; font-weight: bold;
margin: -0.5em -0.5em 0; margin: -0.5em -0.5em 0;
padding: 0.5em; padding: 0.5em;
} }
details[open] { details[open] {
padding: 0.5em; padding: 0.5em;
} }
details[open] summary { details[open] summary {
border-bottom: 1px solid #aaa; border-bottom: 1px solid #aaa;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
table { table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
margin: 20px 0; margin: 20px 0;
} }
th, th,
td { td {
padding: 8px; padding: 8px;
border: 1px solid #ccc; border: 1px solid #ccc;
text-align: left; text-align: left;
} }
th { th {
background-color: #f2f2f2; background-color: #f2f2f2;
} }
.json-container { .json-container {
white-space: pre-wrap; white-space: pre-wrap;
/* Since JSON is formatted with whitespace, this will keep formatting */ /* Since JSON is formatted with whitespace, this will keep formatting */
word-break: break-word; word-break: break-word;
/* To prevent horizontal scrolling */ /* To prevent horizontal scrolling */
max-height: 150px; max-height: 150px;
/* Set a max-height and add scroll to prevent very long JSON from cluttering the table */ /* Set a max-height and add scroll to prevent very long JSON from cluttering the table */
overflow-y: auto; overflow-y: auto;
} }
.empty { .empty {
/* rosa pastel */ /* rosa pastel */
background-color: #ffe8f4; background-color: #ffe8f4;
} }
.no-igual { .no-igual {
/* púrpura pastel */ /* púrpura pastel */
background-color: #f4e8ff; background-color: #f4e8ff;
} }
</style> </style>
<?php <?php
/* /*
idPeriodo: identificador del periodo a consultar (obligatorio, número entero) idPeriodo: identificador del periodo a consultar (obligatorio, número entero)
claveFacultad: clave de la facultad a consultar (opcional, cadena) claveFacultad: clave de la facultad a consultar (opcional, cadena)
claveCarrera: clave de la carrera a consultar (opcional, cadena) claveCarrera: clave de la carrera a consultar (opcional, cadena)
claveProfesor: clave del empleado a consultar (opcional, cadena) claveProfesor: clave del empleado a consultar (opcional, cadena)
fecha: fecha de la clase (opcional, cadena en formato yyyy-MM-dd) fecha: fecha de la clase (opcional, cadena en formato yyyy-MM-dd)
*/ */
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
ini_set('post_max_size', 1); ini_set('post_max_size', 1);
ini_set('max_execution_time', 8 * 60); ini_set('max_execution_time', 8 * 60);
error_reporting(E_ALL); error_reporting(E_ALL);
date_default_timezone_set('America/Mexico_City'); date_default_timezone_set('America/Mexico_City');
$ruta = "../"; $ruta = "../";
$ruta_superior = dirname(__DIR__); $ruta_superior = dirname(__DIR__);
require_once $ruta_superior . "/include/bd_pdo.php"; require_once $ruta_superior . "/include/bd_pdo.php";
require_once __DIR__ . "/token.php"; require_once __DIR__ . "/token.php";
require_once __DIR__ . "/LogCambios.php"; require_once __DIR__ . "/LogCambios.php";
$salon = array(); $salon = array();
$curl = curl_init(); $curl = curl_init();
curl_setopt_array($curl, [ curl_setopt_array($curl, [
CURLOPT_URL => CURLOPT_URL =>
'https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/catalogos/espacios/seleccionar', 'https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/catalogos/espacios/seleccionar',
CURLOPT_RETURNTRANSFER => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => json_encode([]), CURLOPT_POSTFIELDS => json_encode([]),
CURLOPT_HTTPHEADER => [ CURLOPT_HTTPHEADER => [
"token: $token", "token: $token",
'username: SGU_APSA_AUD_ASIST', 'username: SGU_APSA_AUD_ASIST',
'Content-Type: application/json', 'Content-Type: application/json',
], ],
]); ]);
$response = curl_exec($curl); $response = curl_exec($curl);
$err = curl_error($curl); $err = curl_error($curl);
curl_close($curl); curl_close($curl);
$json_flags = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT; $json_flags = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT;
$salones = json_decode($response, true, 512, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); $salones = json_decode($response, true, 512, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
?> ?>
<main> <main>
<p> <p>
<?= count($salones) ?> salones encontrados <?= count($salones) ?> salones encontrados
</p> </p>
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Salones en SGU</th> <th>Salones en SGU</th>
<th>SALONES en Postgres</th> <th>SALONES en Postgres</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
foreach ($salones as $salon) { foreach ($salones as $salon) {
$salon_db = $db->where("id_espacio_sgu", $salon["IdEspacio"])->get("salon"); $salon_db = $db->where("id_espacio_sgu", $salon["IdEspacio"])->get("salon");
// si de el salon es igual NombreEspacio == salon // si de el salon es igual NombreEspacio == salon
$vacío = empty($salon_db); $vacío = empty($salon_db);
$igual = $salon["NombreEspacio"] == ($salon["salon"] ?? ""); $igual = $salon["NombreEspacio"] == ($salon["salon"] ?? "");
if ($vacío) { if ($vacío) {
$db->insert("salon", [ $db->insert("salon", [
"id_espacio_sgu" => $salon["IdEspacio"], "id_espacio_sgu" => $salon["IdEspacio"],
"salon" => $salon["NombreEspacio"], "salon" => $salon["NombreEspacio"],
"id_espacio_padre" => $salon["IdEspacioPadre"] > 0 ? $salon["IdEspacioPadre"] : null, "id_espacio_padre" => $salon["IdEspacioPadre"] > 0 ? $salon["IdEspacioPadre"] : null,
]); ]);
} else if (!$igual) { } else if (!$igual) {
$db->where("id_espacio_sgu", $salon["IdEspacio"])->update("salon", [ $db->where("id_espacio_sgu", $salon["IdEspacio"])->update("salon", [
"salon" => $salon["NombreEspacio"], "salon" => $salon["NombreEspacio"],
// "id_espacio_padre" => $salon["IdEspacioPadre"] > 0 ? $salon["IdEspacioPadre"] : null, // "id_espacio_padre" => $salon["IdEspacioPadre"] > 0 ? $salon["IdEspacioPadre"] : null,
]); ]);
} }
?> ?>
<tr class="<?= $igual ? "empty" : "no-igual" ?>"> <tr class="<?= $igual ? "empty" : "no-igual" ?>">
<td class="json-container"> <td class="json-container">
<?= json_encode($salon, $json_flags) ?> <?= json_encode($salon, $json_flags) ?>
</td> </td>
<td class="json-container"> <td class="json-container">
<?= json_encode($salon_db, $json_flags) ?> <?= json_encode($salon_db, $json_flags) ?>
</td> </td>
</tr> </tr>
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
</main> </main>

File diff suppressed because one or more lines are too long

5
server.info.php Normal file
View File

@@ -0,0 +1,5 @@
<pre>
<?=
json_encode($_SERVER);
?>
</pre>

Some files were not shown because too many files have changed in this diff Show More