reposicion_select.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. if($user->rol["rol_id"] == 7){//es supervisor
  20. $rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, :sup)',
  21. [':id' => $id, ':sup'=>$user->user["id"]]
  22. );
  23. }else{//coordinador
  24. $rs = $db->querySingle('SELECT * from fs_reposicion_solicitud(:id, :fac, NULL, NULL, NULL, NULL, NULL, NULL, null)',
  25. [':id' => $id, ":fac"=>$user->facultad["facultad_id"] ]
  26. );
  27. }
  28. }catch(Exception $e){
  29. $return["error"] = "Ocurrió un error al leer los datos de la reposición.";
  30. echo json_encode($return);
  31. exit();
  32. }
  33. $return["fecha_clase"] = date('d/m/Y', strtotime($rs["fecha_clase"]));
  34. $return["fecha_nueva"] = date('d/m/Y', strtotime($rs["fecha_nueva"]));
  35. $hora_nueva = explode(":",$rs["hora_nueva"]);
  36. $return["hora_ini"] = $hora_nueva[0];
  37. $return["min_ini"] = $hora_nueva[1];
  38. $hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]);
  39. $return["hora_fin"] = $hora_nueva_fin[0];
  40. $return["min_fin"] = $hora_nueva_fin[1];
  41. $return["duracion"] = $rs["duracion_interval"];
  42. // $return["carrera"] = $rs["PlanEstudio_desc"];
  43. $return["horario"] = $rs["horario_id"];
  44. $return["materia"] = $rs["materia_id"];
  45. $return["materia_desc"] = $rs["materia_nombre"];
  46. $return["salon"] = $rs["salon_id"];
  47. if($rs["salon_id"]==""){
  48. $return["salon_desc"] = "Pendiente";
  49. }else{
  50. $salon_json = json_decode($rs["salon_array"], true);
  51. if($salon_json[0]== "UNIVERSIDAD LA SALLE"){
  52. unset($salon_json[0]);
  53. }
  54. $return["salon_desc"] = join(" / ",$salon_json);
  55. }
  56. //$return["salon_desc"] = $rs["salon"]=="" ? "-Pendiente-": $rs["salon"];
  57. $return["ciclo"] = $rs["ciclo"];
  58. $return["bloque"] = $rs["bloque"];
  59. $return["profesor"] = $rs["profesor_id"];
  60. $return["profesor_nombre"] = $rs["profesor_nombre"];
  61. $return["comentario"] = $rs["descripcion"];
  62. $return["alumnos"] = $rs["alumnos"];
  63. $return["tipo"] = $rs["es_reposicion"];
  64. $return["aula"] = $rs["tipoaula_id"];
  65. $return["aula_desc"] = $rs["tipoaula_nombre"];
  66. $return["aula_supervisor"] = $rs["tipoaula_supervisor"];
  67. $return["dia"] = date('w', strtotime($rs["fecha_clase"]));
  68. $return["motivo_cancelacion"] = $rs["motivo_cancelacion"];
  69. $return["estado"] = $rs["estado_reposicion_id"];
  70. $return["facultad"] = $rs["facultad_nombre"];
  71. $return["carrera"] = $rs["carrera_nombre"];
  72. $return["grupo"] = $rs["horario_grupo"];
  73. $return["supervisor_nombre"] = $rs["supervisor_nombre"];
  74. }
  75. echo json_encode($return);
  76. ?>