|
@@ -1,47 +1,62 @@
|
|
|
<?php
|
|
|
|
|
|
require_once 'class/c_login.php';
|
|
|
-$user = Login::get_user();
|
|
|
+if (!isset($_SESSION['user'])){
|
|
|
+ die(header('Location: index.php'));
|
|
|
+}
|
|
|
|
|
|
+//$user = unserialize($_SESSION['user']);
|
|
|
+$user = Login::get_user();
|
|
|
|
|
|
$user->access();
|
|
|
-//if (!$user->admin && in_array($user->acceso, ['n']))
|
|
|
- //die(header('Location: main.php?error=1'));
|
|
|
+echo $user;
|
|
|
+/*print_r($user);
|
|
|
+print_r($user->user["id"]);
|
|
|
+echo "****|";
|
|
|
+print_r($user->acceso);//null sin permisos, w o r
|
|
|
+echo "|****|";
|
|
|
+print_r($user->profesor);
|
|
|
+echo "|****|";
|
|
|
+print_r($user->facultad["facultad_id"]);
|
|
|
+exit();*/
|
|
|
+//profesor, admin, rol, facultad
|
|
|
+if ($user->acceso === null && !$user->admin){
|
|
|
+ die(header('Location: index.php'));
|
|
|
+ exit();
|
|
|
+}
|
|
|
+
|
|
|
+$supervisor = false;
|
|
|
+$coordinador = false;
|
|
|
+if($user->rol["rol_id"]==7){
|
|
|
+ $supervisor = true;
|
|
|
+}
|
|
|
+if($user->rol["rol_id"]==9){
|
|
|
+ $coordinador = true;
|
|
|
+}
|
|
|
|
|
|
-$user->print_to_log('Reposiciones');
|
|
|
+//$user->print_to_log('Reposiciones');
|
|
|
//$write = $user->admin || in_array($user->acceso, ['w']);
|
|
|
$write = true; //
|
|
|
|
|
|
function duracionMinutos($fechahora_i, $fechahora_f){
|
|
|
return round((strtotime($fechahora_f) - strtotime($fechahora_i)) / 60,2);
|
|
|
}
|
|
|
-
|
|
|
-if(!empty($user->periodo)){
|
|
|
- $en_fecha = $db->querySingle("SELECT ESTA_EN_PERIODO(NOW()::DATE, :periodo_id)", [':periodo_id' => $user->periodo])['esta_en_periodo'];
|
|
|
-
|
|
|
+if($user->periodo_id!= ""){
|
|
|
+ $en_fecha = $db->querySingle("SELECT ESTA_EN_PERIODO(NOW()::DATE, :periodo_id)", [':periodo_id' => $user->periodo_id])['esta_en_periodo'];
|
|
|
|
|
|
$profesores_rs = array();
|
|
|
$tab_inicial = 1;
|
|
|
- if($user->jefe_carrera){
|
|
|
- $carrera_rs = $db->query('SELECT * FROM fs_usuario_carrera(:usr, NULL)', [':usr'=>$user->user["id"]]);
|
|
|
- foreach($carrera_rs as $carr){
|
|
|
- $rs = $db->query('SELECT * FROM fs_profesor_carrera(:carr, :periodo)', [':carr' => $carr['carrera_id'], ':periodo' => $user->periodo]);
|
|
|
- $profesores_rs = array_merge($profesores_rs, $rs);
|
|
|
- }
|
|
|
-
|
|
|
- }else if($write){// $user->supervisor || $user->admin
|
|
|
- $profesores_rs = $db->query('SELECT * FROM fs_profesor_carrera(NULL, :periodo)', [':periodo' => $user->periodo]);
|
|
|
- $tab_inicial = 2;
|
|
|
+ if(!$supervisor){
|
|
|
+ $fac_id = $user->facultad["facultad_id"];
|
|
|
+ $carrera_rs = $db->query('SELECT * FROM fs_profesor_facultad(:fac, :periodo)', [':fac'=>$fac_id, ':periodo' => $user->periodo_id]);
|
|
|
}else{
|
|
|
- die(header('Location: index.php'));
|
|
|
+ $carrera_rs = $db->query('SELECT * FROM fs_profesor_facultad(NULL, :periodo)', [ ':periodo' => $user->periodo_id]);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
$salones_rs = $db->query('SELECT * FROM salon_view WHERE tiene_salones IS true');
|
|
|
|
|
|
-
|
|
|
//Periodo
|
|
|
- $periodo_rs = $db->querySingle('SELECT periodo_fecha_inicio, periodo_fecha_fin FROM periodo WHERE periodo_id = :periodo_id', [':periodo_id' => $user->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"]));
|
|
@@ -73,13 +88,13 @@ if(!empty($user->periodo)){
|
|
|
$repEdo_rs = $db->query('SELECT * FROM fs_estado_reposicion' );
|
|
|
|
|
|
$repoParams = array();
|
|
|
- $query = "";//carrera, prof
|
|
|
- if($user->jefe_carrera){
|
|
|
+ $query = "NULL,";//carrera, prof
|
|
|
+ /*if($user->jefe_carrera){
|
|
|
$query .= ":jefe, ";
|
|
|
$repoParams[":jefe"] = $user->user["id"];
|
|
|
}else{
|
|
|
$query .= "NULL, ";
|
|
|
- }
|
|
|
+ }*/
|
|
|
if((isset($_POST["prof"]) && is_numeric($_POST["prof"])) ){
|
|
|
$query .= ":prof,";
|
|
|
$repoParams[":prof"] = filter_input(INPUT_POST, "prof", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
|
@@ -87,8 +102,15 @@ if(!empty($user->periodo)){
|
|
|
$query .= "NULL,";
|
|
|
}
|
|
|
$query .= ":f_ini, :f_fin, :edo, ";
|
|
|
- $repoParams[":f_ini"] = $fecha_ini;
|
|
|
- $repoParams[":f_fin"] = $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');
|
|
|
+ $repoParams[":f_ini"] = $fecha_ini_db;
|
|
|
+ $repoParams[":f_fin"] = $fecha_fin_db;
|
|
|
$repoParams[":edo"] = 1;//se sobreescribe
|
|
|
}
|
|
|
?>
|
|
@@ -101,24 +123,26 @@ if(!empty($user->periodo)){
|
|
|
<meta charset="utf-8">
|
|
|
<meta http-equiv="content-type" content="text/plain; charset=UTF-8" />
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
- <?php include_once "import/html_css_files.php"; ?>
|
|
|
- <link rel="stylesheet" href="css/jquery-ui.css">
|
|
|
- <link rel="stylesheet" href="css/richtext.css" type="text/css">
|
|
|
- <link rel="stylesheet" href="css/clockpicker.css">
|
|
|
- <link rel="stylesheet" href="css/calendar.css">
|
|
|
- <link rel="stylesheet" href="css/fa_all.css" type="text/css">
|
|
|
+ <?php
|
|
|
+ include 'import/html_css_files.php';
|
|
|
+ ?>
|
|
|
|
|
|
<script src="js/scrollables.js" defer></script>
|
|
|
<script>
|
|
|
const write = <?= $write ? 'true' : 'false' ?>;
|
|
|
</script>
|
|
|
- <script src="js/moment.js" defer></script>
|
|
|
<style>
|
|
|
.wizard { height: 20px; width: 80%; background: #D0D0D0; }
|
|
|
.wizard.full { background: #D0D0D0; }
|
|
|
.wizard.active > div:first-child { background: #00A6CE; }
|
|
|
.wizard.active > div:last-child { width: 0px; height: 0px; border-style: solid; border-width: 10px 0 10px 6px; border-color: transparent transparent transparent #00a6ce; transform: rotate(0deg); }
|
|
|
</style>
|
|
|
+ <script src="js/jquery.min.js"></script>
|
|
|
+ <script src="js/bootstrap/popper.min.js"></script>
|
|
|
+ <script src="js/bootstrap/bootstrap.min.js"></script>
|
|
|
+ <script src="js/jquery-ui.js"></script>
|
|
|
+ <script src="js/datepicker-es.js"></script>
|
|
|
+ <script src="js/messages.js"></script>
|
|
|
|
|
|
|
|
|
</head>
|
|
@@ -136,7 +160,7 @@ if(!empty($user->periodo)){
|
|
|
<section id="message"></section>
|
|
|
<?php require('import/periodo.php') ?>
|
|
|
|
|
|
- <?php if(!empty($user->periodo)){ ?>
|
|
|
+ <?php if($user->periodo_id!= ""){ ?>
|
|
|
<form id="asistencia" method="post" onsubmit="return validaFechas()">
|
|
|
<div class="form-box">
|
|
|
<input type="hidden" name="facultad" value="5">
|
|
@@ -191,10 +215,10 @@ if(!empty($user->periodo)){
|
|
|
<a class="nav-link" id="tab1-tab" data-toggle="tab" href="#tab1" role="tab" aria-controls="calendario" aria-selected="true">Nuevas reposiciones</a>
|
|
|
</li>
|
|
|
<li class="nav-item">
|
|
|
- <a class="nav-link" id="tab2-tab" data-toggle="tab" href="#tab2" role="tab" aria-controls="lista" aria-selected="false">Aprobadas por jefe</a>
|
|
|
+ <a class="nav-link" id="tab2-tab" data-toggle="tab" href="#tab2" role="tab" aria-controls="lista" aria-selected="false">Aprobadas por Facultad</a>
|
|
|
</li>
|
|
|
<li class="nav-item">
|
|
|
- <a class="nav-link" id="tab3-tab" data-toggle="tab" href="#tab3" role="tab" aria-controls="lista" aria-selected="false">Autorizadas</a>
|
|
|
+ <a class="nav-link" id="tab3-tab" data-toggle="tab" href="#tab3" role="tab" aria-controls="lista" aria-selected="false">Autorizadas por Vicerrectoría</a>
|
|
|
</li>
|
|
|
<li class="nav-item">
|
|
|
<a class="nav-link" id="tab4-tab" data-toggle="tab" href="#tab4" role="tab" aria-controls="lista" aria-selected="false">Rechazadas</a>
|
|
@@ -208,6 +232,7 @@ if(!empty($user->periodo)){
|
|
|
<?php
|
|
|
$repoParams[":edo"]=$redo["estado_reposicion_id"];
|
|
|
$reposiciones_rs = $db->query('SELECT * FROM fs_reposicion(NULL, '.$query.'0, NULL) ', $repoParams );
|
|
|
+
|
|
|
?>
|
|
|
|
|
|
<h4 class="mb-4" <?php echo "style='color:".$redo["estado_color"]."'>".$redo["estado_nombre"]; ?> </h4>
|
|
@@ -229,7 +254,7 @@ if(!empty($user->periodo)){
|
|
|
if(isset($reposiciones_rs)){
|
|
|
foreach($reposiciones_rs as $reposicion){
|
|
|
?>
|
|
|
- <tr data-id="<?php echo $reposicion["reposicion_id"]; ?>" data-edo="<?php echo $reposicion["estado_reposicion_id"];?>" id="id<?php echo $reposicion["reposicion_id"]; ?>">
|
|
|
+ <tr data-id="<?php echo $reposicion["reposicion_solicitud_id"]; ?>" data-edo="<?php echo $reposicion["estado_reposicion_id"];?>" id="id<?php echo $reposicion["reposicion_solicitud_id"]; ?>">
|
|
|
<td class="align-middle">
|
|
|
<?php if($reposicion["estado_reposicion_id"]<3){ ?>
|
|
|
<div class="wizard <?php if(intval($reposicion["estado_reposicion_id"])==2) echo "active";?> d-flex mx-auto">
|
|
@@ -298,11 +323,12 @@ if(!empty($user->periodo)){
|
|
|
<?php
|
|
|
if($reposicion["estado_reposicion_id"]<4){
|
|
|
if(
|
|
|
- (($user->jefe_carrera || $user->admin) && $reposicion["estado_reposicion_id"] <= 2)
|
|
|
- || ((!$user->jefe_carrera || $user->admin) && $reposicion["estado_reposicion_id"] >= 2 )){
|
|
|
+ (($user->jefe_carrera || $user->admin || $coordinador) && $reposicion["estado_reposicion_id"] == 1)/* nueva */
|
|
|
+ || (($user->admin || $coordinador || $supervisor) && $reposicion["estado_reposicion_id"] == 2)/* aprobado facultad */
|
|
|
+ ){
|
|
|
?>
|
|
|
<a href="#" data-toggle="modal" data-target="#modal_confirm" title="Cancelar"><span class="text-danger"><?php echo $ICO["cancelar"];?></span></a>
|
|
|
- <?php }
|
|
|
+ <?php }
|
|
|
} //estado
|
|
|
?>
|
|
|
</td>
|
|
@@ -351,6 +377,18 @@ if(!empty($user->periodo)){
|
|
|
<p class="rep-mat"></p>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-6 col-sm-4 barra-right text-right">
|
|
|
+ <p class="font-weight-bold">Ciclo y bloque</p>
|
|
|
+ </div>
|
|
|
+ <div class="col-3">
|
|
|
+ <p><strong>Ciclo:</strong><span class="rep-ciclo ml-3"></span></p>
|
|
|
+ </div>
|
|
|
+ <div class="col-3">
|
|
|
+ <p><strong>Bloque:</strong><span class="rep-bloque ml-3"></span></p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="row">
|
|
|
<div class="col-6 col-sm-4 barra-right text-right">
|
|
|
<p class="font-weight-bold">Tipo</p>
|
|
@@ -438,6 +476,14 @@ if(!empty($user->periodo)){
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
+ <div class="row mt-4" id="cancelada-block">
|
|
|
+ <div class="col-6 col-sm-4 barra-right text-right">
|
|
|
+ <p class="font-weight-bold text-danger">Motivo de cancelación</p>
|
|
|
+ </div>
|
|
|
+ <div class="col-6 bg-light">
|
|
|
+ <p class="rep-motivo"></p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
<div class="form-group row mt-3">
|
|
|
<div class="col-12 text-center">
|
|
@@ -495,12 +541,7 @@ if(!empty($user->periodo)){
|
|
|
?>
|
|
|
</main>
|
|
|
</body>
|
|
|
-<script src="js/jquery.min.js"></script>
|
|
|
-<script src="js/bootstrap/popper.min.js"></script>
|
|
|
-<script src="js/bootstrap/bootstrap.min.js"></script>
|
|
|
-<script src="js/jquery-ui.js"></script>
|
|
|
-<script src="js/datepicker-es.js"></script>
|
|
|
-<script src="js/messages.js"></script>
|
|
|
+
|
|
|
<?php
|
|
|
//--Manejo de errores y mensajes de exito
|
|
|
if(isset($_GET["error"]) && is_numeric($_GET["error"])){
|
|
@@ -537,11 +578,6 @@ if(!empty($user->periodo)){
|
|
|
var _periodo_fecha_final = "<?php echo date("d/m/Y", strtotime($periodo_rs["periodo_fecha_fin"])); ?>";
|
|
|
var datepickerOptions = { dateFormat: "dd/mm/yy", minDate:_periodo_fecha_inicial, maxDate:_periodo_fecha_final };
|
|
|
|
|
|
- $(document).ready(function(){
|
|
|
- $(".date-picker-filtro" ).datepicker(datepickerOptions);
|
|
|
- $(".date-picker-filtro" ).datepicker( $.datepicker.regional[ "es" ] );
|
|
|
- $('#tab<?php echo $tab_inicial;?>-tab').tab('show');
|
|
|
- });
|
|
|
|
|
|
function valida(){
|
|
|
<?php
|
|
@@ -556,7 +592,10 @@ if(!empty($user->periodo)){
|
|
|
}
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
-
|
|
|
+ $(".date-picker-filtro" ).datepicker(datepickerOptions);
|
|
|
+ $(".date-picker-filtro" ).datepicker( $.datepicker.regional[ "es" ] );
|
|
|
+ $('#tab<?php echo $tab_inicial;?>-tab').tab('show');
|
|
|
+
|
|
|
$('#modal_confirm').on('show.bs.modal', function (event) {
|
|
|
var button = $(event.relatedTarget); // Button that triggered the modal
|
|
|
var id = button.parents("tr").data("id");
|
|
@@ -566,10 +605,11 @@ if(!empty($user->periodo)){
|
|
|
|
|
|
$('#modal_aprobar').on('show.bs.modal', function (event) {
|
|
|
var button = $(event.relatedTarget); // Button that triggered the modal
|
|
|
- //console.log(button.data("tipo"));
|
|
|
+ console.log("Abre:"+button.data("tipo"));
|
|
|
var id = button.parents("tr").data("id");
|
|
|
var edo = button.data('tipo');
|
|
|
|
|
|
+ //1 ver, 2 aprobar, 3 autorizar
|
|
|
$("#edo").val(edo);
|
|
|
$("#id").val(id);
|
|
|
|
|
@@ -587,7 +627,9 @@ if(!empty($user->periodo)){
|
|
|
}else{
|
|
|
|
|
|
$("#modal_aprobar .rep-prof").text(result["profesor_nombre"]);
|
|
|
- $("#modal_aprobar .rep-mat").text(result["materia_desc"]+" ["+result["grupo"]+"]" );
|
|
|
+ $("#modal_aprobar .rep-mat").text(result["materia_desc"]);
|
|
|
+ $("#modal_aprobar .rep-ciclo").text(result["ciclo"]);
|
|
|
+ $("#modal_aprobar .rep-bloque").text(result["bloque"]);
|
|
|
if(result["tipo"])
|
|
|
$("#modal_aprobar .rep-tipo").text("Reposición");
|
|
|
else
|
|
@@ -605,14 +647,21 @@ if(!empty($user->periodo)){
|
|
|
$("#modal_aprobar .rep-comentarios").text(result["comentario"]);
|
|
|
$('#modal_aprobar .rep-alumnos').text(result["alumnos"]);
|
|
|
|
|
|
- if(button.data("tipo") == 1){//ver
|
|
|
+ if(result["estado"] == 4){//cancelada
|
|
|
+ $('#modal_aprobar .rep-motivo').text(result["motivo_cancelacion"]);
|
|
|
+ $("#cancelada-block").show();
|
|
|
+ }else{
|
|
|
+ $("#cancelada-block").hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(edo == 1){// 1 ver
|
|
|
$("#modalLabel").text("Detalle de reposición");
|
|
|
$(".aprobar-block").hide();
|
|
|
$("#salon-ver").show();
|
|
|
$("#salon-editar").hide();
|
|
|
|
|
|
}else{
|
|
|
- if(parseInt($("#modal_aprobar .rep-aula").data("aula")) == 1){//ver
|
|
|
+ if(parseInt($("#modal_aprobar .rep-aula").data("aula")) == 1){//tipo aula 1 (salon normal) - ver
|
|
|
$("#modalLabel").text("Detalle de reposición");
|
|
|
$(".aprobar-block").hide();
|
|
|
$("#salon-ver").show();
|
|
@@ -620,7 +669,7 @@ if(!empty($user->periodo)){
|
|
|
}else{
|
|
|
$("#modalLabel").text("Aprobar reposición");
|
|
|
$(".aprobar-block").show();
|
|
|
- if(button.data("tipo") == 3){//aprobar (con salón)
|
|
|
+ if(edo == 3){//aprobar (con salón)
|
|
|
$("#salon-ver").hide();
|
|
|
$("#salon-editar").show();
|
|
|
|
|
@@ -629,13 +678,13 @@ if(!empty($user->periodo)){
|
|
|
}
|
|
|
|
|
|
if(result["aula_supervisor"]){//Solo supervisor
|
|
|
- <?php if($user->supervisor){ ?>
|
|
|
+ <?php if($supervisor){ ?>
|
|
|
$("#salon-editar").attr("disabled", false);
|
|
|
<?php }else{?>
|
|
|
$("#salon-editar").attr("disabled", true);
|
|
|
<?php } ?>
|
|
|
}else{// Facultad
|
|
|
- <?php if(!$user->supervisor){ ?>
|
|
|
+ <?php if(!$supervisor){ ?>
|
|
|
$("#salon-editar").attr("disabled", false);
|
|
|
<?php }else{?>
|
|
|
$("#salon-editar").attr("disabled", true);
|