getError(); if ($error) { return false; } $pass = utf8_decode($pass); $result = $client->call("valida_user_addo", array($user, $pass)); if ($client->fault) { return false; } else { $error = $client->getError(); if ($error) { return false; } else { if($result) return 1; else return 0; } } } if (isset($_COOKIE[COOKIE_N])){ $usr_id = intval(desencripta($_COOKIE[COOKIE_N])); $stmt = $pdo->prepare('Select * from fs_usuario(:usr)'); $stmt->bindParam(":usr", $usr_id); if(!$stmt->execute()){ //print_r($stmt->errorInfo()); header("Location: ../index.php?error=2"); exit(); } $auth=true; $usr_rs = $stmt->fetch();//Devuelve sólo 1 resultado $stmt->closeCursor(); // cierra conexion de resultado $stmt = null; // cierra conexion $usr_nombre = $usr_rs["Usuario_nombre"]." ".$usr_rs["Usuario_apellidos"]; $usr_cve = $usr_rs["Usuario_claveULSA"]; unset($usr_rs); } if($auth && !empty($usr_id)){ //Buscar las materias que puede checar $error = false; //$fecha = '2021-03-08';//17 //$hora = '08:45'; $fecha = date("Y-m-d"); $hora = date("H:i"); $esProf = false; $esAdmin = false; $asistRegistrada = false; $msg = 0; $fecha_hora = $fecha." ".$hora; $hasAsistencia = false; //Arrelo para guardar los resultados de las validaciones $asistenciasArr = array( "asistencia" => array("profesor"=>array(), "administrativo"=>array()), "retardo" => array("profesor"=>array(), "administrativo"=>array()) ); //--Profesor LICENCIATURA if(!$error){ //Lee asistencias $stmt = $pdo->prepare('Select * from fs_asistenciaprofesor_busca(:fecha, :hora, :usr, -30, 16, 1)');//Limite inferior es incluyente, limite superior excluyente $stmt->bindParam(":usr", $usr_id); $stmt->bindParam(":fecha", $fecha); $stmt->bindParam(":hora", $hora); if(!$stmt->execute()){ //$t = $stmt->errorInfo(); $errorDesc = "No se pudieron leer los horarios."; $error = true; }else{ $esProf = true; $rs = $stmt->fetchAll(); if(count($rs) > 0) $hasAsistencia = true; $asistenciasArr["asistencia"]["profesor"] = array_merge($asistenciasArr["asistencia"]["profesor"], $rs); } $stmt->closeCursor(); } if(!$error){ //Lee retardos $stmt = $pdo->prepare('Select * from fs_asistenciaprofesor_busca(:fecha, :hora, :usr, 16, 31, 1)');//Limite inferior es incluyente, limite superior excluyente $stmt->bindParam(":usr", $usr_id); $stmt->bindParam(":fecha", $fecha); $stmt->bindParam(":hora", $hora); if(!$stmt->execute()){ //$t = $stmt->errorInfo(); $errorDesc = "No se pudieron leer los horarios. "; $error = true; }else{ $esProf = true; $rs = $stmt->fetchAll(); if(count($rs) > 0) $hasAsistencia = true; $asistenciasArr["retardo"]["profesor"] = array_merge($asistenciasArr["retardo"]["profesor"], $rs); } $stmt->closeCursor(); } //--Profesor POSGRADO if(!$error){ //Lee asistencias $stmt = $pdo->prepare('Select * from fs_asistenciaprofesor_busca(:fecha, :hora, :usr, -60, 10, 2)');//Limite inferior es incluyente, limite superior excluyente $stmt->bindParam(":usr", $usr_id); $stmt->bindParam(":fecha", $fecha); $stmt->bindParam(":hora", $hora); if(!$stmt->execute()){ //$t = $stmt->errorInfo(); $errorDesc = "No se pudieron leer los horarios. "; $error = true; }else{ $esProf = true; $rs = $stmt->fetchAll(); if(count($rs) > 0) $hasAsistencia = true; $asistenciasArr["asistencia"]["profesor"] = array_merge($asistenciasArr["asistencia"]["profesor"], $rs); } $stmt->closeCursor(); } if(!$error){ //Lee retardos $stmt = $pdo->prepare('Select * from fs_asistenciaprofesor_busca(:fecha, :hora, :usr, 10, 31, 2)');//Limite inferior es incluyente, limite superior excluyente $stmt->bindParam(":usr", $usr_id); $stmt->bindParam(":fecha", $fecha); $stmt->bindParam(":hora", $hora); if(!$stmt->execute()){ //$t = $stmt->errorInfo(); $errorDesc = "No se pudieron leer los horarios. "; $error = true; }else{ $esProf = true; $rs = $stmt->fetchAll(); if(count($rs) > 0) $hasAsistencia = true; $asistenciasArr["retardo"]["profesor"] = array_merge($asistenciasArr["retardo"]["profesor"], $rs); } $stmt->closeCursor(); } //--Administrativo if(!$error){ //Lee avisos de hoy $avisoArr = array(); $stmt = $pdo->prepare('Select * from fs_avisochecador(:usr, :fecha)'); $stmt->bindParam(":usr", $usr_id); $stmt->bindParam(":fecha", $fecha); if($stmt->execute()){ $aviso_rs = $stmt->fetchAll(); foreach($aviso_rs as $aviso){ $avisoArr[] = $aviso["Aviso_texto"]; } }else{ $t = $stmt->errorInfo(); $errorDesc = "No se pudieron obtener los avisos".$t[2]; } $stmt->closeCursor(); //Lee asistencias /*$stmt = $pdo->prepare('Select * from fs_asistenciaadministrativo_busca(:fecha, :hora, :usr)');//Limite inferior es incluyente, limite superior excluyente $stmt->bindParam(":usr", $usr_id); $stmt->bindParam(":fecha", $fecha); $stmt->bindParam(":hora", $hora); if(!$stmt->execute()){ $t = $stmt->errorInfo(); $errorDesc = "No se pudieron leer los horarios administrativos. "; $error = true; }else{ $esAdmin = true; $rs = $stmt->fetchAll(); if(count($rs) > 0) $hasAsistencia = true; $asistenciasArr["asistencia"]["administrativo"] = array_merge($asistenciasArr["asistencia"]["administrativo"], $rs); } $stmt->closeCursor();*/ } //Profesor Lic $registradasArr = null; $registradasArr = array(); $stmt = $pdo->prepare('Select * from fs_asistenciaprofesor_registrada(:fecha, :hora, :usr, -30, 31, 1)');//Limite inferior es incluyente, limite superior excluyente $stmt->bindParam(":usr", $usr_id); $stmt->bindParam(":fecha", $fecha); $stmt->bindParam(":hora", $hora); if(!$stmt->execute()){ //$t = $stmt->errorInfo(); $resultMsg = "No se pudieron leer los horarios."; $error = true; }else{ $rs = $stmt->fetchAll(); foreach($rs as $row){ $salon = ""; if(isset($row["Salon_desc"])){//para profesores if($row["Salon_desc_larga"]!= ""){ $salon = $row["Salon_desc"]." (".$row["Salon_desc_larga"].")"; }else{ $salon = $row["Salon_desc"]; } } $registradasArr[]= array("salon"=>$salon, "hora"=>$row["Horario_hora"], "hora_inicio"=>substr($row["Horario_hora"], 0, 5), "tipo"=>1, "fecha"=>$row["Fecha"], "retardo"=>$row["Asistencia_isRetardo"], "materia"=>$row["Materia_desc"], "grupo"=>$row["Grupo_desc"]." ".$row["Carrera_prefijo"]); } } $stmt->closeCursor(); //Profesor Posgrado $stmt = $pdo->prepare('Select * from fs_asistenciaprofesor_registrada(:fecha, :hora, :usr, -60, 31, 2)');//Limite inferior es incluyente, limite superior excluyente $stmt->bindParam(":usr", $usr_id); $stmt->bindParam(":fecha", $fecha); $stmt->bindParam(":hora", $hora); if(!$stmt->execute()){ //$t = $stmt->errorInfo(); $resultMsg = "No se pudieron leer los horarios."; $error = true; }else{ $rs = $stmt->fetchAll(); foreach($rs as $row){ $salon = ""; if(isset($row["Salon_desc"])){//para profesores if($row["Salon_desc_larga"]!= ""){ $salon = $row["Salon_desc"]." (".$row["Salon_desc_larga"].")"; }else{ $salon = $row["Salon_desc"]; } } $registradasArr[]= array("salon"=>$salon, "hora"=>$row["Asistencia_hora"], "hora_inicio"=>substr($row["Horario_hora"], 0, 5), "tipo"=>1, "fecha"=>$row["Fecha"], "retardo"=>$row["Asistencia_isRetardo"], "materia"=>$row["Materia_desc"], "grupo"=>$row["Grupo_desc"]." ".$row["Carrera_prefijo"]); } } $stmt->closeCursor(); } function imprimeRegistro($grupo, $materia, $hora, $salon){ $salon = (!empty($salon)) ? "Salón: $salon" : ""; $grupo = (!empty($grupo)) ? $grupo : ""; echo "
Hora: $hora
$salon
Hora: $hora
$salon
Facultad de Ingeniería
Verifique que la clave 000 sea correcta.
Por el momento la conexión a internet está fallando, por favor inténtelo más tarde.
-