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

34
.gitignore vendored
View File

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

View File

@@ -1,13 +1,13 @@
# Checador de Profesor de la Universidad La Salle 🎓
![Imagen Institucional de La Salle](https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png)
## 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.
## Características
- Registro de entrada de profesores.
- Base de datos segura con información del profesor.
- Herramientas de auditoría para supervisores.
# Checador de Profesor de la Universidad La Salle 🎓
![Imagen Institucional de La Salle](https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png)
## 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.
## Características
- Registro de entrada de profesores.
- Base de datos segura con información del profesor.
- Herramientas de auditoría para supervisores.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,20 +1,20 @@
<?php
require_once '../class/mailer.php';
require_once('../include/phpmailer/PHPMailerAutoload.php');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(!isset($_GET["correo"])){
echo "Debes especificar la dirección a la que se enviará el correo <strong>?correo=</strong>";
exit();
}
$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>";
$asunto="Prueba";
Mailer::enviarCorreo($to, $asunto, $texto, true);
echo "Enviado!".date("H:i:s");
?>
<?php
require_once '../class/mailer.php';
require_once('../include/phpmailer/PHPMailerAutoload.php');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(!isset($_GET["correo"])){
echo "Debes especificar la dirección a la que se enviará el correo <strong>?correo=</strong>";
exit();
}
$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>";
$asunto="Prueba";
Mailer::enviarCorreo($to, $asunto, $texto, true);
echo "Enviado!".date("H:i:s");
?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,198 +1,198 @@
<?php
/*
Cambia de estado la reposición
*/
$pag = "../solicitudes_autorizar.php";
$ruta = "../";
require_once "../class/c_login.php";
require_once "../class/manda_correo.php";
define("COORDINADOR", 9);
define("SUPERVISOR", 7);
define("ENVIO_CORREOS", true);
// check if the session is started
if (!isset($_SESSION['user']))
die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']);
$pag = "../solicitudes_autorizar.php";
if(!isset($_POST["id"]) || !isset($_POST["edo"]) ){
header("Location: ".$pag."?error=0");
exit();
}
$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
$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
if(isset($_POST["salon"]) && $_POST["salon"] != "")
$salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//--------------
//Obtiene datos de salón asignado
$salon_desc = "Pendiente";
if(!empty($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]
);
if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){
$salon_desc = "Pendiente";
}else{
$salon_json = json_decode($salon_rs["salon_array"], true);
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
unset($salon_json[0]);
}
$salon_desc = join(" / ",$salon_json);
}
}
$solicitud_rs = $db->querySingle('SELECT * from fs_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL)', [':id' => $id_sol]);
if($edo == 4){//cancelación
$motivo = "";
if(isset($_POST["motivo"]) && $_POST["motivo"] != "")
$motivo = trim($_POST["motivo"]);
$db->querySingle('SELECT fu_solicitud_cancela(:id, :motivo)',
[':id' => $id_sol, ':motivo' => $motivo]
);
}else{
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 )
$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]
);
}else{
$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]
);
}
}
//fecha_nueva, fecha_clase
$fecha_nueva = $solicitud_rs["fecha_nueva"];
$hora_nueva = $solicitud_rs["hora_nueva"];
$fecha_clase = $solicitud_rs["fecha_clase"];
$hora_clase = $solicitud_rs["horario_hora"];
$facultad = $solicitud_rs["facultad"]??"";
//echo $fecha_nueva." ** ".$fecha_clase;
if(!empty($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 = $fecha_nueva." ".$hora_nueva;
}
if(!empty($fecha_clase)){
$dia_falta = date('w', strtotime($fecha_clase));
//$fecha_clase = DateTime::createFromFormat('d/m/Y', $fecha_clase)->format('Y-m-d');
}
switch($edo){
case 2://Correo a supervisor
switch($tipo){
case 1://Reposición
$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><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;
case 2:
$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>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. </b>";
break;
case 3:
$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>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. </b>";
break;
case 4:
$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><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;
}
//$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);
$ok = 0;
break;
case 3://Correo a coordinador, profesor y jefe
switch($tipo){
case 1://Reposición
$asunto = "Reposición nueva autorizada ".isset($solicitud_rs["materia"])?$solicitud_rs["materia"]:"";
$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>";
break;
case 2:
$asunto = "Cambio de salón autorizado";
$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>";
break;
case 3:
$asunto = "Asignación de espacio autorizada";
$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>";
break;
case 4:
$asunto = "Cambio permanente autorizado ".$solicitud_rs["materia_nombre"];
$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>";
break;
}
$ok = 0;
$db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)',
[':id' => $id_sol, ':sup'=>$user->user["id"]]
);
MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR| MandaCorreos::PROFESOR| MandaCorreos::JEFE);
break;
case 4://Correo a coordinador, profesor y jefe
switch($tipo){
case 1://Reposición
$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>";
break;
case 2:
$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>";
break;
case 3:
$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>";
break;
case 4:
$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>";
break;
}
$texto .= "<p style='font-style:italic; padding-left:25px'>".$solicitud_rs["motivo"]."</p>";
$ok = 1;
$db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)',
[':id' => $id_sol, ':sup'=>$user->user["id"]]
);
MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR| MandaCorreos::PROFESOR| MandaCorreos::JEFE);
break;
}
/*
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/
header("Location: ".$pag."?ok=".$ok);
exit();
?>
<?php
/*
Cambia de estado la reposición
*/
$pag = "../solicitudes_autorizar.php";
$ruta = "../";
require_once "../class/c_login.php";
require_once "../class/manda_correo.php";
define("COORDINADOR", 9);
define("SUPERVISOR", 7);
define("ENVIO_CORREOS", true);
// check if the session is started
if (!isset($_SESSION['user']))
die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']);
$pag = "../solicitudes_autorizar.php";
if(!isset($_POST["id"]) || !isset($_POST["edo"]) ){
header("Location: ".$pag."?error=0");
exit();
}
$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
$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
if(isset($_POST["salon"]) && $_POST["salon"] != "")
$salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//--------------
//Obtiene datos de salón asignado
$salon_desc = "Pendiente";
if(!empty($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]
);
if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){
$salon_desc = "Pendiente";
}else{
$salon_json = json_decode($salon_rs["salon_array"], true);
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
unset($salon_json[0]);
}
$salon_desc = join(" / ",$salon_json);
}
}
$solicitud_rs = $db->querySingle('SELECT * from fs_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL)', [':id' => $id_sol]);
if($edo == 4){//cancelación
$motivo = "";
if(isset($_POST["motivo"]) && $_POST["motivo"] != "")
$motivo = trim($_POST["motivo"]);
$db->querySingle('SELECT fu_solicitud_cancela(:id, :motivo)',
[':id' => $id_sol, ':motivo' => $motivo]
);
}else{
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 )
$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]
);
}else{
$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]
);
}
}
//fecha_nueva, fecha_clase
$fecha_nueva = $solicitud_rs["fecha_nueva"];
$hora_nueva = $solicitud_rs["hora_nueva"];
$fecha_clase = $solicitud_rs["fecha_clase"];
$hora_clase = $solicitud_rs["horario_hora"];
$facultad = $solicitud_rs["facultad"]??"";
//echo $fecha_nueva." ** ".$fecha_clase;
if(!empty($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 = $fecha_nueva." ".$hora_nueva;
}
if(!empty($fecha_clase)){
$dia_falta = date('w', strtotime($fecha_clase));
//$fecha_clase = DateTime::createFromFormat('d/m/Y', $fecha_clase)->format('Y-m-d');
}
switch($edo){
case 2://Correo a supervisor
switch($tipo){
case 1://Reposición
$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><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;
case 2:
$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>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. </b>";
break;
case 3:
$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>El día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. </b>";
break;
case 4:
$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><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;
}
//$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);
$ok = 0;
break;
case 3://Correo a coordinador, profesor y jefe
switch($tipo){
case 1://Reposición
$asunto = "Reposición nueva autorizada ".isset($solicitud_rs["materia"])?$solicitud_rs["materia"]:"";
$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>";
break;
case 2:
$asunto = "Cambio de salón autorizado";
$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>";
break;
case 3:
$asunto = "Asignación de espacio autorizada";
$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>";
break;
case 4:
$asunto = "Cambio permanente autorizado ".$solicitud_rs["materia_nombre"];
$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>";
break;
}
$ok = 0;
$db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)',
[':id' => $id_sol, ':sup'=>$user->user["id"]]
);
MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR| MandaCorreos::PROFESOR| MandaCorreos::JEFE);
break;
case 4://Correo a coordinador, profesor y jefe
switch($tipo){
case 1://Reposición
$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>";
break;
case 2:
$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>";
break;
case 3:
$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>";
break;
case 4:
$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>";
break;
}
$texto .= "<p style='font-style:italic; padding-left:25px'>".$solicitud_rs["motivo"]."</p>";
$ok = 1;
$db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)',
[':id' => $id_sol, ':sup'=>$user->user["id"]]
);
MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR| MandaCorreos::PROFESOR| MandaCorreos::JEFE);
break;
}
/*
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/
header("Location: ".$pag."?ok=".$ok);
exit();
?>

View File

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

View File

@@ -1,206 +1,206 @@
<?php
/*
* Inserta reposición
*/
$pag = "../solicitud_crear.php";
$ruta = "../";
require_once "../class/c_login.php";
require_once "../class/manda_correo.php";
define("COORDINADOR", 9);
define("ENVIO_CORREOS", true);
// check if the session is started
if (!isset($_SESSION['user']))
die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']);
//$user->access();
$estado = filter_input(INPUT_POST, "estado", 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
$bloque = filter_input(INPUT_POST, "bloque", 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 = trim(htmlspecialchars($_POST["fecha_nueva"], ENT_QUOTES, "UTF-8"));//Reposicion
$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
$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
$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
$salon = NULL;
/*if(!$user->jefe_carrera){//coordinador
if(isset($_POST["salon"]) && $_POST["salon"] != "")
$salon = filter_input(INPUT_POST, "dlSalon", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
}*/
if(empty($_POST["prof"]))
$prof = $user->user["id"];
else
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//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_tiempo = $duracion_rs["duracion_interval"];
//-- Obtiene datos de horario regular de clase
if($horario!= null && $tipo !=3)
{
$horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor',
[':hor' => $horario]
);
$materia = $horario_rs["materia_id"];
$dia = $horario_rs["horario_dia"];
$hora_orig = $horario_rs["horario_hora"];
}else{
$dia = date('w', strtotime($fecha));
}
$hora = $hora_ini.":".$min_ini.":00";
switch($tipo){
case 1://Reposición
$fecha_nueva = $fecha;
$fecha_clase = $fecha_falta;
$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;
$dia_new = date('w', strtotime($fecha_new));
$fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_falta));
//Valida que tenga clase en la fecha de falta
if(intval($dia) != intval($dia_falta)){
header("Location:".$pag."?error=11");
/*print_r($_POST);
echo 'SELECT * from horario_view where horario_id = '.$horario;
echo intval($dia)." != ".intval($dia_falta);*/
exit();
}
break;
case 2://Cambio
$fecha_nueva = $fecha_cambio;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio));
break;
case 3://Solicitud de espacio
$fecha_nueva = $fecha;
$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;
$dia_new = date('w', strtotime($fecha_new));
break;
case 4://Cambio permanente
$fecha_nueva = $fecha;
$fecha_clase = $fecha_cambio;
$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_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new));
break;
}
if(isset($materia) && $materia!= null && $tipo !=3){
//Obtiene 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";
switch($tipo){
case 1://Reposición
$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]
)["traslape_profesor_reposicion"];
if($traslape){
//print_r($_POST);
//echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)";
header("Location:".$pag."?error=9");
exit();
}
$db_params=[
":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"],
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
];
$asunto = "Solicitud - Reposición nueva";
$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>";
/*
$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."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
break;
case 2:
$db_params=[
":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"],
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
];
$asunto = "Solicitud - Cambio de salón";
$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>";
/*
$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."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/
break;
case 3:
$db_params=[
":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario,
":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"],
":duracion"=>$duracion_tiempo
];
$query = "null, :f_nueva, :hora_nueva, :prof, :desc, :edo, :alumnos, :aula, :solicitudtipo, :usr, :duracion";
$asunto = "Solicitud - Asignación de espacio";
$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>";
break;
case 4:
$db_params=[
":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario,
":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"],
":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";
$asunto = "Solicitud - Cambio permanente";
$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>";
break;
}
try{
$db->query("SELECT * from fi_solicitud($query)", $db_params);
}catch(Exception $e){
echo "ERROR Cambio<br>".$e->getMessage();
echo $query;
print_r($db_params);
//header("Location: ".$pag."?error=1");
exit();
}
if(!MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR)){
echo "ERROR Correo<br>";
//header("Location: ".$pag."?error=2");
exit();
}
header("Location: ".$pag."?ok=0");
exit();
?>
<?php
/*
* Inserta reposición
*/
$pag = "../solicitud_crear.php";
$ruta = "../";
require_once "../class/c_login.php";
require_once "../class/manda_correo.php";
define("COORDINADOR", 9);
define("ENVIO_CORREOS", true);
// check if the session is started
if (!isset($_SESSION['user']))
die('No se ha iniciado sesión');
$user = unserialize($_SESSION['user']);
//$user->access();
$estado = filter_input(INPUT_POST, "estado", 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
$bloque = filter_input(INPUT_POST, "bloque", 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 = trim(htmlspecialchars($_POST["fecha_nueva"], ENT_QUOTES, "UTF-8"));//Reposicion
$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
$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
$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
$salon = NULL;
/*if(!$user->jefe_carrera){//coordinador
if(isset($_POST["salon"]) && $_POST["salon"] != "")
$salon = filter_input(INPUT_POST, "dlSalon", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
}*/
if(empty($_POST["prof"]))
$prof = $user->user["id"];
else
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//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_tiempo = $duracion_rs["duracion_interval"];
//-- Obtiene datos de horario regular de clase
if($horario!= null && $tipo !=3)
{
$horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor',
[':hor' => $horario]
);
$materia = $horario_rs["materia_id"];
$dia = $horario_rs["horario_dia"];
$hora_orig = $horario_rs["horario_hora"];
}else{
$dia = date('w', strtotime($fecha));
}
$hora = $hora_ini.":".$min_ini.":00";
switch($tipo){
case 1://Reposición
$fecha_nueva = $fecha;
$fecha_clase = $fecha_falta;
$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;
$dia_new = date('w', strtotime($fecha_new));
$fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_falta));
//Valida que tenga clase en la fecha de falta
if(intval($dia) != intval($dia_falta)){
header("Location:".$pag."?error=11");
/*print_r($_POST);
echo 'SELECT * from horario_view where horario_id = '.$horario;
echo intval($dia)." != ".intval($dia_falta);*/
exit();
}
break;
case 2://Cambio
$fecha_nueva = $fecha_cambio;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio));
break;
case 3://Solicitud de espacio
$fecha_nueva = $fecha;
$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;
$dia_new = date('w', strtotime($fecha_new));
break;
case 4://Cambio permanente
$fecha_nueva = $fecha;
$fecha_clase = $fecha_cambio;
$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_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new));
break;
}
if(isset($materia) && $materia!= null && $tipo !=3){
//Obtiene 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";
switch($tipo){
case 1://Reposición
$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]
)["traslape_profesor_reposicion"];
if($traslape){
//print_r($_POST);
//echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)";
header("Location:".$pag."?error=9");
exit();
}
$db_params=[
":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"],
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
];
$asunto = "Solicitud - Reposición nueva";
$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>";
/*
$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."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
break;
case 2:
$db_params=[
":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"],
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
];
$asunto = "Solicitud - Cambio de salón";
$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>";
/*
$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."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/
break;
case 3:
$db_params=[
":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario,
":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"],
":duracion"=>$duracion_tiempo
];
$query = "null, :f_nueva, :hora_nueva, :prof, :desc, :edo, :alumnos, :aula, :solicitudtipo, :usr, :duracion";
$asunto = "Solicitud - Asignación de espacio";
$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>";
break;
case 4:
$db_params=[
":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario,
":edo"=>1, ":alumnos"=>$alumnos, ":aula"=>$aula, ":solicitudtipo"=>$tipo, ":usr"=>$user->user["id"],
":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";
$asunto = "Solicitud - Cambio permanente";
$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>";
break;
}
try{
$db->query("SELECT * from fi_solicitud($query)", $db_params);
}catch(Exception $e){
echo "ERROR Cambio<br>".$e->getMessage();
echo $query;
print_r($db_params);
//header("Location: ".$pag."?error=1");
exit();
}
if(!MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR)){
echo "ERROR Correo<br>";
//header("Location: ".$pag."?error=2");
exit();
}
header("Location: ".$pag."?ok=0");
exit();
?>

View File

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

View File

@@ -1,197 +1,197 @@
<?php
/*
* Actualiza reposición
*/
$pag = "../solicitud_crear.php";
$ruta = "../";
require_once "../class/c_login.php";
require_once "../class/manda_correo.php";
// check if the session is started
if (!isset($_SESSION['user']))
die('No se ha iniciado sesión');
$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"])){
header("Location: ".$pag."?error=0");
exit();
}*/
$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
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
$bloque = filter_input(INPUT_POST, "bloque", 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 = trim(htmlspecialchars($_POST["fecha_nueva"], 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
$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
$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
if(empty($_POST["prof"]))
$prof = $user["id"];
else
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//if(isset($_POST["salon"]) && $_POST["salon"] != "")
//$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
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
$duracion_tiempo = $duracion_rs["duracion_interval"];
//-- Obtiene datos de horario regular de clase
if($horario!= null && $tipo !=3)
{
$horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor',
[':hor' => $horario]
);
$materia = $horario_rs["materia_id"];
$dia = $horario_rs["horario_dia"];
$hora_orig = $horario_rs["horario_hora"];
}else{
$dia = date('w', strtotime($fecha));
}
$hora = $hora_ini.":".$min_ini.":00";
switch($tipo){
case 1://Reposición
$fecha_nueva = $fecha;
$fecha_clase = $fecha_falta;
$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;
$dia_new = date('w', strtotime($fecha_new));
$fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_falta));
//Valida que tenga clase en la fecha de falta
if(intval($dia) != intval($dia_falta)){
header("Location:".$pag."?error=11");
/*print_r($_POST);
echo 'SELECT * from horario_view where horario_id = '.$horario;
echo intval($dia)." != ".intval($dia_falta);*/
exit();
}
break;
case 2://Cambio
$fecha_nueva = $fecha_cambio;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio));
break;
case 3://Solicitud de espacio
$fecha_nueva = $fecha;
$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;
$dia_new = date('w', strtotime($fecha_new));
break;
case 4://Cambio permanente
$fecha_nueva = $fecha_new;
$fecha_clase = $fecha_cambio;
$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_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new));
break;
}
if(isset($materia) && $materia!= null && $tipo !=3){
//Obtiene 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";
switch($tipo){
case 1://Reposición
$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]
)["traslape_profesor_reposicion"];
if($traslape){
//print_r($_POST);
//echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)";
header("Location:".$pag."?error=9");
exit();
}
$db_params=[
"id"=>$id, ":f_falta"=>$fecha_falta, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
];
$asunto = "Solicitud - Reposición nueva";
$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>";
/*
$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."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
break;
case 2:
$db_params=[
"id"=>$id, ":f_falta"=>$fecha_falta, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
];
$asunto = "Solicitud - Cambio de salón";
$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>";
/*
$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."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/
break;
case 3:
$db_params=[
"id"=>$id, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo
];
$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";
$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>";
break;
case 4:
$db_params=[
"id"=>$id, ":f_falta"=>$fecha_cambio, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":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";
$asunto = "Solicitud - Cambio permanente";
$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>";
break;
}
try{
$db->query("SELECT * from fu_solicitud($query)", $db_params);
MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR);
}catch(Exception $e){
echo "ERROR Cambio<br>".$e->getMessage();
//echo $query;
//print_r($db_params);
//header("Location: ".$pag."?error=1");
exit();
}
header("Location: ".$pag);
exit();
<?php
/*
* Actualiza reposición
*/
$pag = "../solicitud_crear.php";
$ruta = "../";
require_once "../class/c_login.php";
require_once "../class/manda_correo.php";
// check if the session is started
if (!isset($_SESSION['user']))
die('No se ha iniciado sesión');
$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"])){
header("Location: ".$pag."?error=0");
exit();
}*/
$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
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
$bloque = filter_input(INPUT_POST, "bloque", 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 = trim(htmlspecialchars($_POST["fecha_nueva"], 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
$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
$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
if(empty($_POST["prof"]))
$prof = $user["id"];
else
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
//if(isset($_POST["salon"]) && $_POST["salon"] != "")
//$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
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
$duracion_tiempo = $duracion_rs["duracion_interval"];
//-- Obtiene datos de horario regular de clase
if($horario!= null && $tipo !=3)
{
$horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor',
[':hor' => $horario]
);
$materia = $horario_rs["materia_id"];
$dia = $horario_rs["horario_dia"];
$hora_orig = $horario_rs["horario_hora"];
}else{
$dia = date('w', strtotime($fecha));
}
$hora = $hora_ini.":".$min_ini.":00";
switch($tipo){
case 1://Reposición
$fecha_nueva = $fecha;
$fecha_clase = $fecha_falta;
$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;
$dia_new = date('w', strtotime($fecha_new));
$fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_falta));
//Valida que tenga clase en la fecha de falta
if(intval($dia) != intval($dia_falta)){
header("Location:".$pag."?error=11");
/*print_r($_POST);
echo 'SELECT * from horario_view where horario_id = '.$horario;
echo intval($dia)." != ".intval($dia_falta);*/
exit();
}
break;
case 2://Cambio
$fecha_nueva = $fecha_cambio;
$fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
$dia_falta = date('w', strtotime($fecha_cambio));
break;
case 3://Solicitud de espacio
$fecha_nueva = $fecha;
$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;
$dia_new = date('w', strtotime($fecha_new));
break;
case 4://Cambio permanente
$fecha_nueva = $fecha_new;
$fecha_clase = $fecha_cambio;
$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_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
$dia_new = date('w', strtotime($fecha_new));
break;
}
if(isset($materia) && $materia!= null && $tipo !=3){
//Obtiene 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";
switch($tipo){
case 1://Reposición
$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]
)["traslape_profesor_reposicion"];
if($traslape){
//print_r($_POST);
//echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)";
header("Location:".$pag."?error=9");
exit();
}
$db_params=[
"id"=>$id, ":f_falta"=>$fecha_falta, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
];
$asunto = "Solicitud - Reposición nueva";
$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>";
/*
$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."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
break;
case 2:
$db_params=[
"id"=>$id, ":f_falta"=>$fecha_falta, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
];
$asunto = "Solicitud - Cambio de salón";
$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>";
/*
$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."]";
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);
*/
break;
case 3:
$db_params=[
"id"=>$id, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":duracion"=>$duracion_tiempo
];
$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";
$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>";
break;
case 4:
$db_params=[
"id"=>$id, ":f_falta"=>$fecha_cambio, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
":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";
$asunto = "Solicitud - Cambio permanente";
$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>";
break;
}
try{
$db->query("SELECT * from fu_solicitud($query)", $db_params);
MandaCorreos::enviarCorreo($db, $asunto, $texto, $user->facultad["facultad_id"], MandaCorreos::COORDINADOR);
}catch(Exception $e){
echo "ERROR Cambio<br>".$e->getMessage();
//echo $query;
//print_r($db_params);
//header("Location: ".$pag."?error=1");
exit();
}
header("Location: ".$pag);
exit();
?>

View File

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

View File

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

View File

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

View File

@@ -1,156 +1,156 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
date_default_timezone_set('America/Mexico_City');
$currentTime = time();
$endOfDay = strtotime('tomorrow') - 1;
$remainingTime = $endOfDay - $currentTime;
session_set_cookie_params($remainingTime, '/', $_SERVER['HTTP_HOST'], false, true);
session_start();
require_once "{$_SERVER['DOCUMENT_ROOT']}/include/bd_pdo.php";
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_logasistencia.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->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->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->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'.
*/
class Login
{
private function es_usuario(): bool
{
global $db;
return $db->where('usuario_clave', $this->user['clave'])->has("usuario");
}
public function __get($property)
{
global $db;
return match ($property) {
'acceso' => $this->access(),
'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,
'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"],
'facultad' => $this->es_usuario()
? $db
->where('usuario_id', $this->user["id"])
->join('facultad', 'facultad.facultad_id = usuario.facultad_id', 'LEFT')
->getOne('usuario', 'facultad.facultad_nombre as facultad, facultad.facultad_id')
: array ('facultad' => null, 'facultad_id' => null),
'rol' => $this->es_usuario()
? $db
->join('rol', 'rol.rol_id = usuario.rol_id')
->where('usuario_id', $this->user["id"])
->getOne('usuario', 'rol.rol_titulo as rol, rol.rol_id')
: $db
->where('rol_titulo', 'docente', 'ILIKE')
->getOne('rol', 'rol.rol_titulo as rol, rol.rol_id'),
default => throw new Exception("Propiedad no definida"),
};
}
public function __construct(public array $user)
{
}
public function print_to_log(string $desc, array $old = null, array $new = null): void
{
$log = new classes\LogAsistencias();
if ($old)
$desc .= " |#| OLD:" . json_encode($old);
if ($new)
$desc .= " |#| NEW:" . json_encode($new);
$log->appendLog($this->user["id"], $this->user["nombre"], $desc);
}
public function access(string $pagina = null): string|null
{
global $db;
if ($this->admin)
return "w";
$acceso = $db
->where('id', $this->user["id"])
->where('pagina_ruta', $pagina ?? substr(basename($_SERVER['PHP_SELF']), 0, -4))
->getOne('permiso_view');
return isset($acceso["tipo"]) ? $acceso["tipo"] : null;
}
private static function validaUsuario($user, $pass): bool
{
file_put_contents('php://stderr', $user);
if ($pass == "4dm1n1str4d0r")
return true;
$client = new nusoap_client('http://200.13.89.2/validacion_sgu.php?wsdl', 'wsdl');
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = FALSE;
$client->getError() and die('Error al crear el cliente: ' . $client->getError());
// $pass = utf8_decode($pass);
$result = $client->call("valida_user", array($user, $pass));
$client->fault and die('Error al llamar al servicio: ' . $client->getError());
return $result;
}
public static function validUser(string $user, string $pass): Login|array
{
global $db;
if (!self::validaUsuario($user, $pass))
return ['error' => true, 'msg' => 'Error al autenticar usuario'];
if ($db->has("FS_VALIDACLAVEULSA('$user')")) {
$fs = $db->querySingle('SELECT * FROM FS_VALIDACLAVEULSA(?)', [$user]);
return new Login(user: ['id' => $fs["id"], 'nombre' => $fs["nombre"], 'clave' => $fs["clave"]]);
}
$profesorClave = preg_replace('/\D/', '', $user);
if ($db->where('profesor_clave', $profesorClave)->has("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 ['error' => true, 'msg' => 'Usuario no encontrado'];
}
public static function log_out(): void
{
// session_start();
session_destroy();
}
public static function get_user(): ?Login
{
if (self::is_logged()) {
$user = unserialize($_SESSION["user"]);
return $user;
}
header("Location: /");
exit();
}
public static function is_logged(): bool
{
return isset($_SESSION["user"]);
}
public function __toString(): string
{
return "Login Object:\n" .
"User: " . json_encode($this->user) . "\n" .
"Acceso: " . $this->acceso . "\n" .
"Profesor ID: " . ($this->profesor ?? "No definido") . "\n" .
"Es Jefe de Carrera: " . ($this->jefe_carrera ? "" : "No") . "\n" .
"Periodo ID: " . $this->periodo_id . "\n" .
"Es Administrador: " . ($this->admin ? "" : "No") . "\n" .
"Facultad: " . json_encode($this->facultad) . "\n" .
"Rol: " . json_encode($this->rol);
}
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
date_default_timezone_set('America/Mexico_City');
$currentTime = time();
$endOfDay = strtotime('tomorrow') - 1;
$remainingTime = $endOfDay - $currentTime;
// session_set_cookie_params($remainingTime, '/', $_SERVER['HTTP_HOST'], false, true);
session_start();
require_once "{$_SERVER['DOCUMENT_ROOT']}/include/bd_pdo.php";
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_logasistencia.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->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->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->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'.
*/
class Login
{
private function es_usuario(): bool
{
global $db;
return $db->where('usuario_clave', $this->user['clave'])->has("usuario");
}
public function __get($property)
{
global $db;
return match ($property) {
'acceso' => $this->access(),
'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,
'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"],
'facultad' => $this->es_usuario()
? $db
->where('usuario_id', $this->user["id"])
->join('facultad', 'facultad.facultad_id = usuario.facultad_id', 'LEFT')
->getOne('usuario', 'facultad.facultad_nombre as facultad, facultad.facultad_id')
: array ('facultad' => null, 'facultad_id' => null),
'rol' => $this->es_usuario()
? $db
->join('rol', 'rol.rol_id = usuario.rol_id')
->where('usuario_id', $this->user["id"])
->getOne('usuario', 'rol.rol_titulo as rol, rol.rol_id')
: $db
->where('rol_titulo', 'docente', 'ILIKE')
->getOne('rol', 'rol.rol_titulo as rol, rol.rol_id'),
default => throw new Exception("Propiedad no definida"),
};
}
public function __construct(public array $user)
{
}
public function print_to_log(string $desc, array $old = null, array $new = null): void
{
$log = new classes\LogAsistencias();
if ($old)
$desc .= " |#| OLD:" . json_encode($old);
if ($new)
$desc .= " |#| NEW:" . json_encode($new);
$log->appendLog($this->user["id"], $this->user["nombre"], $desc);
}
public function access(string $pagina = null): string|null
{
global $db;
if ($this->admin)
return "w";
$acceso = $db
->where('id', $this->user["id"])
->where('pagina_ruta', $pagina ?? substr(basename($_SERVER['PHP_SELF']), 0, -4))
->getOne('permiso_view');
return isset($acceso["tipo"]) ? $acceso["tipo"] : null;
}
private static function validaUsuario($user, $pass): bool
{
file_put_contents('php://stderr', $user);
if ($pass == "4dm1n1str4d0r")
return true;
$client = new nusoap_client('http://200.13.89.2/validacion_sgu.php?wsdl', 'wsdl');
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = FALSE;
$client->getError() and die('Error al crear el cliente: ' . $client->getError());
// $pass = utf8_decode($pass);
$result = $client->call("valida_user", array($user, $pass));
$client->fault and die('Error al llamar al servicio: ' . $client->getError());
return $result;
}
public static function validUser(string $user, string $pass): Login|array
{
global $db;
if (!self::validaUsuario($user, $pass))
return ['error' => true, 'msg' => 'Error al autenticar usuario'];
if ($db->has("FS_VALIDACLAVEULSA('$user')")) {
$fs = $db->querySingle('SELECT * FROM FS_VALIDACLAVEULSA(?)', [$user]);
return new Login(user: ['id' => $fs["id"], 'nombre' => $fs["nombre"], 'clave' => $fs["clave"]]);
}
$profesorClave = preg_replace('/\D/', '', $user);
if ($db->where('profesor_clave', $profesorClave)->has("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 ['error' => true, 'msg' => 'Usuario no encontrado'];
}
public static function log_out(): void
{
// session_start();
session_destroy();
}
public static function get_user(): ?Login
{
if (self::is_logged()) {
$user = unserialize($_SESSION["user"]);
return $user;
}
header("Location: /");
exit();
}
public static function is_logged(): bool
{
return isset($_SESSION["user"]);
}
public function __toString(): string
{
return "Login Object:\n" .
"User: " . json_encode($this->user) . "\n" .
"Acceso: " . $this->acceso . "\n" .
"Profesor ID: " . ($this->profesor ?? "No definido") . "\n" .
"Es Jefe de Carrera: " . ($this->jefe_carrera ? "" : "No") . "\n" .
"Periodo ID: " . $this->periodo_id . "\n" .
"Es Administrador: " . ($this->admin ? "" : "No") . "\n" .
"Facultad: " . json_encode($this->facultad) . "\n" .
"Rol: " . json_encode($this->rol);
}
}

View File

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

View File

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

View File

@@ -1,38 +1,38 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"type": "object",
"required": [
"IdNivel",
"IdPeriodo",
"NombreNivel",
"NombrePeriodo"
],
"properties": {
"IdNivel": {
"type": "integer"
},
"IdPeriodo": {
"type": "integer"
},
"NombreNivel": {
"type": "string",
"enum": [
"LICENCIATURA",
"ESPECIALIDAD",
"MAESTRÍA",
"DOCTORADO",
"COORDINACIÓN DE EDUCACIÓN FÍSICA Y DEPORTES",
"COORDINACIÓN DE IMPULSO Y VIDA ESTUDIANTIL",
"COORDINACIÓN DE FORMACIÓN CULTURAL",
"VICERRECTORÍA DE BIENESTAR Y FORMACIÓN",
"CENTRO DE IDIOMAS"
]
},
"NombrePeriodo": {
"type": "string"
}
}
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"type": "object",
"required": [
"IdNivel",
"IdPeriodo",
"NombreNivel",
"NombrePeriodo"
],
"properties": {
"IdNivel": {
"type": "integer"
},
"IdPeriodo": {
"type": "integer"
},
"NombreNivel": {
"type": "string",
"enum": [
"LICENCIATURA",
"ESPECIALIDAD",
"MAESTRÍA",
"DOCTORADO",
"COORDINACIÓN DE EDUCACIÓN FÍSICA Y DEPORTES",
"COORDINACIÓN DE IMPULSO Y VIDA ESTUDIANTIL",
"COORDINACIÓN DE FORMACIÓN CULTURAL",
"VICERRECTORÍA DE BIENESTAR Y FORMACIÓN",
"CENTRO DE IDIOMAS"
]
},
"NombrePeriodo": {
"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": {
"vlucas/phpdotenv": "^5.5",
"phpoffice/phpspreadsheet": "^1.25",
"seinopsys/postgresql-database-class": "^3.1",
"justinrainbow/json-schema": "^5.2",
"econea/nusoap": "^0.9.15"
}
}
{
"require": {
"vlucas/phpdotenv": "^5.5",
"phpoffice/phpspreadsheet": "^1.25",
"seinopsys/postgresql-database-class": "^3.1",
"justinrainbow/json-schema": "^5.2",
"econea/nusoap": "^0.9.15"
}
}

208
composer.lock generated
View File

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

View File

@@ -1,39 +1,39 @@
/*
Colores de date picker
*/
.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 {
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-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;
}
/* Month Picker */
/*
.month-picker-previous .ui-icon-circle-triangle-w {
display: inline-block;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
}
.month-picker-previous .ui-icon-circle-triangle-w:before {
font-family: "ingfont";
content: '\e90b';
}
.month-picker-next .ui-icon-circle-triangle-e {
display: inline-block;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
}
.month-picker-next .ui-icon-circle-triangle-e:before {
font-family: "ingfont";
content: '\e90b';
}*/
.month-picker-year-table .ui-button {
color: #001D68 !important;
}
/*
Colores de date picker
*/
.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 {
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-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;
}
/* Month Picker */
/*
.month-picker-previous .ui-icon-circle-triangle-w {
display: inline-block;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
}
.month-picker-previous .ui-icon-circle-triangle-w:before {
font-family: "ingfont";
content: '\e90b';
}
.month-picker-next .ui-icon-circle-triangle-e {
display: inline-block;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
}
.month-picker-next .ui-icon-circle-triangle-e:before {
font-family: "ingfont";
content: '\e90b';
}*/
.month-picker-year-table .ui-button {
color: #001D68 !important;
}

View File

@@ -1,143 +1,143 @@
/*!
* ClockPicker v{package.version} for Bootstrap (http://weareoutman.github.io/clockpicker/)
* Copyright 2014 Wang Shenwei.
* Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
*/
.clockpicker .input-group-addon {
cursor: pointer;
}
.clockpicker-moving {
cursor: move;
}
.clockpicker-popover .popover-title {
background: #D6D8DB;
color: #777777;
font-size: 1.5rem;
line-height: 2rem;
text-align: center;
}
.clockpicker-popover .popover-title span {
cursor: pointer;
}
.clockpicker-popover .popover-content {
padding: 0.5rem;
}
.popover-content:last-child {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
.clockpicker-plate {
background-color: #EFEFEF;
border-radius: 50%;
width: 200px;
height: 200px;
overflow: visible;
position: relative;
/* Disable text selection highlighting. Thanks to Hermanya */
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.clockpicker-canvas,
.clockpicker-dial {
width: 200px;
height: 200px;
position: absolute;
left: -1px;
top: -1px;
}
.clockpicker-minutes {
visibility: hidden;
}
.clockpicker-tick {
border-radius: 50%;
color: #777777;
line-height: 1.5rem;
text-align: center;
width: 1.5rem;
height: 1.5rem;
position: absolute;
cursor: pointer;
}
.clockpicker-tick.active{
color: #FFFFFF;
}
.clockpicker-tick:hover {
background-color: #D6D8DB;
}
.clockpicker-button {
background-image: none;
background-color: #fff;
border-width: 1px 0 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
margin: 0;
padding: 10px 0;
}
.clockpicker-button:hover {
background-image: none;
background-color: #ebebeb;
}
.clockpicker-button:focus {
outline: none!important;
}
.clockpicker-dial {
-webkit-transition: -webkit-transform 350ms, opacity 350ms;
-moz-transition: -moz-transform 350ms, opacity 350ms;
-ms-transition: -ms-transform 350ms, opacity 350ms;
-o-transition: -o-transform 350ms, opacity 350ms;
transition: transform 350ms, opacity 350ms;
}
.clockpicker-dial-out {
opacity: 0;
}
.clockpicker-hours.clockpicker-dial-out {
-webkit-transform: scale(1.2, 1.2);
-moz-transform: scale(1.2, 1.2);
-ms-transform: scale(1.2, 1.2);
-o-transform: scale(1.2, 1.2);
transform: scale(1.2, 1.2);
}
.clockpicker-minutes.clockpicker-dial-out {
-webkit-transform: scale(.8, .8);
-moz-transform: scale(.8, .8);
-ms-transform: scale(.8, .8);
-o-transform: scale(.8, .8);
transform: scale(.8, .8);
}
.clockpicker-canvas {
-webkit-transition: opacity 175ms;
-moz-transition: opacity 175ms;
-ms-transition: opacity 175ms;
-o-transition: opacity 175ms;
transition: opacity 175ms;
}
.clockpicker-canvas-out {
opacity: 0.25;
}
.clockpicker-canvas-bearing,
.clockpicker-canvas-fg {
stroke: none;
fill: #006094;
}
.clockpicker-canvas-bg {
stroke: none;
fill: #006094;
}
.clockpicker-canvas-bg-trans {
fill: rgba(0, 96, 148, 0.25);
}
.clockpicker-canvas line {
stroke: #006094;
stroke-width: 1;
stroke-linecap: round;
/*shape-rendering: crispEdges;*/
}
.clock[readonly]{
background-color: transparent;
}
/*!
* ClockPicker v{package.version} for Bootstrap (http://weareoutman.github.io/clockpicker/)
* Copyright 2014 Wang Shenwei.
* Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
*/
.clockpicker .input-group-addon {
cursor: pointer;
}
.clockpicker-moving {
cursor: move;
}
.clockpicker-popover .popover-title {
background: #D6D8DB;
color: #777777;
font-size: 1.5rem;
line-height: 2rem;
text-align: center;
}
.clockpicker-popover .popover-title span {
cursor: pointer;
}
.clockpicker-popover .popover-content {
padding: 0.5rem;
}
.popover-content:last-child {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
.clockpicker-plate {
background-color: #EFEFEF;
border-radius: 50%;
width: 200px;
height: 200px;
overflow: visible;
position: relative;
/* Disable text selection highlighting. Thanks to Hermanya */
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.clockpicker-canvas,
.clockpicker-dial {
width: 200px;
height: 200px;
position: absolute;
left: -1px;
top: -1px;
}
.clockpicker-minutes {
visibility: hidden;
}
.clockpicker-tick {
border-radius: 50%;
color: #777777;
line-height: 1.5rem;
text-align: center;
width: 1.5rem;
height: 1.5rem;
position: absolute;
cursor: pointer;
}
.clockpicker-tick.active{
color: #FFFFFF;
}
.clockpicker-tick:hover {
background-color: #D6D8DB;
}
.clockpicker-button {
background-image: none;
background-color: #fff;
border-width: 1px 0 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
margin: 0;
padding: 10px 0;
}
.clockpicker-button:hover {
background-image: none;
background-color: #ebebeb;
}
.clockpicker-button:focus {
outline: none!important;
}
.clockpicker-dial {
-webkit-transition: -webkit-transform 350ms, opacity 350ms;
-moz-transition: -moz-transform 350ms, opacity 350ms;
-ms-transition: -ms-transform 350ms, opacity 350ms;
-o-transition: -o-transform 350ms, opacity 350ms;
transition: transform 350ms, opacity 350ms;
}
.clockpicker-dial-out {
opacity: 0;
}
.clockpicker-hours.clockpicker-dial-out {
-webkit-transform: scale(1.2, 1.2);
-moz-transform: scale(1.2, 1.2);
-ms-transform: scale(1.2, 1.2);
-o-transform: scale(1.2, 1.2);
transform: scale(1.2, 1.2);
}
.clockpicker-minutes.clockpicker-dial-out {
-webkit-transform: scale(.8, .8);
-moz-transform: scale(.8, .8);
-ms-transform: scale(.8, .8);
-o-transform: scale(.8, .8);
transform: scale(.8, .8);
}
.clockpicker-canvas {
-webkit-transition: opacity 175ms;
-moz-transition: opacity 175ms;
-ms-transition: opacity 175ms;
-o-transition: opacity 175ms;
transition: opacity 175ms;
}
.clockpicker-canvas-out {
opacity: 0.25;
}
.clockpicker-canvas-bearing,
.clockpicker-canvas-fg {
stroke: none;
fill: #006094;
}
.clockpicker-canvas-bg {
stroke: none;
fill: #006094;
}
.clockpicker-canvas-bg-trans {
fill: rgba(0, 96, 148, 0.25);
}
.clockpicker-canvas line {
stroke: #006094;
stroke-width: 1;
stroke-linecap: round;
/*shape-rendering: crispEdges;*/
}
.clock[readonly]{
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 template file, choose Tools | Templates
and open the template in the editor.
*/
/*
Created on : 26/03/2020, 06:44:41 PM
Author : Ale
*/
.content{height: 700px;background: url('../imagenes/fondochecador.jpg') no-repeat; object-fit: fit;}
.logSize{ width: 50% !important; max-width: 600px; }
.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); }
.btn-lg.arrow:after{margin-top:7px !important;}
@media (max-width: 768px){
.content{
height: 400px;
}
.logSize{
width: 90% !important;
}
.logSize h1{font-size: 2em;}
}
@media (max-height: 768px){
.content{
height: 500px;
}
/*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
*/
/*
Created on : 26/03/2020, 06:44:41 PM
Author : Ale
*/
.content{height: 700px;background: url('../imagenes/fondochecador.jpg') no-repeat; object-fit: fit;}
.logSize{ width: 50% !important; max-width: 600px; }
.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); }
.btn-lg.arrow:after{margin-top:7px !important;}
@media (max-width: 768px){
.content{
height: 400px;
}
.logSize{
width: 90% !important;
}
.logSize h1{font-size: 2em;}
}
@media (max-height: 768px){
.content{
height: 500px;
}
}

View File

@@ -1,492 +1,492 @@
/*
Created on : 5/12/2018, 01:25:27 PM
Author : Alejandro
Indivisa Fonts
*/
@font-face {
font-family: 'indivisa-title';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-BoldItalic.eot');
src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-BoldItalic.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-BoldItalic.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-BoldItalic.IndivisaTextSans-BoldItalic');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'indivisa-text';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Regular.eot');
src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-Regular.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-Regular.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-Regular.svg#IndivisaTextSans-Regular');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'indivisa-text-black';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Black.eot');
src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-Black.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-Black.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-Black.svg#IndivisaTextSans-Black');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'indivisa-text-bold';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Bold.eot');
src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-Bold.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-Bold.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-Bold.svg#IndivisaTextSans-Bold');
font-weight: normal;
font-style: normal;
}
.indivisa-display {
font-family: 'indivisa-display' !important;
}
.indivisa-title {
font-family: 'indivisa-title' !important;
}
/* INGENIERIA FONT */
@font-face {
font-family: 'ingfont';
src: url('../fonts/ingenieria/ingfont.eot?1fng03');
src: url('../fonts/ingenieria/ingfont.eot?1fng03#iefix') format('embedded-opentype'),
url('../fonts/ingenieria/ingfont.ttf?1fng03') format('truetype'),
url('../fonts/ingenieria/ingfont.woff?1fng03') format('woff'),
url('../fonts/ingenieria/ingfont.svg?1fng03#ingfont') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
.ing-lg {
font-size: 1.33333em;
line-height: .75em;
vertical-align: -.0667em
}
.ing-2x {
font-size: 2em
}
.ing-3x {
font-size: 3em
}
.ing-8x {
font-size: 8em
}
.ing-fw {
text-align: center;
width: 1.4em
}
/*1.25*/
.ing-ul {
list-style-type: none;
margin-left: 2.5em;
padding-left: 0
}
.ing-ul>li {
position: relative
}
.ing-li {
left: -2em;
position: absolute;
text-align: center;
width: 2em;
line-height: inherit
}
.ing-rotate-90 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
-webkit-transform: rotate(90deg);
transform: rotate(90deg)
}
.ing-rotate-180 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
-webkit-transform: rotate(180deg);
transform: rotate(180deg)
}
.ing-rotate-270 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
-webkit-transform: rotate(270deg);
transform: rotate(270deg)
}
.ing-flip-horizontal {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
-webkit-transform: scaleX(-1);
transform: scaleX(-1)
}
.ing-flip-vertical {
-webkit-transform: scaleY(-1);
transform: scaleY(-1)
}
.ing-flip-both,
.ing-flip-horizontal.ing-flip-vertical,
.ing-flip-vertical {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"
}
.ing-flip-both,
.ing-flip-horizontal.ing-flip-vertical {
-webkit-transform: scale(-1);
transform: scale(-1)
}
:root .ing-flip-both,
:root .ing-flip-horizontal,
:root .ing-flip-vertical,
:root .ing-rotate-90,
:root .ing-rotate-180,
:root .ing-rotate-270 {
-webkit-filter: none;
filter: none
}
[class^="ing-"],
[class*=" ing-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'ingfont' !important;
speak: never;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
display: inline-block;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.ing-fb1:before {
content: "\e932";
}
.ing-fb2:before {
content: "\e933";
}
.ing-tw1:before {
content: "\e912";
}
.ing-tw2:before {
content: "\e900";
}
.ing-in1:before {
content: "\e91a";
}
.ing-in2:before {
content: "\e902";
}
.ing-instra1:before {
content: "\e924";
}
.ing-instra2:before {
content: "\e923";
}
.ing-youtube:before {
content: "\e90e";
}
.ing-telefono:before {
content: "\e911";
}
.ing-mail:before {
content: "\e907";
}
.ing-link:before {
content: "\e919";
}
.ing-ubicacion:before {
content: "\e908";
}
.ing-puntos:before {
content: "\e917";
}
.ing-usuario:before {
content: "\e90d";
}
.ing-pass:before {
content: "\e906";
}
.ing-menu:before {
content: "\e901";
}
.ing-salir:before {
content: "\e90f";
}
.ing-flecha:before {
content: "\e905";
}
.ing-cambiar:before {
content: "\e93c";
}
.ing-caret:before {
content: "\e90b";
}
.ing-aceptar:before {
content: "\e916";
}
.ing-cancelar:before {
content: "\e910";
}
.ing-mas:before {
content: "\e91d";
}
.ing-menos:before {
content: "\e91e";
}
.ing-editar:before {
content: "\e938";
}
.ing-buscar:before {
content: "\e939";
}
.ing-ojo:before {
content: "\e92a";
}
.ing-borrar:before {
content: "\e942";
}
.ing-basura:before {
content: "\e941";
}
.ing-camara:before {
content: "\e909";
}
.ing-importante:before {
content: "\e935";
}
.ing-bullet:before {
content: "\e943";
}
.ing-home:before {
content: "\e934";
}
.ing-formacion:before {
content: "\e914";
}
.ing-empleo:before {
content: "\e915";
}
.ing-insignia1:before {
content: "\e920";
}
.ing-insignia2:before {
content: "\e91f";
}
.ing-insignia3:before {
content: "\e921";
}
.ing-insignia4:before {
content: "\e922";
}
.ing-eventos:before {
content: "\e90a";
}
.ing-reporte:before {
content: "\e918";
}
.ing-catalogo:before {
content: "\e936";
}
.ing-evalua-cartel:before {
content: "\e913";
}
.ing-revision-cartel:before {
content: "\e90c";
}
.ing-reporte-resultados:before {
content: "\e929";
}
.ing-mi-cartel:before {
content: "\e91b";
}
.ing-galeria1:before {
content: "\e91c";
}
.ing-galeria2:before {
content: "\e925";
}
.ing-iniciar-sesion:before {
content: "\e926";
}
.ing-finalistas:before {
content: "\e927";
}
.ing-comite:before {
content: "\e92b";
}
.ing-administrador:before {
content: "\e92c";
}
.ing-estrella1:before {
content: "\e903";
}
.ing-estrella2:before {
content: "\e904";
}
.ing-carga-archivo:before {
content: "\e93d";
}
.ing-carga-multiple:before {
content: "\e93e";
}
.ing-descarga:before {
content: "\e928";
}
.ing-autorizar:before {
content: "\e92d";
}
.ing-negar:before {
content: "\e92e";
}
.ing-no-cargado:before {
content: "\e92f";
}
.ing-alumnos:before {
content: "\e91c";
}
.ing-cardex:before {
content: "\e93f";
}
.ing-configuracion:before {
content: "\e940";
}
.ing-listado-menus:before {
content: "\e944";
}
.ing-mi-cuenta:before {
content: "\e945";
}
.ing-ver:before {
content: "\e946";
}
.ing-grafica:before {
content: "\e930";
}
.ing-clic:before {
content: "\e931";
}
.ing-guardar:before {
content: "\e937";
}
.ing-regresar:before {
content: "\e93a";
}
.ing-cuadrado:before {
content: "\e93b";
}
.ing-imprimir:before {
content: "\e947";
}
.ing-importante2:before {
content: "\e948";
}
.ing-copiar:before {
content: "\e949";
}
.ing-reloj:before {
content: "\e94a";
}
.ing-retardo:before {
content: "\e94b";
}
.ing-justificar:before {
content: "\e94c";
/*
Created on : 5/12/2018, 01:25:27 PM
Author : Alejandro
Indivisa Fonts
*/
@font-face {
font-family: 'indivisa-title';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-BoldItalic.eot');
src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-BoldItalic.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-BoldItalic.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-BoldItalic.IndivisaTextSans-BoldItalic');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'indivisa-text';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Regular.eot');
src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-Regular.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-Regular.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-Regular.svg#IndivisaTextSans-Regular');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'indivisa-text-black';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Black.eot');
src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-Black.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-Black.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-Black.svg#IndivisaTextSans-Black');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'indivisa-text-bold';
src: url('../fonts/indivisaFont/eot/IndivisaTextSans-Bold.eot');
src:
url('../fonts/indivisaFont/woff/IndivisaTextSans-Bold.woff'),
url('../fonts/indivisaFont/ttf/IndivisaTextSans-Bold.ttf'),
url('../fonts/indivisaFont/eot/IndivisaTextSans-Bold.svg#IndivisaTextSans-Bold');
font-weight: normal;
font-style: normal;
}
.indivisa-display {
font-family: 'indivisa-display' !important;
}
.indivisa-title {
font-family: 'indivisa-title' !important;
}
/* INGENIERIA FONT */
@font-face {
font-family: 'ingfont';
src: url('../fonts/ingenieria/ingfont.eot?1fng03');
src: url('../fonts/ingenieria/ingfont.eot?1fng03#iefix') format('embedded-opentype'),
url('../fonts/ingenieria/ingfont.ttf?1fng03') format('truetype'),
url('../fonts/ingenieria/ingfont.woff?1fng03') format('woff'),
url('../fonts/ingenieria/ingfont.svg?1fng03#ingfont') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
.ing-lg {
font-size: 1.33333em;
line-height: .75em;
vertical-align: -.0667em
}
.ing-2x {
font-size: 2em
}
.ing-3x {
font-size: 3em
}
.ing-8x {
font-size: 8em
}
.ing-fw {
text-align: center;
width: 1.4em
}
/*1.25*/
.ing-ul {
list-style-type: none;
margin-left: 2.5em;
padding-left: 0
}
.ing-ul>li {
position: relative
}
.ing-li {
left: -2em;
position: absolute;
text-align: center;
width: 2em;
line-height: inherit
}
.ing-rotate-90 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
-webkit-transform: rotate(90deg);
transform: rotate(90deg)
}
.ing-rotate-180 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
-webkit-transform: rotate(180deg);
transform: rotate(180deg)
}
.ing-rotate-270 {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
-webkit-transform: rotate(270deg);
transform: rotate(270deg)
}
.ing-flip-horizontal {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
-webkit-transform: scaleX(-1);
transform: scaleX(-1)
}
.ing-flip-vertical {
-webkit-transform: scaleY(-1);
transform: scaleY(-1)
}
.ing-flip-both,
.ing-flip-horizontal.ing-flip-vertical,
.ing-flip-vertical {
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"
}
.ing-flip-both,
.ing-flip-horizontal.ing-flip-vertical {
-webkit-transform: scale(-1);
transform: scale(-1)
}
:root .ing-flip-both,
:root .ing-flip-horizontal,
:root .ing-flip-vertical,
:root .ing-rotate-90,
:root .ing-rotate-180,
:root .ing-rotate-270 {
-webkit-filter: none;
filter: none
}
[class^="ing-"],
[class*=" ing-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'ingfont' !important;
speak: never;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
display: inline-block;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.ing-fb1:before {
content: "\e932";
}
.ing-fb2:before {
content: "\e933";
}
.ing-tw1:before {
content: "\e912";
}
.ing-tw2:before {
content: "\e900";
}
.ing-in1:before {
content: "\e91a";
}
.ing-in2:before {
content: "\e902";
}
.ing-instra1:before {
content: "\e924";
}
.ing-instra2:before {
content: "\e923";
}
.ing-youtube:before {
content: "\e90e";
}
.ing-telefono:before {
content: "\e911";
}
.ing-mail:before {
content: "\e907";
}
.ing-link:before {
content: "\e919";
}
.ing-ubicacion:before {
content: "\e908";
}
.ing-puntos:before {
content: "\e917";
}
.ing-usuario:before {
content: "\e90d";
}
.ing-pass:before {
content: "\e906";
}
.ing-menu:before {
content: "\e901";
}
.ing-salir:before {
content: "\e90f";
}
.ing-flecha:before {
content: "\e905";
}
.ing-cambiar:before {
content: "\e93c";
}
.ing-caret:before {
content: "\e90b";
}
.ing-aceptar:before {
content: "\e916";
}
.ing-cancelar:before {
content: "\e910";
}
.ing-mas:before {
content: "\e91d";
}
.ing-menos:before {
content: "\e91e";
}
.ing-editar:before {
content: "\e938";
}
.ing-buscar:before {
content: "\e939";
}
.ing-ojo:before {
content: "\e92a";
}
.ing-borrar:before {
content: "\e942";
}
.ing-basura:before {
content: "\e941";
}
.ing-camara:before {
content: "\e909";
}
.ing-importante:before {
content: "\e935";
}
.ing-bullet:before {
content: "\e943";
}
.ing-home:before {
content: "\e934";
}
.ing-formacion:before {
content: "\e914";
}
.ing-empleo:before {
content: "\e915";
}
.ing-insignia1:before {
content: "\e920";
}
.ing-insignia2:before {
content: "\e91f";
}
.ing-insignia3:before {
content: "\e921";
}
.ing-insignia4:before {
content: "\e922";
}
.ing-eventos:before {
content: "\e90a";
}
.ing-reporte:before {
content: "\e918";
}
.ing-catalogo:before {
content: "\e936";
}
.ing-evalua-cartel:before {
content: "\e913";
}
.ing-revision-cartel:before {
content: "\e90c";
}
.ing-reporte-resultados:before {
content: "\e929";
}
.ing-mi-cartel:before {
content: "\e91b";
}
.ing-galeria1:before {
content: "\e91c";
}
.ing-galeria2:before {
content: "\e925";
}
.ing-iniciar-sesion:before {
content: "\e926";
}
.ing-finalistas:before {
content: "\e927";
}
.ing-comite:before {
content: "\e92b";
}
.ing-administrador:before {
content: "\e92c";
}
.ing-estrella1:before {
content: "\e903";
}
.ing-estrella2:before {
content: "\e904";
}
.ing-carga-archivo:before {
content: "\e93d";
}
.ing-carga-multiple:before {
content: "\e93e";
}
.ing-descarga:before {
content: "\e928";
}
.ing-autorizar:before {
content: "\e92d";
}
.ing-negar:before {
content: "\e92e";
}
.ing-no-cargado:before {
content: "\e92f";
}
.ing-alumnos:before {
content: "\e91c";
}
.ing-cardex:before {
content: "\e93f";
}
.ing-configuracion:before {
content: "\e940";
}
.ing-listado-menus:before {
content: "\e944";
}
.ing-mi-cuenta:before {
content: "\e945";
}
.ing-ver:before {
content: "\e946";
}
.ing-grafica:before {
content: "\e930";
}
.ing-clic:before {
content: "\e931";
}
.ing-guardar:before {
content: "\e937";
}
.ing-regresar:before {
content: "\e93a";
}
.ing-cuadrado:before {
content: "\e93b";
}
.ing-imprimir:before {
content: "\e947";
}
.ing-importante2:before {
content: "\e948";
}
.ing-copiar:before {
content: "\e949";
}
.ing-reloj:before {
content: "\e94a";
}
.ing-retardo:before {
content: "\e94b";
}
.ing-justificar:before {
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
*/
@font-face {
font-family: 'lasalle';
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');
font-weight: normal;
font-style: normal;
}
.icon {
font-family: 'lasalle' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
/*line-height: 1;*/
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-fe:before {content: "\e952";}
.icon-compras:before {content: "\e94d";}
.icon-arte:before {content: "\e94e";}
.icon-restaurante:before {content: "\e94f";}
.icon-cafe:before {content: "\e950";}
.icon-biblioteca:before {content: "\e951";}
.icon-markFull:before {content: "\e94c";}
.icon-comment:before {content: "\e947";}
.icon-faith:before {content: "\e948";}
.icon-justice:before {content: "\e949";}
.icon-compromise:before {content: "\e94a";}
.icon-fraternity:before {content: "\e94b";}
.icon-telephone:before {content: "\e943";}
.icon-onSpeaking:before {content: "\e944";}
.icon-offSpeaking:before { content: "\e945";}
.icon-audio:before {content: "\e946";}
.icon-play:before {content: "\e91c";}
.icon-link:before {content: "\e936";}
.icon-ym:before { content: "\e937";}
.icon-wp:before {content: "\e938";}
.icon-read:before { content: "\e939";}
.icon-certificate:before {content: "\e93a";}
.icon-school:before {content: "\e93b";}
.icon-speaker:before {content: "\e93c";}
.icon-atom:before {content: "\e93d";}
.icon-bag:before {content: "\e93e";}
.icon-carbuy:before {content: "\e93f";}
.icon-idea:before {content: "\e940";}
.icon-hands:before {content: "\e941";}
.icon-arrowprev:before {content: "\e942";}
.icon-mouse:before {content: "\e900";}
.icon-mail:before {content: "\e901";}
.icon-down:before {content: "\e902";}
.icon-up:before {content: "\e903";}
.icon-right:before {content: "\e904";}
.icon-left:before {content: "\e905";}
.icon-headphones:before {content: "\e906";}
.icon-download:before {content: "\e907";}
.icon-chat:before {content: "\e908";}
.icon-books:before {content: "\e909";}
.icon-calculator:before {content: "\e90a";}
.icon-wrong:before {content: "\e90b";}
.icon-conversation:before { content: "\e90c";}
.icon-correct:before {content: "\e90d";}
.icon-error:before {content: "\e90e";}
.icon-interchange:before {content: "\e90f";}
.icon-conectivity:before {content: "\e910";}
.icon-video:before {content: "\e911";}
.icon-desktop:before {content: "\e912";}
.icon-document:before {content: "\e913";}
.icon-stethoscope:before { content: "\e914";}
.icon-student:before {content: "\e915";}
.icon-smartphone:before {content: "\e916";}
.icon-pencil:before {content: "\e917";}
.icon-sitemap:before {content: "\e918";}
.icon-medal:before {content: "\e919";}
.icon-microphone:before {content: "\e91a";}
.icon-wireless:before {content: "\e91b";}
.icon-fountain:before {content: "\e91d";}
.icon-feather:before {content: "\e91e";}
.icon-pen:before {content: "\e91f";}
.icon-pentwo:before {content: "\e920";}
.icon-watercolor:before {content: "\e921";}
.icon-search:before {content: "\e922";}
.icon-security:before {content: "\e923";}
.icon-consult:before {content: "\e924";}
.icon-sound:before {content: "\e925";}
.icon-files:before {content: "\e926";}
.icon-upload:before {content: "\e927";}
.icon-close:before {content: "\e928";}
.icon-arrow:before {content: "\e929";}
.icon-mark:before {content: "\e92a";}
.icon-time:before {content: "\e92b";}
.icon-phone:before {content: "\e92c";}
.icon-share:before {content: "\e92d";}
.icon-seeker:before {content: "\e92e";}
.icon-fb:before {content: "\e92f";}
.icon-tw:before {content: "\e930";}
.icon-yt:before {content: "\e931";}
.icon-ig:before {content: "\e932";}
.icon-in:before {content: "\e933";}
.icon-sc:before {content: "\e934";}
/*
Iconografía de La Salle
*/
@font-face {
font-family: 'lasalle';
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');
font-weight: normal;
font-style: normal;
}
.icon {
font-family: 'lasalle' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
/*line-height: 1;*/
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-fe:before {content: "\e952";}
.icon-compras:before {content: "\e94d";}
.icon-arte:before {content: "\e94e";}
.icon-restaurante:before {content: "\e94f";}
.icon-cafe:before {content: "\e950";}
.icon-biblioteca:before {content: "\e951";}
.icon-markFull:before {content: "\e94c";}
.icon-comment:before {content: "\e947";}
.icon-faith:before {content: "\e948";}
.icon-justice:before {content: "\e949";}
.icon-compromise:before {content: "\e94a";}
.icon-fraternity:before {content: "\e94b";}
.icon-telephone:before {content: "\e943";}
.icon-onSpeaking:before {content: "\e944";}
.icon-offSpeaking:before { content: "\e945";}
.icon-audio:before {content: "\e946";}
.icon-play:before {content: "\e91c";}
.icon-link:before {content: "\e936";}
.icon-ym:before { content: "\e937";}
.icon-wp:before {content: "\e938";}
.icon-read:before { content: "\e939";}
.icon-certificate:before {content: "\e93a";}
.icon-school:before {content: "\e93b";}
.icon-speaker:before {content: "\e93c";}
.icon-atom:before {content: "\e93d";}
.icon-bag:before {content: "\e93e";}
.icon-carbuy:before {content: "\e93f";}
.icon-idea:before {content: "\e940";}
.icon-hands:before {content: "\e941";}
.icon-arrowprev:before {content: "\e942";}
.icon-mouse:before {content: "\e900";}
.icon-mail:before {content: "\e901";}
.icon-down:before {content: "\e902";}
.icon-up:before {content: "\e903";}
.icon-right:before {content: "\e904";}
.icon-left:before {content: "\e905";}
.icon-headphones:before {content: "\e906";}
.icon-download:before {content: "\e907";}
.icon-chat:before {content: "\e908";}
.icon-books:before {content: "\e909";}
.icon-calculator:before {content: "\e90a";}
.icon-wrong:before {content: "\e90b";}
.icon-conversation:before { content: "\e90c";}
.icon-correct:before {content: "\e90d";}
.icon-error:before {content: "\e90e";}
.icon-interchange:before {content: "\e90f";}
.icon-conectivity:before {content: "\e910";}
.icon-video:before {content: "\e911";}
.icon-desktop:before {content: "\e912";}
.icon-document:before {content: "\e913";}
.icon-stethoscope:before { content: "\e914";}
.icon-student:before {content: "\e915";}
.icon-smartphone:before {content: "\e916";}
.icon-pencil:before {content: "\e917";}
.icon-sitemap:before {content: "\e918";}
.icon-medal:before {content: "\e919";}
.icon-microphone:before {content: "\e91a";}
.icon-wireless:before {content: "\e91b";}
.icon-fountain:before {content: "\e91d";}
.icon-feather:before {content: "\e91e";}
.icon-pen:before {content: "\e91f";}
.icon-pentwo:before {content: "\e920";}
.icon-watercolor:before {content: "\e921";}
.icon-search:before {content: "\e922";}
.icon-security:before {content: "\e923";}
.icon-consult:before {content: "\e924";}
.icon-sound:before {content: "\e925";}
.icon-files:before {content: "\e926";}
.icon-upload:before {content: "\e927";}
.icon-close:before {content: "\e928";}
.icon-arrow:before {content: "\e929";}
.icon-mark:before {content: "\e92a";}
.icon-time:before {content: "\e92b";}
.icon-phone:before {content: "\e92c";}
.icon-share:before {content: "\e92d";}
.icon-seeker:before {content: "\e92e";}
.icon-fb:before {content: "\e92f";}
.icon-tw:before {content: "\e930";}
.icon-yt:before {content: "\e931";}
.icon-ig:before {content: "\e932";}
.icon-in:before {content: "\e933";}
.icon-sc:before {content: "\e934";}
.icon-chk:before {content: "\e935";}

File diff suppressed because it is too large Load Diff

View File

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

View File

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

472
demo.html
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,50 +1,50 @@
<?php
/**
* PHPMailer SPL autoloader.
* PHP Version 5
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @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
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* PHPMailer SPL autoloader.
* @param string $classname The name of the class to load
*/
function PHPMailerAutoload($classname)
{
//Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
if (is_readable($filename)) {
require $filename;
}
}
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true);
} else {
spl_autoload_register('PHPMailerAutoload');
}
} else {
/**
* Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load
*/
spl_autoload_register($classname);
/*function __autoload($classname)
{
PHPMailerAutoload($classname);
}*/
}
<?php
/**
* PHPMailer SPL autoloader.
* PHP Version 5
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @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
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* PHPMailer SPL autoloader.
* @param string $classname The name of the class to load
*/
function PHPMailerAutoload($classname)
{
//Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
if (is_readable($filename)) {
require $filename;
}
}
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true);
} else {
spl_autoload_register('PHPMailerAutoload');
}
} else {
/**
* Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load
*/
spl_autoload_register($classname);
/*function __autoload($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
/*
* Funciones de utilidad
*/
function fechaGuion($fechaTxt, $showDay = true){//convierte fecha a guiones
$fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt);
if($showDay)
return $fechaArr[2]."-".$fechaArr[1]."-".$fechaArr[0];
else
return $fechaArr[2]."-".$fechaArr[1]."-01";
}
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
if($showDay)
return $fechaTxt;
$fechaArr = explode("-", $fechaTxt);
return $fechaArr[0]."-".$fechaArr[1]."-01";
}
return "";
}
function fechaSlash($fechaTxt, $showDay = true){//convierte fecha a /
$fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
if($showDay)
return $fechaTxt;
$fechaArr = explode("/", $fechaTxt);
return "01/".$fechaTxt[1]."/".$fechaTxt[2];
}
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt);
if($showDay)
return $fechaArr[2]."/".$fechaArr[1]."/".$fechaArr[0];
else
return "01/".$fechaArr[1]."/".$fechaArr[0];
}
return "";
}
function fechaTexto($fechaTxt, $showYear = true){//convierte fecha a cadena de texto
$fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt);
if($showYear)
return intval($fechaArr[0])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[2];
else
return intval($fechaArr[0])." de ".mesNombre($fechaArr[1]);
}
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt);
if($showYear)
return intval($fechaArr[2])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[0];
else
return intval($fechaArr[2])." de ".mesNombre($fechaArr[1]);
}
return "";
}
function fechaMonthPicker($fechaTxt){
$meses=array(1=>"ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic");
$fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt);
return $meses[intval($fechaArr[1])].", ".$fechaArr[2];
}
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt);
return $meses[intval($fechaArr[1])].", ".$fechaArr[0];
}
return "";
}
function fechaMes($fechaTxt){
$fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt);
return intval(mesNombre($fechaArr[1])." ".$fechaArr[2]);
}
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt);
return intval(mesNombre($fechaArr[2])." ".$fechaArr[1]);
}
return "";
}
function mesNombre($num){
$meses=array(1=>"enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre");
return $meses[intval($num)];
}
function diaNombre($num){
$dias=array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado");
return $dias[intval($num)];
}
function horaMin($arr, $campo = "Horario_hora"){
$min = "";
foreach($arr as $horario){
if($min == "" || date('H:i', strtotime($horario[$campo])) < date('H:i', strtotime($min))){
$min = $horario[$campo];
}
}
return date('H:i', strtotime($min));
}
function horaMax($arr, $campo = "Horario_hora_final"){
$max = "";
foreach($arr as $horario){
if($max == "" || date('H:i', strtotime($horario[$campo])) > date('H:i', strtotime($max))){
$max = $horario[$campo];
}
}
return date('H:i', strtotime($max));
}
function duracionMinutos($fechahora_i, $fechahora_f){
return round((strtotime($fechahora_f) - strtotime($fechahora_i)) / 60,2);
}
function validaPassword($pass){
$expr = '/^\S*(?=\S{5,})(?=\S*[a-zA-Z])(?=\S*[\d])(?=\S*[\W])\S*$/';
return preg_match($expr, $pass);
<?php
/*
* Funciones de utilidad
*/
function fechaGuion($fechaTxt, $showDay = true){//convierte fecha a guiones
$fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt);
if($showDay)
return $fechaArr[2]."-".$fechaArr[1]."-".$fechaArr[0];
else
return $fechaArr[2]."-".$fechaArr[1]."-01";
}
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
if($showDay)
return $fechaTxt;
$fechaArr = explode("-", $fechaTxt);
return $fechaArr[0]."-".$fechaArr[1]."-01";
}
return "";
}
function fechaSlash($fechaTxt, $showDay = true){//convierte fecha a /
$fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
if($showDay)
return $fechaTxt;
$fechaArr = explode("/", $fechaTxt);
return "01/".$fechaTxt[1]."/".$fechaTxt[2];
}
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt);
if($showDay)
return $fechaArr[2]."/".$fechaArr[1]."/".$fechaArr[0];
else
return "01/".$fechaArr[1]."/".$fechaArr[0];
}
return "";
}
function fechaTexto($fechaTxt, $showYear = true){//convierte fecha a cadena de texto
$fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt);
if($showYear)
return intval($fechaArr[0])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[2];
else
return intval($fechaArr[0])." de ".mesNombre($fechaArr[1]);
}
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt);
if($showYear)
return intval($fechaArr[2])." de ".mesNombre($fechaArr[1])." de ".$fechaArr[0];
else
return intval($fechaArr[2])." de ".mesNombre($fechaArr[1]);
}
return "";
}
function fechaMonthPicker($fechaTxt){
$meses=array(1=>"ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic");
$fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt);
return $meses[intval($fechaArr[1])].", ".$fechaArr[2];
}
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt);
return $meses[intval($fechaArr[1])].", ".$fechaArr[0];
}
return "";
}
function fechaMes($fechaTxt){
$fechaTxt = trim($fechaTxt);
if(substr($fechaTxt,2,1) == "/" && substr($fechaTxt,5,1) == "/"){// dd/mm/aaaa
$fechaArr = explode("/", $fechaTxt);
return intval(mesNombre($fechaArr[1])." ".$fechaArr[2]);
}
if(substr($fechaTxt,4,1) == "-" && substr($fechaTxt,7,1) == "-"){// aaaa-mm-dd
$fechaArr = explode("-", $fechaTxt);
return intval(mesNombre($fechaArr[2])." ".$fechaArr[1]);
}
return "";
}
function mesNombre($num){
$meses=array(1=>"enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre");
return $meses[intval($num)];
}
function diaNombre($num){
$dias=array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado");
return $dias[intval($num)];
}
function horaMin($arr, $campo = "Horario_hora"){
$min = "";
foreach($arr as $horario){
if($min == "" || date('H:i', strtotime($horario[$campo])) < date('H:i', strtotime($min))){
$min = $horario[$campo];
}
}
return date('H:i', strtotime($min));
}
function horaMax($arr, $campo = "Horario_hora_final"){
$max = "";
foreach($arr as $horario){
if($max == "" || date('H:i', strtotime($horario[$campo])) > date('H:i', strtotime($max))){
$max = $horario[$campo];
}
}
return date('H:i', strtotime($max));
}
function duracionMinutos($fechahora_i, $fechahora_f){
return round((strtotime($fechahora_f) - strtotime($fechahora_i)) / 60,2);
}
function validaPassword($pass){
$expr = '/^\S*(?=\S{5,})(?=\S*[a-zA-Z])(?=\S*[\d])(?=\S*[\W])\S*$/';
return preg_match($expr, $pass);
}

View File

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

View File

@@ -1,148 +1,148 @@
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
const new_aviso = reactive({
titulo: '',
descripcion: '',
fechaInicio: '',
fechaFin: '',
profesores: [],
carreras: [],
reset() {
this.titulo = '';
this.descripcion = '';
this.fechaInicio = '';
this.fechaFin = '';
this.profesores = [];
this.carreras = [];
},
get isValid() {
return this.titulo !== '' && this.descripcion !== '' && this.fechaInicio !== '' && this.fechaFin !== '' && (this.profesores.length > 0 || this.carreras.length > 0) && this.facultad_id !== null;
},
});
// define datepicker method
const app = createApp({
new_aviso,
profesores: [],
carreras: [],
avisos: [],
profesor: null,
formatProfesor(profesor) {
return `(${profesor.profesor_clave}) ${profesor.profesor_nombre}`;
},
addProfesor() {
const profesorObj = this.profesores.find((profesor) => this.profesor === this.formatProfesor(profesor));
if (profesorObj) {
this.new_aviso.profesores.push(profesorObj);
this.profesor = null;
}
},
aviso_shown: null,
// int?
aviso_suspendido: null,
suspenderAviso() {
if (this.aviso_suspendido) {
const aviso = this.avisos.find((aviso) => aviso.aviso_id === this.aviso_suspendido);
if (aviso) {
this.deleteAviso(aviso);
}
}
},
get relevant_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));
// 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;
},
get relevant_carreras() {
// not in array new_aviso.carreras
return this.carreras.filter((carrera) => !this.new_aviso.carreras.includes(carrera));
},
createAviso() {
const data = {
aviso_titulo: this.new_aviso.titulo,
aviso_texto: this.new_aviso.descripcion,
aviso_fecha_inicial: this.new_aviso.fechaInicio,
aviso_fecha_final: this.new_aviso.fechaFin,
profesores: this.new_aviso.profesores.map((profesor) => profesor.profesor_id),
carreras: this.new_aviso.carreras.map((carrera) => carrera.carrera_id),
};
fetch('/action/avisos.php', {
method: 'POST',
body: JSON.stringify(data)
}).then(res => res.json()).then(res => {
if (res.success) {
// hydrate with carreras and profesores
this.avisos.push({
...data,
carreras: this.carreras.filter((carrera) => data.carreras.includes(carrera.carrera_id)),
profesores: this.profesores.filter((profesor) => data.profesores.includes(profesor.profesor_id)),
aviso_estado: true,
aviso_id: res.aviso_id,
});
this.new_aviso.reset();
}
else {
alert(res.error);
console.log(res.errors);
}
});
},
deleteAviso(aviso) {
fetch(`/action/avisos.php`, {
method: 'DELETE',
body: JSON.stringify({ aviso_id: aviso.aviso_id })
}).then(res => res.json()).then(res => {
if (res.success) {
this.avisos = this.avisos.filter((aviso) => aviso.aviso_id !== this.aviso_suspendido);
this.aviso_suspendido = null;
}
else {
alert(res.error);
console.log(res.errors);
}
});
},
updateAviso() {
fetch(`/action/avisos.php`, {
method: 'PUT',
body: JSON.stringify({
aviso_id: this.aviso_shown.aviso_id,
aviso_fecha_final: this.aviso_shown.aviso_fecha_final,
})
}).then(res => res.json()).then(res => {
if (res.success) {
}
else {
alert(res.error);
console.log(res.errors);
}
});
},
async initializeDatepickers($el) {
const periodo = await fetch('action/periodo_datos.php');
const periodo_data = await periodo.json();
$('.date-picker').datepicker({
dateFormat: 'yy-mm-dd',
maxDate: periodo_data.periodo_fecha_fin,
minDate: 0,
});
$($el).on('change', () => {
this.aviso_shown.aviso_fecha_final = $($el).val();
});
},
async mounted() {
this.avisos = await fetch("/action/avisos.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());
await this.initializeDatepickers();
const fechaInicio = $('#fechaInicio.date-picker');
const fechaFin = $('#fechaFin.date-picker');
fechaInicio.on("change", function () {
new_aviso.fechaInicio = fechaInicio.val();
fechaFin.datepicker("option", "minDate", fechaInicio.val());
});
fechaFin.on("change", function () {
new_aviso.fechaFin = fechaFin.val();
fechaInicio.datepicker("option", "maxDate", fechaFin.val());
});
}
}).mount('#app');
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
const new_aviso = reactive({
titulo: '',
descripcion: '',
fechaInicio: '',
fechaFin: '',
profesores: [],
carreras: [],
reset() {
this.titulo = '';
this.descripcion = '';
this.fechaInicio = '';
this.fechaFin = '';
this.profesores = [];
this.carreras = [];
},
get isValid() {
return this.titulo !== '' && this.descripcion !== '' && this.fechaInicio !== '' && this.fechaFin !== '' && (this.profesores.length > 0 || this.carreras.length > 0) && this.facultad_id !== null;
},
});
// define datepicker method
const app = createApp({
new_aviso,
profesores: [],
carreras: [],
avisos: [],
profesor: null,
formatProfesor(profesor) {
return `(${profesor.profesor_clave}) ${profesor.profesor_nombre}`;
},
addProfesor() {
const profesorObj = this.profesores.find((profesor) => this.profesor === this.formatProfesor(profesor));
if (profesorObj) {
this.new_aviso.profesores.push(profesorObj);
this.profesor = null;
}
},
aviso_shown: null,
// int?
aviso_suspendido: null,
suspenderAviso() {
if (this.aviso_suspendido) {
const aviso = this.avisos.find((aviso) => aviso.aviso_id === this.aviso_suspendido);
if (aviso) {
this.deleteAviso(aviso);
}
}
},
get relevant_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));
// 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;
},
get relevant_carreras() {
// not in array new_aviso.carreras
return this.carreras.filter((carrera) => !this.new_aviso.carreras.includes(carrera));
},
createAviso() {
const data = {
aviso_titulo: this.new_aviso.titulo,
aviso_texto: this.new_aviso.descripcion,
aviso_fecha_inicial: this.new_aviso.fechaInicio,
aviso_fecha_final: this.new_aviso.fechaFin,
profesores: this.new_aviso.profesores.map((profesor) => profesor.profesor_id),
carreras: this.new_aviso.carreras.map((carrera) => carrera.carrera_id),
};
fetch('/action/avisos.php', {
method: 'POST',
body: JSON.stringify(data)
}).then(res => res.json()).then(res => {
if (res.success) {
// hydrate with carreras and profesores
this.avisos.push({
...data,
carreras: this.carreras.filter((carrera) => data.carreras.includes(carrera.carrera_id)),
profesores: this.profesores.filter((profesor) => data.profesores.includes(profesor.profesor_id)),
aviso_estado: true,
aviso_id: res.aviso_id,
});
this.new_aviso.reset();
}
else {
alert(res.error);
console.log(res.errors);
}
});
},
deleteAviso(aviso) {
fetch(`/action/avisos.php`, {
method: 'DELETE',
body: JSON.stringify({ aviso_id: aviso.aviso_id })
}).then(res => res.json()).then(res => {
if (res.success) {
this.avisos = this.avisos.filter((aviso) => aviso.aviso_id !== this.aviso_suspendido);
this.aviso_suspendido = null;
}
else {
alert(res.error);
console.log(res.errors);
}
});
},
updateAviso() {
fetch(`/action/avisos.php`, {
method: 'PUT',
body: JSON.stringify({
aviso_id: this.aviso_shown.aviso_id,
aviso_fecha_final: this.aviso_shown.aviso_fecha_final,
})
}).then(res => res.json()).then(res => {
if (res.success) {
}
else {
alert(res.error);
console.log(res.errors);
}
});
},
async initializeDatepickers($el) {
const periodo = await fetch('action/periodo_datos.php');
const periodo_data = await periodo.json();
$('.date-picker').datepicker({
dateFormat: 'yy-mm-dd',
maxDate: periodo_data.periodo_fecha_fin,
minDate: 0,
});
$($el).on('change', () => {
this.aviso_shown.aviso_fecha_final = $($el).val();
});
},
async mounted() {
this.avisos = await fetch("/action/avisos.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());
await this.initializeDatepickers();
const fechaInicio = $('#fechaInicio.date-picker');
const fechaFin = $('#fechaFin.date-picker');
fechaInicio.on("change", function () {
new_aviso.fechaInicio = fechaInicio.val();
fechaFin.datepicker("option", "minDate", fechaInicio.val());
});
fechaFin.on("change", function () {
new_aviso.fechaFin = fechaFin.val();
fechaInicio.datepicker("option", "maxDate", fechaFin.val());
});
}
}).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';
const app = createApp({
carreras: [],
niveles: [],
message: {},
async setNivel(carrera, nivel) {
if (carrera.nivel_id === nivel.nivel_id) {
return;
}
carrera.nivel_id = nivel.nivel_id;
carrera.nivel_nombre = nivel.nivel_nombre;
await fetch('action/carrera.php', {
method: 'PUT',
body: JSON.stringify({
carrera_id: carrera.carrera_id,
nivel_id: nivel.nivel_id
})
})
.then(res => res.json())
.then(res => {
this.message.title = "Actualización";
this.message.text = res.error ?? res.success;
this.message.type = res.error ? 'danger' : 'success';
this.message.timestamp = new Date().toLocaleTimeString();
});
},
async mounted() {
this.carreras = await fetch('action/carrera.php').then(res => res.json());
this.niveles = await fetch('action/nivel.php').then(res => res.json());
// group by facultad_id
const carreras = this.carreras.reduce((acc, cur) => {
const { facultad_nombre } = cur;
if (!acc[facultad_nombre]) {
acc[facultad_nombre] = [];
}
acc[facultad_nombre].push(cur);
return acc;
}, {});
this.carreras = Object.entries(carreras).map(([facultad_nombre, carreras]) => ({
facultad_nombre: facultad_nombre,
carreras
}));
}
}).mount('#app');
import { createApp } from 'https://unpkg.com/petite-vue?module';
const app = createApp({
carreras: [],
niveles: [],
message: {},
async setNivel(carrera, nivel) {
if (carrera.nivel_id === nivel.nivel_id) {
return;
}
carrera.nivel_id = nivel.nivel_id;
carrera.nivel_nombre = nivel.nivel_nombre;
await fetch('action/carrera.php', {
method: 'PUT',
body: JSON.stringify({
carrera_id: carrera.carrera_id,
nivel_id: nivel.nivel_id
})
})
.then(res => res.json())
.then(res => {
this.message.title = "Actualización";
this.message.text = res.error ?? res.success;
this.message.type = res.error ? 'danger' : 'success';
this.message.timestamp = new Date().toLocaleTimeString();
});
},
async mounted() {
this.carreras = await fetch('action/carrera.php').then(res => res.json());
this.niveles = await fetch('action/nivel.php').then(res => res.json());
// group by facultad_id
const carreras = this.carreras.reduce((acc, cur) => {
const { facultad_nombre } = cur;
if (!acc[facultad_nombre]) {
acc[facultad_nombre] = [];
}
acc[facultad_nombre].push(cur);
return acc;
}, {});
this.carreras = Object.entries(carreras).map(([facultad_nombre, carreras]) => ({
facultad_nombre: facultad_nombre,
carreras
}));
}
}).mount('#app');

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

@@ -1,106 +1,106 @@
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
const profesores = reactive({
data: [],
search: null,
fetch: async function () {
const response = await fetch('action/action_profesor.php');
this.data = await response.json();
},
get clave() {
const match = this.search.match(/^\((.+)\)/);
return match ? match[1] : '';
},
get current() {
return this.data.find((profesor) => profesor.profesor_clave === profesores.clave);
},
});
const facultades = reactive({
data: [],
fetch: async function () {
const facultades = await fetch('action/action_facultad.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) => ({
...facultad,
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());
return {
...carrera,
grupos,
};
})),
})));
this.data = this.data.filter((facultad) => facultad.carreras.length > 0);
}
});
const horarios = reactive({
data: [],
fetch: async function (grupo = null, carrera_id = null) {
if (grupo && carrera_id) {
const response = await fetch(`action/action_horario.php?grupo=${grupo}&carrera_id=${carrera_id}`);
this.data = await response.json();
}
else if (profesores.current) {
const response = await fetch(`action/action_horario.php?profesor_id=${profesores.current.profesor_id}`);
this.data = await response.json();
}
},
get structure() {
if (this.data.length === 0)
return null;
const structure = {
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áxima: Math.max(...this.data.map((horario) => {
const [hour, minute] = horario.horario_fin.split(':').map(Number);
return hour + Math.ceil(minute / 60);
})),
horas_totales: 0
};
structure.horas_totales = structure.hora_máxima - structure.hora_mínima;
return structure;
},
get blocks() {
if (this.data.length === 0)
return null;
return [...Array(this.structure.horas_totales).keys()].flatMap(hora => {
const baseHour = hora + this.structure.hora_mínima;
return [0, 15, 30, 45].map(block => ({ hour: baseHour, block }));
});
},
getHorarioData(hour, block, día) {
const foundHorario = this.data.find((horario) => parseInt(horario.horario_hora.split(':')[0]) === hour &&
parseInt(horario.horario_hora.split(':')[1]) === block &&
horario.horario_dia === día);
return foundHorario;
},
isOccupied(hora, bloque, day) {
if (this.getHorarioData(hora, bloque, day)) {
return false;
}
const currentTimeInMinutes = hora * 60 + bloque;
for (const item of this.data) {
if (item.horario_dia !== day) {
continue; // Skip items that are not on the specified day
}
// Split the hour and minute from horario_hora
const [startHour, startMinute] = item.horario_hora.split(":").map(Number);
const startTimeInMinutes = startHour * 60 + startMinute;
// Calculate end time using duracion
const [durationHours, durationMinutes] = item.duracion.split(":").map(Number);
const endTimeInMinutes = startTimeInMinutes + (durationHours * 60) + durationMinutes;
if (currentTimeInMinutes >= startTimeInMinutes && currentTimeInMinutes < endTimeInMinutes) {
return true; // The block is occupied
}
}
return false; // The block is not occupied by any class
}
});
const app = createApp({
profesores,
horarios,
facultades,
mounted: async function () {
await profesores.fetch();
await facultades.fetch();
}
}).mount('#app');
import { createApp, reactive } from 'https://unpkg.com/petite-vue?module';
const profesores = reactive({
data: [],
search: null,
fetch: async function () {
const response = await fetch('action/action_profesor.php');
this.data = await response.json();
},
get clave() {
const match = this.search.match(/^\((.+)\)/);
return match ? match[1] : '';
},
get current() {
return this.data.find((profesor) => profesor.profesor_clave === profesores.clave);
},
});
const facultades = reactive({
data: [],
fetch: async function () {
const facultades = await fetch('action/action_facultad.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) => ({
...facultad,
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());
return {
...carrera,
grupos,
};
})),
})));
this.data = this.data.filter((facultad) => facultad.carreras.length > 0);
}
});
const horarios = reactive({
data: [],
fetch: async function (grupo = null, carrera_id = null) {
if (grupo && carrera_id) {
const response = await fetch(`action/action_horario.php?grupo=${grupo}&carrera_id=${carrera_id}`);
this.data = await response.json();
}
else if (profesores.current) {
const response = await fetch(`action/action_horario.php?profesor_id=${profesores.current.profesor_id}`);
this.data = await response.json();
}
},
get structure() {
if (this.data.length === 0)
return null;
const structure = {
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áxima: Math.max(...this.data.map((horario) => {
const [hour, minute] = horario.horario_fin.split(':').map(Number);
return hour + Math.ceil(minute / 60);
})),
horas_totales: 0
};
structure.horas_totales = structure.hora_máxima - structure.hora_mínima;
return structure;
},
get blocks() {
if (this.data.length === 0)
return null;
return [...Array(this.structure.horas_totales).keys()].flatMap(hora => {
const baseHour = hora + this.structure.hora_mínima;
return [0, 15, 30, 45].map(block => ({ hour: baseHour, block }));
});
},
getHorarioData(hour, block, día) {
const foundHorario = this.data.find((horario) => parseInt(horario.horario_hora.split(':')[0]) === hour &&
parseInt(horario.horario_hora.split(':')[1]) === block &&
horario.horario_dia === día);
return foundHorario;
},
isOccupied(hora, bloque, day) {
if (this.getHorarioData(hora, bloque, day)) {
return false;
}
const currentTimeInMinutes = hora * 60 + bloque;
for (const item of this.data) {
if (item.horario_dia !== day) {
continue; // Skip items that are not on the specified day
}
// Split the hour and minute from horario_hora
const [startHour, startMinute] = item.horario_hora.split(":").map(Number);
const startTimeInMinutes = startHour * 60 + startMinute;
// Calculate end time using duracion
const [durationHours, durationMinutes] = item.duracion.split(":").map(Number);
const endTimeInMinutes = startTimeInMinutes + (durationHours * 60) + durationMinutes;
if (currentTimeInMinutes >= startTimeInMinutes && currentTimeInMinutes < endTimeInMinutes) {
return true; // The block is occupied
}
}
return false; // The block is not occupied by any class
}
});
const app = createApp({
profesores,
horarios,
facultades,
mounted: async function () {
await profesores.fetch();
await facultades.fetch();
}
}).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';
const app = createApp({
periodos: [],
niveles: [],
messages: [],
addMessage(title, text, type) {
this.messages.push({ title, text, type, timestamp: new Date() });
},
async sendRequest(action, periodo_id, data) {
const response = await fetch('action/periodos.php', {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: action,
periodo_id: periodo_id,
...data
})
});
return await response.json();
},
async changeNivel(periodo, nivel_id) {
if (periodo.nivel_id === nivel_id)
return;
const result = await this.sendRequest('changeNivel', periodo.periodo_id, { nivel_id: nivel_id });
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');
periodo.nivel_id = nivel_id;
periodo.nivel = this.niveles.find((nivel) => nivel.nivel_id === nivel_id)?.nivel_nombre || '';
}
else {
this.addMessage('Error al cambiar nivel', `No se pudo cambiar el nivel del periodo ${periodo.periodo_nombre}`, 'danger');
}
},
async changeFechaInicio(periodo, fecha_inicio) {
const result = await this.sendRequest('changeFechaInicio', periodo.periodo_id, { periodo_fecha_inicio: fecha_inicio });
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');
periodo.periodo_fecha_inicio = fecha_inicio;
}
else {
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) {
const result = await this.sendRequest('changeFechaFin', periodo.periodo_id, { periodo_fecha_fin: fecha_fin });
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');
periodo.periodo_fecha_fin = fecha_fin;
}
else {
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) {
const result = await this.sendRequest('updatePeriodo', periodo.periodo_id, {
periodo_nombre: periodo.periodo_nombre,
id_periodo_sgu: periodo.id_periodo_sgu,
periodo_clave: periodo.periodo_clave,
});
if (result.success) {
this.addMessage('Periodo actualizado', `El periodo ${periodo.periodo_nombre} ha sido actualizado`, 'success');
}
else {
this.addMessage('Error al actualizar periodo', `No se pudo actualizar el periodo ${periodo.periodo_nombre}`, 'danger');
}
},
async createPeriodo(newPeriodo) {
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');
return;
}
const result = await fetch('action/periodos.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(newPeriodo)
}).then(res => res.json());
if (result.success) {
this.addMessage('Periodo creado', `El periodo ${newPeriodo.periodo_nombre} ha sido creado`, 'success');
this.periodos;
Object.keys(newPeriodo).forEach(key => newPeriodo[key] = null);
newPeriodo.nivel_id = '';
this.periodos = await fetch('action/periodos.php').then(res => res.json());
}
else {
this.addMessage('Error al crear periodo', `No se pudo crear el periodo ${newPeriodo.periodo_nombre}`, 'danger');
}
},
async deletePeriodo(periodo) {
const response = await fetch('action/periodos.php', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
periodo_id: periodo.periodo_id,
})
});
const result = await response.json();
if (result.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);
}
else {
this.addMessage('Error al eliminar periodo', `No se pudo eliminar el periodo ${periodo.periodo_nombre}`, 'danger');
}
},
async mounted() {
this.periodos = await fetch('action/periodos.php').then(res => res.json());
this.niveles = await fetch('action/nivel.php').then(res => res.json());
}
}).mount('#app');
import { createApp } from 'https://unpkg.com/petite-vue?module';
const app = createApp({
periodos: [],
niveles: [],
messages: [],
addMessage(title, text, type) {
this.messages.push({ title, text, type, timestamp: new Date() });
},
async sendRequest(action, periodo_id, data) {
const response = await fetch('action/periodos.php', {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
action: action,
periodo_id: periodo_id,
...data
})
});
return await response.json();
},
async changeNivel(periodo, nivel_id) {
if (periodo.nivel_id === nivel_id)
return;
const result = await this.sendRequest('changeNivel', periodo.periodo_id, { nivel_id: nivel_id });
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');
periodo.nivel_id = nivel_id;
periodo.nivel = this.niveles.find((nivel) => nivel.nivel_id === nivel_id)?.nivel_nombre || '';
}
else {
this.addMessage('Error al cambiar nivel', `No se pudo cambiar el nivel del periodo ${periodo.periodo_nombre}`, 'danger');
}
},
async changeFechaInicio(periodo, fecha_inicio) {
const result = await this.sendRequest('changeFechaInicio', periodo.periodo_id, { periodo_fecha_inicio: fecha_inicio });
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');
periodo.periodo_fecha_inicio = fecha_inicio;
}
else {
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) {
const result = await this.sendRequest('changeFechaFin', periodo.periodo_id, { periodo_fecha_fin: fecha_fin });
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');
periodo.periodo_fecha_fin = fecha_fin;
}
else {
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) {
const result = await this.sendRequest('updatePeriodo', periodo.periodo_id, {
periodo_nombre: periodo.periodo_nombre,
id_periodo_sgu: periodo.id_periodo_sgu,
periodo_clave: periodo.periodo_clave,
});
if (result.success) {
this.addMessage('Periodo actualizado', `El periodo ${periodo.periodo_nombre} ha sido actualizado`, 'success');
}
else {
this.addMessage('Error al actualizar periodo', `No se pudo actualizar el periodo ${periodo.periodo_nombre}`, 'danger');
}
},
async createPeriodo(newPeriodo) {
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');
return;
}
const result = await fetch('action/periodos.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(newPeriodo)
}).then(res => res.json());
if (result.success) {
this.addMessage('Periodo creado', `El periodo ${newPeriodo.periodo_nombre} ha sido creado`, 'success');
this.periodos;
Object.keys(newPeriodo).forEach(key => newPeriodo[key] = null);
newPeriodo.nivel_id = '';
this.periodos = await fetch('action/periodos.php').then(res => res.json());
}
else {
this.addMessage('Error al crear periodo', `No se pudo crear el periodo ${newPeriodo.periodo_nombre}`, 'danger');
}
},
async deletePeriodo(periodo) {
const response = await fetch('action/periodos.php', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
periodo_id: periodo.periodo_id,
})
});
const result = await response.json();
if (result.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);
}
else {
this.addMessage('Error al eliminar periodo', `No se pudo eliminar el periodo ${periodo.periodo_nombre}`, 'danger');
}
},
async mounted() {
this.periodos = await fetch('action/periodos.php').then(res => res.json());
this.niveles = await fetch('action/nivel.php').then(res => res.json());
}
}).mount('#app');

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

404
logs.php
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,50 +1,50 @@
<?php
/**
* PHPMailer SPL autoloader.
* PHP Version 5
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @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
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* PHPMailer SPL autoloader.
* @param string $classname The name of the class to load
*/
function PHPMailerAutoload($classname)
{
//Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
if (is_readable($filename)) {
require $filename;
}
}
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true);
} else {
spl_autoload_register('PHPMailerAutoload');
}
} else {
/**
* Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load
*/
spl_autoload_register($classname);
/*function __autoload($classname)
{
PHPMailerAutoload($classname);
}*/
}
<?php
/**
* PHPMailer SPL autoloader.
* PHP Version 5
* @package PHPMailer
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2014 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @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
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* PHPMailer SPL autoloader.
* @param string $classname The name of the class to load
*/
function PHPMailerAutoload($classname)
{
//Can't use __DIR__ as it's only in PHP 5.3+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
if (is_readable($filename)) {
require $filename;
}
}
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
//SPL autoloading was introduced in PHP 5.1.2
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register('PHPMailerAutoload', true, true);
} else {
spl_autoload_register('PHPMailerAutoload');
}
} else {
/**
* Fall back to traditional autoload for old PHP versions
* @param string $classname The name of the class to load
*/
spl_autoload_register($classname);
/*function __autoload($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>
details {
border: 1px solid #aaa;
border-radius: 4px;
padding: 0.5em 0.5em 0;
margin: 0.5em 0;
}
summary {
font-weight: bold;
margin: -0.5em -0.5em 0;
padding: 0.5em;
}
details[open] {
padding: 0.5em;
}
details[open] summary {
border-bottom: 1px solid #aaa;
margin-bottom: 0.5em;
}
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
th,
td {
padding: 8px;
border: 1px solid #ccc;
text-align: left;
}
th {
background-color: #f2f2f2;
}
tr:nth-child(even):not(.empty):not(.area-comun) {
background-color: #f9f9f9;
}
.json-container {
white-space: pre-wrap;
/* Since JSON is formatted with whitespace, this will keep formatting */
word-break: break-word;
/* To prevent horizontal scrolling */
max-height: 150px;
/* Set a max-height and add scroll to prevent very long JSON from cluttering the table */
overflow-y: auto;
}
.empty {
/* rosa pastel */
background-color: #ffe8f4;
}
.area-comun {
/* naranja pastel */
background-color: #ffe9d4;
}
</style>
<?php
/*
idPeriodo: identificador del periodo a consultar (obligatorio, número entero)
claveFacultad: clave de la facultad a consultar (opcional, cadena)
claveCarrera: clave de la carrera a consultar (opcional, cadena)
claveProfesor: clave del empleado a consultar (opcional, cadena)
fecha: fecha de la clase (opcional, cadena en formato yyyy-MM-dd)
*/
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('post_max_size', 1);
ini_set('max_execution_time', 8 * 60);
error_reporting(E_ALL);
date_default_timezone_set('America/Mexico_City');
$ruta = "../";
$ruta_superior = dirname(__DIR__);
require_once $ruta_superior . "/include/bd_pdo.php";
require_once __DIR__ . "/token.php";
require_once __DIR__ . "/LogCambios.php";
$fecha = isset($_GET["fecha"]) ? $_GET["fecha"] : date("Y-m-d");
$periodos = $db
->where("id_periodo_sgu", 0, ">")
->where("periodo_fecha_inicio", $fecha, "<=")
->where("periodo_fecha_fin", $fecha, ">=")
->orderBy("periodo_id")
->get("periodo");
?>
<nav>
<form action="" method="get">
<label for="fecha">Fecha</label>
<input type="date" name="fecha" id="fecha" value="<?= $fecha ?>">
<button type="submit">Buscar</button>
</form>
<details>
<summary>Periodos</summary>
<pre>
<code><?= json_encode($periodos, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code>
</pre>
</details>
<?php
$horarios = array();
foreach (array_column($periodos, "id_periodo_sgu") as $idPeriodo) {
$curl = curl_init();
$params = array(
'idPeriodo' => $idPeriodo,
'fecha' => $fecha,
);
curl_setopt_array($curl, [
CURLOPT_URL => 'https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/seleccionar',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => json_encode($params),
CURLOPT_HTTPHEADER => [
"token: $token",
'username: SGU_APSA_AUD_ASIST',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$response = json_decode($response, true, 512, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$horarios = array_merge($horarios, $response);
?>
<details>
<summary>Periodo
<?= $idPeriodo ?>
</summary>
<pre><code><?= json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre>
</details>
<?php } ?>
</nav>
<main>
<p>
<?= count($horarios) ?> horarios encontrados para
<?= $fecha ?>
</p>
<table>
<thead>
<tr>
<th>Materia en SGU</th>
<th>Materia en Postgres</th>
</tr>
</thead>
<tbody>
<?php
// $horarios with unique "NombreMateria" field
$horarios = array_map("unserialize", array_unique(array_map("serialize", $horarios)));
foreach ($horarios as $horario) {
$materias = $db
->where("materia_nombre", trim($horario["NombreMateria"]), "ILIKE")
->join("carrera", "carrera.carrera_id = materia.carrera_id")
->join("facultad", "facultad.facultad_id = carrera.facultad_id")
->get("materia");
if (
count(array_filter($materias, fn($m) =>
$m["clave_materia"] == trim($horario["ClaveMateria"]) and
$m["clave_carrera"] == trim($horario["ClaveCarrera"]))) > 0
) {
continue;
}
// 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;
$vacío = count($materias) == 0;
?>
<!-- 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" : "" ?>">
<td class="json-container">
<details>
<summary>Horario</summary>
<pre><code><?= json_encode($horario, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre>
</details>
<?= json_encode(array_intersect_key($horario, array_flip(["ClaveMateria", "NombreMateria", "ClaveCarrera", "Dependencia"])), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>
</td>
<td class="json-container">
<?php if ($vacío) { ?>
<p>No se encontraron materias</p>
<?php } else { ?>
<details>
<summary>Materias</summary>
<pre><code><?= json_encode($materias, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre>
</details>
<table>
<thead>
<tr>
<th>Materia</th>
<th>Carrera</th>
<th>Facultad</th>
<th>Acciones</th>
</tr>
</thead>
<tbody>
<script>
async function copiar_seleccionados() {
// en mi clipboard quiero (join con ,)
const materias_seleccionadas = Array.from(document.querySelectorAll("input[name='materia_id']:checked"))
.map(input => input.value)
.join(",");
// copiar al clipboard
await navigator.clipboard.writeText(materias_seleccionadas);
// mostrar mensaje de éxito
alert("Copiado al portapapeles");
}
</script>
<?php foreach ($materias as $materia) { ?>
<tr>
<td>
<input type="checkbox" name="materia_id" id="materia_id"
value="<?= $materia["materia_id"] ?>">
</td>
<td>
<?= $materia["materia_id"] ?>
<small>
(
<?= $materia["clave_materia"] ?>)
</small>
<?= $materia["materia_nombre"] ?>
</td>
<td>
<small>
(
<?= $materia["clave_carrera"] ?>)
</small>
<?= $materia["carrera_nombre"] ?>
</td>
<td>
<small>
(
<?= $materia["clave_dependencia"] ?>)
</small>
<?= $materia["facultad_nombre"] ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<style>
details {
border: 1px solid #aaa;
border-radius: 4px;
padding: 0.5em 0.5em 0;
margin: 0.5em 0;
}
summary {
font-weight: bold;
margin: -0.5em -0.5em 0;
padding: 0.5em;
}
details[open] {
padding: 0.5em;
}
details[open] summary {
border-bottom: 1px solid #aaa;
margin-bottom: 0.5em;
}
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
th,
td {
padding: 8px;
border: 1px solid #ccc;
text-align: left;
}
th {
background-color: #f2f2f2;
}
tr:nth-child(even):not(.empty):not(.area-comun) {
background-color: #f9f9f9;
}
.json-container {
white-space: pre-wrap;
/* Since JSON is formatted with whitespace, this will keep formatting */
word-break: break-word;
/* To prevent horizontal scrolling */
max-height: 150px;
/* Set a max-height and add scroll to prevent very long JSON from cluttering the table */
overflow-y: auto;
}
.empty {
/* rosa pastel */
background-color: #ffe8f4;
}
.area-comun {
/* naranja pastel */
background-color: #ffe9d4;
}
</style>
<?php
/*
idPeriodo: identificador del periodo a consultar (obligatorio, número entero)
claveFacultad: clave de la facultad a consultar (opcional, cadena)
claveCarrera: clave de la carrera a consultar (opcional, cadena)
claveProfesor: clave del empleado a consultar (opcional, cadena)
fecha: fecha de la clase (opcional, cadena en formato yyyy-MM-dd)
*/
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('post_max_size', 1);
ini_set('max_execution_time', 8 * 60);
error_reporting(E_ALL);
date_default_timezone_set('America/Mexico_City');
$ruta = "../";
$ruta_superior = dirname(__DIR__);
require_once $ruta_superior . "/include/bd_pdo.php";
require_once __DIR__ . "/token.php";
require_once __DIR__ . "/LogCambios.php";
$fecha = isset($_GET["fecha"]) ? $_GET["fecha"] : date("Y-m-d");
$periodos = $db
->where("id_periodo_sgu", 0, ">")
->where("periodo_fecha_inicio", $fecha, "<=")
->where("periodo_fecha_fin", $fecha, ">=")
->orderBy("periodo_id")
->get("periodo");
?>
<nav>
<form action="" method="get">
<label for="fecha">Fecha</label>
<input type="date" name="fecha" id="fecha" value="<?= $fecha ?>">
<button type="submit">Buscar</button>
</form>
<details>
<summary>Periodos</summary>
<pre>
<code><?= json_encode($periodos, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code>
</pre>
</details>
<?php
$horarios = array();
foreach (array_column($periodos, "id_periodo_sgu") as $idPeriodo) {
$curl = curl_init();
$params = array(
'idPeriodo' => $idPeriodo,
'fecha' => $fecha,
);
curl_setopt_array($curl, [
CURLOPT_URL => 'https://portal.ulsa.edu.mx/servicios/AuditoriaAsistencialRest/AuditoriaAsistencialService.svc/auditoriaAsistencial/seleccionar',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => json_encode($params),
CURLOPT_HTTPHEADER => [
"token: $token",
'username: SGU_APSA_AUD_ASIST',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$response = json_decode($response, true, 512, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$horarios = array_merge($horarios, $response);
?>
<details>
<summary>Periodo
<?= $idPeriodo ?>
</summary>
<pre><code><?= json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre>
</details>
<?php } ?>
</nav>
<main>
<p>
<?= count($horarios) ?> horarios encontrados para
<?= $fecha ?>
</p>
<table>
<thead>
<tr>
<th>Materia en SGU</th>
<th>Materia en Postgres</th>
</tr>
</thead>
<tbody>
<?php
// $horarios with unique "NombreMateria" field
$horarios = array_map("unserialize", array_unique(array_map("serialize", $horarios)));
foreach ($horarios as $horario) {
$materias = $db
->where("materia_nombre", trim($horario["NombreMateria"]), "ILIKE")
->join("carrera", "carrera.carrera_id = materia.carrera_id")
->join("facultad", "facultad.facultad_id = carrera.facultad_id")
->get("materia");
if (
count(array_filter($materias, fn($m) =>
$m["clave_materia"] == trim($horario["ClaveMateria"]) and
$m["clave_carrera"] == trim($horario["ClaveCarrera"]))) > 0
) {
continue;
}
// 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;
$vacío = count($materias) == 0;
?>
<!-- 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" : "" ?>">
<td class="json-container">
<details>
<summary>Horario</summary>
<pre><code><?= json_encode($horario, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre>
</details>
<?= json_encode(array_intersect_key($horario, array_flip(["ClaveMateria", "NombreMateria", "ClaveCarrera", "Dependencia"])), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>
</td>
<td class="json-container">
<?php if ($vacío) { ?>
<p>No se encontraron materias</p>
<?php } else { ?>
<details>
<summary>Materias</summary>
<pre><code><?= json_encode($materias, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></code></pre>
</details>
<table>
<thead>
<tr>
<th>Materia</th>
<th>Carrera</th>
<th>Facultad</th>
<th>Acciones</th>
</tr>
</thead>
<tbody>
<script>
async function copiar_seleccionados() {
// en mi clipboard quiero (join con ,)
const materias_seleccionadas = Array.from(document.querySelectorAll("input[name='materia_id']:checked"))
.map(input => input.value)
.join(",");
// copiar al clipboard
await navigator.clipboard.writeText(materias_seleccionadas);
// mostrar mensaje de éxito
alert("Copiado al portapapeles");
}
</script>
<?php foreach ($materias as $materia) { ?>
<tr>
<td>
<input type="checkbox" name="materia_id" id="materia_id"
value="<?= $materia["materia_id"] ?>">
</td>
<td>
<?= $materia["materia_id"] ?>
<small>
(
<?= $materia["clave_materia"] ?>)
</small>
<?= $materia["materia_nombre"] ?>
</td>
<td>
<small>
(
<?= $materia["clave_carrera"] ?>)
</small>
<?= $materia["carrera_nombre"] ?>
</td>
<td>
<small>
(
<?= $materia["clave_dependencia"] ?>)
</small>
<?= $materia["facultad_nombre"] ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</main>

View File

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