reposicion_select.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. $user = Login::get_user();
  9. //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
  10. /*if(!$objSesion->tieneAcceso()){
  11. $return["error"] = "Error! No tienes permisos para realizar esta acción.";
  12. }else*/ if(!isset($_POST["id"])){
  13. $return["error"] = "Error! No se recibió la información de la reposición.";
  14. }else{
  15. $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
  16. try{
  17. $rs = $db->querySingle('SELECT * from fs_reposicion(:id, NULL, NULL, NULL, NULL, NULL, NULL, NULL)',
  18. [':id' => $id]
  19. );
  20. }catch(Exception $e){
  21. $return["error"] = "Ocurrió un error al leer los datos de la reposición.";
  22. echo json_encode($return);
  23. }
  24. $return["fecha_clase"] = date('d/m/Y', strtotime($rs["fecha_clase"]));
  25. $return["fecha_nueva"] = date('d/m/Y', strtotime($rs["fecha_nueva"]));
  26. $hora_nueva = explode(":",$rs["hora_nueva"]);
  27. $return["hora_ini"] = $hora_nueva[0];
  28. $return["min_ini"] = $hora_nueva[1];
  29. $hora_nueva_fin = explode(":",$rs["hora_nueva_fin"]);
  30. $return["hora_fin"] = $hora_nueva_fin[0];
  31. $return["min_fin"] = $hora_nueva_fin[1];
  32. $return["duracion"] = $rs["duracion_total"];
  33. // $return["carrera"] = $rs["PlanEstudio_desc"];
  34. $return["horario"] = $rs["horario_id"];
  35. $return["materia"] = $rs["materia_id"];
  36. $return["materia_desc"] = $rs["materia_nombre"];
  37. $return["salon"] = $rs["salon_id"];
  38. $return["salon_desc"] = $rs["Salon_desc"]=="" ? "-Pendiente-": $rs["Salon_desc"];
  39. $return["grupo"] = $rs["horario_grupo"];
  40. $return["profesor"] = $rs["profesor_id"];
  41. $return["profesor_nombre"] = $rs["profesor_nombre"];
  42. $return["comentario"] = $rs["descripcion"];
  43. $return["alumnos"] = $rs["alumnos"];
  44. $return["tipo"] = $rs["es_reposicion"];
  45. $return["aula"] = $rs["tipoaula_id"];
  46. $return["aula_desc"] = $rs["tipoaula_nombre"];
  47. $return["aula_supervisor"] = $rs["tipoaula_supervisor"];
  48. $return["dia"] = date('w', strtotime($rs["fecha_clase"]));
  49. }
  50. echo json_encode($return);
  51. ?>