action_estado_supervisor.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?
  2. #input $_GET['id_espacio_sgu']
  3. define("INFORMATION", [
  4. 'GET' => [
  5. ],
  6. ]);
  7. #output rutas: [ ...ruta, salones: [{...salon}] ]
  8. header('Content-Type: application/json charset=utf-8');
  9. #return html
  10. $ruta = "../";
  11. require_once "../class/c_login.php";
  12. // check method
  13. try {
  14. if ($_SERVER['REQUEST_METHOD'] === 'GET') {
  15. // check parameters
  16. $raw = file_get_contents('php://input');
  17. $post_get = json_decode($raw, true);
  18. $data = $db->get('estado_supervisor');
  19. echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
  20. } else {
  21. http_response_code(405);
  22. echo json_encode(['error' => 'method not allowed']);
  23. exit;
  24. }
  25. } catch (PDOException $th) {
  26. http_response_code(500);
  27. echo json_encode([
  28. 'error' => $th->getMessage(),
  29. 'query' => $db->getLastQuery(),
  30. 'post_data' => $post_get,
  31. ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
  32. exit;
  33. } catch (Exception $th) {
  34. http_response_code(500);
  35. echo json_encode([
  36. 'error' => $th->getMessage(),
  37. ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
  38. exit;
  39. }