prepare('Select "Periodo_id", "Periodo_desc" from "Periodo" WHERE "Nivel_id" = :nivel AND "EstadoPeriodo_id" != 2 AND "Periodo_calendario_activo" = true'); $stmt->bindParam(":nivel", $nivel); if(!$stmt->execute()){ echo "Error al obtener los periodos activos."; exit(); }else{ $periodo_rs = $stmt->fetch(); if(!is_array($periodo_rs) || count($periodo_rs) == 0){ unset($periodo_rs); } } $stmt->closeCursor(); //Obtiene grupos del periodo if(isset($periodo_rs)){ $stmt = $pdo->prepare('Select * from fs_grupo(NULL, :periodo)'); $stmt->bindParam(":periodo", $periodo_rs["Periodo_id"]); if(!$stmt->execute()){ echo "Error al obtener los grupos."; exit(); }else{ $grupos_rs = $stmt->fetchAll(); } $stmt->closeCursor(); } $pendiente = "Pendiente"; if(isset($periodo_rs) && 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", $periodo_rs["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: consulta_horario.php"); 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(); } }else{//no existe nivel $stmt = $pdo->prepare('Select * from fs_nivel(NULL)'); if(!$stmt->execute()){ echo "Error al obtener los niveles."; exit(); }else{ $nivel_rs = $stmt->fetchAll(); } $stmt->closeCursor(); } ?> Horarios - Facultad de Ingeniería
horarios

No hay horarios para mostrar.

Horarios de

No hay horarios para mostrar.

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;*/ ?>
".$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_nombre = $profesor["Usuario_apellidos"]." ".$profesor["Usuario_nombre"]; $profesores_all .= $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_nombre = $profesor["Usuario_apellidos"]." ".$profesor["Usuario_nombre"]; $profesores_all .= $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["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); $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($submateria["Dia_id"]))." ".date('H:i', strtotime($horario["Horario_hora"])); $profesores_all = ""; $salon_text = ""; //--- $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 = $ICO["profesor"].$profesor["Usuario_apellidos"]." ".$profesor["Usuario_nombre"]; $profesores_all .= $prof_nombre."
"; } //$xtpl->assign("PROFESOR_SUB", $profesores_all); if($submateria["Salon_desc"]){ $salon_text = $submateria["Salon_desc"]; }else{ $salon_text = $pendiente; } ?> parse("main.submaterias_block.row"); }//se pinta sólo si tiene profesor } }//hay submaterias }//fin if } unset($profesores_rs); ?>
MateriaHorarioProfesoresSalón