Add new files and make code improvements
This commit is contained in:
@@ -31,7 +31,7 @@ try {
|
||||
"WITH horarios AS (
|
||||
SELECT
|
||||
horario_id,
|
||||
facultad.facultad_id,
|
||||
horario.facultad_id,
|
||||
horario_fecha_inicio,
|
||||
horario_fecha_fin,
|
||||
horario_grupo,
|
||||
@@ -40,20 +40,19 @@ try {
|
||||
PERIODO.periodo_fecha_fin,
|
||||
salon,
|
||||
COALESCE(materia_nombre, materia_asignacion_materia) as materia,
|
||||
carrera_nombre as carrera,
|
||||
coalesce(carrera_nombre, materia_asignacion_carrera) as carrera,
|
||||
facultad_nombre as facultad,
|
||||
nivel_nombre as nivel,
|
||||
horario_fin
|
||||
FROM horario
|
||||
left JOIN materia USING (materia_id)
|
||||
LEFT JOIN carrera USING (carrera_id)
|
||||
left join carrera using (carrera_id)
|
||||
left join materia_asignacion using (horario_id)
|
||||
-- JOIN carrera USING (carrera_id) but if carrera_id is null then 0
|
||||
JOIN nivel USING (nivel_id)
|
||||
JOIN facultad ON facultad.facultad_id = COALESCE(carrera.facultad_id, 0)
|
||||
join facultad on facultad.facultad_id = horario.facultad_id
|
||||
JOIN PERIODO USING (periodo_id)
|
||||
JOIN nivel on periodo.nivel_id = nivel.nivel_id
|
||||
JOIN SALON USING (salon_id)
|
||||
WHERE (PERIODO.periodo_id, facultad.facultad_id) = (:periodo_id, COALESCE(:facultad_id, facultad.facultad_id))
|
||||
WHERE (PERIODO.periodo_id, horario.facultad_id) = (:periodo_id, COALESCE(:facultad_id, horario.facultad_id))
|
||||
),
|
||||
fechas AS (
|
||||
SELECT fechas_clase(h.horario_id, true) as registro_fecha_ideal, h.horario_id
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?
|
||||
#input $_GET['id_espacio_sgu']
|
||||
define("INFORMATION", [
|
||||
'GET' => [
|
||||
|
||||
@@ -23,7 +23,8 @@ if (!isset($_GET['carrera_id'])) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$grupos = $db->query(<<<SQL
|
||||
try {
|
||||
$grupos = $db->query(<<<SQL
|
||||
SELECT distinct substring(horario_grupo, 7, 3)::int - 1 as horario_grupo FROM horario_view WHERE
|
||||
PERIODO_ID = :periodo_id AND
|
||||
(FACULTAD_ID = :facultad_id OR :facultad_id IS NULL) AND
|
||||
@@ -31,11 +32,15 @@ $grupos = $db->query(<<<SQL
|
||||
GROUP BY horario_grupo
|
||||
ORDER BY horario_grupo ASC
|
||||
SQL,
|
||||
[
|
||||
':periodo_id' => $user->periodo_id,
|
||||
':facultad_id' => $user->facultad['facultad_id'],
|
||||
':carrera_id' => $_GET['carrera_id']
|
||||
]
|
||||
);
|
||||
[
|
||||
':periodo_id' => $user->periodo_id,
|
||||
':facultad_id' => $user->facultad['facultad_id'],
|
||||
':carrera_id' => $_GET['carrera_id'] ?? 0
|
||||
]
|
||||
);
|
||||
} catch (PDOException $ex) {
|
||||
echo json_encode([]);
|
||||
exit();
|
||||
}
|
||||
|
||||
echo json_encode(array_map(fn($grupo) => $grupo['horario_grupo'], $grupos));
|
||||
15
action/action_usuarios_delete.php
Normal file
15
action/action_usuarios_delete.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
global $db;
|
||||
|
||||
try {
|
||||
$db->querySingle("UPDATE usuario SET estado_baja = TRUE WHERE usuario_id = ?", [$_GET['id']]);
|
||||
header("Location: ../usuarios.php", true, 307);
|
||||
} catch (PDOException $e) {
|
||||
header("Location: ../usuarios.php?error=2");
|
||||
exit;
|
||||
}
|
||||
33
action/asignacion_delete.php
Normal file
33
action/asignacion_delete.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
* Borra reposición
|
||||
*/
|
||||
$pag = "../reposiciones_crear.php";
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
// check if the session is started
|
||||
if (!isset($_SESSION['user']))
|
||||
die('No se ha iniciado sesión');
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
|
||||
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión
|
||||
if(!isset($_POST["id"])){
|
||||
$return["error"] = "Error! No se recibió la información necesaria.";
|
||||
}else{
|
||||
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$creador = $user->user["id"];
|
||||
|
||||
try{
|
||||
$db->query('SELECT * from fd_asignacion_solicitud(:id, :creador)', [":id"=> $id, ":creador"=>$creador]);
|
||||
$return["ok"] = "La solicitud se borró correctamente";
|
||||
|
||||
}catch(Exception $e){
|
||||
$return["error"] = "Ocurrió un error al borrar la solicitud de salón.";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
echo json_encode($return);
|
||||
?>
|
||||
@@ -23,6 +23,8 @@ $hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//l
|
||||
$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
|
||||
if(isset($_POST["salon"]) && $_POST["salon"] != "")
|
||||
$salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
|
||||
if(empty($_POST["prof"]))
|
||||
$prof = $user["id"];
|
||||
@@ -32,7 +34,7 @@ else
|
||||
//$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
|
||||
$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto
|
||||
|
||||
$aula_rs = $db->querySingle("select tipoaula_nombre from tipoaula where tipoaula_id = :id", [":id"=>$aula]);
|
||||
$aula_rs = $db->querySingle("select tipoaula_nombre, tipoaula_supervisor from tipoaula where tipoaula_id = :id", [":id"=>$aula]);
|
||||
|
||||
|
||||
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
|
||||
@@ -45,16 +47,52 @@ $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$
|
||||
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
|
||||
$dia_new = date('w', strtotime($fecha_new));
|
||||
|
||||
//Datos de dependencia de usuario
|
||||
$fac_rs = $db->querySingle("SELECT facultad_nombre, clave_dependencia from facultad where facultad_id = :id_fac",[':id_fac' => $user->facultad["facultad_id"]] );
|
||||
|
||||
|
||||
//Obtiene correo
|
||||
$correos_rs = $db->querySingle('SELECT coor.usuario_correo, coor.usuario_nombre from usuario coor where rol_id = :rol_coord and facultad_id = (
|
||||
select coalesce(facultad_id,0) from usuario u where u.usuario_id = :id_usr)',[':rol_coord' => COORDINADOR, ':id_usr' => $user->user["id"]]
|
||||
);
|
||||
if( count($correos_rs) > 0 ){
|
||||
$to = $correos_rs["usuario_correo"];
|
||||
$salon_desc = "Pendiente";
|
||||
if(!empty($salon)){
|
||||
$salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon',
|
||||
[':id_salon' => $salon]
|
||||
);
|
||||
if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){
|
||||
$salon_desc = "Pendiente";
|
||||
}else{
|
||||
$salon_json = json_decode($salon_rs["salon_array"], true);
|
||||
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
|
||||
unset($salon_json[0]);
|
||||
}
|
||||
$salon_desc = join(" / ",$salon_json);
|
||||
}
|
||||
}
|
||||
|
||||
//Obtiene correos
|
||||
$correos_rs = $db->query('SELECT coor.usuario_correo as coordinador_correo
|
||||
from reposicion_solicitud rs
|
||||
inner join profesor p on rs.profesor_id =p.profesor_id
|
||||
inner join usuario u on u.usuario_id = rs.usuario_id
|
||||
inner join horario_view hv on hv.horario_id = rs.horario_id
|
||||
inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord
|
||||
where hv.facultad_id = :id_fac',
|
||||
[':rol_coord' => COORDINADOR, ':id_fac' => $user->facultad["facultad_id"]]
|
||||
);
|
||||
$coord_correos=[];
|
||||
foreach($correos_rs as $correo){
|
||||
if( count($coord_correos)==0 && $correo["coordinador_correo"]!=""){
|
||||
if(!isset($coord_correos["correo"]) || !in_array($correo["coordinador_correo"], $coord_correos["correo"])){
|
||||
array_push($coord_correos, $correo["coordinador_correo"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo as coordinador_correo
|
||||
FROM horario_supervisor hs
|
||||
inner join usuario sup on sup.usuario_id =hs.usuario_id
|
||||
where :id_fac = ANY(hs.facultad_id_array)
|
||||
and sup.usuario_correo is not null and sup.usuario_correo != ''",
|
||||
[':id_fac' => $user->facultad["facultad_id"]] );
|
||||
|
||||
|
||||
// Valida que grupo no tenga clases
|
||||
/*$result = validaConflictoHoras($pdo, $gpo, $dia_new, $hora, $materia, "-", $fecha_new, $fecha_fin_new, $duracion);
|
||||
if($result != ""){//error
|
||||
@@ -77,10 +115,14 @@ if($traslape){
|
||||
}
|
||||
|
||||
try{
|
||||
//echo "SELECT * from fi_asignacion_solicitud( $fecha_new, $hora, $prof, 1, $comentario, $alumnos, $aula, $duracion_tiempo, ".$user->user["id"].")";
|
||||
$db->query('SELECT * from fi_asignacion_solicitud(:f_nueva, :hora_nueva, :prof, 1, :desc, :alumnos, :aula, :duracion, :usr)',
|
||||
$edo = 1;
|
||||
if(!$user->jefe_carrera)
|
||||
$edo = 2;
|
||||
|
||||
//echo "SELECT * from fi_asignacion_solicitud( $fecha_new, $hora, $prof, $edo, $comentario, $alumnos, $aula, $duracion_tiempo, ".$user->user["id"].")"; exit();
|
||||
$db->query('SELECT * from fi_asignacion_solicitud(:f_nueva, :hora_nueva, :prof, :edo, :desc, :alumnos, :aula, :duracion, :usr)',
|
||||
[':f_nueva' => $fecha_new, ':hora_nueva' => $hora,
|
||||
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"]
|
||||
':prof' => $prof, ':edo'=>$edo, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"]
|
||||
]
|
||||
);
|
||||
}catch(Exception $e){
|
||||
@@ -88,9 +130,34 @@ try{
|
||||
//header("Location: ".$pag."?error=1");
|
||||
exit();
|
||||
}
|
||||
$texto = "<p>Se creó una asignación nueva.</p>";
|
||||
$texto .= "<p><b>Se solicita un espacio de tipo ".mb_strtoupper($aula_rs["tipoaula_nombre"])."</b> del día <b>".$fecha_new." hrs. </b>";
|
||||
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
|
||||
|
||||
$asunto = "";
|
||||
$texto = "";
|
||||
$to = "";
|
||||
switch($edo){
|
||||
case 1://Correo a coordinador
|
||||
if( count($coord_correos) > 0 ){
|
||||
$to = join(",", $coord_correos);
|
||||
}
|
||||
$asunto = "Solicitud de salon nueva";
|
||||
$texto = "<p>Se creó una solicitud de asignación de salón nueva.</p>";
|
||||
$texto .= "<p><b>Se solicita un espacio de tipo ".mb_strtoupper($aula_rs["tipoaula_nombre"])."</b> para el día <b>".$fecha." a las ".$hora." hrs. </b>";
|
||||
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
|
||||
break;
|
||||
case 2://Correo a supervisor
|
||||
$asunto = "Solicitud de salon nueva - ".$fac_rs["clave_dependencia"]." ".$fac_rs["facultad_nombre"];
|
||||
//crear plantilla
|
||||
$texto = "<p>Se creó una solicitud de asignación de salón nueva para: <b>".$fac_rs["clave_dependencia"]." ".$fac_rs["facultad_nombre"]."</b>.</p>";
|
||||
$texto .= "<p>Para el día <b>".$fecha." a las ".$hora." hrs. </b>";
|
||||
if(!$aula_rs["tipoaula_supervisor"]){
|
||||
$texto .= " en el salón: <b>".$salon_desc."</b></p>";
|
||||
}else{
|
||||
$texto .= " en un salón de tipo: <b>".mb_strtoupper($aula_rs["tipoaula_nombre"])."</b></p>";
|
||||
}
|
||||
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
|
||||
$to = join(",", $correosSup_rs);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
$log = new LogActividad();
|
||||
@@ -100,7 +167,6 @@ $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSI
|
||||
|
||||
|
||||
if($to!= "" && ENVIO_CORREOS){
|
||||
$asunto = "Reposición nueva - solicitud";
|
||||
//crear plantilla
|
||||
$texto = '<body >
|
||||
<img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px">
|
||||
|
||||
81
action/asignacion_select.php
Normal file
81
action/asignacion_select.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Obtiene datos de reposición
|
||||
*/
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
// check if the session is started
|
||||
if (!isset($_SESSION['user']))
|
||||
die('No se ha iniciado sesión');
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
|
||||
|
||||
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión
|
||||
/*if(!$objSesion->tieneAcceso()){
|
||||
$return["error"] = "Error! No tienes permisos para realizar esta acción.";
|
||||
}else*/ if(!isset($_POST["id"])){
|
||||
$return["error"] = "Error! No se recibió la información de la reposición.";
|
||||
}else{
|
||||
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
|
||||
|
||||
try{
|
||||
if($user->rol["rol_id"] == 7){//es supervisor
|
||||
$rs = $db->querySingle('SELECT * from fs_asignacion_solicitud(:id, NULL, NULL, :sup, NULL)',
|
||||
[':id' => $id, ':sup'=>$user->user["id"]]
|
||||
);
|
||||
}else{//coordinador
|
||||
$rs = $db->querySingle('SELECT * from fs_asignacion_solicitud(:id, NULL, NULL, NULL, null)',
|
||||
[':id' => $id]
|
||||
);
|
||||
}
|
||||
|
||||
}catch(Exception $e){
|
||||
$return["error"] = "Ocurrió un error al leer los datos de la reposición.";
|
||||
echo json_encode($return);
|
||||
exit();
|
||||
}
|
||||
|
||||
$return["fecha_nueva"] = date('d/m/Y', strtotime($rs["fecha_nueva"]));
|
||||
$hora_nueva = explode(":",$rs["hora_nueva"]);
|
||||
$return["hora_ini"] = $hora_nueva[0];
|
||||
$return["min_ini"] = $hora_nueva[1];
|
||||
$hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]);
|
||||
$return["hora_fin"] = $hora_nueva_fin[0];
|
||||
$return["min_fin"] = $hora_nueva_fin[1];
|
||||
$return["duracion"] = $rs["duracion_total"];
|
||||
|
||||
// $return["carrera"] = $rs["PlanEstudio_desc"];
|
||||
// $return["materia"] = $rs["materia_id"];
|
||||
// $return["materia_desc"] = $rs["materia_nombre"];
|
||||
$return["salon"] = $rs["salon_id"];
|
||||
if($rs["salon_id"]==""){
|
||||
$return["salon_desc"] = "Pendiente";
|
||||
}else{
|
||||
$salon_json = json_decode($rs["salon_array"], true);
|
||||
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
|
||||
unset($salon_json[0]);
|
||||
}
|
||||
$return["salon_desc"] = join(" / ",$salon_json);
|
||||
}
|
||||
|
||||
//$return["salon_desc"] = $rs["salon"]=="" ? "-Pendiente-": $rs["salon"];
|
||||
|
||||
$return["profesor"] = $rs["profesor_id"];
|
||||
$return["profesor_nombre"] = $rs["profesor_nombre"];
|
||||
$return["comentario"] = $rs["descripcion"];
|
||||
$return["alumnos"] = $rs["alumnos"];
|
||||
$return["aula"] = $rs["tipoaula_id"];
|
||||
$return["aula_desc"] = $rs["tipoaula_nombre"];
|
||||
$return["aula_supervisor"] = $rs["tipoaula_supervisor"];
|
||||
$return["dia"] = date('w', strtotime($rs["fecha_nueva"]));
|
||||
$return["motivo_cancelacion"] = $rs["motivo_cancelacion"];
|
||||
$return["estado"] = $rs["estado_reposicion_id"];
|
||||
$return["facultad"] = $rs["facultad_nombre"];
|
||||
$return["supervisor_nombre"] = $rs["supervisor_nombre"];
|
||||
}
|
||||
echo json_encode($return);
|
||||
?>
|
||||
135
action/asignacion_update.php
Normal file
135
action/asignacion_update.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Actualiza reposición
|
||||
*/
|
||||
$pag = "../asignacion_crear.php";
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
define("COORDINADOR", 9);
|
||||
define("ENVIO_CORREOS", true);
|
||||
|
||||
// check if the session is started
|
||||
if (!isset($_SESSION['user']))
|
||||
die('No se ha iniciado sesión');
|
||||
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
|
||||
|
||||
/*if(!isset($_POST["id"]) || !isset($_POST["fecha_falta"]) || !isset($_POST["fecha_inicial"]) || !isset($_POST["hora_ini"]) || !isset($_POST["min_ini"]) || !isset($_POST["materia"]) || !isset($_POST["grupo"])){
|
||||
header("Location: ".$pag."?error=0");
|
||||
exit();
|
||||
}*/
|
||||
|
||||
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
|
||||
$fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//limpia texto
|
||||
$hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
|
||||
|
||||
if(empty($_POST["prof"]))
|
||||
$prof = $user["id"];
|
||||
else
|
||||
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
|
||||
//if(isset($_POST["salon"]) && $_POST["salon"] != "")
|
||||
//$salon = trim(filter_input(INPUT_POST, "salon", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
|
||||
$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto
|
||||
|
||||
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
|
||||
$duracion_tiempo = $duracion_rs["duracion_interval"];
|
||||
|
||||
|
||||
|
||||
$hora = $hora_ini.":".$min_ini.":00";
|
||||
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
|
||||
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
|
||||
$dia_new = date('w', strtotime($fecha_new));
|
||||
|
||||
//echo $fecha_new."<br>";
|
||||
//echo $fecha_fin_new."<br>";
|
||||
$fac_rs = $db->querySingle("SELECT facultad_nombre, clave_dependencia from facultad where facultad_id = :id_fac",[':id_fac' => $user->facultad["facultad_id"]] );
|
||||
|
||||
$salon_desc = "Pendiente";
|
||||
if(!empty($salon)){
|
||||
$salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon',
|
||||
[':id_salon' => $salon]
|
||||
);
|
||||
if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){
|
||||
$salon_desc = "Pendiente";
|
||||
}else{
|
||||
$salon_json = json_decode($salon_rs["salon_array"], true);
|
||||
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
|
||||
unset($salon_json[0]);
|
||||
}
|
||||
$salon_desc = join(" / ",$salon_json);
|
||||
}
|
||||
}
|
||||
|
||||
//Obtiene correos
|
||||
$correos_rs = $db->query('SELECT coor.usuario_correo as coordinador_correo
|
||||
from reposicion_solicitud rs
|
||||
inner join profesor p on rs.profesor_id =p.profesor_id
|
||||
inner join usuario u on u.usuario_id = rs.usuario_id
|
||||
inner join horario_view hv on hv.horario_id = rs.horario_id
|
||||
inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord
|
||||
where hv.facultad_id = :id_fac',
|
||||
[':rol_coord' => COORDINADOR, ':id_fac' => $user->facultad["facultad_id"]]
|
||||
);
|
||||
$coord_correos=[];
|
||||
foreach($correos_rs as $correo){
|
||||
if( count($coord_correos)==0 && $correo["coordinador_correo"]!=""){
|
||||
if(!isset($coord_correos["correo"]) || !in_array($correo["coordinador_correo"], $coord_correos["correo"])){
|
||||
array_push($coord_correos, $correo["coordinador_correo"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo as coordinador_correo
|
||||
FROM horario_supervisor hs
|
||||
inner join usuario sup on sup.usuario_id =hs.usuario_id
|
||||
where :id_fac = ANY(hs.facultad_id_array)
|
||||
and sup.usuario_correo is not null and sup.usuario_correo != ''",
|
||||
[':id_fac' => $user->facultad["facultad_id"]] );
|
||||
|
||||
|
||||
//Valida que profesor no este en 2 reposiciones al mismo tiempo
|
||||
$traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur, :id)',
|
||||
[':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo, ':id'=>$id]
|
||||
)["traslape_profesor_reposicion"];
|
||||
echo "SELECT * from traslape_profesor_reposicion($prof, '".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."', $hora, $duracion_tiempo, $id)";
|
||||
if($traslape){
|
||||
//header("Location:".$pag."?error=9");
|
||||
echo "traslape";
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
$log = new LogActividad();
|
||||
$desc_log = "Actualiza reposición ID[".$id."] Fechas[".$fecha_ini."][".$fecha_fin."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."]";
|
||||
$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
|
||||
|
||||
try{
|
||||
$db->query('SELECT * from fu_asignacion_solicitud(:id, :f_nueva, :hora_nueva, NULL, NULL, :desc, :alumnos, :aula, :duracion, NULL)',
|
||||
[':id'=> $id, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora,
|
||||
':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo
|
||||
]
|
||||
);
|
||||
}catch(Exception $e){
|
||||
//header("Location: ".$pag."?error=2");
|
||||
print_r($e->getMessage());
|
||||
echo "SELECT * from fu_asignacion_solicitud(:id, :f_nueva, :hora_nueva, NULL, NULL, :desc, :alumnos, :aula, :duracion, NULL)'";
|
||||
print_r(
|
||||
[':id'=> $id, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora,
|
||||
':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo
|
||||
]);
|
||||
exit();
|
||||
}
|
||||
header("Location: ".$pag);
|
||||
exit();
|
||||
?>
|
||||
46
action/horario_profesor.php
Normal file
46
action/horario_profesor.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once "{$_SERVER['DOCUMENT_ROOT']}/class/c_login.php";
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if (!Login::is_logged()) {
|
||||
header('HTTP/1.1 401 Unauthorized');
|
||||
echo json_encode(['error' => 'No se ha iniciado sesión']);
|
||||
exit();
|
||||
}
|
||||
$user = Login::get_user();
|
||||
|
||||
try {
|
||||
switch ($_SERVER['REQUEST_METHOD']) {
|
||||
case 'GET':
|
||||
$profesor_id = $db
|
||||
->where('profesor_clave', $_GET['profesor'])
|
||||
->getOne('profesor', 'profesor_id');
|
||||
// Fetch all puestos
|
||||
$horarios = $db->query(<<<SQL
|
||||
SELECT * FROM horario
|
||||
|
||||
NATURAL JOIN horario_profesor
|
||||
NATURAL JOIN facultad
|
||||
NATURAL LEFT JOIN materia
|
||||
NATURAL LEFT JOIN carrera
|
||||
|
||||
WHERE periodo_id = ? AND profesor_id = ?
|
||||
SQL,
|
||||
[$user->periodo_id, $profesor_id['profesor_id']]
|
||||
);
|
||||
|
||||
echo json_encode($horarios);
|
||||
break;
|
||||
default:
|
||||
header('HTTP/1.1 405 Method Not Allowed');
|
||||
echo json_encode(['error' => 'Método no permitido']);
|
||||
break;
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo json_encode([
|
||||
'error' => $e->getMessage(),
|
||||
'query' => $db->getLastQuery(),
|
||||
'exception' => $e->getTraceAsString()
|
||||
]);
|
||||
}
|
||||
7
action/mail_javier.php
Normal file
7
action/mail_javier.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
require_once "../class/c_login.php";
|
||||
require_once "../class/mailer.php";
|
||||
require_once('../include/phpmailer/PHPMailerAutoload.php');
|
||||
|
||||
Mailer::enviarCorreo("javier.garrido@lasalle.mx", "Prueba de correo", "Este es un correo de prueba", "", true);
|
||||
echo "Correo enviado";
|
||||
@@ -27,47 +27,77 @@ if(!isset($_POST["id"]) || !isset($_POST["edo"]) ){
|
||||
|
||||
$id_repo = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$edo = filter_input(INPUT_POST, "edo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
if(isset($_POST["salon"]) && $_POST["salon"] != "")
|
||||
$salon = filter_input(INPUT_POST, "salon", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
//--------------
|
||||
|
||||
//--------------
|
||||
//Obtiene datos reposición
|
||||
$reposicion_rs = $db->querySingle('SELECT h.materia, r.fecha_nueva, r.hora_nueva, r.fecha_clase, h.horario_hora, h.facultad_id, h.facultad, f.clave_dependencia, r.motivo_cancelacion, ta.tipoaula_supervisor , ta.tipoaula_nombre
|
||||
from reposicion_solicitud r
|
||||
inner join horario_view h on h.horario_id = r.horario_id
|
||||
inner join facultad f on f.facultad_id = h.facultad_id
|
||||
inner join tipoaula ta on ta.tipoaula_id = r.tipoaula_id
|
||||
where r.reposicion_solicitud_id = :id_repo',
|
||||
[':id_repo' => $id_repo]
|
||||
);
|
||||
|
||||
//Obtiene datos de salón asignado
|
||||
$salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon',
|
||||
[':id_salon' => $salon]
|
||||
);
|
||||
if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){
|
||||
$salon_desc = "Pendiente";
|
||||
}else{
|
||||
$salon_json = json_decode($salon_rs["salon_array"], true);
|
||||
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
|
||||
unset($salon_json[0]);
|
||||
$salon_desc = "Pendiente";
|
||||
if(!empty($salon)){
|
||||
$salon_rs = $db->querySingle('SELECT s.salon_id, s.salon_array FROM salon_view s where s.salon_id = :id_salon',
|
||||
[':id_salon' => $salon]
|
||||
);
|
||||
if($salon_rs["salon_id"] == "" || $salon_rs["salon_id"] == NULL){
|
||||
$salon_desc = "Pendiente";
|
||||
}else{
|
||||
$salon_json = json_decode($salon_rs["salon_array"], true);
|
||||
if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
|
||||
unset($salon_json[0]);
|
||||
}
|
||||
$salon_desc = join(" / ",$salon_json);
|
||||
}
|
||||
$salon_desc = join(" / ",$salon_json);
|
||||
}
|
||||
|
||||
//Obtiene correos
|
||||
$correos_rs = $db->query('SELECT p.profesor_nombre, p.profesor_correo, u.usuario_nombre as jefe_nombre, u.usuario_correo as jefe_correo,
|
||||
coor.usuario_nombre as coordinador_nombre, coor.usuario_correo as coordinador_correo
|
||||
from reposicion_solicitud rs
|
||||
inner join profesor p on rs.profesor_id =p.profesor_id
|
||||
inner join usuario u on u.usuario_id = rs.usuario_id
|
||||
inner join horario_view hv on hv.horario_id = rs.horario_id
|
||||
inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord
|
||||
where rs.reposicion_solicitud_id = :id_repo',
|
||||
[':rol_coord' => COORDINADOR, ':id_repo' => $id_repo]
|
||||
);
|
||||
//print_r($correos_rs); exit();
|
||||
|
||||
if($tipo ==1 || $tipo == 2){
|
||||
//--------------
|
||||
//Obtiene datos reposición
|
||||
$reposicion_rs = $db->querySingle('SELECT h.materia, r.fecha_nueva, r.hora_nueva, r.fecha_clase, r.descripcion, h.horario_hora, h.facultad_id, h.facultad, f.clave_dependencia, r.motivo_cancelacion, ta.tipoaula_supervisor , ta.tipoaula_nombre
|
||||
from reposicion_solicitud r
|
||||
inner join horario_view h on h.horario_id = r.horario_id
|
||||
inner join facultad f on f.facultad_id = h.facultad_id
|
||||
inner join tipoaula ta on ta.tipoaula_id = r.tipoaula_id
|
||||
where r.reposicion_solicitud_id = :id_repo',
|
||||
[':id_repo' => $id_repo]
|
||||
);
|
||||
|
||||
//Obtiene correos
|
||||
$correos_rs = $db->query('SELECT p.profesor_nombre, p.profesor_correo, u.usuario_nombre as jefe_nombre, u.usuario_correo as jefe_correo,
|
||||
coor.usuario_nombre as coordinador_nombre, coor.usuario_correo as coordinador_correo
|
||||
from reposicion_solicitud rs
|
||||
inner join profesor p on rs.profesor_id =p.profesor_id
|
||||
inner join usuario u on u.usuario_id = rs.usuario_id
|
||||
inner join horario_view hv on hv.horario_id = rs.horario_id
|
||||
inner join usuario coor on hv.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord
|
||||
where rs.reposicion_solicitud_id = :id_repo',
|
||||
[':rol_coord' => COORDINADOR, ':id_repo' => $id_repo]
|
||||
);
|
||||
//print_r($correos_rs); exit();
|
||||
}else{
|
||||
//Obtiene datos asignación
|
||||
$reposicion_rs = $db->querySingle('SELECT r.fecha_nueva, r.hora_nueva, r.descripcion, f.facultad_id, f.facultad_nombre as facultad, f.clave_dependencia, r.motivo_cancelacion, ta.tipoaula_supervisor , ta.tipoaula_nombre, p.profesor_nombre
|
||||
from asignacion_solicitud r
|
||||
inner join usuario u on u.usuario_id = r.usuario_id
|
||||
inner join facultad f on f.facultad_id = u.facultad_id
|
||||
inner join tipoaula ta on ta.tipoaula_id = r.tipoaula_id
|
||||
inner join profesor p on p.profesor_id = r.profesor_id
|
||||
where r.asignacion_solicitud_id = :id_repo',
|
||||
[':id_repo' => $id_repo]
|
||||
);
|
||||
|
||||
//Obtiene correos
|
||||
$correos_rs = $db->query('SELECT p.profesor_nombre, p.profesor_correo, NULL as jefe_nombre, NULL as jefe_correo,
|
||||
coor.usuario_nombre as coordinador_nombre, coor.usuario_correo as coordinador_correo
|
||||
from asignacion_solicitud rs
|
||||
inner join profesor p on rs.profesor_id =p.profesor_id
|
||||
inner join usuario u on u.usuario_id = rs.usuario_id
|
||||
inner join usuario coor on u.facultad_id = coor.facultad_id and coor.rol_id = :rol_coord
|
||||
where rs.asignacion_solicitud_id = :id_repo',
|
||||
[':rol_coord' => COORDINADOR, ':id_repo' => $id_repo]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$prof_correos=array();
|
||||
$jefe_correos=[];
|
||||
@@ -91,74 +121,150 @@ foreach($correos_rs as $correo){
|
||||
}
|
||||
}
|
||||
|
||||
$correosSup_rs = $db->querySingle("SELECT DISTINCT sup.usuario_correo as coordinador_correo
|
||||
$correosSup_rs = $db->query("SELECT DISTINCT sup.usuario_correo as supervisor_correo
|
||||
FROM horario_supervisor hs
|
||||
inner join usuario sup on sup.usuario_id =hs.usuario_id
|
||||
where :facultad = ANY(hs.facultad_id_array)
|
||||
and hs.turno_inicio <= :hora and hs.turno_fin >= :hora",
|
||||
[':facultad'=>$reposicion_rs["facultad_id"], ':hora'=>$reposicion_rs["hora_nueva"]] );
|
||||
where :facultad = ANY(hs.facultad_id_array)",
|
||||
[':facultad'=>$reposicion_rs["facultad_id"]] );
|
||||
|
||||
$sup_correos=[];
|
||||
foreach($correosSup_rs as $correo){
|
||||
array_push($sup_correos, $correo["supervisor_correo"]);
|
||||
}
|
||||
|
||||
|
||||
if($edo == 4){//cancelación
|
||||
$motivo = "";
|
||||
if(isset($_POST["motivo"]) && $_POST["motivo"] != "")
|
||||
$motivo = trim($_POST["motivo"]);
|
||||
$db->querySingle('SELECT fu_reposicion_cancela(:id, :motivo)',
|
||||
[':id' => $id_repo, ':motivo' => $motivo]
|
||||
);
|
||||
}else{
|
||||
if(!empty($salon)){
|
||||
$db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, :sal, :edo, NULL, NULL, NULL, NULL)',
|
||||
[':id' => $id_repo, ':sal' => $salon, ':edo' => $edo]
|
||||
if($tipo ==1 || $tipo == 2){
|
||||
if($edo == 4){//cancelación
|
||||
$motivo = "";
|
||||
if(isset($_POST["motivo"]) && $_POST["motivo"] != "")
|
||||
$motivo = trim($_POST["motivo"]);
|
||||
$db->querySingle('SELECT fu_reposicion_cancela(:id, :motivo)',
|
||||
[':id' => $id_repo, ':motivo' => $motivo]
|
||||
);
|
||||
}else{
|
||||
$db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL)',
|
||||
[':id' => $id_repo, ':edo' => $edo]
|
||||
if(!empty($salon)){
|
||||
$db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, :sal, :edo, NULL, NULL, NULL, NULL)',
|
||||
[':id' => $id_repo, ':sal' => $salon, ':edo' => $edo]
|
||||
);
|
||||
}else{
|
||||
$db->querySingle('SELECT fu_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL)',
|
||||
[':id' => $id_repo, ':edo' => $edo]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$fecha_clase = date('d/m/Y', strtotime($reposicion_rs["fecha_clase"]));
|
||||
$fecha_nueva = date('d/m/Y', strtotime($reposicion_rs["fecha_nueva"]));
|
||||
$hora_tmp = explode(":",$reposicion_rs["horario_hora"]);
|
||||
$hora_clase = $hora_tmp[0].":".$hora_tmp[1];
|
||||
$hora_tmp = explode(":",$reposicion_rs["hora_nueva"]);
|
||||
$hora_nueva = $hora_tmp[0].":".$hora_tmp[1];
|
||||
|
||||
$asunto = "";
|
||||
$texto = "";
|
||||
$to = "";
|
||||
switch($edo){
|
||||
case 2://Correo a supervisor
|
||||
$asunto = "Reposición nueva - ".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"];
|
||||
//crear plantilla
|
||||
$texto = "<p>Se creó una reposición nueva para: <b>".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"]."</b>.</p>";
|
||||
$texto .= "<p><b>".mb_strtoupper($reposicion_rs["materia"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b>";
|
||||
if(!$reposicion_rs["tipoaula_supervisor"]){
|
||||
$texto .= " en el salón: <b>".$salon_desc."</b></p>";
|
||||
}else{
|
||||
$texto .= " en un salón de tipo: <b>".$reposicion_rs["tipoaula_nombre"]."</b></p>";
|
||||
}
|
||||
$texto .= "<p style='font-style:italic; padding-left:25px'>".$reposicion_rs["descripcion"]."</p>";
|
||||
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
|
||||
$to = join(",", $sup_correos);
|
||||
$ok = 0;
|
||||
break;
|
||||
case 3://Correo a coordinador, profesor y jefe
|
||||
$asunto = "Reposición autorizada - ".$reposicion_rs["materia"];
|
||||
$texto = "<p>La resposición de la clase de <b>".$reposicion_rs["materia"]."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. </b> está autorizada para realizarse el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en: $salon_desc</b></p>";
|
||||
$to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
|
||||
$ok = 0;
|
||||
$db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)',
|
||||
[':id' => $id_repo, ':sup'=>$user->user["id"]]
|
||||
);
|
||||
break;
|
||||
case 4://Correo a coordinador, profesor y jefe
|
||||
$asunto = "Reposición declinada - ".$reposicion_rs["materia"];
|
||||
$texto = "<p>La resposición de la clase de <b>".$reposicion_rs["materia"]." planeada para el día ".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo:</p>";
|
||||
$texto .= "<p style='font-style:italic; padding-left:25px'>".$motivo."</p>";
|
||||
$to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
|
||||
$ok = 1;
|
||||
$db->querySingle('SELECT fu_reposicion_solicitud_supervisor(:id, :sup)',
|
||||
[':id' => $id_repo, ':sup'=>$user->user["id"]]
|
||||
);
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
if($edo == 4){//cancelación
|
||||
$motivo = "";
|
||||
if(isset($_POST["motivo"]) && $_POST["motivo"] != "")
|
||||
$motivo = trim($_POST["motivo"]);
|
||||
$db->querySingle('SELECT fu_asignacion_cancela(:id, :motivo)',
|
||||
[':id' => $id_repo, ':motivo' => $motivo]
|
||||
);
|
||||
}else{
|
||||
if(!empty($salon)){
|
||||
$db->querySingle('SELECT fu_asignacion_solicitud(:id, NULL, NULL, :sal, :edo, NULL, NULL, NULL, NULL, NULL)',
|
||||
[':id' => $id_repo, ':sal' => $salon, ':edo' => $edo]
|
||||
);
|
||||
}else{
|
||||
$db->querySingle('SELECT fu_asignacion_solicitud(:id, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL, NULL)',
|
||||
[':id' => $id_repo, ':edo' => $edo]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$fecha_nueva = date('d/m/Y', strtotime($reposicion_rs["fecha_nueva"]));
|
||||
$hora_tmp = explode(":",$reposicion_rs["hora_nueva"]);
|
||||
$hora_nueva = $hora_tmp[0].":".$hora_tmp[1];
|
||||
|
||||
$asunto = "";
|
||||
$texto = "";
|
||||
$to = "";
|
||||
switch($edo){
|
||||
case 2://Correo a supervisor
|
||||
$asunto = "Asignación nueva - ".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"];
|
||||
//crear plantilla
|
||||
$texto = "<p>Se creó una solicitud de asignación nueva para: <b>".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"]."</b>.</p>";
|
||||
$texto .= "<p>Se solicita el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b> para el profesor: <b>".$reposicion_rs["profesor_nombre"]."</b>.";
|
||||
if(!$reposicion_rs["tipoaula_supervisor"]){
|
||||
$texto .= " en el salón: <b>".$salon_desc."</b></p>";
|
||||
}else{
|
||||
$texto .= " en un salón de tipo: <b>".$reposicion_rs["tipoaula_nombre"]."</b></p>";
|
||||
}
|
||||
$texto .= "<p style='font-style:italic; padding-left:25px'>".$reposicion_rs["descripcion"]."</p>";
|
||||
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
|
||||
$to = join(",", $sup_correos);
|
||||
$ok = 0;
|
||||
break;
|
||||
case 3://Correo a coordinador, profesor y jefe
|
||||
$asunto = "Asignación autorizada - ".$reposicion_rs["profesor_nombre"];
|
||||
$texto = "<p>La asignación de espacio para el profesor <b>".$reposicion_rs["profesor_nombre"]."</b> está autorizada para realizarse el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en: $salon_desc</b></p>";
|
||||
$to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
|
||||
$ok = 0;
|
||||
$db->querySingle('SELECT fu_asignacion_solicitud_supervisor(:id, :sup)',
|
||||
[':id' => $id_repo, ':sup'=>$user->user["id"]]
|
||||
);
|
||||
break;
|
||||
case 4://Correo a coordinador, profesor y jefe
|
||||
$asunto = "Asignación declinada - ".$reposicion_rs["profesor_nombre"];
|
||||
$texto = "<p>La asignación de espacio para el profesor <b>".$reposicion_rs["profesor_nombre"]."</b> planeada para el día ".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo:</p>";
|
||||
$texto .= "<p style='font-style:italic; padding-left:25px'>".$motivo."</p>";
|
||||
$to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
|
||||
$ok = 1;
|
||||
$db->querySingle('SELECT fu_asignacion_solicitud_supervisor(:id, :sup)',
|
||||
[':id' => $id_repo, ':sup'=>$user->user["id"]]
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$fecha_clase = date('d/m/Y', strtotime($reposicion_rs["fecha_clase"]));
|
||||
$fecha_nueva = date('d/m/Y', strtotime($reposicion_rs["fecha_nueva"]));
|
||||
$hora_tmp = explode(":",$reposicion_rs["horario_hora"]);
|
||||
$hora_clase = $hora_tmp[0].":".$hora_tmp[1];
|
||||
$hora_tmp = explode(":",$reposicion_rs["hora_nueva"]);
|
||||
$hora_nueva = $hora_tmp[0].":".$hora_tmp[1];
|
||||
|
||||
$asunto = "";
|
||||
$texto = "";
|
||||
$to = "";
|
||||
switch($edo){
|
||||
case 2://Correo a supervisor
|
||||
$asunto = "Reposición nueva - ".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"];
|
||||
//crear plantilla
|
||||
$texto = "<p>Se creó una reposición nueva para: <b>".$reposicion_rs["clave_dependencia"]." ".$reposicion_rs["facultad"]."</b>.</p>";
|
||||
$texto .= "<p><b>".mb_strtoupper($reposicion_rs["materia"])."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. </b> se propone reponer el <b>".$fecha_nueva." a las ".$hora_nueva." hrs.</b>";
|
||||
if(!$reposicion_rs["tipoaula_supervisor"]){
|
||||
$texto .= " en el salón: <b>".$salon_desc."</b></p>";
|
||||
}else{
|
||||
$texto .= " en un salón de tipo: <b>".$reposicion_rs["tipoaula_nombre"]."</b></p>";
|
||||
}
|
||||
$texto .= "<p>Ingresa al <a href='https://paad.lci.ulsa.mx'>sistema PAAD</a> para autorizarla.</p>";
|
||||
$to = join(",", $correosSup_rs);
|
||||
$ok = 0;
|
||||
break;
|
||||
case 3://Correo a coordinador, profesor y jefe
|
||||
$asunto = "Reposición autorizada - ".$reposicion_rs["materia"];
|
||||
$texto = "<p>La resposición de la clase de <b>".$reposicion_rs["materia"]."</b> del día <b>".$fecha_clase." a las ".$hora_clase." hrs. </b> está autorizada para realizarse el día <b>".$fecha_nueva." a las ".$hora_nueva." hrs. en: $salon_desc</b></p>";
|
||||
$to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
|
||||
$ok = 0;
|
||||
break;
|
||||
case 4://Correo a coordinador, profesor y jefe
|
||||
$asunto = "Reposición declinada - ".$reposicion_rs["materia"];
|
||||
$texto = "<p>La resposición de la clase de <b>".$reposicion_rs["materia"]." planeada para el día ".$fecha_nueva." a las ".$hora_nueva." hrs.</b> ha sido declinada por el siguiente motivo:</p>";
|
||||
$texto .= "<p style='font-style:italic; padding-left:25px'>".$motivo."</p>";
|
||||
$to = join(",", $coord_correos).",".join(",", $prof_correos).",".join(",", $jefe_correos);
|
||||
$ok = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if($to!= "" && ENVIO_CORREOS){
|
||||
$texto = '<body >
|
||||
<img src="https://paad.lci.ulsa.mx/imagenes/logo_lasalle.png" alt="La Salle" style="margin-bottom:60px">
|
||||
@@ -166,13 +272,12 @@ if($to!= "" && ENVIO_CORREOS){
|
||||
</body>';
|
||||
|
||||
require_once('../include/phpmailer/PHPMailerAutoload.php');
|
||||
/*if($_ENV['DB_NAME'] == "paad_pruebas"){
|
||||
if($_ENV['DB_NAME'] == "paad_pruebas"){
|
||||
$asunto = "PRUEBAS-".$asunto;
|
||||
Mailer::enviarCorreo("alejandro.lara@lasalle.mx", $asunto, $texto, true);
|
||||
}else{
|
||||
Mailer::enviarCorreo($to, $asunto, $texto, true);
|
||||
}*/
|
||||
Mailer::enviarCorreo("alejandro.rosales@lasalle.mx", $asunto, $texto, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -20,15 +20,16 @@ $user = unserialize($_SESSION['user']);
|
||||
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//Id reposicion
|
||||
$bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);//
|
||||
$ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);//
|
||||
$fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//limpia texto
|
||||
$fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//limpia texto fecha de reposicion
|
||||
$fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//limpia texto
|
||||
$fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//Reposicion
|
||||
$fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//Reposicion
|
||||
$fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//Cambio salón
|
||||
$hora_ini = filter_input(INPUT_POST, "hora_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto hora reposicion
|
||||
$min_ini = filter_input(INPUT_POST, "min_ini", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$hor = filter_input(INPUT_POST, "horario", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$alumnos = filter_input(INPUT_POST, "alumnos", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
$tipo = filter_input(INPUT_POST, "tipo", FILTER_SANITIZE_NUMBER_INT);//1 Repo , 0 Cambio
|
||||
$aula = filter_input(INPUT_POST, "aula", FILTER_SANITIZE_NUMBER_INT);//1 regular , 2 sala computo, 3 otro facultad
|
||||
$salon = NULL;
|
||||
|
||||
if(!$user->jefe_carrera){//coordinador
|
||||
if(isset($_POST["salon"]) && $_POST["salon"] != "")
|
||||
@@ -36,7 +37,7 @@ if(!$user->jefe_carrera){//coordinador
|
||||
}
|
||||
|
||||
if(empty($_POST["prof"]))
|
||||
$prof = $user["id"];
|
||||
$prof = $user->user["id"];
|
||||
else
|
||||
$prof = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
|
||||
@@ -56,11 +57,13 @@ $materia = $horario_rs["materia_id"];
|
||||
$dia = $horario_rs["horario_dia"];
|
||||
|
||||
$hora = $hora_ini.":".$min_ini.":00";
|
||||
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
|
||||
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
|
||||
$dia_new = date('w', strtotime($fecha_new));
|
||||
|
||||
|
||||
if($tipo == 1){//Reposición
|
||||
$fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
|
||||
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
|
||||
$dia_new = date('w', strtotime($fecha_new));
|
||||
|
||||
$fecha_falta = DateTime::createFromFormat('d/m/Y', $fecha_falta)->format('Y-m-d');
|
||||
$dia_falta = date('w', strtotime($fecha_falta));
|
||||
}else{
|
||||
@@ -131,7 +134,7 @@ if($tipo == 1){//Reposición
|
||||
}
|
||||
}catch(Exception $e){
|
||||
|
||||
echo $e->getMessage();
|
||||
echo "ERROR Reposición<br>".$e->getMessage();
|
||||
//header("Location: ".$pag."?error=1");
|
||||
exit();
|
||||
}
|
||||
@@ -151,23 +154,23 @@ if($tipo == 1){//Reposición
|
||||
|
||||
try{
|
||||
if($user->jefe_carrera){//jefe
|
||||
$db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo)',
|
||||
[':f_falta' => $fecha_falta, ':f_nueva' => $fecha_cambio, ':hora_nueva' => $hora, ':hor' => $hor,
|
||||
$db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, false, :aula, :duracion, :usr, :bloque, :ciclo)',
|
||||
[':f_falta' => $fecha_cambio, ':f_nueva' => $fecha_cambio, ':hora_nueva' => $hora, ':hor' => $hor,
|
||||
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"],
|
||||
':bloque' => $bloque, ':ciclo' => $ciclo
|
||||
]
|
||||
);
|
||||
}else{//coordinador
|
||||
$db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 2, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo, :salon)',
|
||||
[':f_falta' => $fecha_falta, ':f_nueva' => $fecha_cambio, ':hora_nueva' => $hora, ':hor' => $hor,
|
||||
$db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 2, :desc, :alumnos, false, :aula, :duracion, :usr, :bloque, :ciclo, :salon)',
|
||||
[':f_falta' => $fecha_cambio, ':f_nueva' => $fecha_cambio, ':hora_nueva' => $hora, ':hor' => $hor,
|
||||
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_tiempo, ':usr'=>$user->user["id"],
|
||||
':bloque' => $bloque, ':ciclo' => $ciclo, ':salon'=>$salon
|
||||
]
|
||||
);
|
||||
}
|
||||
}catch(Exception $e){
|
||||
|
||||
header("Location: ".$pag."?error=1");
|
||||
echo "ERROR Cambio<br>".$e->getMessage();
|
||||
//header("Location: ".$pag."?error=1");
|
||||
exit();
|
||||
}
|
||||
$texto = "<p>Se creó un cambio de salón nuevo.</p>";
|
||||
@@ -191,13 +194,13 @@ if($to!= "" && ENVIO_CORREOS){
|
||||
</body>';
|
||||
|
||||
require_once('../include/phpmailer/PHPMailerAutoload.php');
|
||||
/*if($_ENV['DB_NAME'] == "paad_pruebas"){
|
||||
if($_ENV['DB_NAME'] == "paad_pruebas"){
|
||||
$asunto = "PRUEBAS-".$asunto;
|
||||
Mailer::enviarCorreo("alejandro.lara@lasalle.mx", $asunto, $texto, true);
|
||||
}else{
|
||||
Mailer::enviarCorreo($to, $asunto, $texto, true);
|
||||
}*/
|
||||
Mailer::enviarCorreo("alejandro.rosales@lasalle.mx", $asunto, $texto, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
header("Location: ".$pag."?ok=0");
|
||||
|
||||
@@ -80,6 +80,9 @@ $user = unserialize($_SESSION['user']);
|
||||
$return["motivo_cancelacion"] = $rs["motivo_cancelacion"];
|
||||
$return["estado"] = $rs["estado_reposicion_id"];
|
||||
$return["facultad"] = $rs["facultad_nombre"];
|
||||
$return["carrera"] = $rs["carrera_nombre"];
|
||||
$return["grupo"] = $rs["horario_grupo"];
|
||||
$return["supervisor_nombre"] = $rs["supervisor_nombre"];
|
||||
}
|
||||
echo json_encode($return);
|
||||
?>
|
||||
|
||||
@@ -5,7 +5,7 @@ require_once "../class/c_login.php";
|
||||
|
||||
$universidad_la_salle = $db
|
||||
->where('salon', 'UNIVERSIDAD LA SALLE', 'ILIKE')
|
||||
->getOne('salon_view');
|
||||
->getOne('salon_view_mat');
|
||||
|
||||
$rutas =
|
||||
array_map(
|
||||
@@ -14,14 +14,14 @@ $rutas =
|
||||
$db
|
||||
->where('id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->orderBy('salon')
|
||||
->get('salon_view');
|
||||
->get('salon_view_mat');
|
||||
return $ruta;
|
||||
|
||||
},
|
||||
$db
|
||||
->where('id_espacio_padre', $universidad_la_salle['id_espacio_sgu'])
|
||||
->orderBy('salon')
|
||||
->get('salon_view')
|
||||
->get('salon_view_mat')
|
||||
);
|
||||
|
||||
// echo json_encode($universidad_la_salle, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); EXIT;
|
||||
|
||||
@@ -31,7 +31,7 @@ try {
|
||||
$data = $db
|
||||
->where('tiene_salones')
|
||||
->where("{$_GET['id_espacio_sgu']} = ANY(id_espacio_sgu_array)")
|
||||
->get('salon_view', columns: 'id_espacio_sgu, salon, salon_id, salon_array');
|
||||
->get('salon_view_mat', columns: 'id_espacio_sgu, salon, salon_id, salon_array');
|
||||
|
||||
$columns = [
|
||||
// horario
|
||||
@@ -61,47 +61,51 @@ try {
|
||||
'reposicion_hora_fin',
|
||||
'salon_reposicion.salon as reposicion_salon',
|
||||
];
|
||||
$fecha = ($_GET['fecha'] != 'null') ? ("'{$_GET['fecha']}'" ?: 'CURRENT_DATE') : 'CURRENT_DATE';
|
||||
$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')
|
||||
->join('reposicion', 'reposicion.reposicion_id = registro.reposicion_id', 'LEFT')
|
||||
->join('salon as salon_reposicion', 'salon_reposicion.salon_id = reposicion.salon_id', '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('salon_view.id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->orderBy('horario_hora')
|
||||
->orderBy('salon_view.salon')
|
||||
->get(
|
||||
'horario_view',
|
||||
columns: $columns
|
||||
),
|
||||
'horarios' => $db->query(
|
||||
"SELECT " . implode(', ', $columns) . <<<SQL
|
||||
FROM horario_view
|
||||
NATURAL JOIN periodo
|
||||
JOIN bloque_horario ON (bloque_horario.hora_inicio, bloque_horario.hora_fin) OVERLAPS (horario_view.horario_hora, horario_view.horario_hora + horario_view.duracion)
|
||||
NATURAL JOIN salon_view_mat
|
||||
NATURAL JOIN horario_profesor
|
||||
NATURAL JOIN profesor
|
||||
LEFT JOIN registro ON (registro.profesor_id, registro.horario_id, registro.registro_fecha_ideal) = (profesor.profesor_id, horario_view.horario_id, $fecha::DATE)
|
||||
NATURAL LEFT JOIN reposicion
|
||||
LEFT JOIN salon AS salon_reposicion ON salon_reposicion.salon_id = reposicion.salon_id
|
||||
WHERE $fecha::DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin
|
||||
AND horario_dia = EXTRACT(DOW FROM $fecha::DATE)
|
||||
AND bloque_horario.id = :bloque_horario_id
|
||||
AND salon_view_mat.id_espacio_padre = :id_espacio_sgu
|
||||
ORDER BY horario_hora, salon_view_mat.salon;
|
||||
SQL,
|
||||
[
|
||||
'bloque_horario_id' => $_GET['bloque_horario_id'],
|
||||
'id_espacio_sgu' => $ruta['id_espacio_sgu'],
|
||||
]
|
||||
),
|
||||
// 'query' => $db->getLastQuery(),
|
||||
'reposiciones' => $db->query(
|
||||
'SELECT ' . implode(', ', $columns) . <<<SQL
|
||||
, reposicion_hora + horario_view.duracion as reposicion_fin
|
||||
, reposicion_hora + horario_view.duracion as reposicion_fin, registro_fecha_ideal
|
||||
FROM horario_view
|
||||
JOIN periodo USING (periodo_id)
|
||||
JOIN registro USING (horario_id)
|
||||
JOIN reposicion USING (reposicion_id)
|
||||
NATURAL JOIN periodo
|
||||
NATURAL JOIN registro
|
||||
NATURAL JOIN reposicion
|
||||
JOIN bloque_horario ON (bloque_horario.hora_inicio, bloque_horario.hora_fin) OVERLAPS (reposicion_hora, reposicion_hora + horario_view.duracion)
|
||||
JOIN profesor USING (profesor_id)
|
||||
JOIN salon_view as salon_reposicion ON (salon_reposicion.salon_id = reposicion.salon_id)
|
||||
NATURAL JOIN profesor
|
||||
JOIN salon_view_mat as salon_reposicion ON (salon_reposicion.salon_id = reposicion.salon_id)
|
||||
WHERE
|
||||
CURRENT_DATE BETWEEN periodo.periodo_fecha_inicio
|
||||
$fecha::DATE BETWEEN periodo.periodo_fecha_inicio
|
||||
AND periodo.periodo_fecha_fin
|
||||
AND reposicion_fecha = CURRENT_DATE
|
||||
AND reposicion_fecha = $fecha::DATE
|
||||
AND bloque_horario.id = :bloque_horario_id
|
||||
AND salon_reposicion.id_espacio_padre = :id_espacio_sgu
|
||||
ORDER BY reposicion_hora
|
||||
SQL,
|
||||
SQL,
|
||||
[
|
||||
'bloque_horario_id' => $_GET['bloque_horario_id'],
|
||||
'id_espacio_sgu' => $ruta['id_espacio_sgu'],
|
||||
|
||||
@@ -3,21 +3,9 @@ $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'];
|
||||
}
|
||||
$nombre = $_POST['nombre'] ?: null;
|
||||
$clave = $_POST['clave'] ?: null;
|
||||
$facultad = $_POST['facultad'] ?: null;
|
||||
|
||||
echo json_encode($db->query("SELECT * FROM fs_profesores(:nombre, :clave, :facultad) ORDER BY profesor_nombre", [':nombre' => $nombre, ':clave' => $clave, ':facultad' => $facultad]));
|
||||
?>
|
||||
Reference in New Issue
Block a user