Stable
This commit is contained in:
@@ -1,43 +1,43 @@
|
||||
<?php
|
||||
$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']);
|
||||
|
||||
extract($_POST);
|
||||
|
||||
$initial_date = DateTime::createFromFormat('d/m/Y', $fecha_inicial);
|
||||
$final_date = DateTime::createFromFormat('d/m/Y', $fecha_final);
|
||||
|
||||
if ($initial_date > $final_date) {
|
||||
echo json_encode(['error' => 'La fecha inicial no puede ser mayor a la fecha final']);
|
||||
die;
|
||||
}
|
||||
// Nombre del profesor es opcional
|
||||
$params = [
|
||||
':carrera' => empty($carrera) ? null : $carrera,
|
||||
':periodo' => $periodo,
|
||||
':nombre' => empty($nombre) ? null : $nombre,
|
||||
':clave' => empty($clave) ? null : $clave,
|
||||
':initial_date' => $initial_date->format('Y-m-d'),
|
||||
':final_date' => $final_date->format('Y-m-d'),
|
||||
':facultad' => $facultad,
|
||||
];
|
||||
|
||||
$response = json_encode(
|
||||
[
|
||||
"retardo" => query("SELECT FS_HAS_RETARDO(:facultad) retardo", [
|
||||
'facultad' => $facultad
|
||||
]),
|
||||
"reporte" => queryAll(
|
||||
"SELECT * FROM fs_asistencia_reporte(:carrera, :periodo, :clave, :nombre, :facultad, :initial_date, :final_date) where total > 0",
|
||||
$params
|
||||
)
|
||||
]
|
||||
);
|
||||
$user->print_to_log("Genera reporte de asistencias", old: $params);
|
||||
echo $response;
|
||||
<?php
|
||||
$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']);
|
||||
|
||||
extract($_POST);
|
||||
|
||||
$initial_date = DateTime::createFromFormat('d/m/Y', $fecha_inicial);
|
||||
$final_date = DateTime::createFromFormat('d/m/Y', $fecha_final);
|
||||
|
||||
if ($initial_date > $final_date) {
|
||||
echo json_encode(['error' => 'La fecha inicial no puede ser mayor a la fecha final']);
|
||||
die;
|
||||
}
|
||||
// Nombre del profesor es opcional
|
||||
$params = [
|
||||
':carrera' => empty($carrera) ? null : $carrera,
|
||||
':periodo' => $periodo,
|
||||
':nombre' => empty($nombre) ? null : $nombre,
|
||||
':clave' => empty($clave) ? null : $clave,
|
||||
':initial_date' => $initial_date->format('Y-m-d'),
|
||||
':final_date' => $final_date->format('Y-m-d'),
|
||||
':facultad' => $facultad,
|
||||
];
|
||||
|
||||
$response = json_encode(
|
||||
[
|
||||
"retardo" => query("SELECT FS_HAS_RETARDO(:facultad) retardo", [
|
||||
'facultad' => $facultad
|
||||
]),
|
||||
"reporte" => queryAll(
|
||||
"SELECT * FROM fs_asistencia_reporte(:carrera, :periodo, :clave, :nombre, :facultad, :initial_date, :final_date) where total > 0",
|
||||
$params
|
||||
)
|
||||
]
|
||||
);
|
||||
$user->print_to_log("Genera reporte de asistencias", old: $params);
|
||||
echo $response;
|
||||
|
||||
@@ -1,100 +1,100 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../vendor/autoload.php";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
if (!isset($_SESSION['user']))
|
||||
die(json_encode(['error' => 'No se ha iniciado sesión']));
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
$user->print_to_log('Genera excel de asistencias');
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
//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());
|
||||
|
||||
|
||||
// In POST
|
||||
/** Array
|
||||
* * nombre
|
||||
* * clave
|
||||
* * id
|
||||
* * total
|
||||
* * asistencias
|
||||
* * faltas
|
||||
* * justificaciones
|
||||
* * retardos
|
||||
*/
|
||||
|
||||
$retardo = query("SELECT COALESCE(FS_HAS_RETARDO(:facultad), FALSE) AS retardo", [':facultad' => $user->facultad['facultad_id']])['retardo'];
|
||||
extract($_POST);
|
||||
|
||||
$row = 6;
|
||||
|
||||
$sheet->setCellValue("A$row", 'Clave');
|
||||
$sheet->setCellValue("B$row", 'Profesor');
|
||||
$sheet->setCellValue("C$row", 'Asistencias');
|
||||
$sheet->setCellValue("D$row", 'Faltas');
|
||||
$sheet->setCellValue("E$row", 'Justificaciones');
|
||||
$sheet->setCellValue("F$row", 'Retardos');
|
||||
$sheet->setCellValue("G$row", 'Total');
|
||||
|
||||
// $row++;
|
||||
$col = 0;
|
||||
# die(print_r($asistencias, true));
|
||||
foreach (json_decode($asistencias, true) as $profesor) {
|
||||
$row++;
|
||||
$sheet->setCellValue("A$row", $profesor['profesor_clave']);
|
||||
$sheet->setCellValue("B$row", $profesor['profesor_nombre']);
|
||||
$sheet->setCellValue("C$row", $profesor['asistencias']);
|
||||
$sheet->setCellValue("D$row", $profesor['faltas']);
|
||||
$sheet->setCellValue("E$row", $profesor['justificaciones']);
|
||||
$sheet->setCellValue("F$row", $profesor['retardos']);
|
||||
$sheet->setCellValue("G$row", $profesor['total']);
|
||||
}
|
||||
|
||||
# Style
|
||||
$sheet->getStyle("A6:G$row")->getBorders()->getAllBorders()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN);
|
||||
$sheet->getStyle("A6:G$row")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
$sheet->getStyle("A6:G$row")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
$sheet->getStyle("A6:G$row")->getAlignment()->setWrapText(true);
|
||||
$sheet->getStyle("A6:G$row")->getFont()->setSize(12);
|
||||
$sheet->getStyle("A6:G$row")->getFont()->setName('Indivisa Sans');
|
||||
# Autosize columns
|
||||
foreach (range('A', 'G') as $column) {
|
||||
$sheet->getColumnDimension($column)->setAutoSize(true);
|
||||
}
|
||||
# filters in the column
|
||||
$sheet->setAutoFilter("A6:G6");
|
||||
|
||||
if (!$retardo) # hide column
|
||||
$sheet->getColumnDimension('F')->setVisible(false);
|
||||
|
||||
#$writer = new Xlsx($spreadsheet);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
# $writer->save('asistencias.xlsx');
|
||||
|
||||
// download
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="asistencias.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
// cache expires in 60 seconds (1 minute)
|
||||
header('Expires: mon 26 jul 1997 05:00:00 gmt');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: cache, must-revalidate');
|
||||
header('Pragma: public');
|
||||
|
||||
$writer->save('php://output');
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../vendor/autoload.php";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
if (!isset($_SESSION['user']))
|
||||
die(json_encode(['error' => 'No se ha iniciado sesión']));
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
$user->print_to_log('Genera excel de asistencias');
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
//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());
|
||||
|
||||
|
||||
// In POST
|
||||
/** Array
|
||||
* * nombre
|
||||
* * clave
|
||||
* * id
|
||||
* * total
|
||||
* * asistencias
|
||||
* * faltas
|
||||
* * justificaciones
|
||||
* * retardos
|
||||
*/
|
||||
|
||||
$retardo = query("SELECT COALESCE(FS_HAS_RETARDO(:facultad), FALSE) AS retardo", [':facultad' => $user->facultad['facultad_id']])['retardo'];
|
||||
extract($_POST);
|
||||
|
||||
$row = 6;
|
||||
|
||||
$sheet->setCellValue("A$row", 'Clave');
|
||||
$sheet->setCellValue("B$row", 'Profesor');
|
||||
$sheet->setCellValue("C$row", 'Asistencias');
|
||||
$sheet->setCellValue("D$row", 'Faltas');
|
||||
$sheet->setCellValue("E$row", 'Justificaciones');
|
||||
$sheet->setCellValue("F$row", 'Retardos');
|
||||
$sheet->setCellValue("G$row", 'Total');
|
||||
|
||||
// $row++;
|
||||
$col = 0;
|
||||
# die(print_r($asistencias, true));
|
||||
foreach (json_decode($asistencias, true) as $profesor) {
|
||||
$row++;
|
||||
$sheet->setCellValue("A$row", $profesor['profesor_clave']);
|
||||
$sheet->setCellValue("B$row", $profesor['profesor_nombre']);
|
||||
$sheet->setCellValue("C$row", $profesor['asistencias']);
|
||||
$sheet->setCellValue("D$row", $profesor['faltas']);
|
||||
$sheet->setCellValue("E$row", $profesor['justificaciones']);
|
||||
$sheet->setCellValue("F$row", $profesor['retardos']);
|
||||
$sheet->setCellValue("G$row", $profesor['total']);
|
||||
}
|
||||
|
||||
# Style
|
||||
$sheet->getStyle("A6:G$row")->getBorders()->getAllBorders()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN);
|
||||
$sheet->getStyle("A6:G$row")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
$sheet->getStyle("A6:G$row")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
$sheet->getStyle("A6:G$row")->getAlignment()->setWrapText(true);
|
||||
$sheet->getStyle("A6:G$row")->getFont()->setSize(12);
|
||||
$sheet->getStyle("A6:G$row")->getFont()->setName('Indivisa Sans');
|
||||
# Autosize columns
|
||||
foreach (range('A', 'G') as $column) {
|
||||
$sheet->getColumnDimension($column)->setAutoSize(true);
|
||||
}
|
||||
# filters in the column
|
||||
$sheet->setAutoFilter("A6:G6");
|
||||
|
||||
if (!$retardo) # hide column
|
||||
$sheet->getColumnDimension('F')->setVisible(false);
|
||||
|
||||
#$writer = new Xlsx($spreadsheet);
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
# $writer->save('asistencias.xlsx');
|
||||
|
||||
// download
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="asistencias.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
// cache expires in 60 seconds (1 minute)
|
||||
header('Expires: mon 26 jul 1997 05:00:00 gmt');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: cache, must-revalidate');
|
||||
header('Pragma: public');
|
||||
|
||||
$writer->save('php://output');
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
<?
|
||||
#input $_GET['id_espacio_sgu']
|
||||
#output rutas: [ ...ruta, salones: [{...salon}] ]
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
$information = [
|
||||
'GET' => [
|
||||
#'periodo_id',
|
||||
],
|
||||
];
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
// check method
|
||||
try {
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
array_walk($information['GET'], function ($value) {
|
||||
if (!array_key_exists($value, $_GET)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => "$value is required"]);
|
||||
exit;
|
||||
}
|
||||
});
|
||||
|
||||
$data = $db->query("SELECT *, horario_view.facultad_id FROM registro
|
||||
JOIN horario_view USING (horario_id)
|
||||
LEFT JOIN estado_supervisor USING (estado_supervisor_id)
|
||||
LEFT JOIN profesor USING (profesor_id)
|
||||
LEFT JOIN usuario ON usuario.usuario_id = registro.supervisor_id
|
||||
ORDER BY registro_fecha_ideal DESC, horario_hora ASC, registro_fecha_supervisor ASC");
|
||||
|
||||
$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);
|
||||
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');
|
||||
$information = [
|
||||
'GET' => [
|
||||
#'periodo_id',
|
||||
],
|
||||
];
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
// check method
|
||||
try {
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
array_walk($information['GET'], function ($value) {
|
||||
if (!array_key_exists($value, $_GET)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => "$value is required"]);
|
||||
exit;
|
||||
}
|
||||
});
|
||||
|
||||
$data = $db->query("SELECT *, horario_view.facultad_id, horario_view.periodo_id FROM registro
|
||||
JOIN horario_view USING (horario_id)
|
||||
LEFT JOIN estado_supervisor USING (estado_supervisor_id)
|
||||
LEFT JOIN profesor USING (profesor_id)
|
||||
LEFT JOIN usuario ON usuario.usuario_id = registro.supervisor_id
|
||||
ORDER BY registro_fecha_ideal DESC, horario_hora ASC, registro_fecha_supervisor ASC");
|
||||
|
||||
$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);
|
||||
exit;
|
||||
} catch (Exception $th) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $th->getMessage(),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
exit;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
$ruta = '../';
|
||||
require_once '../include/bd_pdo.php';
|
||||
global $pdo;
|
||||
|
||||
$sql = "SELECT fu_update_estado_aviso(false, :id)";
|
||||
$params = [':id' => $_POST['id']];
|
||||
echo json_encode(query($sql, $params, false));
|
||||
<?php
|
||||
$ruta = '../';
|
||||
require_once '../include/bd_pdo.php';
|
||||
global $pdo;
|
||||
|
||||
$sql = "SELECT fu_update_estado_aviso(false, :id)";
|
||||
$params = [':id' => $_POST['id']];
|
||||
echo json_encode(query($sql, $params, false));
|
||||
?>
|
||||
@@ -1,28 +1,28 @@
|
||||
<?php
|
||||
$ruta = '../';
|
||||
require_once '../include/bd_pdo.php';
|
||||
global $pdo;
|
||||
|
||||
$profesores = [];
|
||||
|
||||
if(isset($_POST['tipo'])){
|
||||
foreach($_POST['tipo'] as $tipo){
|
||||
$profesores_carrera = query("SELECT profesor_id FROM fs_profesor_carrera(:carrera_id)", [':carrera_id' => $tipo], false);
|
||||
foreach($profesores_carrera as $profesor){
|
||||
array_push($profesores, $profesor['profesor_id']);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$sql = "SELECT fi_aviso(:fecha_inicial, :fecha_final, :texto, :facultad)";
|
||||
$params = [':fecha_inicial' => $_POST['fecha_inicial'], ':fecha_final' => $_POST['fecha_final'], ':texto' => $_POST['texto'], ':facultad' => $_POST['facultad']];
|
||||
$aviso_id = query($sql, $params, true);
|
||||
|
||||
$sql = "SELECT fi_aviso_profesor(:aviso_id, :profesor_id)";
|
||||
foreach($profesores as $profesor_id){
|
||||
$params = [':aviso_id' => $aviso_id['fi_aviso'], ':profesor_id' => $profesor_id];
|
||||
query($sql, $params, false);
|
||||
}
|
||||
header("Location: ../avisos.php");
|
||||
exit();
|
||||
<?php
|
||||
$ruta = '../';
|
||||
require_once '../include/bd_pdo.php';
|
||||
global $pdo;
|
||||
|
||||
$profesores = [];
|
||||
|
||||
if(isset($_POST['tipo'])){
|
||||
foreach($_POST['tipo'] as $tipo){
|
||||
$profesores_carrera = query("SELECT profesor_id FROM fs_profesor_carrera(:carrera_id)", [':carrera_id' => $tipo], false);
|
||||
foreach($profesores_carrera as $profesor){
|
||||
array_push($profesores, $profesor['profesor_id']);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$sql = "SELECT fi_aviso(:fecha_inicial, :fecha_final, :texto, :facultad)";
|
||||
$params = [':fecha_inicial' => $_POST['fecha_inicial'], ':fecha_final' => $_POST['fecha_final'], ':texto' => $_POST['texto'], ':facultad' => $_POST['facultad']];
|
||||
$aviso_id = query($sql, $params, true);
|
||||
|
||||
$sql = "SELECT fi_aviso_profesor(:aviso_id, :profesor_id)";
|
||||
foreach($profesores as $profesor_id){
|
||||
$params = [':aviso_id' => $aviso_id['fi_aviso'], ':profesor_id' => $profesor_id];
|
||||
query($sql, $params, false);
|
||||
}
|
||||
header("Location: ../avisos.php");
|
||||
exit();
|
||||
?>
|
||||
@@ -1,52 +1,52 @@
|
||||
<?php
|
||||
$ruta = '../';
|
||||
require_once '../include/bd_pdo.php';
|
||||
global $pdo;
|
||||
|
||||
$aviso = query("SELECT * FROM fs_aviso(:id, null, null, null, 0, null)", [':id' => $_POST['aviso_id']], true);
|
||||
if(isset($_POST['fecha_final'])){
|
||||
$fecha_fin = $_POST['fecha_final'];
|
||||
}else{
|
||||
$fecha_fin = $aviso['aviso_fecha_final'];
|
||||
}
|
||||
if(isset($_POST['texto'])){
|
||||
$texto = $_POST['texto'];
|
||||
}else{
|
||||
$texto = $aviso['aviso_texto'];
|
||||
}
|
||||
if(isset($_POST['fecha_inicial'])){
|
||||
$fecha_inicio = $_POST['fecha_inicial'];
|
||||
}else{
|
||||
$fecha_inicio = $aviso['aviso_fecha_inicial'];
|
||||
}
|
||||
|
||||
$sql = "SELECT fu_update_aviso(:id, :fecha_fin, :texto, :fecha_inicio)";
|
||||
$params = [':id' => $_POST['aviso_id'], ':fecha_fin' => $fecha_fin, ':texto' => $texto, ':fecha_inicio' => $fecha_inicio];
|
||||
query($sql, $params, true);
|
||||
|
||||
query("SELECT fd_aviso_profesor(:aviso_id)", [':aviso_id' => $_POST['aviso_id']], false);
|
||||
|
||||
$profesores = [];
|
||||
if(isset($_POST['tipo'])){
|
||||
foreach($_POST['tipo'] as $tipo){
|
||||
$profesores_carrera = query("SELECT profesor_id FROM fs_profesor_carrera(:carrera_id)", [':carrera_id' => $tipo], false);
|
||||
foreach($profesores_carrera as $profesor){
|
||||
array_push($profesores, $profesor['profesor_id']);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach($_POST['usuario'] as $profesor){
|
||||
array_push($profesores, $profesor);
|
||||
}
|
||||
$sql = "SELECT fi_aviso_profesor(:aviso_id, :profesor_id)";
|
||||
foreach($profesores as $profesor_id){
|
||||
$params = [':aviso_id' => $_POST['aviso_id'], ':profesor_id' => $profesor_id];
|
||||
query($sql, $params, false);
|
||||
}
|
||||
|
||||
header("Location: ../avisos.php");
|
||||
exit();
|
||||
<?php
|
||||
$ruta = '../';
|
||||
require_once '../include/bd_pdo.php';
|
||||
global $pdo;
|
||||
|
||||
$aviso = query("SELECT * FROM fs_aviso(:id, null, null, null, 0, null)", [':id' => $_POST['aviso_id']], true);
|
||||
if(isset($_POST['fecha_final'])){
|
||||
$fecha_fin = $_POST['fecha_final'];
|
||||
}else{
|
||||
$fecha_fin = $aviso['aviso_fecha_final'];
|
||||
}
|
||||
if(isset($_POST['texto'])){
|
||||
$texto = $_POST['texto'];
|
||||
}else{
|
||||
$texto = $aviso['aviso_texto'];
|
||||
}
|
||||
if(isset($_POST['fecha_inicial'])){
|
||||
$fecha_inicio = $_POST['fecha_inicial'];
|
||||
}else{
|
||||
$fecha_inicio = $aviso['aviso_fecha_inicial'];
|
||||
}
|
||||
|
||||
$sql = "SELECT fu_update_aviso(:id, :fecha_fin, :texto, :fecha_inicio)";
|
||||
$params = [':id' => $_POST['aviso_id'], ':fecha_fin' => $fecha_fin, ':texto' => $texto, ':fecha_inicio' => $fecha_inicio];
|
||||
query($sql, $params, true);
|
||||
|
||||
query("SELECT fd_aviso_profesor(:aviso_id)", [':aviso_id' => $_POST['aviso_id']], false);
|
||||
|
||||
$profesores = [];
|
||||
if(isset($_POST['tipo'])){
|
||||
foreach($_POST['tipo'] as $tipo){
|
||||
$profesores_carrera = query("SELECT profesor_id FROM fs_profesor_carrera(:carrera_id)", [':carrera_id' => $tipo], false);
|
||||
foreach($profesores_carrera as $profesor){
|
||||
array_push($profesores, $profesor['profesor_id']);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach($_POST['usuario'] as $profesor){
|
||||
array_push($profesores, $profesor);
|
||||
}
|
||||
$sql = "SELECT fi_aviso_profesor(:aviso_id, :profesor_id)";
|
||||
foreach($profesores as $profesor_id){
|
||||
$params = [':aviso_id' => $_POST['aviso_id'], ':profesor_id' => $profesor_id];
|
||||
query($sql, $params, false);
|
||||
}
|
||||
|
||||
header("Location: ../avisos.php");
|
||||
exit();
|
||||
?>
|
||||
@@ -1,24 +1,24 @@
|
||||
<?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";
|
||||
|
||||
$nivel = $db->where("id", $_POST['periodo'])->getOne("fs_periodo", "nivel_id");
|
||||
$carreras = $db
|
||||
->where("nivel", $nivel)
|
||||
->where("facultad", $_POST['facultad'])
|
||||
->get("fs_carrera", null, "id, carrera");
|
||||
|
||||
$user->print_to_log("Crea carrera", old: $_POST);
|
||||
|
||||
die(json_encode($carreras));
|
||||
<?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";
|
||||
|
||||
$nivel = $db->where("id", $_POST['periodo'])->getOne("fs_periodo", "nivel_id");
|
||||
$carreras = $db
|
||||
->where("nivel", $nivel)
|
||||
->where("facultad", $_POST['facultad'])
|
||||
->get("fs_carrera", null, "id, carrera");
|
||||
|
||||
$user->print_to_log("Crea carrera", old: $_POST);
|
||||
|
||||
die(json_encode($carreras));
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
$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";
|
||||
$sql = "SELECT fi_carrera(:nombre, :idfacultad, :idnivel, true, :estado)";
|
||||
$params = [':nombre' => mb_strtoupper($_POST['nombre']), ':idfacultad' => $_POST['facultad'], ':idnivel' => $_POST['nivel'], ':estado' => $_POST['estado']];
|
||||
|
||||
print_r($_POST);
|
||||
echo json_encode(query($sql, $params, true));
|
||||
$user->print_to_log("Crea carrera", new: $params);
|
||||
header("Location: ../carreras.php?facultad=" . $_POST['facultad']);
|
||||
exit();
|
||||
<?php
|
||||
$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";
|
||||
$sql = "SELECT fi_carrera(:nombre, :idfacultad, :idnivel, true, :estado)";
|
||||
$params = [':nombre' => mb_strtoupper($_POST['nombre']), ':idfacultad' => $_POST['facultad'], ':idnivel' => $_POST['nivel'], ':estado' => $_POST['estado']];
|
||||
|
||||
print_r($_POST);
|
||||
echo json_encode(query($sql, $params, true));
|
||||
$user->print_to_log("Crea carrera", new: $params);
|
||||
header("Location: ../carreras.php?facultad=" . $_POST['facultad']);
|
||||
exit();
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
$sql = "SELECT * FROM fs_carreras(:idfacultad, :idcarrera, null)";
|
||||
$params = [':idfacultad' => $_POST['idfacultad'], ':idcarrera' => $_POST['idcarrera']];
|
||||
$user->print_to_log("Crea carrera", old: $params);
|
||||
echo json_encode(query($sql, $params, true));
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
$sql = "SELECT * FROM fs_carreras(:idfacultad, :idcarrera, null)";
|
||||
$params = [':idfacultad' => $_POST['idfacultad'], ':idcarrera' => $_POST['idcarrera']];
|
||||
$user->print_to_log("Crea carrera", old: $params);
|
||||
echo json_encode(query($sql, $params, true));
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
$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";
|
||||
$old = query("SELECT * FROM FS_CARRERA WHERE ID = :id", [':id' => $_POST['id']]);
|
||||
$sql = "SELECT fu_updatecarrera(:idcarrera, :nombre, :activa, :idnivel)";
|
||||
print_r($_POST);
|
||||
$params = [':idcarrera' => $_POST['id'], ':nombre' => mb_strtoupper($_POST['nombre']), ':activa' => $_POST['estado'], ':idnivel' => $_POST['nivel']];
|
||||
query($sql, $params, true);
|
||||
$user->print_to_log("Actualiza carrera.", old: $old, new: $params);
|
||||
header("Location: ../carreras.php?facultad=" . $_POST['facultad']);
|
||||
<?php
|
||||
$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";
|
||||
$old = query("SELECT * FROM FS_CARRERA WHERE ID = :id", [':id' => $_POST['id']]);
|
||||
$sql = "SELECT fu_updatecarrera(:idcarrera, :nombre, :activa, :idnivel)";
|
||||
print_r($_POST);
|
||||
$params = [':idcarrera' => $_POST['id'], ':nombre' => mb_strtoupper($_POST['nombre']), ':activa' => $_POST['estado'], ':idnivel' => $_POST['nivel']];
|
||||
query($sql, $params, true);
|
||||
$user->print_to_log("Actualiza carrera.", old: $old, new: $params);
|
||||
header("Location: ../carreras.php?facultad=" . $_POST['facultad']);
|
||||
exit();
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
$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";
|
||||
#$sql = "SELECT * FROM diasfestivos WHERE diasfestivos_id = :id";
|
||||
$sql = "DELETE FROM diasfestivos WHERE diasfestivos_id = :id";
|
||||
$params = [':id' => $_POST['id']];
|
||||
echo json_encode(query($sql, $params, false));
|
||||
<?php
|
||||
$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";
|
||||
#$sql = "SELECT * FROM diasfestivos WHERE diasfestivos_id = :id";
|
||||
$sql = "DELETE FROM diasfestivos WHERE diasfestivos_id = :id";
|
||||
$params = [':id' => $_POST['id']];
|
||||
echo json_encode(query($sql, $params, false));
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
print_r($_POST);
|
||||
if ($_POST['periodo'] == 0) {
|
||||
$periodo = null;
|
||||
} else {
|
||||
$periodo = $_POST['periodo'];
|
||||
}
|
||||
if (isset($_POST['rango'])) {
|
||||
$diaInicio = new DateTime(date("Y-m-d", strtotime(str_replace("/", "-", $_POST['diaFestivo']))));
|
||||
$diaFin = new DateTime(date("Y-m-d", strtotime(str_replace("/", "-", $_POST['diaFestivoFin']))));
|
||||
$cantidad = $diaFin->diff($diaInicio);
|
||||
$date = date("Y-m-d", strtotime(str_replace("/", "-", $_POST['diaFestivo'])));
|
||||
for ($dias = 0; $dias <= $cantidad->days; $dias++) {
|
||||
$sql = "SELECT fi_diasfestivos(:periodo, :dia)";
|
||||
$params = [':periodo' => $periodo, ':dia' => $date];
|
||||
query($sql, $params, false);
|
||||
$date = date("Y-m-d", strtotime($date . "+ 1 days"));
|
||||
}
|
||||
header("Location: ../días_festivos.php");
|
||||
exit();
|
||||
} else {
|
||||
$sql = "SELECT * FROM fs_diasfestivos(null, :dia)";
|
||||
$params = [':dia' => $_POST['diaFestivo']];
|
||||
$dia_general = query($sql, $params, false);
|
||||
$sql = "SELECT * FROM fs_diasfestivos(null, null, :periodo, :dia)";
|
||||
$params = [':periodo' => $periodo, ":dia" => $_POST['diaFestivo']];
|
||||
$dia = query($sql, $params, false);
|
||||
if (!$dia && !$dia_general) { //no hay repetidos
|
||||
$sql = "SELECT fi_diasfestivos(:periodo, :dia)";
|
||||
$id = query($sql, $params, false);
|
||||
header("Location: ../días_festivos.php");
|
||||
exit();
|
||||
} else {
|
||||
header("Location: ../días_festivos.php?error=1");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
print_r($_POST);
|
||||
if ($_POST['periodo'] == 0) {
|
||||
$periodo = null;
|
||||
} else {
|
||||
$periodo = $_POST['periodo'];
|
||||
}
|
||||
if (isset($_POST['rango'])) {
|
||||
$diaInicio = new DateTime(date("Y-m-d", strtotime(str_replace("/", "-", $_POST['diaFestivo']))));
|
||||
$diaFin = new DateTime(date("Y-m-d", strtotime(str_replace("/", "-", $_POST['diaFestivoFin']))));
|
||||
$cantidad = $diaFin->diff($diaInicio);
|
||||
$date = date("Y-m-d", strtotime(str_replace("/", "-", $_POST['diaFestivo'])));
|
||||
for ($dias = 0; $dias <= $cantidad->days; $dias++) {
|
||||
$sql = "SELECT fi_diasfestivos(:periodo, :dia)";
|
||||
$params = [':periodo' => $periodo, ':dia' => $date];
|
||||
query($sql, $params, false);
|
||||
$date = date("Y-m-d", strtotime($date . "+ 1 days"));
|
||||
}
|
||||
header("Location: ../días_festivos.php");
|
||||
exit();
|
||||
} else {
|
||||
$sql = "SELECT * FROM fs_diasfestivos(null, :dia)";
|
||||
$params = [':dia' => $_POST['diaFestivo']];
|
||||
$dia_general = query($sql, $params, false);
|
||||
$sql = "SELECT * FROM fs_diasfestivos(null, null, :periodo, :dia)";
|
||||
$params = [':periodo' => $periodo, ":dia" => $_POST['diaFestivo']];
|
||||
$dia = query($sql, $params, false);
|
||||
if (!$dia && !$dia_general) { //no hay repetidos
|
||||
$sql = "SELECT fi_diasfestivos(:periodo, :dia)";
|
||||
$id = query($sql, $params, false);
|
||||
header("Location: ../días_festivos.php");
|
||||
exit();
|
||||
} else {
|
||||
header("Location: ../días_festivos.php?error=1");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
$params = [':id' => $_POST['id']];
|
||||
if ($_POST['periodo'] == 0) {
|
||||
$sql = "SELECT * FROM fs_diasfestivos(:id, null)";
|
||||
} else {
|
||||
$sql = "SELECT * FROM fs_diasfestivos(null, :id, null, null)";
|
||||
}
|
||||
echo json_encode(query($sql, $params, true));
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
$params = [':id' => $_POST['id']];
|
||||
if ($_POST['periodo'] == 0) {
|
||||
$sql = "SELECT * FROM fs_diasfestivos(:id, null)";
|
||||
} else {
|
||||
$sql = "SELECT * FROM fs_diasfestivos(null, :id, null, null)";
|
||||
}
|
||||
echo json_encode(query($sql, $params, true));
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
if ($_POST['periodo'] == 0) {
|
||||
$periodo = null;
|
||||
} else
|
||||
$periodo = $_POST['periodo'];
|
||||
$sql = "SELECT * FROM fs_diasfestivos(null, :dia) WHERE diasfestivos_id != :id";
|
||||
$params = [':dia' => $_POST['diaFestivo'], ':id' => $_POST['id']];
|
||||
$dia_general = query($sql, $params, false);
|
||||
$sql = "SELECT * FROM fs_diasfestivos(null, null, :periodo, :dia) WHERE diasfestivos_id != :id";
|
||||
$params = [':periodo' => $periodo, ':dia' => $_POST['diaFestivo'], ':id' => $_POST['id']];
|
||||
$dia = query($sql, $params, false);
|
||||
if (!$dia && !$dia_general) { //no hay repetidos
|
||||
$sql = "SELECT fu_update_diasfestivos(:id, :dia, :periodo)";
|
||||
query($sql, $params, false);
|
||||
header("Location: ../días_festivos.php");
|
||||
exit();
|
||||
} else { //es repetido
|
||||
header("Location: ../días_festivos.php?error=1");
|
||||
exit();
|
||||
}
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
if ($_POST['periodo'] == 0) {
|
||||
$periodo = null;
|
||||
} else
|
||||
$periodo = $_POST['periodo'];
|
||||
$sql = "SELECT * FROM fs_diasfestivos(null, :dia) WHERE diasfestivos_id != :id";
|
||||
$params = [':dia' => $_POST['diaFestivo'], ':id' => $_POST['id']];
|
||||
$dia_general = query($sql, $params, false);
|
||||
$sql = "SELECT * FROM fs_diasfestivos(null, null, :periodo, :dia) WHERE diasfestivos_id != :id";
|
||||
$params = [':periodo' => $periodo, ':dia' => $_POST['diaFestivo'], ':id' => $_POST['id']];
|
||||
$dia = query($sql, $params, false);
|
||||
if (!$dia && !$dia_general) { //no hay repetidos
|
||||
$sql = "SELECT fu_update_diasfestivos(:id, :dia, :periodo)";
|
||||
query($sql, $params, false);
|
||||
header("Location: ../días_festivos.php");
|
||||
exit();
|
||||
} else { //es repetido
|
||||
header("Location: ../días_festivos.php?error=1");
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
<?
|
||||
#input $_GET['id_espacio_sgu']
|
||||
define("INFORMATION", [
|
||||
'GET' => [
|
||||
],
|
||||
]);
|
||||
#output rutas: [ ...ruta, salones: [{...salon}] ]
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
#return html
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
// check method
|
||||
try {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// check parameters
|
||||
$raw = file_get_contents('php://input');
|
||||
$post_get = json_decode($raw, true);
|
||||
|
||||
$data = $db->get('estado_supervisor');
|
||||
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(),
|
||||
'post_data' => $post_get,
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
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']
|
||||
define("INFORMATION", [
|
||||
'GET' => [
|
||||
],
|
||||
]);
|
||||
#output rutas: [ ...ruta, salones: [{...salon}] ]
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
#return html
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
// check method
|
||||
try {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// check parameters
|
||||
$raw = file_get_contents('php://input');
|
||||
$post_get = json_decode($raw, true);
|
||||
|
||||
$data = $db->get('estado_supervisor');
|
||||
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(),
|
||||
'post_data' => $post_get,
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
exit;
|
||||
} catch (Exception $th) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $th->getMessage(),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
exit;
|
||||
}
|
||||
@@ -1,51 +1,51 @@
|
||||
<?
|
||||
$information = [
|
||||
'GET' => [],
|
||||
];
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
// check if the session is started
|
||||
if (!isset($_SESSION['user'])) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => 'No se ha iniciado sesión'
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
try {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// check parameters
|
||||
array_walk($information['GET'], function ($value) {
|
||||
if (!array_key_exists($value, $_GET)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => "$value is required"]);
|
||||
exit;
|
||||
}
|
||||
});
|
||||
// step 1: get subrutas
|
||||
$data = $db->get('facultad');
|
||||
|
||||
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);
|
||||
exit;
|
||||
} catch (Exception $th) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $th->getMessage(),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
exit;
|
||||
<?
|
||||
$information = [
|
||||
'GET' => [],
|
||||
];
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
// check if the session is started
|
||||
if (!isset($_SESSION['user'])) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => 'No se ha iniciado sesión'
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
try {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// check parameters
|
||||
array_walk($information['GET'], function ($value) {
|
||||
if (!array_key_exists($value, $_GET)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => "$value is required"]);
|
||||
exit;
|
||||
}
|
||||
});
|
||||
// step 1: get subrutas
|
||||
$data = $db->get('facultad');
|
||||
|
||||
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);
|
||||
exit;
|
||||
} catch (Exception $th) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $th->getMessage(),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
exit;
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
$sql = "SELECT fi_facultad(:nombre, :activa)";
|
||||
$params = [':nombre' => mb_strtoupper($_POST['nombre']), ':activa' => $_POST['estado']];
|
||||
$fac_id = query($sql, $params, true);
|
||||
$sql = "SELECT fi_tiempo_checado(:idfacultad, :idnivel, :antes, :despues, :retardo)";
|
||||
$params = [':idfacultad' => $fac_id['fi_facultad'], ':idnivel' => 1, ':antes' => -15, ':despues' => 16, ':retardo' => 31];
|
||||
query($sql, $params, false);
|
||||
$params = [':idfacultad' => $fac_id['fi_facultad'], ':idnivel' => 2, ':antes' => -15, ':despues' => 16, ':retardo' => 31];
|
||||
query($sql, $params, false);
|
||||
print_r($fac_id);
|
||||
header("Location: ../carreras.php?facultad=" . $fac_id['fi_facultad']);
|
||||
exit();
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
$sql = "SELECT fi_facultad(:nombre, :activa)";
|
||||
$params = [':nombre' => mb_strtoupper($_POST['nombre']), ':activa' => $_POST['estado']];
|
||||
$fac_id = query($sql, $params, true);
|
||||
$sql = "SELECT fi_tiempo_checado(:idfacultad, :idnivel, :antes, :despues, :retardo)";
|
||||
$params = [':idfacultad' => $fac_id['fi_facultad'], ':idnivel' => 1, ':antes' => -15, ':despues' => 16, ':retardo' => 31];
|
||||
query($sql, $params, false);
|
||||
$params = [':idfacultad' => $fac_id['fi_facultad'], ':idnivel' => 2, ':antes' => -15, ':despues' => 16, ':retardo' => 31];
|
||||
query($sql, $params, false);
|
||||
print_r($fac_id);
|
||||
header("Location: ../carreras.php?facultad=" . $fac_id['fi_facultad']);
|
||||
exit();
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
$sql = "SELECT * FROM facultad WHERE facultad_id = :idFacultad";
|
||||
$params = [':idFacultad' => $_POST['id_facultad']];
|
||||
echo json_encode(query($sql, $params, false));
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
$sql = "SELECT * FROM facultad WHERE facultad_id = :idFacultad";
|
||||
$params = [':idFacultad' => $_POST['id_facultad']];
|
||||
echo json_encode(query($sql, $params, false));
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
$sql = "SELECT fu_updatefacultad(:nombre, :activa, :id)";
|
||||
$params = [':nombre' => mb_strtoupper($_POST['nombre']), ':activa' => $_POST['estado'], ':id' => $_POST['id']];
|
||||
query($sql, $params, false);
|
||||
header("Location: ../facultades.php");
|
||||
exit();
|
||||
<?php
|
||||
$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";
|
||||
global $pdo;
|
||||
$sql = "SELECT fu_updatefacultad(:nombre, :activa, :id)";
|
||||
$params = [':nombre' => mb_strtoupper($_POST['nombre']), ':activa' => $_POST['estado'], ':id' => $_POST['id']];
|
||||
query($sql, $params, false);
|
||||
header("Location: ../facultades.php");
|
||||
exit();
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
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";
|
||||
|
||||
// if method is get
|
||||
header("Content-Type: application/json");
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$user->print_to_log("Acceso a reposiciones");
|
||||
if (empty($_GET['horario_id']))
|
||||
die(json_encode(['error' => 'No se ha enviado el id del horario']));
|
||||
// fecha greater than today
|
||||
$reposiciones = $db->query("SELECT fecha, EXTRACT(DOW FROM fecha) as day, EXTRACT(MONTH FROM fecha) as month, EXTRACT(YEAR FROM fecha) as year, EXTRACT(DAY FROM fecha) as dia_mes FROM fechas_clase(:horario_id) WHERE fecha > CURRENT_DATE", [
|
||||
'horario_id' => $_GET['horario_id']
|
||||
]);
|
||||
echo json_encode([
|
||||
'status' => 'success',
|
||||
'data' => $reposiciones
|
||||
]);
|
||||
}
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
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";
|
||||
|
||||
// if method is get
|
||||
header("Content-Type: application/json");
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$user->print_to_log("Acceso a reposiciones");
|
||||
if (empty($_GET['horario_id']))
|
||||
die(json_encode(['error' => 'No se ha enviado el id del horario']));
|
||||
// fecha greater than today
|
||||
$reposiciones = $db->query("SELECT fecha, EXTRACT(DOW FROM fecha) as day, EXTRACT(MONTH FROM fecha) as month, EXTRACT(YEAR FROM fecha) as year, EXTRACT(DAY FROM fecha) as dia_mes FROM fechas_clase(:horario_id) WHERE fecha > CURRENT_DATE", [
|
||||
'horario_id' => $_GET['horario_id']
|
||||
]);
|
||||
echo json_encode([
|
||||
'status' => 'success',
|
||||
'data' => $reposiciones
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<?php
|
||||
$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");
|
||||
extract($_POST);
|
||||
$params = ['per' => $_POST['periodo'], 'fac' => $_POST['facultad'], 'car' => $_POST['carrera']];
|
||||
|
||||
$user->print_to_log("Acceso a grupos", old: $params);
|
||||
$grupos = queryAll("SELECT DISTINCT LENGTH(GRUPO), GRUPO FROM fs_horario_basic WHERE PERIODO_ID = COALESCE(:per, PERIODO_ID) AND FACULTAD_ID = COALESCE(:fac, FACULTAD_ID) AND CARRERA_ID = COALESCE(:car, CARRERA_ID) ORDER BY LENGTH(GRUPO), GRUPO", $params);
|
||||
|
||||
$grupos = array_map(fn ($grupo) => $grupo['grupo'], $grupos);
|
||||
|
||||
echo json_encode([
|
||||
'status' => 'success',
|
||||
'grupos' => $grupos
|
||||
]);
|
||||
<?php
|
||||
$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");
|
||||
extract($_POST);
|
||||
$params = ['per' => $_POST['periodo'], 'fac' => $_POST['facultad'], 'car' => $_POST['carrera']];
|
||||
|
||||
$user->print_to_log("Acceso a grupos", old: $params);
|
||||
$grupos = queryAll("SELECT DISTINCT LENGTH(GRUPO), GRUPO FROM fs_horario_basic WHERE PERIODO_ID = COALESCE(:per, PERIODO_ID) AND FACULTAD_ID = COALESCE(:fac, FACULTAD_ID) AND CARRERA_ID = COALESCE(:car, CARRERA_ID) ORDER BY LENGTH(GRUPO), GRUPO", $params);
|
||||
|
||||
$grupos = array_map(fn ($grupo) => $grupo['grupo'], $grupos);
|
||||
|
||||
echo json_encode([
|
||||
'status' => 'success',
|
||||
'grupos' => $grupos
|
||||
]);
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php");
|
||||
|
||||
$grupo = isset($_GET['grupo']) ? $_GET['grupo'] : 1;
|
||||
$grupo_horarios = $db->querySingle(
|
||||
"WITH bloques AS (
|
||||
SELECT id, hora_inicio, hora_fin
|
||||
FROM public.bloque_horario
|
||||
WHERE grupo = ?
|
||||
ORDER BY hora_inicio ASC
|
||||
)
|
||||
|
||||
SELECT json_agg(json_build_object(
|
||||
'id', id,
|
||||
'hora_inicio', hora_inicio,
|
||||
'hora_fin', hora_fin,
|
||||
'selected', current_time between hora_inicio and hora_fin
|
||||
)) AS bloque_horario
|
||||
FROM bloques
|
||||
",
|
||||
[$grupo]
|
||||
)['bloque_horario'];
|
||||
|
||||
|
||||
echo $grupo_horarios;
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php");
|
||||
|
||||
$grupo = isset($_GET['grupo']) ? $_GET['grupo'] : 1;
|
||||
$grupo_horarios = $db->querySingle(
|
||||
"WITH bloques AS (
|
||||
SELECT id, hora_inicio, hora_fin
|
||||
FROM public.bloque_horario
|
||||
WHERE grupo = ?
|
||||
ORDER BY hora_inicio ASC
|
||||
)
|
||||
|
||||
SELECT json_agg(json_build_object(
|
||||
'id', id,
|
||||
'hora_inicio', hora_inicio,
|
||||
'hora_fin', hora_fin,
|
||||
'selected', current_time between hora_inicio and hora_fin
|
||||
)) AS bloque_horario
|
||||
FROM bloques
|
||||
",
|
||||
[$grupo]
|
||||
)['bloque_horario'];
|
||||
|
||||
|
||||
echo $grupo_horarios;
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php");
|
||||
|
||||
extract($_POST);
|
||||
|
||||
$dias = array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado");
|
||||
$horarios = $db
|
||||
->get("fs_horario($periodo, $carrera, '$grupo', true)");
|
||||
|
||||
// get each id from $horarios (might be duplicate)
|
||||
|
||||
try {
|
||||
$horarios = array_map(function ($horario) use ($dias, $db) {
|
||||
$horario['profesores'] = array_map(
|
||||
fn ($profesor) =>
|
||||
$db->where("id", $profesor)->getOne("fs_profesor"),
|
||||
explode(",", substr($horario['profesores'], 1, -1))
|
||||
);
|
||||
$horario['dia'] = $dias[$horario['dia']];
|
||||
return $horario;
|
||||
}, $horarios);
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => $e->getMessage(),
|
||||
]));
|
||||
}
|
||||
?>
|
||||
<?= json_encode([
|
||||
"status" => "success",
|
||||
"horario" => $horarios,
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php");
|
||||
|
||||
extract($_POST);
|
||||
|
||||
$dias = array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado");
|
||||
$horarios = $db
|
||||
->get("fs_horario($periodo, $carrera, '$grupo', true)");
|
||||
|
||||
// get each id from $horarios (might be duplicate)
|
||||
|
||||
try {
|
||||
$horarios = array_map(function ($horario) use ($dias, $db) {
|
||||
$horario['profesores'] = array_map(
|
||||
fn ($profesor) =>
|
||||
$db->where("id", $profesor)->getOne("fs_profesor"),
|
||||
explode(",", substr($horario['profesores'], 1, -1))
|
||||
);
|
||||
$horario['dia'] = $dias[$horario['dia']];
|
||||
return $horario;
|
||||
}, $horarios);
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => $e->getMessage(),
|
||||
]));
|
||||
}
|
||||
?>
|
||||
<?= json_encode([
|
||||
"status" => "success",
|
||||
"horario" => $horarios,
|
||||
]) ?>
|
||||
@@ -1,41 +1,41 @@
|
||||
<?php
|
||||
$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";
|
||||
|
||||
extract($_POST);
|
||||
|
||||
$params = [
|
||||
"hora" => $hora,
|
||||
"salon" => $salón,
|
||||
"facultad_id" => $facultad,
|
||||
"periodo" => $periodo,
|
||||
"grupo" => $grupo,
|
||||
"materia_id" => $materia,
|
||||
"dia" => $día,
|
||||
"duracion" => $duración,
|
||||
"profesores" => "{{$profesores}}",
|
||||
];
|
||||
|
||||
header("Content-Type: application/json");
|
||||
$user->print_to_log("Creación de horario", new: $params);
|
||||
|
||||
try {
|
||||
$db->insert("fs_horario", $params);
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => "No se pudo crear el horario",
|
||||
]));
|
||||
}
|
||||
die(json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Horario creado correctamente",
|
||||
]));
|
||||
<?php
|
||||
$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";
|
||||
|
||||
extract($_POST);
|
||||
|
||||
$params = [
|
||||
"hora" => $hora,
|
||||
"salon" => $salón,
|
||||
"facultad_id" => $facultad,
|
||||
"periodo" => $periodo,
|
||||
"grupo" => $grupo,
|
||||
"materia_id" => $materia,
|
||||
"dia" => $día,
|
||||
"duracion" => $duración,
|
||||
"profesores" => "{{$profesores}}",
|
||||
];
|
||||
|
||||
header("Content-Type: application/json");
|
||||
$user->print_to_log("Creación de horario", new: $params);
|
||||
|
||||
try {
|
||||
$db->insert("fs_horario", $params);
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => "No se pudo crear el horario",
|
||||
]));
|
||||
}
|
||||
die(json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Horario creado correctamente",
|
||||
]));
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
<?php
|
||||
$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']);
|
||||
|
||||
extract($_POST);
|
||||
try {
|
||||
$old = $db
|
||||
->where('horario_id', $id)
|
||||
->getOne('horario');
|
||||
|
||||
$user->print_to_log("Eliminación de horario", old: $old);
|
||||
|
||||
$horario = $db
|
||||
->where('id', $id)
|
||||
->delete('fs_horario');
|
||||
} catch (Exception $e) {
|
||||
// if message contains "Integrity constraint violation"
|
||||
$message = (strpos($e->getMessage(), 'Foreign') !== false)
|
||||
? "No se puede eliminar el registro, tiene datos asociados"
|
||||
: "Error al eliminar el registro";
|
||||
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => $message,
|
||||
"response" => $e->getMessage(),
|
||||
]));
|
||||
}
|
||||
|
||||
die(json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Horario eliminado correctamente",
|
||||
<?php
|
||||
$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']);
|
||||
|
||||
extract($_POST);
|
||||
try {
|
||||
$old = $db
|
||||
->where('horario_id', $id)
|
||||
->getOne('horario');
|
||||
|
||||
$user->print_to_log("Eliminación de horario", old: $old);
|
||||
|
||||
$horario = $db
|
||||
->where('id', $id)
|
||||
->delete('fs_horario');
|
||||
} catch (Exception $e) {
|
||||
// if message contains "Integrity constraint violation"
|
||||
$message = (strpos($e->getMessage(), 'Foreign') !== false)
|
||||
? "No se puede eliminar el registro, tiene datos asociados"
|
||||
: "Error al eliminar el registro";
|
||||
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => $message,
|
||||
"response" => $e->getMessage(),
|
||||
]));
|
||||
}
|
||||
|
||||
die(json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Horario eliminado correctamente",
|
||||
]));
|
||||
@@ -1,51 +1,51 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
require_once "../include/func_excel.php";
|
||||
|
||||
extract($_POST);
|
||||
|
||||
# $carrera;
|
||||
# $facultad;
|
||||
|
||||
$horarios = json_decode($data, true);
|
||||
|
||||
// make sure profesores are in the database
|
||||
foreach ($horarios as $horario) {
|
||||
$params = [
|
||||
'materia' => $horario['materia'],
|
||||
'carrera' => $carrera,
|
||||
];
|
||||
$horario['materia'] = query("SELECT FI_MATERIA(:materia, :carrera) id", $params)['id'];
|
||||
|
||||
$params = [
|
||||
'clave' => $horario['clave'],
|
||||
'nombre' => $horario['nombre'],
|
||||
'correo' => $horario['correo'],
|
||||
'grado' => $horario['grado'],
|
||||
'facultad' => $facultad,
|
||||
];
|
||||
|
||||
$horario['profesor'] = query("SELECT FI_PROFESOR(:nombre, :clave, :facultad, :correo, :grado) id", $params)['id'];
|
||||
$horario = array_diff_key($horario, array_flip(['clave', 'nombre', 'correo', 'grado', '']));
|
||||
$horario['periodo'] = $periodo;
|
||||
$horario['facultad'] = $facultad;
|
||||
|
||||
try {
|
||||
query(
|
||||
"SELECT FI_HORARIO(:horario::VARCHAR, :profesor::INT, :materia::INT, :facultad::INT, :periodo::INT, :grupo::VARCHAR, :salon::VARCHAR)",
|
||||
$horario
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"sql" => $e->getMessage(),
|
||||
"message" => "Error al cargar el archivo",
|
||||
]));
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?= json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Horarios guardado con éxito",
|
||||
]) ?>
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
require_once "../include/func_excel.php";
|
||||
|
||||
extract($_POST);
|
||||
|
||||
# $carrera;
|
||||
# $facultad;
|
||||
|
||||
$horarios = json_decode($data, true);
|
||||
|
||||
// make sure profesores are in the database
|
||||
foreach ($horarios as $horario) {
|
||||
$params = [
|
||||
'materia' => $horario['materia'],
|
||||
'carrera' => $carrera,
|
||||
];
|
||||
$horario['materia'] = query("SELECT FI_MATERIA(:materia, :carrera) id", $params)['id'];
|
||||
|
||||
$params = [
|
||||
'clave' => $horario['clave'],
|
||||
'nombre' => $horario['nombre'],
|
||||
'correo' => $horario['correo'],
|
||||
'grado' => $horario['grado'],
|
||||
'facultad' => $facultad,
|
||||
];
|
||||
|
||||
$horario['profesor'] = query("SELECT FI_PROFESOR(:nombre, :clave, :facultad, :correo, :grado) id", $params)['id'];
|
||||
$horario = array_diff_key($horario, array_flip(['clave', 'nombre', 'correo', 'grado', '']));
|
||||
$horario['periodo'] = $periodo;
|
||||
$horario['facultad'] = $facultad;
|
||||
|
||||
try {
|
||||
query(
|
||||
"SELECT FI_HORARIO(:horario::VARCHAR, :profesor::INT, :materia::INT, :facultad::INT, :periodo::INT, :grupo::VARCHAR, :salon::VARCHAR)",
|
||||
$horario
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"sql" => $e->getMessage(),
|
||||
"message" => "Error al cargar el archivo",
|
||||
]));
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?= json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Horarios guardado con éxito",
|
||||
]) ?>
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php");
|
||||
|
||||
$dias = array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado");
|
||||
|
||||
try {
|
||||
if(empty($_POST['profesor_id']))
|
||||
throw new Exception("No se ha especificado un profesor");
|
||||
|
||||
// RECORD LAST QUERY
|
||||
$horarios = $db->query("SELECT * FROM fs_horario(_periodo_id => ?, _last => true, _profesor_id => ?) ORDER BY MATERIA", [
|
||||
$_POST['periodo_id'],
|
||||
$_POST['profesor_id'],
|
||||
]);
|
||||
|
||||
$horarios = array_map(function ($horario) use ($dias, $db) {
|
||||
$horario['profesores'] = array_map(
|
||||
fn ($profesor) =>
|
||||
$db->where("id", $profesor)->getOne("fs_profesor"),
|
||||
explode(",", substr($horario['profesores'], 1, -1))
|
||||
);
|
||||
$horario['dia'] = $dias[$horario['dia']];
|
||||
return $horario;
|
||||
}, $horarios);
|
||||
die(json_encode([
|
||||
"status" => "success",
|
||||
"data" => $horarios,
|
||||
// "data" => [],
|
||||
]));
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => $e->getMessage(),
|
||||
"query" => $db->getLastQuery(),
|
||||
]));
|
||||
}
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php");
|
||||
|
||||
$dias = array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado");
|
||||
|
||||
try {
|
||||
if(empty($_POST['profesor_id']))
|
||||
throw new Exception("No se ha especificado un profesor");
|
||||
|
||||
// RECORD LAST QUERY
|
||||
$horarios = $db->query("SELECT * FROM fs_horario(_periodo_id => ?, _last => true, _profesor_id => ?) ORDER BY MATERIA", [
|
||||
$_POST['periodo_id'],
|
||||
$_POST['profesor_id'],
|
||||
]);
|
||||
|
||||
$horarios = array_map(function ($horario) use ($dias, $db) {
|
||||
$horario['profesores'] = array_map(
|
||||
fn ($profesor) =>
|
||||
$db->where("id", $profesor)->getOne("fs_profesor"),
|
||||
explode(",", substr($horario['profesores'], 1, -1))
|
||||
);
|
||||
$horario['dia'] = $dias[$horario['dia']];
|
||||
return $horario;
|
||||
}, $horarios);
|
||||
die(json_encode([
|
||||
"status" => "success",
|
||||
"data" => $horarios,
|
||||
// "data" => [],
|
||||
]));
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => $e->getMessage(),
|
||||
"query" => $db->getLastQuery(),
|
||||
]));
|
||||
}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
<?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']);
|
||||
|
||||
$horario = array_map(fn ($value) => $_POST[$value], array_filter([
|
||||
"hora" => "hora",
|
||||
"dia" => "día",
|
||||
"salon" => "salón",
|
||||
"duracion" => "duración",
|
||||
], fn ($value) => !empty($_POST[$value])));
|
||||
|
||||
if (!empty($_POST['profesores']))
|
||||
$horario["profesores"] = "{ {$_POST['profesores']} }";
|
||||
|
||||
try {
|
||||
$id = $_POST['id'] ?? 0;
|
||||
|
||||
$old = $db
|
||||
->where("horario_id", $id)
|
||||
->getOne("horario");
|
||||
|
||||
$horario = $db
|
||||
->where("id", $id)
|
||||
->update("fs_horario", $horario);
|
||||
|
||||
$new = $db
|
||||
->orderBy("horario_id", "DESC")
|
||||
->getOne("horario");
|
||||
|
||||
$user->print_to_log("Actualización de horario", old: $old, new: $new);
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => $e->getMessage(),
|
||||
'POST' => $_POST,
|
||||
]));
|
||||
}
|
||||
|
||||
die(json_encode([
|
||||
"status" => "success",
|
||||
]));
|
||||
<?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']);
|
||||
|
||||
$horario = array_map(fn ($value) => $_POST[$value], array_filter([
|
||||
"hora" => "hora",
|
||||
"dia" => "día",
|
||||
"salon" => "salón",
|
||||
"duracion" => "duración",
|
||||
], fn ($value) => !empty($_POST[$value])));
|
||||
|
||||
if (!empty($_POST['profesores']))
|
||||
$horario["profesores"] = "{ {$_POST['profesores']} }";
|
||||
|
||||
try {
|
||||
$id = $_POST['id'] ?? 0;
|
||||
|
||||
$old = $db
|
||||
->where("horario_id", $id)
|
||||
->getOne("horario");
|
||||
|
||||
$horario = $db
|
||||
->where("id", $id)
|
||||
->update("fs_horario", $horario);
|
||||
|
||||
$new = $db
|
||||
->orderBy("horario_id", "DESC")
|
||||
->getOne("horario");
|
||||
|
||||
$user->print_to_log("Actualización de horario", old: $old, new: $new);
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => $e->getMessage(),
|
||||
'POST' => $_POST,
|
||||
]));
|
||||
}
|
||||
|
||||
die(json_encode([
|
||||
"status" => "success",
|
||||
]));
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
extract($_POST);
|
||||
|
||||
/* print_r($claves);
|
||||
exit; */
|
||||
|
||||
$fecha = DateTime::createFromFormat('d/m/Y', $fecha);
|
||||
|
||||
if (isset($hora)) {
|
||||
$claves = [[
|
||||
'clave' => $clave,
|
||||
'hora' => $hora,
|
||||
'id' => $id
|
||||
]];
|
||||
}
|
||||
foreach ($claves as $horario)
|
||||
try {
|
||||
$profesor_id = $horario["clave"];
|
||||
query("SELECT fi_registrar_asistencia(:id::INT, FALSE, ARRAY[ NOW(), :fecha::DATE + :hora::TIME ]::TIMESTAMP[], :profesor_id::INT, TRUE)", [
|
||||
":fecha" => $fecha->format('Y-m-d'),
|
||||
":hora" => $horario["hora"],
|
||||
":id" => $horario["id"],
|
||||
":profesor_id" => $profesor_id
|
||||
]);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
die( json_encode(["error" => $e->getMessage()]) );
|
||||
}
|
||||
|
||||
die(json_encode(["success" => true]));
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
extract($_POST);
|
||||
|
||||
/* print_r($claves);
|
||||
exit; */
|
||||
|
||||
$fecha = DateTime::createFromFormat('d/m/Y', $fecha);
|
||||
|
||||
if (isset($hora)) {
|
||||
$claves = [[
|
||||
'clave' => $clave,
|
||||
'hora' => $hora,
|
||||
'id' => $id
|
||||
]];
|
||||
}
|
||||
foreach ($claves as $horario)
|
||||
try {
|
||||
$profesor_id = $horario["clave"];
|
||||
query("SELECT fi_registrar_asistencia(:id::INT, FALSE, ARRAY[ NOW(), :fecha::DATE + :hora::TIME ]::TIMESTAMP[], :profesor_id::INT, TRUE)", [
|
||||
":fecha" => $fecha->format('Y-m-d'),
|
||||
":hora" => $horario["hora"],
|
||||
":id" => $horario["id"],
|
||||
":profesor_id" => $profesor_id
|
||||
]);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
die( json_encode(["error" => $e->getMessage()]) );
|
||||
}
|
||||
|
||||
die(json_encode(["success" => true]));
|
||||
|
||||
@@ -1,43 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
* Valida usuario con la BD y devuelve contraseña para validar con PHP
|
||||
*
|
||||
* Recibe:
|
||||
* POST: usuario, password
|
||||
*
|
||||
* Error:
|
||||
* 0 - No se recibieron datos
|
||||
* 1 - Usuario/Contraseña incorrectos
|
||||
* 2 - Usuario no esta en BD
|
||||
* 3 - No existe usuario
|
||||
*
|
||||
* Success:
|
||||
* Redirecciona a inicio.php
|
||||
*/
|
||||
include_once("../include/nocache.php"); //continue on error
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php"); //die on error
|
||||
require_once("../class/c_login.php");
|
||||
require_once("../include/util.php");
|
||||
require_once("../include/nusoap/nusoap.php");
|
||||
|
||||
if (!isset($_POST["username"]) || !isset($_POST["passwd"]))
|
||||
die(header("Location: ../index.php?error=0"));
|
||||
|
||||
$usr = trim(filter_input(INPUT_POST, "username")); //limpia texto
|
||||
$pass = $_POST["passwd"];
|
||||
|
||||
$user = Login::validUser($usr, $pass);
|
||||
|
||||
if (is_array($user)) {
|
||||
$_SESSION['error'] = true;
|
||||
// build query params
|
||||
$params = http_build_query($user);
|
||||
header("Location: ../index.php?$params");
|
||||
} else {
|
||||
$_SESSION['user'] = serialize($user);
|
||||
|
||||
header("Location: " . (isset($_SESSION['ruta']) ? $_SESSION['ruta'] : "../main.php"));
|
||||
}
|
||||
|
||||
<?php
|
||||
/*
|
||||
* Valida usuario con la BD y devuelve contraseña para validar con PHP
|
||||
*
|
||||
* Recibe:
|
||||
* POST: usuario, password
|
||||
*
|
||||
* Error:
|
||||
* 0 - No se recibieron datos
|
||||
* 1 - Usuario/Contraseña incorrectos
|
||||
* 2 - Usuario no esta en BD
|
||||
* 3 - No existe usuario
|
||||
*
|
||||
* Success:
|
||||
* Redirecciona a inicio.php
|
||||
*/
|
||||
include_once "../include/nocache.php"; //continue on error
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php"; //die on error
|
||||
require_once "../class/c_login.php";
|
||||
require_once "../include/util.php";
|
||||
|
||||
if (!isset($_POST["username"]) || !isset($_POST["passwd"]))
|
||||
die(header("Location: ../index.php?error=0"));
|
||||
|
||||
$usr = trim(filter_input(INPUT_POST, "username")); //limpia texto
|
||||
$pass = $_POST["passwd"];
|
||||
|
||||
$user = Login::validUser($usr, $pass);
|
||||
|
||||
if (is_array($user)) {
|
||||
$_SESSION['error'] = true;
|
||||
// build query params
|
||||
$params = http_build_query($user);
|
||||
header("Location: ../index.php?$params");
|
||||
} else {
|
||||
$_SESSION['user'] = serialize($user);
|
||||
|
||||
header("Location: " . (isset($_SESSION['ruta']) ? $_SESSION['ruta'] : "../main.php"));
|
||||
}
|
||||
|
||||
exit;
|
||||
@@ -1,26 +1,26 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
extract($_POST);
|
||||
# print_r($_POST); exit;
|
||||
|
||||
if (!isset($_SESSION['user']))
|
||||
die(header('Location: index.php'));
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
|
||||
if (!$user->admin && ($access = $user->access('asistencia')) == 'n')
|
||||
die(json_encode(['error' => true]));
|
||||
|
||||
$user->print_to_log('Consultar materias');
|
||||
$materias = queryAll(
|
||||
"SELECT id, nombre FROM FS_MATERIA WHERE carrera = COALESCE(:carrera, carrera) ORDER BY nombre",
|
||||
[':carrera' => empty($carrera) ? null : $carrera]
|
||||
);
|
||||
?>
|
||||
|
||||
<?= json_encode([
|
||||
'status' => 'success',
|
||||
'materias' => $materias,
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
extract($_POST);
|
||||
# print_r($_POST); exit;
|
||||
|
||||
if (!isset($_SESSION['user']))
|
||||
die(header('Location: index.php'));
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
|
||||
if (!$user->admin && ($access = $user->access('asistencia')) == 'n')
|
||||
die(json_encode(['error' => true]));
|
||||
|
||||
$user->print_to_log('Consultar materias');
|
||||
$materias = queryAll(
|
||||
"SELECT id, nombre FROM FS_MATERIA WHERE carrera = COALESCE(:carrera, carrera) ORDER BY nombre",
|
||||
[':carrera' => empty($carrera) ? null : $carrera]
|
||||
);
|
||||
?>
|
||||
|
||||
<?= json_encode([
|
||||
'status' => 'success',
|
||||
'materias' => $materias,
|
||||
]); ?>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
$sql="SELECT * FROM materia WHERE materia_id = :idMateria";
|
||||
$params = ['idMateria' => $_POST['idmateria']];
|
||||
echo json_encode(query($sql, $params, false));
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
$sql="SELECT * FROM materia WHERE materia_id = :idMateria";
|
||||
$params = ['idMateria' => $_POST['idmateria']];
|
||||
echo json_encode(query($sql, $params, false));
|
||||
?>
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
|
||||
$sql = "UPDATE materia SET materia_nombre = :nombre WHERE materia_id = :id";
|
||||
$params = array(':nombre' => mb_strtoupper($_POST["nombre"]), ':id' => $_POST["id"]);
|
||||
$hecho = query($sql, $params, false);
|
||||
header("Location: ../materias.php");
|
||||
exit();
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
|
||||
$sql = "UPDATE materia SET materia_nombre = :nombre WHERE materia_id = :id";
|
||||
$params = array(':nombre' => mb_strtoupper($_POST["nombre"]), ':id' => $_POST["id"]);
|
||||
$hecho = query($sql, $params, false);
|
||||
header("Location: ../materias.php");
|
||||
exit();
|
||||
?>
|
||||
@@ -1,17 +1,17 @@
|
||||
<!-- fi_horario(
|
||||
p_hora character varying,
|
||||
p_materia character varying,
|
||||
p_clave character varying,
|
||||
p_nombre character varying,
|
||||
p_grado character varying,
|
||||
p_correo character varying,
|
||||
p_facultad integer,
|
||||
p_carrera integer,
|
||||
p_grupo character varying DEFAULT NULL::character varying,
|
||||
p_salon character varying DEFAULT NULL::character varying) -->
|
||||
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
|
||||
<!-- fi_horario(
|
||||
p_hora character varying,
|
||||
p_materia character varying,
|
||||
p_clave character varying,
|
||||
p_nombre character varying,
|
||||
p_grado character varying,
|
||||
p_correo character varying,
|
||||
p_facultad integer,
|
||||
p_carrera integer,
|
||||
p_grupo character varying DEFAULT NULL::character varying,
|
||||
p_salon character varying DEFAULT NULL::character varying) -->
|
||||
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
|
||||
$sql = "SELECT fi_horario(:hora, :materia, :clave, :nombre, :grado, :correo, :facultad, :carrera, :grupo, :salon)";
|
||||
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
$sql = "SELECT fi_periodo(:fecha_inicio, :fecha_fin, :estado, :nombre, :nivel, :facultad)";
|
||||
$params = [
|
||||
':fecha_inicio' => $_POST['fecha_inicial'],
|
||||
':fecha_fin' => $_POST['fecha_final'],
|
||||
':estado' => $_POST['estadoP'],
|
||||
':nombre' => mb_strtoupper($_POST['nombreP']),
|
||||
':nivel' => $_POST['nivelP'],
|
||||
':facultad' => $_POST['facultadP']
|
||||
];
|
||||
echo json_encode(query($sql, $params, true));
|
||||
header("Location: ../carreras.php?facultad=".$_POST['facultadP']);
|
||||
exit();
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
$sql = "SELECT fi_periodo(:fecha_inicio, :fecha_fin, :estado, :nombre, :nivel, :facultad)";
|
||||
$params = [
|
||||
':fecha_inicio' => $_POST['fecha_inicial'],
|
||||
':fecha_fin' => $_POST['fecha_final'],
|
||||
':estado' => $_POST['estadoP'],
|
||||
':nombre' => mb_strtoupper($_POST['nombreP']),
|
||||
':nivel' => $_POST['nivelP'],
|
||||
':facultad' => $_POST['facultadP']
|
||||
];
|
||||
echo json_encode(query($sql, $params, true));
|
||||
header("Location: ../carreras.php?facultad=".$_POST['facultadP']);
|
||||
exit();
|
||||
?>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
$sql = "SELECT * FROM fs_periodo WHERE facultad_id = :idfacultad AND id = :idperiodo";
|
||||
$params = [':idfacultad' => $_POST['idfacultad'], ':idperiodo' => $_POST['idperiodo']];
|
||||
echo json_encode(query($sql, $params, true));
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
$sql = "SELECT * FROM fs_periodo WHERE facultad_id = :idfacultad AND id = :idperiodo";
|
||||
$params = [':idfacultad' => $_POST['idfacultad'], ':idperiodo' => $_POST['idperiodo']];
|
||||
echo json_encode(query($sql, $params, true));
|
||||
?>
|
||||
@@ -1,18 +1,18 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
print_r($_POST);
|
||||
$sql = "SELECT fu_update_periodo(:periodo_id, :fecha_inicio, :fecha_final, :estado, :nombre, :nivel)";
|
||||
$params = [
|
||||
':periodo_id' => $_POST['idP'],
|
||||
':fecha_inicio' => $_POST['fecha_inicial'],
|
||||
':fecha_final' => $_POST['fecha_final'],
|
||||
':estado' => $_POST['estadoP'],
|
||||
':nombre' => mb_strtoupper($_POST['nombreP']),
|
||||
':nivel' => $_POST['nivelP']
|
||||
];
|
||||
echo json_encode(query($sql, $params, true));
|
||||
header("Location: ../carreras.php?facultad=".$_POST['facultadP']);
|
||||
exit();
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
print_r($_POST);
|
||||
$sql = "SELECT fu_update_periodo(:periodo_id, :fecha_inicio, :fecha_final, :estado, :nombre, :nivel)";
|
||||
$params = [
|
||||
':periodo_id' => $_POST['idP'],
|
||||
':fecha_inicio' => $_POST['fecha_inicial'],
|
||||
':fecha_final' => $_POST['fecha_final'],
|
||||
':estado' => $_POST['estadoP'],
|
||||
':nombre' => mb_strtoupper($_POST['nombreP']),
|
||||
':nivel' => $_POST['nivelP']
|
||||
];
|
||||
echo json_encode(query($sql, $params, true));
|
||||
header("Location: ../carreras.php?facultad=".$_POST['facultadP']);
|
||||
exit();
|
||||
?>
|
||||
@@ -1,27 +1,27 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
if (!isset($_SESSION['user'])) {
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
} else
|
||||
$user = unserialize($_SESSION['user']);
|
||||
|
||||
$params = array(':id' => $user->user['id'], ':per' => $_POST['id']);
|
||||
$user->print_to_log('Actualizando periodo from ' . $user->periodo . ' to ' . $_POST['id']);
|
||||
|
||||
query("SELECT FU_UPDATEPERIODO(:id, :per)", $params);
|
||||
$user->periodo = $params[':per'];
|
||||
|
||||
# if the user is admin, also update the facultad in user object
|
||||
if ($user->admin) {
|
||||
$facultad = query("SELECT FACULTAD_ID id, FACULTAD f FROM FS_PERIODO WHERE ID = :id", [':id' => $user->periodo]);
|
||||
$user->facultad = array(
|
||||
'facultad_id' => $facultad["id"],
|
||||
'facultad' => $facultad["f"],
|
||||
);
|
||||
}
|
||||
|
||||
$_SESSION['user'] = serialize($user);
|
||||
header("Location: {$_POST["target"]}");
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
if (!isset($_SESSION['user'])) {
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
} else
|
||||
$user = unserialize($_SESSION['user']);
|
||||
|
||||
$params = array(':id' => $user->user['id'], ':per' => $_POST['id']);
|
||||
$user->print_to_log('Actualizando periodo from ' . $user->periodo . ' to ' . $_POST['id']);
|
||||
|
||||
query("SELECT FU_UPDATEPERIODO(:id, :per)", $params);
|
||||
$user->periodo = $params[':per'];
|
||||
|
||||
# if the user is admin, also update the facultad in user object
|
||||
if ($user->admin) {
|
||||
$facultad = query("SELECT FACULTAD_ID id, FACULTAD f FROM FS_PERIODO WHERE ID = :id", [':id' => $user->periodo]);
|
||||
$user->facultad = array(
|
||||
'facultad_id' => $facultad["id"],
|
||||
'facultad' => $facultad["f"],
|
||||
);
|
||||
}
|
||||
|
||||
$_SESSION['user'] = serialize($user);
|
||||
header("Location: {$_POST["target"]}");
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
if(isset($_POST['lectura']))
|
||||
$ver = $_POST['lectura'];
|
||||
if(isset($_POST['editar']))
|
||||
$editar = $_POST['editar'];
|
||||
foreach($editar as $edit){
|
||||
$edit_separado = explode("_", $edit);
|
||||
$completo[]=$edit_separado;
|
||||
}
|
||||
#echo "<br><br><br><br>";
|
||||
#print_r($ver);
|
||||
#print_r($editar);
|
||||
query("SELECT fd_permiso()", null, false);
|
||||
foreach($ver as $lectura){
|
||||
$igual=false;
|
||||
$ver_separado = explode("_", $lectura);
|
||||
#print_r($ver_separado);
|
||||
foreach($completo as $comp){
|
||||
if($ver_separado[0] == $comp[0] && $ver_separado[1] == $comp[1]){
|
||||
#echo " igual";
|
||||
$igual=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#echo "<br>";
|
||||
if(!$igual)
|
||||
$completo[]=$ver_separado;
|
||||
}
|
||||
#print_r($completo);
|
||||
foreach($completo as $actual){
|
||||
$sql = "SELECT fi_permiso(:pagina, :rol, :tipo)";
|
||||
$params = [':pagina' => $actual['0'], ':rol' => $actual['1'], ':tipo' => $actual['2']];
|
||||
query($sql, $params, false);
|
||||
}
|
||||
header("Location: ../permisos.php");
|
||||
exit();
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
if(isset($_POST['lectura']))
|
||||
$ver = $_POST['lectura'];
|
||||
if(isset($_POST['editar']))
|
||||
$editar = $_POST['editar'];
|
||||
foreach($editar as $edit){
|
||||
$edit_separado = explode("_", $edit);
|
||||
$completo[]=$edit_separado;
|
||||
}
|
||||
#echo "<br><br><br><br>";
|
||||
#print_r($ver);
|
||||
#print_r($editar);
|
||||
query("SELECT fd_permiso()", null, false);
|
||||
foreach($ver as $lectura){
|
||||
$igual=false;
|
||||
$ver_separado = explode("_", $lectura);
|
||||
#print_r($ver_separado);
|
||||
foreach($completo as $comp){
|
||||
if($ver_separado[0] == $comp[0] && $ver_separado[1] == $comp[1]){
|
||||
#echo " igual";
|
||||
$igual=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#echo "<br>";
|
||||
if(!$igual)
|
||||
$completo[]=$ver_separado;
|
||||
}
|
||||
#print_r($completo);
|
||||
foreach($completo as $actual){
|
||||
$sql = "SELECT fi_permiso(:pagina, :rol, :tipo)";
|
||||
$params = [':pagina' => $actual['0'], ':rol' => $actual['1'], ':tipo' => $actual['2']];
|
||||
query($sql, $params, false);
|
||||
}
|
||||
header("Location: ../permisos.php");
|
||||
exit();
|
||||
?>
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php");
|
||||
|
||||
extract($_GET);
|
||||
|
||||
$profesores = $db
|
||||
->where("facultad_id", $facultad ?? 0)
|
||||
->get("fs_profesor");
|
||||
|
||||
echo json_encode([
|
||||
"status" => "success",
|
||||
"profesores" => $profesores
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php");
|
||||
|
||||
extract($_GET);
|
||||
|
||||
$profesores = $db
|
||||
->where("facultad_id", $facultad ?? 0)
|
||||
->get("fs_profesor");
|
||||
|
||||
echo json_encode([
|
||||
"status" => "success",
|
||||
"profesores" => $profesores
|
||||
]);
|
||||
@@ -1,40 +1,40 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
|
||||
// die(print_r($_POST, true));
|
||||
|
||||
extract($_POST);
|
||||
// if hora fin is null, then subtract half an hour from hora inicio and set hora fin to hora inicio + half an hour
|
||||
$hora_fin = empty($hora_fin) ? $hora_inicio : $hora_fin;
|
||||
|
||||
$hora_inicio = date('H:i:s', strtotime($hora_inicio < '07:00' ? '07:00' : $hora_inicio) - 1800);
|
||||
$hora_fin = date('H:i:s', strtotime($hora_fin > '22:00' ? '22:00' : $hora_fin) + 1800);
|
||||
|
||||
die(json_encode(
|
||||
array_map(fn ($row) => array_merge(
|
||||
$db->where('id', $row['profesor_id'])->getOne('fs_profesor'),
|
||||
$db->where('id', $row['materia_id'])->getOne('fs_materia'),
|
||||
$row
|
||||
),
|
||||
queryAll(
|
||||
"SELECT REPORTE.*
|
||||
FROM fs_asistencia_profesorreporte(null, :periodo, null, :fecha, :fecha) AS REPORTE
|
||||
JOIN PROFESOR P ON P.PROFESOR_ID = REPORTE.PROFESOR_ID
|
||||
WHERE HORA_CHECADO IS NULL
|
||||
AND HORA BETWEEN :inicio AND :fin
|
||||
AND P.PROFESOR_CLAVE ILIKE COALESCE(:clave, P.PROFESOR_CLAVE) and UNACCENT(P.PROFESOR_NOMBRE) ILIKE UNACCENT(COALESCE(:nombre, P.PROFESOR_NOMBRE))
|
||||
AND FECHA = :fecha
|
||||
ORDER BY HORA, MATERIA",
|
||||
[
|
||||
'periodo' => $periodo,
|
||||
'fecha' => $fecha,
|
||||
'inicio' => $hora_inicio,
|
||||
'fin' => $hora_fin,
|
||||
'clave' => empty($clave) ? null : "%$clave%",
|
||||
'nombre' => empty($nombre) ? null : "%$nombre%"
|
||||
]
|
||||
))));
|
||||
|
||||
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
|
||||
// die(print_r($_POST, true));
|
||||
|
||||
extract($_POST);
|
||||
// if hora fin is null, then subtract half an hour from hora inicio and set hora fin to hora inicio + half an hour
|
||||
$hora_fin = empty($hora_fin) ? $hora_inicio : $hora_fin;
|
||||
|
||||
$hora_inicio = date('H:i:s', strtotime($hora_inicio < '07:00' ? '07:00' : $hora_inicio) - 1800);
|
||||
$hora_fin = date('H:i:s', strtotime($hora_fin > '22:00' ? '22:00' : $hora_fin) + 1800);
|
||||
|
||||
die(json_encode(
|
||||
array_map(fn ($row) => array_merge(
|
||||
$db->where('id', $row['profesor_id'])->getOne('fs_profesor'),
|
||||
$db->where('id', $row['materia_id'])->getOne('fs_materia'),
|
||||
$row
|
||||
),
|
||||
queryAll(
|
||||
"SELECT REPORTE.*
|
||||
FROM fs_asistencia_profesorreporte(null, :periodo, null, :fecha, :fecha) AS REPORTE
|
||||
JOIN PROFESOR P ON P.PROFESOR_ID = REPORTE.PROFESOR_ID
|
||||
WHERE HORA_CHECADO IS NULL
|
||||
AND HORA BETWEEN :inicio AND :fin
|
||||
AND P.PROFESOR_CLAVE ILIKE COALESCE(:clave, P.PROFESOR_CLAVE) and UNACCENT(P.PROFESOR_NOMBRE) ILIKE UNACCENT(COALESCE(:nombre, P.PROFESOR_NOMBRE))
|
||||
AND FECHA = :fecha
|
||||
ORDER BY HORA, MATERIA",
|
||||
[
|
||||
'periodo' => $periodo,
|
||||
'fecha' => $fecha,
|
||||
'inicio' => $hora_inicio,
|
||||
'fin' => $hora_fin,
|
||||
'clave' => empty($clave) ? null : "%$clave%",
|
||||
'nombre' => empty($nombre) ? null : "%$nombre%"
|
||||
]
|
||||
))));
|
||||
|
||||
|
||||
#ECHO "$hora_inicio - $hora_fin";
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
$sql = "SELECT fu_estado_facultad_profesor(:idprofesor, :idfacultad, :estado)";
|
||||
$params = [':idprofesor' => $_POST['id_profesor'], ':idfacultad' => $_POST['id_facultad'], ':estado' => $_POST['estado']];
|
||||
echo json_encode(query($sql, $params, false));
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
$sql = "SELECT fu_estado_facultad_profesor(:idprofesor, :idfacultad, :estado)";
|
||||
$params = [':idprofesor' => $_POST['id_profesor'], ':idfacultad' => $_POST['id_facultad'], ':estado' => $_POST['estado']];
|
||||
echo json_encode(query($sql, $params, false));
|
||||
?>
|
||||
@@ -1,75 +1,75 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
$id = trim(filter_input(INPUT_POST, "id", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
if(isset($_POST["dlfacultad"]))
|
||||
$facultad = trim(filter_input(INPUT_POST, "dlfacultad", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
else
|
||||
$facultad = trim(filter_input(INPUT_POST, "mfacultad", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
$clave = trim(filter_input(INPUT_POST, "mclave", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
$grado = trim(filter_input(INPUT_POST, "grado", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
$nombre = trim(filter_input(INPUT_POST, "nombre", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
$grado = mb_strtoupper($grado);
|
||||
if(!empty($grado)){
|
||||
if(!ctype_space($grado)){
|
||||
if($grado[strlen($grado)-1] != '.')
|
||||
$grado.='.';
|
||||
}
|
||||
else{
|
||||
$grado="";
|
||||
}
|
||||
}
|
||||
$fs_profesores = query(//revisar si existe la clave del profesor
|
||||
"SELECT * FROM fs_profesor WHERE clave = :clave",
|
||||
array(":clave" => $_POST["mclave"]),
|
||||
true
|
||||
);
|
||||
if(!$fs_profesores){//hay que crearlo desde 0 (profesor) y agregarlo a su facultad(facultad_profesor)
|
||||
$profesor_id = query(
|
||||
"SELECT public.fi_profesor(
|
||||
:nombre,
|
||||
:clave,
|
||||
:facultad,
|
||||
null,
|
||||
:grado
|
||||
)",
|
||||
array(":nombre" => mb_strtoupper($nombre), ":clave" => $clave, ":facultad" => $facultad, ":grado" => $grado),
|
||||
true
|
||||
);
|
||||
header("Location: ../profesores.php");
|
||||
exit();
|
||||
}
|
||||
else{//el profesor ya existe
|
||||
$profac = query(
|
||||
"SELECT * FROM facultad_profesor WHERE facultad_id = :facultad AND profesor_id = :profesor",
|
||||
array(":facultad" => $facultad, ":profesor" => $fs_profesores["id"]),
|
||||
true
|
||||
);
|
||||
if(!$profac){//agregarlo a la facultad (facultad_profesor)
|
||||
query(
|
||||
"SELECT fi_facultad_profesor(
|
||||
:facultad,
|
||||
:profesor
|
||||
)",
|
||||
array(":facultad" => $facultad, ":profesor" => $fs_profesores["id"]),
|
||||
true
|
||||
);
|
||||
header("Location: ../profesores.php");
|
||||
exit();
|
||||
}
|
||||
else{//regresar error (ya existe este profesor en esta facultad)
|
||||
//print_r($profac);
|
||||
if(!$profac['fp_activo']){
|
||||
query(
|
||||
"SELECT fu_estado_facultad_profesor(:idprofesor, :idfacultad, :estado)",
|
||||
array(":idprofesor" => $fs_profesores["id"], ":idfacultad" => $facultad, ":estado" => true),
|
||||
true
|
||||
);
|
||||
header("Location: ../profesores.php");
|
||||
exit();
|
||||
}
|
||||
header("Location: ../profesores.php?error=1");
|
||||
#exit();
|
||||
}
|
||||
}
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
$id = trim(filter_input(INPUT_POST, "id", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
if(isset($_POST["dlfacultad"]))
|
||||
$facultad = trim(filter_input(INPUT_POST, "dlfacultad", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
else
|
||||
$facultad = trim(filter_input(INPUT_POST, "mfacultad", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
$clave = trim(filter_input(INPUT_POST, "mclave", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
$grado = trim(filter_input(INPUT_POST, "grado", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
$nombre = trim(filter_input(INPUT_POST, "nombre", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));
|
||||
$grado = mb_strtoupper($grado);
|
||||
if(!empty($grado)){
|
||||
if(!ctype_space($grado)){
|
||||
if($grado[strlen($grado)-1] != '.')
|
||||
$grado.='.';
|
||||
}
|
||||
else{
|
||||
$grado="";
|
||||
}
|
||||
}
|
||||
$fs_profesores = query(//revisar si existe la clave del profesor
|
||||
"SELECT * FROM fs_profesor WHERE clave = :clave",
|
||||
array(":clave" => $_POST["mclave"]),
|
||||
true
|
||||
);
|
||||
if(!$fs_profesores){//hay que crearlo desde 0 (profesor) y agregarlo a su facultad(facultad_profesor)
|
||||
$profesor_id = query(
|
||||
"SELECT public.fi_profesor(
|
||||
:nombre,
|
||||
:clave,
|
||||
:facultad,
|
||||
null,
|
||||
:grado
|
||||
)",
|
||||
array(":nombre" => mb_strtoupper($nombre), ":clave" => $clave, ":facultad" => $facultad, ":grado" => $grado),
|
||||
true
|
||||
);
|
||||
header("Location: ../profesores.php");
|
||||
exit();
|
||||
}
|
||||
else{//el profesor ya existe
|
||||
$profac = query(
|
||||
"SELECT * FROM facultad_profesor WHERE facultad_id = :facultad AND profesor_id = :profesor",
|
||||
array(":facultad" => $facultad, ":profesor" => $fs_profesores["id"]),
|
||||
true
|
||||
);
|
||||
if(!$profac){//agregarlo a la facultad (facultad_profesor)
|
||||
query(
|
||||
"SELECT fi_facultad_profesor(
|
||||
:facultad,
|
||||
:profesor
|
||||
)",
|
||||
array(":facultad" => $facultad, ":profesor" => $fs_profesores["id"]),
|
||||
true
|
||||
);
|
||||
header("Location: ../profesores.php");
|
||||
exit();
|
||||
}
|
||||
else{//regresar error (ya existe este profesor en esta facultad)
|
||||
//print_r($profac);
|
||||
if(!$profac['fp_activo']){
|
||||
query(
|
||||
"SELECT fu_estado_facultad_profesor(:idprofesor, :idfacultad, :estado)",
|
||||
array(":idprofesor" => $fs_profesores["id"], ":idfacultad" => $facultad, ":estado" => true),
|
||||
true
|
||||
);
|
||||
header("Location: ../profesores.php");
|
||||
exit();
|
||||
}
|
||||
header("Location: ../profesores.php?error=1");
|
||||
#exit();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
|
||||
global $pdo;
|
||||
|
||||
$sql = "SELECT * FROM profesor WHERE profesor_id = :idProfesor";
|
||||
$params = [':idProfesor' => $_POST['profesor']];
|
||||
|
||||
echo json_encode(query($sql, $params, false));
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
|
||||
global $pdo;
|
||||
|
||||
$sql = "SELECT * FROM profesor WHERE profesor_id = :idProfesor";
|
||||
$params = [':idProfesor' => $_POST['profesor']];
|
||||
|
||||
echo json_encode(query($sql, $params, false));
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
|
||||
$profesor = query(
|
||||
"SELECT * FROM profesor WHERE :clave = profesor_clave",
|
||||
array(":clave" => $_POST["mclave"]),
|
||||
true
|
||||
);
|
||||
if($profesor){
|
||||
if($profesor['profesor_id'] != $_POST['id']){
|
||||
echo "clave en uso";
|
||||
header("Location: ../profesores.php?error=2");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
$grado = $_POST['grado'];
|
||||
$grado = mb_strtoupper($grado);
|
||||
if(!empty($grado)){
|
||||
if(!ctype_space($grado)){
|
||||
if($grado[strlen($grado)-1] != '.')
|
||||
$grado.='.';
|
||||
}
|
||||
else{
|
||||
$grado="";
|
||||
}
|
||||
}
|
||||
print_r($_POST);
|
||||
$sql = "SELECT public.fu_updateprofesor(:id, :clave, :nombre, :grado)";
|
||||
$params = array(':id' => $_POST["id"], ':clave' => $_POST["mclave"], ':nombre' => mb_strtoupper($_POST["nombre"]), ':grado' => $grado);
|
||||
$hecho = query($sql, $params, false);
|
||||
|
||||
header("Location: ../profesores.php", true, 307);
|
||||
exit();
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
|
||||
$profesor = query(
|
||||
"SELECT * FROM profesor WHERE :clave = profesor_clave",
|
||||
array(":clave" => $_POST["mclave"]),
|
||||
true
|
||||
);
|
||||
if($profesor){
|
||||
if($profesor['profesor_id'] != $_POST['id']){
|
||||
echo "clave en uso";
|
||||
header("Location: ../profesores.php?error=2");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
$grado = $_POST['grado'];
|
||||
$grado = mb_strtoupper($grado);
|
||||
if(!empty($grado)){
|
||||
if(!ctype_space($grado)){
|
||||
if($grado[strlen($grado)-1] != '.')
|
||||
$grado.='.';
|
||||
}
|
||||
else{
|
||||
$grado="";
|
||||
}
|
||||
}
|
||||
print_r($_POST);
|
||||
$sql = "SELECT public.fu_updateprofesor(:id, :clave, :nombre, :grado)";
|
||||
$params = array(':id' => $_POST["id"], ':clave' => $_POST["mclave"], ':nombre' => mb_strtoupper($_POST["nombre"]), ':grado' => $grado);
|
||||
$hecho = query($sql, $params, false);
|
||||
|
||||
header("Location: ../profesores.php", true, 307);
|
||||
exit();
|
||||
?>
|
||||
@@ -1,54 +1,54 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
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";
|
||||
|
||||
// if method is get
|
||||
header("Content-Type: application/json");
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$user->print_to_log("Acceso a reposiciones");
|
||||
$reposiciones = $db
|
||||
->where('periodo_id', $_GET['periodo_id'] ?? null)
|
||||
->where('profesor_id', $_GET['profesor_id'] ?? [])
|
||||
->get("reposicion");
|
||||
echo json_encode([
|
||||
'status' => 'success',
|
||||
'reposiciones' => $reposiciones
|
||||
]);
|
||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$user->print_to_log("Creación de reposición", new: $params);
|
||||
try {
|
||||
$requiredParams = ['horario_id', 'fecha', 'hora', 'duracion_id', 'descripcion', 'profesor_id', 'salon', 'unidad', 'periodo_id', 'fecha_clase'];
|
||||
|
||||
// Filter params based on requiredParams
|
||||
$params = array_filter($_POST, function ($key) use ($requiredParams) {
|
||||
return in_array($key, $requiredParams);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
|
||||
// Check if all required params are present
|
||||
if (count($params) !== count($requiredParams)) {
|
||||
throw new Exception('Falta uno o más parámetros requeridos');
|
||||
}
|
||||
|
||||
$db->insert("reposicion", $params);
|
||||
|
||||
// Return success response
|
||||
echo json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Reposición creada correctamente",
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
// Return error response
|
||||
echo json_encode([
|
||||
"status" => "error",
|
||||
"message" => "No se pudo crear la reposición",
|
||||
"error" => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
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";
|
||||
|
||||
// if method is get
|
||||
header("Content-Type: application/json");
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$user->print_to_log("Acceso a reposiciones");
|
||||
$reposiciones = $db
|
||||
->where('periodo_id', $_GET['periodo_id'] ?? null)
|
||||
->where('profesor_id', $_GET['profesor_id'] ?? [])
|
||||
->get("reposicion");
|
||||
echo json_encode([
|
||||
'status' => 'success',
|
||||
'reposiciones' => $reposiciones
|
||||
]);
|
||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$user->print_to_log("Creación de reposición", new: $params);
|
||||
try {
|
||||
$requiredParams = ['horario_id', 'fecha', 'hora', 'duracion_id', 'descripcion', 'profesor_id', 'salon', 'unidad', 'periodo_id', 'fecha_clase'];
|
||||
|
||||
// Filter params based on requiredParams
|
||||
$params = array_filter($_POST, function ($key) use ($requiredParams) {
|
||||
return in_array($key, $requiredParams);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
|
||||
// Check if all required params are present
|
||||
if (count($params) !== count($requiredParams)) {
|
||||
throw new Exception('Falta uno o más parámetros requeridos');
|
||||
}
|
||||
|
||||
$db->insert("reposicion", $params);
|
||||
|
||||
// Return success response
|
||||
echo json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Reposición creada correctamente",
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
// Return error response
|
||||
echo json_encode([
|
||||
"status" => "error",
|
||||
"message" => "No se pudo crear la reposición",
|
||||
"error" => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
<?php
|
||||
#display PHP errors
|
||||
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
require_once "../include/func_excel.php";
|
||||
require_once "../include/func_string.php";
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
$reader = IOFactory::createReader("Xlsx");
|
||||
$reader->setReadDataOnly(true);
|
||||
|
||||
$file = $_FILES['archivo'];
|
||||
|
||||
|
||||
$spreadsheet = $reader->load($file['tmp_name'][0]);
|
||||
|
||||
$data = [];
|
||||
|
||||
try {
|
||||
|
||||
foreach_sheet(
|
||||
$spreadsheet, // object $spreadsheet
|
||||
function (array $row_data, int $i, string $sheet) {
|
||||
global $horario, $data;
|
||||
|
||||
if (renglón_vacío($row_data)) return;
|
||||
validar_registro($row_data, $i);
|
||||
|
||||
$horario["horario"] = horario($row_data, $i, $sheet);
|
||||
|
||||
foreach (array_filter($row_data) as $key => $value)
|
||||
$horario = array_merge($horario, ($key == 'maestro') ? columna_nombre($value) : [$key => $value]);
|
||||
|
||||
$data[] = $horario;
|
||||
}
|
||||
);
|
||||
|
||||
die(json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Horario revisado con éxito, se leyeron: " . count($data) . " registros",
|
||||
"data" => $data
|
||||
]));
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => $e->getMessage(),
|
||||
]));
|
||||
}
|
||||
<?php
|
||||
#display PHP errors
|
||||
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
require_once "../include/func_excel.php";
|
||||
require_once "../include/func_string.php";
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
$reader = IOFactory::createReader("Xlsx");
|
||||
$reader->setReadDataOnly(true);
|
||||
|
||||
$file = $_FILES['archivo'];
|
||||
|
||||
|
||||
$spreadsheet = $reader->load($file['tmp_name'][0]);
|
||||
|
||||
$data = [];
|
||||
|
||||
try {
|
||||
|
||||
foreach_sheet(
|
||||
$spreadsheet, // object $spreadsheet
|
||||
function (array $row_data, int $i, string $sheet) {
|
||||
global $horario, $data;
|
||||
|
||||
if (renglón_vacío($row_data)) return;
|
||||
validar_registro($row_data, $i);
|
||||
|
||||
$horario["horario"] = horario($row_data, $i, $sheet);
|
||||
|
||||
foreach (array_filter($row_data) as $key => $value)
|
||||
$horario = array_merge($horario, ($key == 'maestro') ? columna_nombre($value) : [$key => $value]);
|
||||
|
||||
$data[] = $horario;
|
||||
}
|
||||
);
|
||||
|
||||
die(json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Horario revisado con éxito, se leyeron: " . count($data) . " registros",
|
||||
"data" => $data
|
||||
]));
|
||||
} catch (Exception $e) {
|
||||
die(json_encode([
|
||||
"status" => "error",
|
||||
"message" => $e->getMessage(),
|
||||
]));
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
print_r($_POST);
|
||||
$sql = "INSERT INTO rol (rol_titulo) VALUES (:nombre)";
|
||||
$params = [':nombre' => mb_strtoupper($_POST['mtitulo'])];
|
||||
$hecho = query($sql, $params, true);
|
||||
header("Location: ../roles.php");
|
||||
exit();
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
print_r($_POST);
|
||||
$sql = "INSERT INTO rol (rol_titulo) VALUES (:nombre)";
|
||||
$params = [':nombre' => mb_strtoupper($_POST['mtitulo'])];
|
||||
$hecho = query($sql, $params, true);
|
||||
header("Location: ../roles.php");
|
||||
exit();
|
||||
?>
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
|
||||
global $pdo;
|
||||
|
||||
$sql = "SELECT * FROM rol WHERE rol_id = :idRol";
|
||||
$params = [':idRol' => $_POST['rol']];
|
||||
|
||||
echo json_encode( query($sql, $params, true));
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
|
||||
global $pdo;
|
||||
|
||||
$sql = "SELECT * FROM rol WHERE rol_id = :idRol";
|
||||
$params = [':idRol' => $_POST['rol']];
|
||||
|
||||
echo json_encode( query($sql, $params, true));
|
||||
?>
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
$sql = "UPDATE rol SET rol_titulo = :nombre WHERE rol_id = :id";
|
||||
$params = array(':nombre' => mb_strtoupper($_POST['mtitulo']), ':id' => $_POST['id']);
|
||||
print_r($_POST);
|
||||
$hecho = query($sql, $params, false);
|
||||
header("Location: ../roles.php", true, 307);
|
||||
exit();
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
$sql = "UPDATE rol SET rol_titulo = :nombre WHERE rol_id = :id";
|
||||
$params = array(':nombre' => mb_strtoupper($_POST['mtitulo']), ':id' => $_POST['id']);
|
||||
print_r($_POST);
|
||||
$hecho = query($sql, $params, false);
|
||||
header("Location: ../roles.php", true, 307);
|
||||
exit();
|
||||
?>
|
||||
@@ -1,37 +1,37 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
print_r($_POST);
|
||||
|
||||
$fs_tiempo = query(
|
||||
"SELECT * FROM fs_tiempo_checado(:facultad, 1)", [':facultad' => $_POST['facultadT']], true
|
||||
);
|
||||
|
||||
if($fs_tiempo){
|
||||
$sql = "SELECT fu_update_tiempo_checado(:idfacultad, :idnivel, :antes, :despues, :retardo)";
|
||||
$params = [':idfacultad' => $_POST['facultadT'], ':idnivel' => 1, ':antes' => -1*$_POST['antesL'], ':despues' => $_POST['despuesL']+1, ':retardo' => $_POST['retardoL']+$_POST['despuesL']+1];
|
||||
}
|
||||
else{
|
||||
$sql = "SELECT fi_tiempo_checado(:idfacultad, :idnivel, :antes, :despues, :retardo)";
|
||||
$params = [':idfacultad' => $_POST['facultadT'], ':idnivel' => 1, ':antes' => -1*$_POST['antesL'], ':despues' => $_POST['despuesL']+1, ':retardo' => $_POST['retardoL']+$_POST['despuesL']+1];
|
||||
}
|
||||
query($sql, $params, false);
|
||||
|
||||
|
||||
$fs_tiempo2 = query(
|
||||
"SELECT * FROM fs_tiempo_checado(:facultad, 2)", [':facultad' => $_POST['facultadT']], true
|
||||
);
|
||||
|
||||
if($fs_tiempo2){
|
||||
$sql = "SELECT fu_update_tiempo_checado(:idfacultad, :idnivel, :antes, :despues, :retardo)";
|
||||
$params = [':idfacultad' => $_POST['facultadT'], ':idnivel' => 2, ':antes' => -1*$_POST['antesP'], ':despues' => $_POST['despuesP']+1, ':retardo' => $_POST['retardoP']+$_POST['despuesP']+1];
|
||||
}
|
||||
else{
|
||||
$sql = "SELECT fi_tiempo_checado(:idfacultad, :idnivel, :antes, :despues, :retardo)";
|
||||
$params = [':idfacultad' => $_POST['facultadT'], ':idnivel' => 2, ':antes' => -1*$_POST['antesP'], ':despues' => $_POST['despuesP']+1, ':retardo' => $_POST['retardoP']+$_POST['despuesP']+1];
|
||||
}
|
||||
query($sql, $params, false);
|
||||
|
||||
header("Location: ../carreras.php?facultad=".$_POST['facultadT']);
|
||||
exit();
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
print_r($_POST);
|
||||
|
||||
$fs_tiempo = query(
|
||||
"SELECT * FROM fs_tiempo_checado(:facultad, 1)", [':facultad' => $_POST['facultadT']], true
|
||||
);
|
||||
|
||||
if($fs_tiempo){
|
||||
$sql = "SELECT fu_update_tiempo_checado(:idfacultad, :idnivel, :antes, :despues, :retardo)";
|
||||
$params = [':idfacultad' => $_POST['facultadT'], ':idnivel' => 1, ':antes' => -1*$_POST['antesL'], ':despues' => $_POST['despuesL']+1, ':retardo' => $_POST['retardoL']+$_POST['despuesL']+1];
|
||||
}
|
||||
else{
|
||||
$sql = "SELECT fi_tiempo_checado(:idfacultad, :idnivel, :antes, :despues, :retardo)";
|
||||
$params = [':idfacultad' => $_POST['facultadT'], ':idnivel' => 1, ':antes' => -1*$_POST['antesL'], ':despues' => $_POST['despuesL']+1, ':retardo' => $_POST['retardoL']+$_POST['despuesL']+1];
|
||||
}
|
||||
query($sql, $params, false);
|
||||
|
||||
|
||||
$fs_tiempo2 = query(
|
||||
"SELECT * FROM fs_tiempo_checado(:facultad, 2)", [':facultad' => $_POST['facultadT']], true
|
||||
);
|
||||
|
||||
if($fs_tiempo2){
|
||||
$sql = "SELECT fu_update_tiempo_checado(:idfacultad, :idnivel, :antes, :despues, :retardo)";
|
||||
$params = [':idfacultad' => $_POST['facultadT'], ':idnivel' => 2, ':antes' => -1*$_POST['antesP'], ':despues' => $_POST['despuesP']+1, ':retardo' => $_POST['retardoP']+$_POST['despuesP']+1];
|
||||
}
|
||||
else{
|
||||
$sql = "SELECT fi_tiempo_checado(:idfacultad, :idnivel, :antes, :despues, :retardo)";
|
||||
$params = [':idfacultad' => $_POST['facultadT'], ':idnivel' => 2, ':antes' => -1*$_POST['antesP'], ':despues' => $_POST['despuesP']+1, ':retardo' => $_POST['retardoP']+$_POST['despuesP']+1];
|
||||
}
|
||||
query($sql, $params, false);
|
||||
|
||||
header("Location: ../carreras.php?facultad=".$_POST['facultadT']);
|
||||
exit();
|
||||
?>
|
||||
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once '../class/c_login.php';
|
||||
|
||||
// print_r($_POST); exit;
|
||||
|
||||
if (($user = Login::validUser($_POST['username'], $_POST['passwd'])) === false) {
|
||||
echo json_encode("error");
|
||||
exit;
|
||||
}
|
||||
|
||||
$facultades = queryAll("SELECT DISTINCT ID, FACULTAD FROM FS_FACULTAD WHERE ACTIVA");
|
||||
|
||||
for ($i = 0; $i < count($facultades); $i++) {
|
||||
# print_r($facultades[$i]);
|
||||
$facultades[$i]['usuarios'] = queryAll(
|
||||
"SELECT ID, USERNAME FROM FS_USUARIO WHERE facultad = :facultad",
|
||||
array(":facultad" => $facultades[$i]["id"])
|
||||
);
|
||||
}
|
||||
|
||||
echo json_encode($facultades);
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once '../class/c_login.php';
|
||||
|
||||
// print_r($_POST); exit;
|
||||
|
||||
if (($user = Login::validUser($_POST['username'], $_POST['passwd'])) === false) {
|
||||
echo json_encode("error");
|
||||
exit;
|
||||
}
|
||||
|
||||
$facultades = queryAll("SELECT DISTINCT ID, FACULTAD FROM FS_FACULTAD WHERE ACTIVA");
|
||||
|
||||
for ($i = 0; $i < count($facultades); $i++) {
|
||||
# print_r($facultades[$i]);
|
||||
$facultades[$i]['usuarios'] = queryAll(
|
||||
"SELECT ID, USERNAME FROM FS_USUARIO WHERE facultad = :facultad",
|
||||
array(":facultad" => $facultades[$i]["id"])
|
||||
);
|
||||
}
|
||||
|
||||
echo json_encode($facultades);
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
if(isset($_POST['dlfacultad']))
|
||||
$facultad=$_POST['dlfacultad'];
|
||||
else
|
||||
$facultad=$_POST['mfacultad'];
|
||||
|
||||
$hecho = query("SELECT * FROM fs_usuario WHERE clave = :clave", [':clave' => $_POST['mclave']], true);
|
||||
if(!$hecho){
|
||||
$sql = "SELECT fi_usuario(:nombre, :correo, :clave, :rol, :facultad)";
|
||||
$params = [':nombre' => mb_strtoupper($_POST['mnombre']), ':correo' => $_POST['mcorreo'], ':clave' => $_POST['mclave'], ':rol' => $_POST['mrol'], ':facultad' => $facultad];
|
||||
$hecho = query($sql, $params, true);
|
||||
header("Location: ../usuarios.php", true, 307);
|
||||
exit();
|
||||
}
|
||||
else{
|
||||
header("Location: ../usuarios.php?error=1");
|
||||
exit();
|
||||
}
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
if(isset($_POST['dlfacultad']))
|
||||
$facultad=$_POST['dlfacultad'];
|
||||
else
|
||||
$facultad=$_POST['mfacultad'];
|
||||
|
||||
$hecho = query("SELECT * FROM fs_usuario WHERE clave = :clave", [':clave' => $_POST['mclave']], true);
|
||||
if(!$hecho){
|
||||
$sql = "SELECT fi_usuario(:nombre, :correo, :clave, :rol, :facultad)";
|
||||
$params = [':nombre' => mb_strtoupper($_POST['mnombre']), ':correo' => $_POST['mcorreo'], ':clave' => $_POST['mclave'], ':rol' => $_POST['mrol'], ':facultad' => $facultad];
|
||||
$hecho = query($sql, $params, true);
|
||||
header("Location: ../usuarios.php", true, 307);
|
||||
exit();
|
||||
}
|
||||
else{
|
||||
header("Location: ../usuarios.php?error=1");
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
$sql = "SELECT * FROM usuario WHERE usuario_id = :idUsuario";
|
||||
$params = [':idUsuario' => $_POST['usuario']];
|
||||
echo json_encode(query($sql, $params, true));
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
$sql = "SELECT * FROM usuario WHERE usuario_id = :idUsuario";
|
||||
$params = [':idUsuario' => $_POST['usuario']];
|
||||
echo json_encode(query($sql, $params, true));
|
||||
?>
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
if(isset($_POST['dlfacultad']))
|
||||
$facultad=$_POST['dlfacultad'];
|
||||
else
|
||||
$facultad=$_POST['mfacultad'];
|
||||
$sql = "SELECT fu_update_usuario(:id, :nombre, :correo, :clave, :rol, :facultad)";
|
||||
$params = array(':id' => $_POST['id'], ':nombre' => mb_strtoupper($_POST['mnombre']), ':correo' => $_POST['mcorreo'], ':clave' => $_POST['mclave'], ':rol' => $_POST['mrol'], ':facultad' => $facultad);
|
||||
#print_r($_POST);
|
||||
$hecho = query($sql, $params, false);
|
||||
header("Location: ../usuarios.php", true, 307);
|
||||
exit();
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $pdo;
|
||||
if(isset($_POST['dlfacultad']))
|
||||
$facultad=$_POST['dlfacultad'];
|
||||
else
|
||||
$facultad=$_POST['mfacultad'];
|
||||
$sql = "SELECT fu_update_usuario(:id, :nombre, :correo, :clave, :rol, :facultad)";
|
||||
$params = array(':id' => $_POST['id'], ':nombre' => mb_strtoupper($_POST['mnombre']), ':correo' => $_POST['mcorreo'], ':clave' => $_POST['mclave'], ':rol' => $_POST['mrol'], ':facultad' => $facultad);
|
||||
#print_r($_POST);
|
||||
$hecho = query($sql, $params, false);
|
||||
header("Location: ../usuarios.php", true, 307);
|
||||
exit();
|
||||
?>
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
$ruta = '../';
|
||||
require_once '../include/bd_pdo.php';
|
||||
global $pdo;
|
||||
|
||||
$sql = "SELECT * FROM fs_carreras(:fac, null, null)";
|
||||
$params = [':fac' => $_POST['fac_id']];
|
||||
|
||||
echo json_encode(query($sql, $params, false));
|
||||
<?php
|
||||
$ruta = '../';
|
||||
require_once '../include/bd_pdo.php';
|
||||
global $pdo;
|
||||
|
||||
$sql = "SELECT * FROM fs_carreras(:fac, null, null)";
|
||||
$params = [':fac' => $_POST['fac_id']];
|
||||
|
||||
echo json_encode(query($sql, $params, false));
|
||||
?>
|
||||
@@ -1,37 +1,37 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once '../class/c_login.php';
|
||||
|
||||
# print_r($_POST); exit;
|
||||
extract($_POST); // $usuario
|
||||
Login::log_out();
|
||||
|
||||
$user = query("SELECT * FROM FS_USUARIO WHERE ID = :id", [":id" => $usuario]);
|
||||
// die(json_encode($user));
|
||||
|
||||
$facultad = [
|
||||
"facultad_id" => $user["facultad"],
|
||||
"facultad" => $user["facultad_nombre"]
|
||||
];
|
||||
|
||||
$rol = [
|
||||
"rol_id" => $user["rol"],
|
||||
"rol" => $user["titulo"]
|
||||
];
|
||||
|
||||
$admin = false;
|
||||
|
||||
$periodo = $user["periodo"];
|
||||
|
||||
$user = [
|
||||
"id" => $user["id"],
|
||||
"nombre" => $user["username"]
|
||||
];
|
||||
|
||||
$user = new Login($user, $facultad, $rol, $admin, $periodo);
|
||||
if (isset($_SESSION))
|
||||
session_start();
|
||||
$_SESSION['user'] = serialize($user);
|
||||
|
||||
header("Location: ../main.php");
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once '../class/c_login.php';
|
||||
|
||||
# print_r($_POST); exit;
|
||||
extract($_POST); // $usuario
|
||||
Login::log_out();
|
||||
|
||||
$user = query("SELECT * FROM FS_USUARIO WHERE ID = :id", [":id" => $usuario]);
|
||||
// die(json_encode($user));
|
||||
|
||||
$facultad = [
|
||||
"facultad_id" => $user["facultad"],
|
||||
"facultad" => $user["facultad_nombre"]
|
||||
];
|
||||
|
||||
$rol = [
|
||||
"rol_id" => $user["rol"],
|
||||
"rol" => $user["titulo"]
|
||||
];
|
||||
|
||||
$admin = false;
|
||||
|
||||
$periodo = $user["periodo"];
|
||||
|
||||
$user = [
|
||||
"id" => $user["id"],
|
||||
"nombre" => $user["username"]
|
||||
];
|
||||
|
||||
$user = new Login($user, $facultad, $rol, $admin, $periodo);
|
||||
if (isset($_SESSION))
|
||||
session_start();
|
||||
$_SESSION['user'] = serialize($user);
|
||||
|
||||
header("Location: ../main.php");
|
||||
exit;
|
||||
@@ -1,60 +1,60 @@
|
||||
<?
|
||||
#input $_GET['id_espacio_sgu']
|
||||
define("INFORMATION", [
|
||||
'POST' => [
|
||||
'profesor_id',
|
||||
'horario_id',
|
||||
'estado',
|
||||
'comentario',
|
||||
'supervisor_id',
|
||||
],
|
||||
]);
|
||||
#output rutas: [ ...ruta, salones: [{...salon}] ]
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
#return html
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
// check method
|
||||
try {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// check parameters
|
||||
$raw = file_get_contents('php://input');
|
||||
$post_data = json_decode($raw, true);
|
||||
// if it's a list
|
||||
// step 1: get subrutas
|
||||
if (empty($post_data)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'No hay clases pendientes']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$data = $db->query(
|
||||
'INSERT INTO registro (profesor_id, horario_id, registro_fecha_supervisor, estado_supervisor_id, registro_fecha_ideal, supervisor_id, comentario)
|
||||
VALUES' .
|
||||
implode(',', array_map(fn($x) => "({$x['profesor_id']} , {$x['horario_id']}, NOW()," . (is_null($x['estado']) ? 'null' : $x['estado']) . ", NOW(), {$x['supervisor_id']}," . (empty($x['comentario']) ? 'null' : "'{$x['comentario']}'") . ')', $post_data))
|
||||
. ' ON CONFLICT (profesor_id, horario_id, registro_fecha_ideal) DO UPDATE SET estado_supervisor_id = EXCLUDED.estado_supervisor_id, registro_fecha_supervisor = NOW(), comentario = EXCLUDED.comentario
|
||||
RETURNING *'
|
||||
);
|
||||
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(),
|
||||
'post_data' => $post_data,
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
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']
|
||||
define("INFORMATION", [
|
||||
'POST' => [
|
||||
'profesor_id',
|
||||
'horario_id',
|
||||
'estado',
|
||||
'comentario',
|
||||
'supervisor_id',
|
||||
],
|
||||
]);
|
||||
#output rutas: [ ...ruta, salones: [{...salon}] ]
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
#return html
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
// check method
|
||||
try {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// check parameters
|
||||
$raw = file_get_contents('php://input');
|
||||
$post_data = json_decode($raw, true);
|
||||
// if it's a list
|
||||
// step 1: get subrutas
|
||||
if (empty($post_data)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'No hay clases pendientes']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$data = $db->query(
|
||||
'INSERT INTO registro (profesor_id, horario_id, registro_fecha_supervisor, estado_supervisor_id, registro_fecha_ideal, supervisor_id, comentario)
|
||||
VALUES' .
|
||||
implode(',', array_map(fn($x) => "({$x['profesor_id']} , {$x['horario_id']}, NOW()," . (is_null($x['estado']) ? 'null' : $x['estado']) . ", NOW(), {$x['supervisor_id']}," . (empty($x['comentario']) ? 'null' : "'{$x['comentario']}'") . ')', $post_data))
|
||||
. ' ON CONFLICT (profesor_id, horario_id, registro_fecha_ideal) DO UPDATE SET estado_supervisor_id = EXCLUDED.estado_supervisor_id, registro_fecha_supervisor = NOW(), comentario = EXCLUDED.comentario, supervisor_id = EXCLUDED.supervisor_id
|
||||
RETURNING *'
|
||||
);
|
||||
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(),
|
||||
'post_data' => $post_data,
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
exit;
|
||||
} catch (Exception $th) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $th->getMessage(),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
exit;
|
||||
}
|
||||
@@ -1,28 +1,28 @@
|
||||
<?
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
$universidad_la_salle = $db
|
||||
->where('salon', 'UNIVERSIDAD LA SALLE', 'ILIKE')
|
||||
->getOne('salon_view');
|
||||
|
||||
$rutas =
|
||||
array_map(
|
||||
function (&$ruta) use ($db) {
|
||||
$ruta['subrutas'] =
|
||||
$db
|
||||
->where('id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->orderBy('salon')
|
||||
->get('salon_view');
|
||||
return $ruta;
|
||||
|
||||
},
|
||||
$db
|
||||
->where('id_espacio_padre', $universidad_la_salle['id_espacio_sgu'])
|
||||
->orderBy('salon')
|
||||
->get('salon_view')
|
||||
);
|
||||
|
||||
// echo json_encode($universidad_la_salle, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); EXIT;
|
||||
<?
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
$universidad_la_salle = $db
|
||||
->where('salon', 'UNIVERSIDAD LA SALLE', 'ILIKE')
|
||||
->getOne('salon_view');
|
||||
|
||||
$rutas =
|
||||
array_map(
|
||||
function ($ruta) use ($db) {
|
||||
$ruta['subrutas'] =
|
||||
$db
|
||||
->where('id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->orderBy('salon')
|
||||
->get('salon_view');
|
||||
return $ruta;
|
||||
|
||||
},
|
||||
$db
|
||||
->where('id_espacio_padre', $universidad_la_salle['id_espacio_sgu'])
|
||||
->orderBy('salon')
|
||||
->get('salon_view')
|
||||
);
|
||||
|
||||
// echo json_encode($universidad_la_salle, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); EXIT;
|
||||
echo json_encode($rutas, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
@@ -1,73 +1,73 @@
|
||||
<?
|
||||
#input $_GET['id_espacio_sgu']
|
||||
$information = [
|
||||
'GET' => [
|
||||
'id_espacio_sgu',
|
||||
'bloque_horario_id',
|
||||
],
|
||||
];
|
||||
#output rutas: [ ...ruta, salones: [{...salon}] ]
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
// check method
|
||||
try {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// check parameters
|
||||
array_walk($information['GET'], function ($value) {
|
||||
if (!array_key_exists($value, $_GET)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => "$value is required"]);
|
||||
exit;
|
||||
}
|
||||
});
|
||||
// step 1: get subrutas
|
||||
$data = $db
|
||||
->where('tiene_salones')
|
||||
->where("{$_GET['id_espacio_sgu']} = ANY(id_espacio_sgu_array)")
|
||||
->get('salon_view');
|
||||
|
||||
// step 3: get horarios
|
||||
$data = array_map(
|
||||
fn($ruta) => array_merge(
|
||||
[
|
||||
'horarios' => $db
|
||||
->join('periodo', 'periodo.periodo_id = horario_view.periodo_id')
|
||||
->join('bloque_horario', '(bloque_horario.hora_inicio, bloque_horario.hora_fin) OVERLAPS (horario_view.horario_hora, horario_view.horario_hora + horario_view.duracion)')
|
||||
->join('salon_view', 'salon_view.salon_id = horario_view.salon_id')
|
||||
->join('horario_profesor', 'horario_profesor.horario_id = horario_view.horario_id')
|
||||
->join('profesor', 'profesor.profesor_id = horario_profesor.profesor_id')
|
||||
->join('registro', '(registro.profesor_id, registro.horario_id, registro.registro_fecha_ideal) = (profesor.profesor_id, horario_view.horario_id, CURRENT_DATE)', 'LEFT')
|
||||
->where('CURRENT_DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin')
|
||||
->where('horario_dia = EXTRACT(DOW FROM CURRENT_DATE)')
|
||||
->where('bloque_horario.id', $_GET['bloque_horario_id'])
|
||||
->where('id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->get('horario_view', null, '*, horario_view.horario_id, profesor.profesor_id'),
|
||||
],
|
||||
$ruta
|
||||
),
|
||||
$data
|
||||
);
|
||||
|
||||
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);
|
||||
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']
|
||||
$information = [
|
||||
'GET' => [
|
||||
'id_espacio_sgu',
|
||||
'bloque_horario_id',
|
||||
],
|
||||
];
|
||||
#output rutas: [ ...ruta, salones: [{...salon}] ]
|
||||
header('Content-Type: application/json charset=utf-8');
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
// check method
|
||||
try {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// check parameters
|
||||
array_walk($information['GET'], function ($value) {
|
||||
if (!array_key_exists($value, $_GET)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => "$value is required"]);
|
||||
exit;
|
||||
}
|
||||
});
|
||||
// step 1: get subrutas
|
||||
$data = $db
|
||||
->where('tiene_salones')
|
||||
->where("{$_GET['id_espacio_sgu']} = ANY(id_espacio_sgu_array)")
|
||||
->get('salon_view');
|
||||
|
||||
// step 3: get horarios
|
||||
$data = array_map(
|
||||
fn($ruta) => array_merge(
|
||||
[
|
||||
'horarios' => $db
|
||||
->join('periodo', 'periodo.periodo_id = horario_view.periodo_id')
|
||||
->join('bloque_horario', '(bloque_horario.hora_inicio, bloque_horario.hora_fin) OVERLAPS (horario_view.horario_hora, horario_view.horario_hora + horario_view.duracion)')
|
||||
->join('salon_view', 'salon_view.salon_id = horario_view.salon_id')
|
||||
->join('horario_profesor', 'horario_profesor.horario_id = horario_view.horario_id')
|
||||
->join('profesor', 'profesor.profesor_id = horario_profesor.profesor_id')
|
||||
->join('registro', '(registro.profesor_id, registro.horario_id, registro.registro_fecha_ideal) = (profesor.profesor_id, horario_view.horario_id, CURRENT_DATE)', 'LEFT')
|
||||
->where('CURRENT_DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin')
|
||||
->where('horario_dia = EXTRACT(DOW FROM CURRENT_DATE)')
|
||||
->where('bloque_horario.id', $_GET['bloque_horario_id'])
|
||||
->where('id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->get('horario_view', null, '*, horario_view.horario_id, profesor.profesor_id'),
|
||||
],
|
||||
$ruta
|
||||
),
|
||||
$data
|
||||
);
|
||||
|
||||
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);
|
||||
exit;
|
||||
} catch (Exception $th) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $th->getMessage(),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
exit;
|
||||
}
|
||||
@@ -1,24 +1,24 @@
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"profesor_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"horario_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"estado": {
|
||||
"type": ["integer", "null"]
|
||||
},
|
||||
"comentario": {
|
||||
"type": "string"
|
||||
},
|
||||
"supervisor_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": ["profesor_id", "horario_id", "comentario", "supervisor_id"]
|
||||
}
|
||||
}
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"profesor_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"horario_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"estado": {
|
||||
"type": ["integer", "null"]
|
||||
},
|
||||
"comentario": {
|
||||
"type": "string"
|
||||
},
|
||||
"supervisor_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": ["profesor_id", "horario_id", "comentario", "supervisor_id"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<?php
|
||||
$ruta = '../';
|
||||
require_once '../include/bd_pdo.php';
|
||||
global $pdo;
|
||||
|
||||
if($_POST['nombre']==""){
|
||||
$nombre = null;
|
||||
}else{
|
||||
$nombre = $_POST['nombre'];
|
||||
}
|
||||
if($_POST['clave']==""){
|
||||
$clave = null;
|
||||
}else{
|
||||
$clave = $_POST['clave'];
|
||||
}
|
||||
if($_POST['facultad']==""){
|
||||
$facultad = null;
|
||||
}else{
|
||||
$facultad = $_POST['facultad'];
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM fs_profesores(:nombre, :clave, :facultad) ORDER BY profesor_nombre";
|
||||
$params = [':nombre' => $nombre, ':clave' => $clave, ':facultad' => $facultad];
|
||||
|
||||
echo json_encode(query($sql, $params, false));
|
||||
<?php
|
||||
$ruta = '../';
|
||||
require_once '../include/bd_pdo.php';
|
||||
global $pdo;
|
||||
|
||||
if($_POST['nombre']==""){
|
||||
$nombre = null;
|
||||
}else{
|
||||
$nombre = $_POST['nombre'];
|
||||
}
|
||||
if($_POST['clave']==""){
|
||||
$clave = null;
|
||||
}else{
|
||||
$clave = $_POST['clave'];
|
||||
}
|
||||
if($_POST['facultad']==""){
|
||||
$facultad = null;
|
||||
}else{
|
||||
$facultad = $_POST['facultad'];
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM fs_profesores(:nombre, :clave, :facultad) ORDER BY profesor_nombre";
|
||||
$params = [':nombre' => $nombre, ':clave' => $clave, ':facultad' => $facultad];
|
||||
|
||||
echo json_encode(query($sql, $params, false));
|
||||
?>
|
||||
Reference in New Issue
Block a user