diff --git a/action/action_auditoria.php b/action/action_auditoria.php index 9780e51..f9e11b5 100644 --- a/action/action_auditoria.php +++ b/action/action_auditoria.php @@ -24,8 +24,16 @@ try { fechas AS ( SELECT fechas_clase(h.horario_id) as registro_fecha_ideal, h.horario_id FROM horarios h + ), + sin_registro AS ( + SELECT * FROM ESTADO_SUPERVISOR WHERE (estado_color, estado_icon) = ('dark', 'ing-cancelar') ) - SELECT estado_supervisor.*, usuario.*, registro.*, profesor.*, horarios.*, fechas.*, + SELECT + usuario.*, registro.*, profesor.*, horarios.*, fechas.*, + coalesce(estado_supervisor.estado_supervisor_id, sin_registro.estado_supervisor_id) as estado_supervisor_id, + coalesce(estado_supervisor.nombre, sin_registro.nombre) as nombre, + coalesce(estado_supervisor.estado_color, sin_registro.estado_color) as estado_color, + coalesce(estado_supervisor.estado_icon, sin_registro.estado_icon) as estado_icon, justificador.usuario_nombre as justificador_nombre, justificador.usuario_clave as justificador_clave, facultad.facultad_nombre as justificador_facultad, @@ -36,6 +44,7 @@ try { JOIN profesor using (profesor_id) LEFT JOIN registro USING (horario_id, registro_fecha_ideal, profesor_id) LEFT join estado_supervisor using (estado_supervisor_id) + CROSS JOIN sin_registro LEFT JOIN USUARIO ON USUARIO.usuario_id = REGISTRO.supervisor_id LEFT JOIN USUARIO JUSTIFICADOR ON JUSTIFICADOR.usuario_id = REGISTRO.justificador_id LEFT JOIN ROL on ROL.rol_id = justificador.rol_id diff --git a/action/action_horario.php b/action/action_horario.php index 8594f4e..477ed4c 100644 --- a/action/action_horario.php +++ b/action/action_horario.php @@ -1,35 +1,56 @@ -get("fs_horario($periodo, $carrera, '$grupo', true)"); - -// get each id from $horarios (might be duplicate) - -try { - $horarios = array_map(function ($horario) use ($dias, $db) { - $horario['profesores'] = array_map( - fn ($profesor) => - $db->where("id", $profesor)->getOne("fs_profesor"), - explode(",", substr($horario['profesores'], 1, -1)) - ); - $horario['dia'] = $dias[$horario['dia']]; - return $horario; - }, $horarios); -} catch (Exception $e) { - die(json_encode([ - "status" => "error", - "message" => $e->getMessage(), - ])); +require_once $ruta . "class/c_login.php"; +if (!isset($_SESSION['user'])) { + http_response_code(401); + die(json_encode(['error' => 'unauthorized'])); } -?> - "success", - "horario" => $horarios, -]) ?> \ No newline at end of file +$user = unserialize($_SESSION['user']); + +// check method +try { + if ($_SERVER['REQUEST_METHOD'] === 'GET') { + if (!isset($_GET['profesor_id'])) { + throw new Exception('missing parameters'); + } + $data = $db->query( + "SELECT *, (EXTRACT(EPOCH FROM (horario_fin - horario_hora) ) / EXTRACT(EPOCH FROM interval '15 minute'))::INT AS bloques + FROM horario_view + JOIN horario_profesor ON horario_profesor.horario_id = horario_view.horario_id + WHERE horario_profesor.profesor_id = :profesor_id + AND (facultad_id = :facultad_id OR :facultad_id IS NULL)", + [ + 'profesor_id' => $_GET['profesor_id'], + 'facultad_id' => $user->facultad['facultad_id'], + ] + ); + + $last_query = [ + 'query' => $db->getLastQuery(), + ]; + + echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + } else { + throw new Exception('invalid method'); + } +} catch (PDOException $th) { + http_response_code(500); + echo json_encode([ + 'error' => $th->getMessage(), + 'query' => $db->getLastQuery(), + ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR); + exit; +} catch (Exception $th) { + http_response_code(500); + echo json_encode([ + 'error' => $th->getMessage(), + ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + exit; +} \ No newline at end of file diff --git a/action/action_materias.php b/action/action_materias.php index 4f98325..504e971 100644 --- a/action/action_materias.php +++ b/action/action_materias.php @@ -10,7 +10,7 @@ if (!isset($_SESSION['user'])) $user = unserialize($_SESSION['user']); -if (!$user->admin && ($access = $user->access('asistencia')) == 'n') +if (($access = $user->access('asistencia')) == 'n') die(json_encode(['error' => true])); $user->print_to_log('Consultar materias'); diff --git a/action/action_permisos_update.php b/action/action_permisos_update.php index 2ef88e5..b82c5bd 100644 --- a/action/action_permisos_update.php +++ b/action/action_permisos_update.php @@ -1,7 +1,7 @@


"; - #print_r($ver); - #print_r($editar); - query("SELECT fd_permiso()", null, false); + $db->query("SELECT fd_permiso()"); foreach($ver as $lectura){ $igual=false; $ver_separado = explode("_", $lectura); - #print_r($ver_separado); foreach($completo as $comp){ if($ver_separado[0] == $comp[0] && $ver_separado[1] == $comp[1]){ - #echo " igual"; $igual=true; break; } } - #echo "
"; if(!$igual) $completo[]=$ver_separado; } - #print_r($completo); foreach($completo as $actual){ - $sql = "SELECT fi_permiso(:pagina, :rol, :tipo)"; - $params = [':pagina' => $actual['0'], ':rol' => $actual['1'], ':tipo' => $actual['2']]; - query($sql, $params, false); + + $db->insert('permiso', [ + 'pagina_id' => $actual['0'], + 'rol_id' => $actual['1'], + 'permiso_tipo' => $actual['2'], + ]); } header("Location: ../permisos.php"); exit(); diff --git a/action/action_profesor.php b/action/action_profesor.php index e5746d2..345b582 100644 --- a/action/action_profesor.php +++ b/action/action_profesor.php @@ -1,14 +1,57 @@ - 'unauthorized'])); +} +$user = unserialize($_SESSION['user']); -extract($_GET); +// check method +try { + if ($_SERVER['REQUEST_METHOD'] === 'GET') { + $data = $db->query( + "SELECT DISTINCT profesor.* + FROM profesor + JOIN horario_profesor using (profesor_id) + JOIN horario using (horario_id) + JOIN materia using (materia_id) + JOIN carrera using (carrera_id) + WHERE carrera.facultad_id = :facultad_id OR :facultad_id IS NULL + ORDER BY profesor.profesor_nombre", + array( + ":facultad_id" => $user->facultad['facultad_id'] + ) + ); -$profesores = $db - ->where("facultad_id", $facultad ?? 0) - ->get("fs_profesor"); + $last_query = [ + 'query' => $db->getLastQuery(), + ]; -echo json_encode([ - "status" => "success", - "profesores" => $profesores -]); \ No newline at end of file + echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + } else { + http_response_code(405); + echo json_encode(['error' => 'method not allowed']); + exit; + } +} catch (PDOException $th) { + http_response_code(500); + echo json_encode([ + 'error' => $th->getMessage(), + 'query' => $db->getLastQuery(), + ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR); + exit; +} catch (Exception $th) { + http_response_code(500); + echo json_encode([ + 'error' => $th->getMessage(), + ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + exit; +} \ No newline at end of file diff --git a/action/action_usuarios_insert.php b/action/action_usuarios_insert.php index 4d6c5a4..d34ea1e 100644 --- a/action/action_usuarios_insert.php +++ b/action/action_usuarios_insert.php @@ -1,22 +1,26 @@ $_POST['mclave']], true); - if(!$hecho){ - $sql = "SELECT fi_usuario(:nombre, :correo, :clave, :rol, :facultad)"; - $params = [':nombre' => mb_strtoupper($_POST['mnombre']), ':correo' => $_POST['mcorreo'], ':clave' => $_POST['mclave'], ':rol' => $_POST['mrol'], ':facultad' => $facultad]; - $hecho = query($sql, $params, true); - header("Location: ../usuarios.php", true, 307); - exit(); - } - else{ - header("Location: ../usuarios.php?error=1"); - exit(); - } -?> \ No newline at end of file +if ($db->where('usuario_clave', $_POST['mclave'])->has('usuario')) { + header("Location: ../usuarios.php?error=1"); + exit; +} + +$db->insert('usuario', [ + 'usuario_nombre' => mb_strtoupper($_POST['mnombre']), + 'usuario_correo' => $_POST['mcorreo'], + 'usuario_clave' => $_POST['mclave'], + 'rol_id' => $_POST['mrol'] ?? null, + 'facultad_id' => empty($facultad) ? null : $facultad, +]); + +header("Location: ../usuarios.php", true, 307); \ No newline at end of file diff --git a/action/asistenciasprofesor_select.php b/action/asistenciasprofesor_select.php new file mode 100644 index 0000000..1347b50 --- /dev/null +++ b/action/asistenciasprofesor_select.php @@ -0,0 +1,26 @@ +query('SELECT * from fs_asistenciaprofesor_horario(:id, :hor)', [':id' => $id, ':hor' => $hor]); + $asistArr = array(); + + foreach($rs as $row){ + $asistArr[] = $row["registro_fecha_ideal"]; + } + $return["asistenciaArr"] = $asistArr; +} +echo json_encode($return); +?> diff --git a/action/reposicion_autoriza.php b/action/reposicion_autoriza.php new file mode 100644 index 0000000..7f8a80c --- /dev/null +++ b/action/reposicion_autoriza.php @@ -0,0 +1,98 @@ + FILTER_FLAG_STRIP_LOW)));//limpia texto + +$motivo = ""; +if(isset($_POST["motivo"]) && $_POST["motivo"] != "") + $motivo = trim($_POST["motivo"]); + +if($edo == 4){//cancelación + $db->querySingle('SELECT fu_reposicion_cancela(:id, :motivo)', + [':id' => $id_repo, ':motivo' => $motivo] + ); +}else{ + if(!empty($salon)){ + $db->querySingle('SELECT fu_reposicion(:id, NULL, NULL, NULL, :sal, :edo, NULL, NULL, NULL, NULL)', + [':id' => $id_repo, ':sal' => $salon, ':edo' => $edo] + ); + }else{ + $db->querySingle('SELECT fu_reposicion(:id, NULL, NULL, NULL, NULL, :edo, NULL, NULL, NULL, NULL)', + [':id' => $id_repo, ':edo' => $edo] + ); + } +} + +//Obtener datos del usuario que creó la reposición y mandar correo +/*$stmt = $pdo->prepare('Select * from fs_reposicion(:id, :periodo, NULL, NULL, NULL, NULL, NULL, 0, 1)'); +$stmt->bindParam(":id", $id_repo); +$stmt->bindParam(":periodo", $_SESSION["periodo_id"]); +if(!$stmt->execute()){ + header("Location:".$pag."?error=1"); + exit(); +} +$rs = $stmt->fetch(); +$stmt->closeCursor(); +$stmt = null; + +$stmt = $pdo->prepare('Select * from fs_contacto(:usr, 3, NULL)');//3 = correo +$stmt->bindParam(":usr", $rs["Usuario_id"]); +if(!$stmt->execute()){ + header("Location:".$pag."?error=1"); + exit(); +} +$correos_rs = $stmt->fetchAll(); +$stmt->closeCursor(); +$stmt = null; + +$correoList = ""; +foreach($correos_rs as $c){ + if($c.substr("lasallistas.org,mx",0) || $c.substr("lasalle.mx",0)){ + $correoList .= $c.";"; + } +} + +//$correoHTML = "

Se aprobó la reposición para el a las en el salón .

"; +*/ +/* +$log = new LogActividad(); +if($edo == 4){ + $desc_log = "Cancela reposición ID[".$id_repo."] edo[".$edo."]"; + $ok = 2; +}else{ + $desc_log = "Autoriza reposición ID[".$id_repo."] edo[".$edo."] Salon[".(empty($salon)?"":$salon)."]"; + $ok = 0; + if($edo == 3){ + $ok = 1; + //if($correoList!= "") + //Mailer::enviarCorreo($correoList , "Reposición autorizada", $correoHTML); + } +} +$log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log); +*/ +header("Location: ".$pag."?ok=".$ok); +exit(); +?> diff --git a/action/reposicion_delete.php b/action/reposicion_delete.php new file mode 100644 index 0000000..5ba0429 --- /dev/null +++ b/action/reposicion_delete.php @@ -0,0 +1,33 @@ +query('SELECT * from fd_reposicion(:id, :prof)', [":id"=> $id, ":prof"=>$prof]); + $return["ok"] = "La reposición se borró correctamente"; + + }catch(Exception $e){ + $return["error"] = "Ocurrió un error al borrar la reposición."; + } + + +} +echo json_encode($return); +?> diff --git a/action/reposicion_insert.php b/action/reposicion_insert.php new file mode 100644 index 0000000..828f773 --- /dev/null +++ b/action/reposicion_insert.php @@ -0,0 +1,124 @@ + FILTER_FLAG_STRIP_LOW)));//limpia texto +$comentario = trim(htmlspecialchars($_POST["comentario"], ENT_QUOTES, "UTF-8"));//limpia texto + +//-- Obtiene datos de horario regular de clase +$horario_rs = $db->querySingle('SELECT * from fs_horario_basic where id = :hor', + [':hor' => $hor] + ); + +$materia = $horario_rs["materia_id"]; +$gpo = $horario_rs["grupo"]; +$duracion = $horario_rs["duracion_total"]; +$dia = $horario_rs["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')); +$dia_new = date('w', strtotime($fecha_new)); + +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_new, $hora, $materia, "-", $fecha_new, $fecha_fin_new, $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)', + [':prof' => $prof, ':fecha'=>$fecha_falta, ':hora'=>$hora, ':dur'=>$duracion] + )["traslape_profesor_reposicion"]; + if($traslape){ + 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)', + [':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, ':hor' => $hor, + ':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion + ] + ); + }catch(Exception $e){ + header("Location: ".$pag."?error=1"); + exit(); + } + +/* + $log = new LogActividad(); + $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_falta.">".$fecha_new."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]"; + $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/ + + +}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)', + [':f_falta' => $fecha_falta, ':f_nueva' => $fecha_cambio, ':hora_nueva' => $hora, ':hor' => $hor, + ':prof' => $prof, ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula, ':duracion' => $duracion + ] + ); + }catch(Exception $e){ + header("Location: ".$pag."?error=1"); + exit(); + } + + /* + $log = new LogActividad(); + $desc_log = "Inserta reposición nueva ID[".$rs["fi_reposicion"]."] Fechas[".$fecha_cambio.">".$fecha_cambio_nueva."] Periodo[".$_SESSION["periodo_id"]."] Materia[".$materia."] Profesor[".$prof."] Salon[".$salon."] Horario[".$hor."] Alumnos[".$alumnos."]"; + $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log); + */ + +} + +header("Location: ".$pag."?ok=0"); +exit(); +?> diff --git a/action/reposicion_select.php b/action/reposicion_select.php new file mode 100644 index 0000000..846736c --- /dev/null +++ b/action/reposicion_select.php @@ -0,0 +1,64 @@ +tieneAcceso()){ + $return["error"] = "Error! No tienes permisos para realizar esta acción."; +}else*/ if(!isset($_POST["id"])){ + $return["error"] = "Error! No se recibió la información de la reposición."; +}else{ + $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto + + + try{ + $rs = $db->querySingle('SELECT * from fs_reposicion(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL)', + [':id' => $id] + ); + + }catch(Exception $e){ + $return["error"] = "Ocurrió un error al leer los datos de la reposición."; + echo json_encode($return); + } + + + $return["fecha_clase"] = date('d/m/Y', strtotime($rs["fecha_clase"])); + $return["fecha_nueva"] = date('d/m/Y', strtotime($rs["fecha_nueva"])); + $hora_nueva = explode(":",$rs["hora_nueva"]); + $return["hora_ini"] = $hora_nueva[0]; + $return["min_ini"] = $hora_nueva[1]; + $hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]); + $return["hora_fin"] = $hora_nueva_fin[0]; + $return["min_fin"] = $hora_nueva_fin[1]; + $return["duracion"] = $rs["duracion_total"]; + +// $return["carrera"] = $rs["PlanEstudio_desc"]; + $return["horario"] = $rs["horario_id"]; + $return["materia"] = $rs["materia_id"]; + $return["materia_desc"] = $rs["materia_nombre"]; + $return["salon"] = $rs["salon_id"]; + $return["salon_desc"] = $rs["Salon_desc"]=="" ? "-Pendiente-": $rs["Salon_desc"]; + $return["grupo"] = $rs["horario_grupo"]; + $return["profesor"] = $rs["profesor_id"]; + $return["profesor_nombre"] = $rs["profesor_nombre"]; + $return["comentario"] = $rs["descripcion"]; + $return["alumnos"] = $rs["alumnos"]; + $return["tipo"] = $rs["es_reposicion"]; + $return["aula"] = $rs["tipoaula_id"]; + $return["aula_desc"] = $rs["tipoaula_nombre"]; + $return["aula_supervisor"] = $rs["tipoaula_supervisor"]; + $return["dia"] = date('w', strtotime($rs["fecha_clase"])); +} +echo json_encode($return); +?> diff --git a/action/reposicion_update.php b/action/reposicion_update.php new file mode 100644 index 0000000..3a13d2a --- /dev/null +++ b/action/reposicion_update.php @@ -0,0 +1,121 @@ + FILTER_FLAG_STRIP_LOW)));//limpia texto +$fecha = trim(filter_input(INPUT_POST, "fecha_inicial", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto +$fecha_cambio = trim(filter_input(INPUT_POST, "fecha_cambio", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//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 +$prof = $_SESSION["usuario_id"]; +//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(filter_input(INPUT_POST, "comentario", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//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 +$comentario = trim(filter_input(INPUT_POST, "comentario", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto + +$horario_rs = $db->querySingle('SELECT * from fs_horario_basic where id = :hor', + [':hor' => $hor] + ); + +$materia = $horario_rs["materia_id"]; +$gpo = $horario_rs["grupo"]; +$duracion = $horario_rs["duracion_total"]; +$dia = $horario_rs["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')); +$dia_new = date('w', strtotime($fecha_new)); + +echo $fecha_new."
"; +echo $fecha_fin_new."
"; +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)', + [':prof' => $prof, ':fecha'=>$fecha_falta, ':hora'=>$hora, ':dur'=>$duracion] + )["traslape_profesor_reposicion"]; + if($traslape){ + header("Location:".$pag."?error=9"); + exit(); + } + + try{ + $db->query('SELECT * from fu_reposicion(:id, :f_falta, :f_nueva, :hora_nueva, NULL, 1, :desc, :alumnos, true, :aula)', + [':id'=> $id, ':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, + ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula + ] + ); + }catch(Exception $e){ + header("Location: ".$pag."?error=2"); + 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);*/ +}else{ + + try{ + $db->query('SELECT * from fu_reposicion(:id, :f_falta, :f_nueva, :hora_nueva, NULL, 1, :desc, :alumnos, true, :aula)', + [':id'=> $id, ':f_falta' => $fecha_falta, ':f_nueva' => $fecha_new, ':hora_nueva' => $hora, + ':desc' => $comentario, ':alumnos' => $alumnos, ':aula' => $aula + ] + ); + }catch(Exception $e){ + header("Location: ".$pag."?error=2"); + exit(); + } + +} +header("Location: ".$pag); +exit(); +?> diff --git a/alta_de_horario.php b/alta_de_horario.php index 4c88fdc..5e1e4ec 100644 --- a/alta_de_horario.php +++ b/alta_de_horario.php @@ -5,7 +5,7 @@ if (!isset($_SESSION['user'])) $user = unserialize($_SESSION['user']); $user->access(); -if (!$user->admin && in_array($user->acceso, ['r', 'n'])) +if (in_array($user->acceso, ['r', 'n'])) die(header('Location: main.php?error=1')); $user->print_to_log('Consultar: Alta de horario'); diff --git a/auditoria.php b/auditoria.php index 795e134..2d02e62 100644 --- a/auditoria.php +++ b/auditoria.php @@ -23,11 +23,14 @@ $redirect = $_SERVER['PHP_SELF']; include "import/html_header.php"; global $user; - $user->access(); + html_header( "Registro de asistencia - Vicerrectoría Académica", "Sistema de gestión de checador", ); + + + if (!$user->periodo_id) { ?> @@ -54,7 +57,7 @@ -
+
@@ -74,7 +77,8 @@
  • + @click="store.filters.facultad_id = facultad.facultad_id; store.current.page = 1;" + style="white-space: nowrap;"> ( {{facultad.clave_dependencia}} ) {{ facultad.facultad_nombre }}
  • @@ -129,7 +133,7 @@ - @@ -142,7 +146,7 @@
    @@ -164,14 +168,6 @@ {{estado.nombre}} - -
  • - - - Sin registro - -
  • @@ -180,13 +176,20 @@
    @@ -213,20 +216,30 @@
    -
    +
    - -
    - -
    -
    -
    - Loading... +
    +
    +
    - Generando reporte... +
    +
    + Loading... +
    + Generando reporte... +
    +
    +
    + + + + + {{estado.nombre}} +
    @@ -234,19 +247,24 @@ - - + + - + + acceso == 'w') { ?> + + @@ -258,23 +276,19 @@ - - + - + acceso == 'w') { ?> + +
    - - Fecha + Fecha SalónSalón ProfesorHorarioHorario Registro SupervisorJustificar
    {{ registro.registro_fecha_ideal }} {{ registro.salon }} -
    - {{ registro.profesor_clave }} - {{ registro.profesor_nombre }} -
    -
    - -
    +
    + {{ registro.profesor_clave }} + {{ registro.profesor_nombre }} + {{ registro.horario_hora?.slice(0,5) }} - {{ - registro.horario_fin?.slice(0,5) }}{{ registro.horario_hora?.slice(0,5) }} - + {{registro.horario_fin?.slice(0,5) }}
    @@ -285,73 +299,60 @@
    - -
    -
    - Sin registro +
    -
    +
    +
    - {{ registro.usuario_nombre }} + + + + {{ registro.usuario_nombre + }}
    -
    +
    Hora {{ registro.registro_fecha_supervisor?.slice(11,19) }}
    -
    - - - {{ registro.nombre }} - -
    - -
    - Observaciones: - {{registro.comentario?.slice(0, - 25)}}{{registro.comentario.length > 10 ? '...' : ''}} + Observaciones: + {{registro.comentario?.slice(0,25)}}{{registro.comentario.length + > 10 ? '...' : ''}}
    - -
    -
    - -
    -
    - Sin registro -
    -
    - acceso == 'w') { ?> - -
    +
    + +
    +
    -