All
This commit is contained in:
@@ -7,7 +7,16 @@ $ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
// check if the session is started
|
||||
$user = Login::get_user();
|
||||
if (!isset($_SESSION['user']))
|
||||
die('No se ha iniciado sesión');
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
//$user->access();
|
||||
|
||||
$duracion_id = filter_input(INPUT_POST, "duracion", FILTER_SANITIZE_NUMBER_INT);//1 Repo , 0 Cambio
|
||||
$bloque = filter_input(INPUT_POST, "bloque", FILTER_SANITIZE_NUMBER_INT);//1 Repo , 0 Cambio
|
||||
$ciclo = filter_input(INPUT_POST, "ciclo", FILTER_SANITIZE_NUMBER_INT);//1 Repo , 0 Cambio
|
||||
$fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//limpia texto
|
||||
$fecha_falta = trim(htmlspecialchars($_POST["fecha_falta"], ENT_QUOTES, "UTF-8"));//limpia texto
|
||||
$fecha = trim(htmlspecialchars($_POST["fecha_inicial"], ENT_QUOTES, "UTF-8"));//limpia texto
|
||||
$fecha_cambio = trim(htmlspecialchars($_POST["fecha_cambio"], ENT_QUOTES, "UTF-8"));//limpia texto
|
||||
@@ -26,19 +35,21 @@ 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
|
||||
|
||||
|
||||
$duracion_rs = $db->querySingle("select * from duracion where duracion_id = :id", [":id"=>$duracion_id]);
|
||||
$duracion_tiempo = $duracion_rs["duracion_interval"];
|
||||
|
||||
//-- Obtiene datos de horario regular de clase
|
||||
$horario_rs = $db->querySingle('SELECT * from fs_horario_basic where id = :hor',
|
||||
$horario_rs = $db->querySingle('SELECT * from horario_view where horario_id = :hor',
|
||||
[':hor' => $hor]
|
||||
);
|
||||
|
||||
$materia = $horario_rs["materia_id"];
|
||||
$gpo = $horario_rs["grupo"];
|
||||
$duracion = $horario_rs["duracion_total"];
|
||||
$dia = $horario_rs["dia"];
|
||||
$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 H:i:00", strtotime($fecha_new.' + '.$duracion.' minute'));
|
||||
$fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
|
||||
$dia_new = date('w', strtotime($fecha_new));
|
||||
|
||||
if($tipo == 1){//Reposición
|
||||
@@ -52,8 +63,10 @@ if($tipo == 1){//Reposición
|
||||
|
||||
//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);
|
||||
header("Location:".$pag."?error=11");
|
||||
/*print_r($_POST);
|
||||
echo 'SELECT * from horario_view where horario_id = '.$hor;
|
||||
echo intval($dia)." != ".intval($dia_falta);*/
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -66,24 +79,28 @@ if($tipo == 1){//Reposición
|
||||
exit();
|
||||
}
|
||||
*/
|
||||
//Valida que profesor no este en 2 reposiciones al mismo tiempo
|
||||
//Valida que profesor no este en 2 reposiciones al mismo tiempo en la fecha nueva
|
||||
|
||||
$traslape = $db->querySingle('SELECT * from traslape_profesor_reposicion(:prof, :fecha, :hora, :dur)',
|
||||
[':prof' => $prof, ':fecha'=>$fecha_falta, ':hora'=>$hora, ':dur'=>$duracion]
|
||||
[':prof' => $prof, ':fecha'=>DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d'), ':hora'=>$hora, ':dur'=>$duracion_tiempo]
|
||||
)["traslape_profesor_reposicion"];
|
||||
if($traslape){
|
||||
//print_r($_POST);
|
||||
//echo "SELECT * from traslape_profesor_reposicion($prof,'".DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')."' , '$hora', $duracion)";
|
||||
header("Location:".$pag."?error=9");
|
||||
exit();
|
||||
}
|
||||
|
||||
try{
|
||||
$db->query('SELECT * from fi_reposicion(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, true, :aula, :duracion)',
|
||||
$db->query('SELECT * from fi_reposicion_solicitud(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, true, :aula, :duracion, :usr, :bloque, :ciclo)',
|
||||
[':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, ':hor' => $hor,
|
||||
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion
|
||||
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_id, ':usr'=>$user->user["id"],
|
||||
':bloque' => $bloque, ':ciclo' => $ciclo
|
||||
]
|
||||
);
|
||||
}catch(Exception $e){
|
||||
header("Location: ".$pag."?error=1");
|
||||
echo $e->getMessage();
|
||||
//header("Location: ".$pag."?error=1");
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -96,9 +113,10 @@ if($tipo == 1){//Reposición
|
||||
}else{//Cambio salón / hora
|
||||
|
||||
try{
|
||||
$db->query('SELECT * from fi_reposicion(:f_falta, :f_nueva, :hora_nueva, :hor, :prof, 1, :desc, :alumnos, true, :aula, :duracion)',
|
||||
$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,
|
||||
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion
|
||||
':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion_id, ':usr'=>$user->user["id"],
|
||||
':bloque' => $bloque, ':ciclo' => $ciclo
|
||||
]
|
||||
);
|
||||
}catch(Exception $e){
|
||||
|
||||
Reference in New Issue
Block a user