tieneAcceso()){ $objSesion->terminaSesion(); } $objSesion->validaPeriodoUsuario();//si no tiene periodo manda a main //Obtiene grupos del periodo $stmt = $pdo->prepare('Select * from fs_grupo(NULL, :periodo)'); $stmt->bindParam(":periodo", $_SESSION["periodo_id"]); if(!$stmt->execute()){ header("Location: grupos.php?error=4"); exit(); }else{ $grupos_rs = $stmt->fetchAll(); } $stmt->closeCursor(); if(!is_array($grupos_rs) || count($grupos_rs) == 0){ header("Location: grupos.php?error=5"); exit(); } $pendiente = "Pendiente"; if(isset($_POST["grupo"]) && is_numeric($_POST["grupo"]) && $_POST["grupo"] != ""){ $filter_grupo = filter_input(INPUT_POST, "grupo", FILTER_SANITIZE_NUMBER_INT);//limpia texto if(isset($_POST["filter_fecha"]) && $_POST["filter_fecha"]!= "") $filter_fecha = fechaGuion(trim(filter_input(INPUT_POST, "filter_fecha", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW))));//limpia texto $stmt = $pdo->prepare('Select * from fs_grupo(:grupo, :periodo)'); $stmt->bindParam(":periodo", $_SESSION["periodo_id"]); $stmt->bindParam(":grupo", $filter_grupo); if(!$stmt->execute()){ $errorDesc = "Ocurrió un error al cargar el grupo."; }else{ $grupo_actual_rs = $stmt->fetch(); if(!is_array($grupo_actual_rs) || count($grupo_actual_rs) == 0){ $stmt->closeCursor(); header("Location: grupos.php?error=6"); exit(); } } $stmt->closeCursor(); //Obtiene horario del grupo $stmt = $pdo->prepare('Select * from fs_horariogrupo(:gpo, NULL, false)'); $stmt->bindParam(":gpo", $filter_grupo); if(!$stmt->execute()){ //header("Location: materias.php?error=2"); $errorDesc = "Error al cargar el horario del grupo"; print_r($stmt->errorInfo()); exit(); }else{ $horario_rs = $stmt->fetchAll(); $horaMin = horaMin($horario_rs); $horaMax = horaMax($horario_rs); } $stmt->closeCursor(); } function enBloqueClase($pdo, $hora, $frac, $nivel){ $stmt = $pdo->prepare('Select * from fs_horaclase(:nivel, NULL)'); $stmt->bindParam(":nivel", $nivel); $stmt->execute(); $bloque_rs = $stmt->fetchAll(); $horaFracc = $hora .":". (60/FRACCION_HORA*$frac).":00"; foreach($bloque_rs as $bloque){ if(strtotime($horaFracc) >= strtotime($bloque["HoraClase_inicio"]) && strtotime($horaFracc) < strtotime($bloque["HoraClase_final"])) return "fraccion-sugerida"; } return ""; } ?> APSA - Facultad de Ingeniería
printMenu(); ?>
prepare('Select * from fs_periodo(:periodo, NULL, NULL, true)'); $stmt->bindParam(":periodo", $_SESSION["periodo_id"]); if(!$stmt->execute()){ $errorDesc = "Ocurrió un error al cargar las fechas del periodo"; }else{ $periodo_rs = $stmt->fetch(); } $stmt->closeCursor(); $stmt = null; //--Manejo de errores y mensajes de exito if(isset($_GET["error"]) && is_numeric($_GET["error"])){ switch ($_GET["error"]){ case 0: $errorDesc = "No se reciberon los datos del grupo."; break; case 1: $errorDesc = "Ocurrió un error al insertar los datos del grupo."; break; case 2: $errorDesc = "Ocurrió un error al actualizar los datos del grupo."; break; case 3: $errorDesc = "No tienes permisos para realizar esa acción."; break; } } if(isset($_GET["ok"]) && is_numeric($_GET["ok"])){ switch ($_GET["ok"]){ case 0: $successDesc = "El grupo se guardó correctamente."; break; case 1: $successDesc = "El grupo se actualizó correctamente."; break; } } ?>
Selecciona un grupo
  • " >

Grupo

prepare('Select * from fs_dia(NULL)'); if(!$stmt->execute()){ echo "Error al obtener los días"; print_r($stmt->errorInfo()); } $dias_rs = $stmt->fetchAll(); $stmt->closeCursor(); $stmt = null; $horas_dif = intval(date('H', strtotime($horaMax))) - intval(date('H', strtotime($horaMin))); $hora_ini = date('H', strtotime($horaMin)); $hora_fin = date('H', strtotime($horaMax)); if(intval(date('i', strtotime($horaMax))) != 0) $hora_fin++; /* Definidas en constantes.php HORA_INICIO = 7; HORA_FINAL = 22; FRACCION_HORA = 4;*/ //print_r($horario_rs); ?>

Descargar horarios

".$dia["Dia_desc"].""; } ?>
Hora
:00
"; foreach($dias_rs as $dia){ echo ""; } echo ""; } } ?>
prepare('Select * from fs_horariogrupo(:gpo, NULL, false) order by "Materia_desc", "Dia_id", "Horario_hora"'); $stmt->bindParam(":gpo", $filter_grupo); if(!$stmt->execute()){ //header("Location: materias.php?error=2"); $errorDesc = "Error al cargar el horario del grupo"; print_r($stmt->errorInfo()); exit(); } $horario_materia_rs = $stmt->fetchAll(); $stmt->closeCursor(); $materia_old = -1; $xtpl = new XTemplate('./tpl/horariolista_reporte.tpl.html'); foreach($horario_materia_rs as $horario){ if(intval($horario["Materia_id"]) != $materia_old && $materia_old != -1){ if((isset($filter_fecha) && strtotime($filter_fecha) >= strtotime($horario["fecha_inicial"]) && strtotime($filter_fecha) <= strtotime($horario["fecha_final"]) ) || !isset($filter_fecha)){ $xtpl->parse("main.table"); } } $materia_old = intval($horario["Materia_id"]); $xtpl->assign("MATERIA", $horario["Materia_desc"]); $xtpl->assign("CLAVE", $horario["Materia_clave"]); //----- Carga profesores ---- if($horario["TipoSubmateria_id"] == 0){ $stmt = $pdo->prepare('Select * from fs_profesorhorariogrupo(:id)'); $stmt->bindParam(":id", $horario["HorarioGrupo_id"]); if(!$stmt->execute()){ $t = $stmt->errorInfo(); $errorDesc = "Ocurrió un error al obtener los datos de los profesores ".$t[2]; break; } $profesores_rs = $stmt->fetchAll(); $stmt->closeCursor(); $prof_nombre = ""; if(isset($profesores_rs) && count($profesores_rs) > 0){ $profesores_all = ""; foreach($profesores_rs as $profesor){ $prof_clave = ''.$profesor["Usuario_claveULSA"].' '; $prof_nombre = $profesor["Usuario_apellidos"]." ".$profesor["Usuario_nombre"]; $profesores_all .= $prof_clave.$prof_nombre."
"; } }else{ $profesores_all = $pendiente; } $xtpl->assign("PROFESOR", $profesores_all); }else{//Con submaterias //----- Carga submaterias ---- $stmt = $pdo->prepare('Select * from fs_submateriahorariogrupo(:id)'); $stmt->bindParam(":id", $horario["HorarioGrupo_id"]); if(!$stmt->execute()){ $t = $stmt->errorInfo(); $errorDesc = "Ocurrió un error al obtener los datos de los profesores ".$t[2]; break; } $submaterias_rs = $stmt->fetchAll(); $stmt->closeCursor(); $sub_prof_num = 0; $profesores_all = ""; if(count($submaterias_rs) > 0){ foreach($submaterias_rs as $submateria){ //--- $stmt = $pdo->prepare('Select * from fs_submateriahorariogrupoprofesor(:id,:sub)'); $stmt->bindParam(":id", $horario["HorarioGrupo_id"]); $stmt->bindParam(":sub", $submateria["Submateria_id"]); if(!$stmt->execute()){ $t = $stmt->errorInfo(); $errorDesc = "Ocurrió un error al obtener los datos de los profesores ".$t[2]; break; } $profesores_rs = $stmt->fetchAll(); $stmt->closeCursor(); $sub_prof_num += count($profesores_rs); if(isset($profesores_rs) && count($profesores_rs) > 0){ foreach($profesores_rs as $profesor){ $prof_clave = ''.$profesor["Usuario_claveULSA"].' '; $prof_nombre = $profesor["Usuario_apellidos"]." ".$profesor["Usuario_nombre"]; $profesores_all .= $prof_clave.$prof_nombre."
"; } //$xtpl->assign("PROFESOR", $profesores_all); }/*else{ $xtpl->assign("PROFESOR", $pendiente); }*/ } if($sub_prof_num > 0) $xtpl->assign("PROFESOR", $profesores_all); else $xtpl->assign("PROFESOR", $pendiente); } unset($profesores_rs); }//fin con submaterias $xtpl->assign("DIA", ucfirst(diaNombre($horario["Dia_id"]))); $xtpl->assign("HORAI", date('H:i', strtotime($horario["Horario_hora"]))); $xtpl->assign("HORAF", date('H:i', strtotime($horario["Horario_hora_final"]))); if($horario["TipoSubmateria_id"] == 0){ if($horario["Salon_desc"]!= ""){ if($horario["Salon_desc_larga"] != "") $xtpl->assign("SALON", $horario["Salon_desc"]." (".$horario["Salon_desc_larga"].")"); else $xtpl->assign("SALON", $horario["Salon_desc"]); }else $xtpl->assign("SALON", $pendiente); }else{ $xtpl->assign("SALON", "*Revisa la tabla de materias electivas"); } $xtpl->parse("main.table.row"); }//for each materias if($materia_old != -1){ if((isset($filter_fecha) && strtotime($filter_fecha) >= strtotime($horario["fecha_inicial"]) && strtotime($filter_fecha) <= strtotime($horario["fecha_final"]) ) || !isset($filter_fecha)) $xtpl->parse("main.table"); } $xtpl->parse("main"); $xtpl->out("main"); ?>

Electivas

prepare('Select * from fs_submateriahorariogrupo(:id)'); $stmt->bindParam(":id", $horario["HorarioGrupo_id"]); if(!$stmt->execute()){ $t = $stmt->errorInfo(); $errorDesc = "Ocurrió un error al obtener los datos de los profesores ".$t[2]; break; } $submaterias_rs = $stmt->fetchAll(); $stmt->closeCursor(); $sub_prof_num = 0; $nombre_impreso = false; if(count($submaterias_rs) > 0){ $tiene_submaterias = true; foreach($submaterias_rs as $submateria){ $submateria_text = $submateria["Submateria_desc"]; $dia_hora_text = ucfirst(diaNombre($horario["Dia_id"]))." ".date('H:i', strtotime($horario["Horario_hora"])); $profesores_all = ""; $salon_text = ""; /*$xtpl->assign("SUBMATERIA", $submateria["Submateria_desc"]); $xtpl->assign("DIA", diaNombre($submateria["Dia_id"]));*/ //--- $stmt = $pdo->prepare('Select * from fs_submateriahorariogrupoprofesor(:id,:sub)'); $stmt->bindParam(":id",$horario["HorarioGrupo_id"]); $stmt->bindParam(":sub", $submateria["Submateria_id"]); if(!$stmt->execute()){ $t = $stmt->errorInfo(); $errorDesc = "Ocurrió un error al obtener los datos de los profesores ".$t[2]; break; } $profesores_rs = $stmt->fetchAll(); $stmt->closeCursor(); $sub_prof_num += count($profesores_rs); if(isset($profesores_rs) && count($profesores_rs) > 0){ foreach($profesores_rs as $profesor){ $prof_nombre = ' '.$profesor["Usuario_apellidos"]." ".$profesor["Usuario_nombre"]; $profesores_all .= $prof_nombre."
"; if($profesor["Salon_desc"]){ $salon_text .= $profesor["Salon_desc"]."
"; }else{ $salon_text .= $pendiente."
"; } } //$xtpl->assign("PROFESOR_SUB", $profesores_all); //$xtpl->parse("main.submaterias_block.row.submateria"); /*if(!$nombre_impreso){ $nombre_impreso = true; $xtpl->assign("MAT_ROWSPAN", count($submaterias_rs)); $xtpl->parse("main.submaterias_block.row.materia"); }*/ $row = array(); $row["id"] = $submateria["Submateria_id"]; $row["materia"] = $submateria_text; $row["dia"] = $dia_hora_text; $row["profesores"] = $profesores_all; $row["salon"] = $salon_text; $tabla_electivas[] = $row; //$xtpl->parse("main.submaterias_block.row"); }//se pinta sólo si tiene profesor } }//hay submaterias }//fin if } if(count($tabla_electivas) > 0){ //Ordena arreglo asociativo usort($tabla_electivas, function($a, $b) { return $a['materia'] <=> $b['materia']; }); //Pinta arreglo ordenado foreach($tabla_electivas as $row){ ?>
MateriaHorarioSalónProfesores