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