All
This commit is contained in:
@@ -24,7 +24,6 @@ if ($user->acceso === null && !$user->admin){
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//if (!$user->admin && in_array($user->acceso, ['n']))
|
||||
//die(header('Location: main.php?error=1'));
|
||||
//$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'];
|
||||
|
||||
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
|
||||
$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>
|
||||
@@ -132,7 +139,7 @@ $fecha_fin_db = $date->format('Y-m-d');
|
||||
<?php }?>
|
||||
<section id="message"></section>
|
||||
<?php require('import/periodo.php') ?>
|
||||
|
||||
<?php if(!is_null($user->periodo_id)) { ?>
|
||||
<form id="asistencia" method="post" onsubmit="return validaFechas()">
|
||||
<div class="form-box">
|
||||
<input type="hidden" name="facultad" value="">
|
||||
@@ -160,8 +167,8 @@ $fecha_fin_db = $date->format('Y-m-d');
|
||||
|
||||
<?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">
|
||||
@@ -245,11 +252,17 @@ $fecha_fin_db = $date->format('Y-m-d');
|
||||
</tbody>
|
||||
</table>
|
||||
</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">
|
||||
<h4 class="mt-4 text-danger">No tienes reposiciones disponibles que cumplan con los filtros</h4>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php }
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<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");
|
||||
});
|
||||
|
||||
$("#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',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: { id: pid, },
|
||||
async: false,
|
||||
//async: false,
|
||||
success: function(result) {
|
||||
if(result["error"]!= "" && result["error"] !== undefined){
|
||||
triggerMessage(result["error"], "Error");
|
||||
@@ -780,29 +791,42 @@ $fecha_fin_db = $date->format('Y-m-d');
|
||||
);
|
||||
$("#dlMateria ul").append(html);
|
||||
}
|
||||
//setDatalistFirst("#horario");
|
||||
$("#dlMateria ul li:first").click();
|
||||
}
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown ){
|
||||
triggerMessage(errorThrown, "Error");
|
||||
}
|
||||
});//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
|
||||
$(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 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',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: { "id": $("#prof").val(), "hor": $(this).data("id") },
|
||||
//async: false,
|
||||
success: function(result) {
|
||||
if(result["error"]!= "" && result["error"] !== undefined){
|
||||
triggerMessage(result["error"], "Error");
|
||||
@@ -819,7 +843,6 @@ $fecha_fin_db = $date->format('Y-m-d');
|
||||
$(this).prop('selected', true);
|
||||
}
|
||||
});
|
||||
console.log("fin materia click");
|
||||
}
|
||||
|
||||
},
|
||||
@@ -827,12 +850,8 @@ $fecha_fin_db = $date->format('Y-m-d');
|
||||
triggerMessage(errorThrown, "Error");
|
||||
}
|
||||
});//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
|
||||
@@ -857,7 +876,7 @@ $fecha_fin_db = $date->format('Y-m-d');
|
||||
if(result["error"]!= "" && result["error"] !== undefined){
|
||||
triggerMessage(result["error"], "Error");
|
||||
}else{
|
||||
triggerMessage(result["ok"], "Éxito");
|
||||
triggerMessage(result["ok"], "Éxito", "success");
|
||||
$("#id"+r_id).remove();
|
||||
}
|
||||
},
|
||||
@@ -919,13 +938,17 @@ $fecha_fin_db = $date->format('Y-m-d');
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: { id: r_id },
|
||||
async: true,
|
||||
success: function(result) {
|
||||
if(result["error"]!= "" && result["error"] !== undefined){
|
||||
triggerMessage(result["error"], "Error");
|
||||
$("#modal").modal('hide');
|
||||
}else{
|
||||
//setDatalist("#prof", result["profesor"]);
|
||||
setDatalist("#prof", result["profesor"])
|
||||
setDatalist("#prof", result["profesor"]);
|
||||
|
||||
var profCarga = obtieneProf(result["profesor"]);
|
||||
|
||||
//$('#salon').val(result["salon"]);
|
||||
$("#fecha_falta").val(result["fecha_clase"]);
|
||||
$('#hora_ini').val(result["hora_ini"]);
|
||||
@@ -947,8 +970,11 @@ $fecha_fin_db = $date->format('Y-m-d');
|
||||
_dia_valido = parseInt(result["dia"]);
|
||||
$(".date-picker" ).datepicker(datepickerOptions);
|
||||
$("#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"]);
|
||||
modal.modal('show');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user