|
@@ -24,7 +24,6 @@ if ($user->acceso === null && !$user->admin){
|
|
exit();
|
|
exit();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//if (!$user->admin && in_array($user->acceso, ['n']))
|
|
//if (!$user->admin && in_array($user->acceso, ['n']))
|
|
//die(header('Location: main.php?error=1'));
|
|
//die(header('Location: main.php?error=1'));
|
|
//$user->print_to_log('Reposiciones');
|
|
//$user->print_to_log('Reposiciones');
|
|
@@ -34,51 +33,59 @@ $write = true; //
|
|
|
|
|
|
$en_fecha = $db->querySingle("SELECT ESTA_EN_PERIODO(NOW()::DATE, :periodo_id)", [':periodo_id' => $user->periodo_id])['esta_en_periodo'];
|
|
$en_fecha = $db->querySingle("SELECT ESTA_EN_PERIODO(NOW()::DATE, :periodo_id)", [':periodo_id' => $user->periodo_id])['esta_en_periodo'];
|
|
|
|
|
|
-if($user->jefe_carrera){
|
|
|
|
|
|
+//if($user->jefe_carrera){
|
|
|
|
|
|
- $prof_rs = $db->query('SELECT DISTINCT * FROM fs_profesores(null, null, :fac) ORDER BY PROFESOR_NOMBRE', [':fac' => $user->facultad["facultad_id"]]);
|
|
|
|
-}
|
|
|
|
|
|
+ //$prof_rs = $db->query('SELECT DISTINCT * FROM fs_profesores(null, null, :fac) ORDER BY PROFESOR_NOMBRE', [':fac' => $user->facultad["facultad_id"]]);
|
|
|
|
+ $prof_rs = $db->query('SELECT DISTINCT PROFESOR.* FROM PUESTO_USUARIO
|
|
|
|
+ JOIN PUESTO_MATERIA USING (PUESTO_ID)
|
|
|
|
+ JOIN HORARIO_VIEW USING (MATERIA_ID)
|
|
|
|
+ JOIN HORARIO_PROFESOR USING (HORARIO_ID)
|
|
|
|
+ JOIN PROFESOR USING (PROFESOR_ID)
|
|
|
|
+ WHERE USUARIO_ID = :usr', [':usr' => $user->user["id"]]);
|
|
|
|
+//}
|
|
|
|
|
|
//Duraciones
|
|
//Duraciones
|
|
$duracion_rs = $db->query("select * from duracion order by duracion_interval");
|
|
$duracion_rs = $db->query("select * from duracion order by duracion_interval");
|
|
|
|
|
|
-//Periodo
|
|
|
|
-$periodo_rs = $db->querySingle('SELECT periodo_fecha_inicio, periodo_fecha_fin FROM periodo WHERE periodo_id = :periodo_id', [':periodo_id' => $user->periodo_id]);
|
|
|
|
-$periodo_fin = $periodo_rs["periodo_fecha_fin"];
|
|
|
|
-if(strtotime($periodo_rs["periodo_fecha_inicio"])>strtotime(date("Y-m-d")) )
|
|
|
|
- $fecha_man = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_inicio"]));
|
|
|
|
-else{
|
|
|
|
- $dias = 3;
|
|
|
|
- if( intval(date("w")) >=3 && intval(date("w"))<=5 )//Mie a Vie
|
|
|
|
- $dias+=3;
|
|
|
|
- else if( intval(date("w")) ==6 )//Sab
|
|
|
|
- $dias+=2;
|
|
|
|
- else if( intval(date("w")) ==0 )//Do
|
|
|
|
- $dias+=1;
|
|
|
|
-
|
|
|
|
- $fecha_man = date("d/m/Y", strtotime("+".$dias." day"));
|
|
|
|
|
|
+if(!is_null($user->periodo_id)){
|
|
|
|
+ //Periodo
|
|
|
|
+ $periodo_rs = $db->querySingle('SELECT periodo_fecha_inicio, periodo_fecha_fin FROM periodo WHERE periodo_id = :periodo_id', [':periodo_id' => $user->periodo_id]);
|
|
|
|
+ $periodo_fin = $periodo_rs["periodo_fecha_fin"];
|
|
|
|
+ if(strtotime($periodo_rs["periodo_fecha_inicio"])>strtotime(date("Y-m-d")) )
|
|
|
|
+ $fecha_man = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_inicio"]));
|
|
|
|
+ else{
|
|
|
|
+ $dias = 3;
|
|
|
|
+ if( intval(date("w")) >=3 && intval(date("w"))<=5 )//Mie a Vie
|
|
|
|
+ $dias+=3;
|
|
|
|
+ else if( intval(date("w")) ==6 )//Sab
|
|
|
|
+ $dias+=2;
|
|
|
|
+ else if( intval(date("w")) ==0 )//Do
|
|
|
|
+ $dias+=1;
|
|
|
|
+
|
|
|
|
+ $fecha_man = date("d/m/Y", strtotime("+".$dias." day"));
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ // Materias
|
|
|
|
+ $id_prof = $user->profesor;
|
|
|
|
+ //$facultad_id = 28;
|
|
|
|
+ $materias_rs = $db->query('SELECT * FROM fs_materiasprofesor(:id)', [':id' => $id_prof]);
|
|
|
|
+ */
|
|
|
|
+ if(isset($_POST["fecha_inicial"]))
|
|
|
|
+ $fecha_ini = $_POST["fecha_inicial"];
|
|
|
|
+ else
|
|
|
|
+ $fecha_ini = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_inicio"]));
|
|
|
|
+
|
|
|
|
+ if(isset($_POST["fecha_final"]))
|
|
|
|
+ $fecha_fin = $_POST["fecha_final"];
|
|
|
|
+ else
|
|
|
|
+ $fecha_fin = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_fin"]));
|
|
|
|
+
|
|
|
|
+ $date = DateTime::createFromFormat('d/m/Y', $fecha_ini);
|
|
|
|
+ $fecha_ini_db = $date->format('Y-m-d');
|
|
|
|
+
|
|
|
|
+ $date = DateTime::createFromFormat('d/m/Y', $fecha_fin);
|
|
|
|
+ $fecha_fin_db = $date->format('Y-m-d');
|
|
}
|
|
}
|
|
-/*
|
|
|
|
-// Materias
|
|
|
|
-$id_prof = $user->profesor;
|
|
|
|
-//$facultad_id = 28;
|
|
|
|
-$materias_rs = $db->query('SELECT * FROM fs_materiasprofesor(:id)', [':id' => $id_prof]);
|
|
|
|
-*/
|
|
|
|
-if(isset($_POST["fecha_inicial"]))
|
|
|
|
- $fecha_ini = $_POST["fecha_inicial"];
|
|
|
|
-else
|
|
|
|
- $fecha_ini = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_inicio"]));
|
|
|
|
-
|
|
|
|
-if(isset($_POST["fecha_final"]))
|
|
|
|
- $fecha_fin = $_POST["fecha_final"];
|
|
|
|
-else
|
|
|
|
- $fecha_fin = date("d/m/Y", strtotime($periodo_rs["periodo_fecha_fin"]));
|
|
|
|
-
|
|
|
|
-$date = DateTime::createFromFormat('d/m/Y', $fecha_ini);
|
|
|
|
-$fecha_ini_db = $date->format('Y-m-d');
|
|
|
|
-
|
|
|
|
-$date = DateTime::createFromFormat('d/m/Y', $fecha_fin);
|
|
|
|
-$fecha_fin_db = $date->format('Y-m-d');
|
|
|
|
|
|
|
|
?>
|
|
?>
|
|
<!DOCTYPE html>
|
|
<!DOCTYPE html>
|
|
@@ -132,7 +139,7 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|
<?php }?>
|
|
<?php }?>
|
|
<section id="message"></section>
|
|
<section id="message"></section>
|
|
<?php require('import/periodo.php') ?>
|
|
<?php require('import/periodo.php') ?>
|
|
-
|
|
|
|
|
|
+ <?php if(!is_null($user->periodo_id)) { ?>
|
|
<form id="asistencia" method="post" onsubmit="return validaFechas()">
|
|
<form id="asistencia" method="post" onsubmit="return validaFechas()">
|
|
<div class="form-box">
|
|
<div class="form-box">
|
|
<input type="hidden" name="facultad" value="">
|
|
<input type="hidden" name="facultad" value="">
|
|
@@ -160,8 +167,8 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|
|
|
|
|
<?php
|
|
<?php
|
|
|
|
|
|
- $reposiciones_rs = $db->query('SELECT * FROM fs_reposiciones_solicitud(:f_ini, :f_fin, :usr ,NULL, NULL)', [':f_ini' => $fecha_ini_db, ':f_fin' => $fecha_fin_db, ':usr' => $user->user["id"]]);
|
|
|
|
-
|
|
|
|
|
|
+ $reposiciones_rs = $db->query('SELECT * FROM fs_reposiciones_solicitud(:f_ini, :f_fin, :usr ,NULL, NULL)', [':f_ini' => $fecha_ini_db, ':f_fin' => $fecha_fin_db, ':usr' => $user->user["id"]]);
|
|
|
|
+ }
|
|
?>
|
|
?>
|
|
|
|
|
|
<div class="row">
|
|
<div class="row">
|
|
@@ -245,11 +252,17 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|
</tbody>
|
|
</tbody>
|
|
</table>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
- <?php } else { ?>
|
|
|
|
|
|
+ <?php } else {
|
|
|
|
+ if(is_null($user->periodo_id)){ ?>
|
|
|
|
+ <div class="col-12 text-center">
|
|
|
|
+ <h4 class="mt-4 text-danger">Selecciona un periodo</h4>
|
|
|
|
+ </div>
|
|
|
|
+ <?php } else {?>
|
|
<div class="col-12 text-center">
|
|
<div class="col-12 text-center">
|
|
<h4 class="mt-4 text-danger">No tienes reposiciones disponibles que cumplan con los filtros</h4>
|
|
<h4 class="mt-4 text-danger">No tienes reposiciones disponibles que cumplan con los filtros</h4>
|
|
</div>
|
|
</div>
|
|
- <?php } ?>
|
|
|
|
|
|
+ <?php }
|
|
|
|
+ } ?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
|
|
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modal" aria-hidden="true">
|
|
@@ -752,15 +765,13 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|
$("#filtro_final").removeClass("is-invalid");
|
|
$("#filtro_final").removeClass("is-invalid");
|
|
});
|
|
});
|
|
|
|
|
|
- $("#dlProfesor ul li").click(function(){//cambia datalist
|
|
|
|
- var pid = $(this).data('id');
|
|
|
|
- //busca materias del profesor
|
|
|
|
- $.ajax({
|
|
|
|
|
|
+ function obtieneProf(pid){
|
|
|
|
+ return $.ajax({
|
|
url: './action/reposicion_profesor_materias.php',
|
|
url: './action/reposicion_profesor_materias.php',
|
|
type: 'POST',
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
dataType: 'json',
|
|
data: { id: pid, },
|
|
data: { id: pid, },
|
|
- async: false,
|
|
|
|
|
|
+ //async: false,
|
|
success: function(result) {
|
|
success: function(result) {
|
|
if(result["error"]!= "" && result["error"] !== undefined){
|
|
if(result["error"]!= "" && result["error"] !== undefined){
|
|
triggerMessage(result["error"], "Error");
|
|
triggerMessage(result["error"], "Error");
|
|
@@ -780,29 +791,42 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|
);
|
|
);
|
|
$("#dlMateria ul").append(html);
|
|
$("#dlMateria ul").append(html);
|
|
}
|
|
}
|
|
- //setDatalistFirst("#horario");
|
|
|
|
- $("#dlMateria ul li:first").click();
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
error: function(jqXHR, textStatus, errorThrown ){
|
|
error: function(jqXHR, textStatus, errorThrown ){
|
|
triggerMessage(errorThrown, "Error");
|
|
triggerMessage(errorThrown, "Error");
|
|
}
|
|
}
|
|
});//ajax
|
|
});//ajax
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $(document).on( "click", "#dlProfesor ul li", function(event){//cambia datalist
|
|
|
|
+ var pid = $(this).data('id');
|
|
|
|
+ //busca materias del profesor
|
|
|
|
+ var profCarga = obtieneProf(pid);
|
|
|
|
+ profCarga.done(function(){
|
|
|
|
+ $("#dlMateria ul li:first").click();
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
//Actualiza días elegibles de calendario
|
|
//Actualiza días elegibles de calendario
|
|
$(document).on( "click", "#dlMateria ul li", function(event){//manda al frente de todos
|
|
$(document).on( "click", "#dlMateria ul li", function(event){//manda al frente de todos
|
|
- _dia_valido = $(this).data('dia');
|
|
|
|
|
|
+ _dia_valido = $(this).data('dia');//variable global
|
|
var grupo = $(this).data("gpo");
|
|
var grupo = $(this).data("gpo");
|
|
var duracionMateria = $(this).data("duracion");
|
|
var duracionMateria = $(this).data("duracion");
|
|
|
|
|
|
- $.ajax({
|
|
|
|
|
|
+ $(".date-picker" ).datepicker(datepickerOptions);
|
|
|
|
+ var hora = $(this).data("hr");
|
|
|
|
+ var min = $(this).data("min");
|
|
|
|
+ $("#hora_ini").val(hora)
|
|
|
|
+ $("#min_ini").val(min)
|
|
|
|
+
|
|
|
|
+ return $.ajax({
|
|
url: './action/asistenciasprofesor_select.php',
|
|
url: './action/asistenciasprofesor_select.php',
|
|
type: 'POST',
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
dataType: 'json',
|
|
data: { "id": $("#prof").val(), "hor": $(this).data("id") },
|
|
data: { "id": $("#prof").val(), "hor": $(this).data("id") },
|
|
|
|
+ //async: false,
|
|
success: function(result) {
|
|
success: function(result) {
|
|
if(result["error"]!= "" && result["error"] !== undefined){
|
|
if(result["error"]!= "" && result["error"] !== undefined){
|
|
triggerMessage(result["error"], "Error");
|
|
triggerMessage(result["error"], "Error");
|
|
@@ -819,7 +843,6 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|
$(this).prop('selected', true);
|
|
$(this).prop('selected', true);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- console.log("fin materia click");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
},
|
|
},
|
|
@@ -827,12 +850,8 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|
triggerMessage(errorThrown, "Error");
|
|
triggerMessage(errorThrown, "Error");
|
|
}
|
|
}
|
|
});//ajax
|
|
});//ajax
|
|
-
|
|
|
|
- $(".date-picker" ).datepicker(datepickerOptions);
|
|
|
|
- var hora = $(this).data("hr");
|
|
|
|
- var min = $(this).data("min");
|
|
|
|
- $("#hora_ini").val(hora)
|
|
|
|
- $("#min_ini").val(min)
|
|
|
|
|
|
+
|
|
|
|
+
|
|
});
|
|
});
|
|
|
|
|
|
$("#dlTipo ul li").click(function(){//cambia datalist
|
|
$("#dlTipo ul li").click(function(){//cambia datalist
|
|
@@ -857,7 +876,7 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|
if(result["error"]!= "" && result["error"] !== undefined){
|
|
if(result["error"]!= "" && result["error"] !== undefined){
|
|
triggerMessage(result["error"], "Error");
|
|
triggerMessage(result["error"], "Error");
|
|
}else{
|
|
}else{
|
|
- triggerMessage(result["ok"], "Éxito");
|
|
|
|
|
|
+ triggerMessage(result["ok"], "Éxito", "success");
|
|
$("#id"+r_id).remove();
|
|
$("#id"+r_id).remove();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -919,13 +938,17 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|
type: 'POST',
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
dataType: 'json',
|
|
data: { id: r_id },
|
|
data: { id: r_id },
|
|
|
|
+ async: true,
|
|
success: function(result) {
|
|
success: function(result) {
|
|
if(result["error"]!= "" && result["error"] !== undefined){
|
|
if(result["error"]!= "" && result["error"] !== undefined){
|
|
triggerMessage(result["error"], "Error");
|
|
triggerMessage(result["error"], "Error");
|
|
$("#modal").modal('hide');
|
|
$("#modal").modal('hide');
|
|
}else{
|
|
}else{
|
|
//setDatalist("#prof", result["profesor"]);
|
|
//setDatalist("#prof", result["profesor"]);
|
|
- setDatalist("#prof", result["profesor"])
|
|
|
|
|
|
+ setDatalist("#prof", result["profesor"]);
|
|
|
|
+
|
|
|
|
+ var profCarga = obtieneProf(result["profesor"]);
|
|
|
|
+
|
|
//$('#salon').val(result["salon"]);
|
|
//$('#salon').val(result["salon"]);
|
|
$("#fecha_falta").val(result["fecha_clase"]);
|
|
$("#fecha_falta").val(result["fecha_clase"]);
|
|
$('#hora_ini').val(result["hora_ini"]);
|
|
$('#hora_ini').val(result["hora_ini"]);
|
|
@@ -947,8 +970,11 @@ $fecha_fin_db = $date->format('Y-m-d');
|
|
_dia_valido = parseInt(result["dia"]);
|
|
_dia_valido = parseInt(result["dia"]);
|
|
$(".date-picker" ).datepicker(datepickerOptions);
|
|
$(".date-picker" ).datepicker(datepickerOptions);
|
|
$("#dlTipo ul li:selected").click();
|
|
$("#dlTipo ul li:selected").click();
|
|
- console.log("llega a cambio horario"+result["horario"]);
|
|
|
|
- setTimeout(setDatalist("#horario", result["horario"]), 20);// No se actualiza TODO
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ profCarga.done(function(){
|
|
|
|
+ setDatalist("#horario", result["horario"]);// No se actualiza TODO
|
|
|
|
+ });
|
|
setDatalist("#aula", result["aula"]);
|
|
setDatalist("#aula", result["aula"]);
|
|
modal.modal('show');
|
|
modal.modal('show');
|
|
}
|
|
}
|