reposicion_select.php 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /*
  3. * Obtiene datos de reposición
  4. */
  5. $ruta = "../";
  6. require_once "../class/c_login.php";
  7. // check if the session is started
  8. if (!isset($_SESSION['user']))
  9. die('No se ha iniciado sesión');
  10. $user = unserialize($_SESSION['user']);
  11. //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
  12. /*if(!$objSesion->tieneAcceso()){
  13. $return["error"] = "Error! No tienes permisos para realizar esta acción.";
  14. }else*/ if(!isset($_POST["id"])){
  15. $return["error"] = "Error! No se recibió la información de la reposición.";
  16. }else{
  17. $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
  18. try{
  19. $rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)',
  20. [':id' => $id]
  21. );
  22. /*if($user->rol["rol_id"] == 7){//es supervisor
  23. $rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, :sup)',
  24. [':id' => $id, ':sup'=>$user->user["id"]]
  25. );
  26. }else{//coordinador
  27. $rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, :fac, NULL, NULL, NULL, NULL, NULL, NULL, null)',
  28. [':id' => $id, ":fac"=>$user->facultad["facultad_id"] ]
  29. );
  30. }*/
  31. }catch(Exception $e){
  32. $return["error"] = "Ocurrió un error al leer los datos de la reposición.";
  33. echo json_encode($return);
  34. exit();
  35. }
  36. $return["fecha_clase"] = date('d/m/Y', strtotime($rs["fecha_clase"]));
  37. $return["fecha_nueva"] = date('d/m/Y', strtotime($rs["fecha_nueva"]));
  38. $hora_nueva = explode(":",$rs["hora_nueva"]);
  39. $return["hora_ini"] = $hora_nueva[0];
  40. $return["min_ini"] = $hora_nueva[1];
  41. $hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]);
  42. $return["hora_fin"] = $hora_nueva_fin[0];
  43. $return["min_fin"] = $hora_nueva_fin[1];
  44. $return["duracion"] = $rs["duracion_interval"];
  45. // $return["carrera"] = $rs["PlanEstudio_desc"];
  46. $return["horario"] = $rs["horario_id"];
  47. $return["materia"] = $rs["materia_id"];
  48. $return["materia_desc"] = $rs["materia_nombre"];
  49. $return["salon"] = $rs["salon_id"];
  50. if($rs["salon_id"]==""){
  51. $return["salon_desc"] = "Pendiente";
  52. }else{
  53. $salon_json = json_decode($rs["salon_array"], true);
  54. if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
  55. unset($salon_json[0]);
  56. }
  57. $return["salon_desc"] = join(" / ",$salon_json);
  58. }
  59. //$return["salon_desc"] = $rs["salon"]=="" ? "-Pendiente-": $rs["salon"];
  60. $return["ciclo"] = $rs["ciclo"];
  61. $return["bloque"] = $rs["bloque"];
  62. $return["profesor"] = $rs["profesor_id"];
  63. $return["profesor_nombre"] = $rs["profesor_nombre"];
  64. $return["comentario"] = $rs["descripcion"];
  65. $return["alumnos"] = $rs["alumnos"];
  66. $return["tipo"] = $rs["es_reposicion"];
  67. $return["aula"] = $rs["tipoaula_id"];
  68. $return["aula_desc"] = $rs["tipoaula_nombre"];
  69. $return["aula_supervisor"] = $rs["tipoaula_supervisor"];
  70. $return["dia"] = date('w', strtotime($rs["fecha_clase"]));
  71. $return["motivo_cancelacion"] = $rs["motivo_cancelacion"];
  72. $return["estado"] = $rs["estado_reposicion_id"];
  73. $return["facultad"] = $rs["facultad_nombre"];
  74. $return["carrera"] = $rs["carrera_comun"]? $rs["carrera_nombre"]: ($rs["horario_carrera"]==""?$rs["carrera_nombre"]:$rs["horario_carrera"]);//si es común, se muestra la carrera de la materia, si no, la carrera del horario
  75. $return["grupo"] = $rs["horario_grupo"];
  76. $return["supervisor_nombre"] = $rs["supervisor_nombre"];
  77. }
  78. echo json_encode($return);
  79. ?>