Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
vor 3 Jahren
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. class Conn {
  3. private $con;
  4. public function __construct() {
  5. $this->con = new SQLite3("/home/pi/raspberry-noaa/panel.db");
  6. }
  7. public function getPasses() {
  8. $today = strtotime(date('Y-m-d', time()));
  9. $query = $this->con->query("SELECT sat_name, is_active,
  10. pass_start, pass_end,
  11. max_elev FROM predict_passes
  12. WHERE (pass_start > $today) ORDER BY
  13. pass_start ASC;");
  14. $passes = [];
  15. $i = 0;
  16. while($row = $query->fetchArray()){
  17. $passes[$i] = $row;
  18. $i++;
  19. }
  20. return $passes;
  21. }
  22. public function totalPages($img_per_page) {
  23. $total_pages = $this->con->querySingle("SELECT count() from decoded_passes;");
  24. return ceil($total_pages/$img_per_page);
  25. }
  26. public function getImages($page, $img_per_page) {
  27. $query = $this->con->prepare("SELECT decoded_passes.id, predict_passes.pass_start,
  28. file_path, sat_type, predict_passes.sat_name, predict_passes.max_elev
  29. FROM decoded_passes INNER JOIN predict_passes
  30. ON predict_passes.pass_start = decoded_passes.pass_start
  31. ORDER BY decoded_passes.pass_start DESC LIMIT ? OFFSET ?;");
  32. $query->bindValue(1, $img_per_page);
  33. $query->bindValue(2, $img_per_page * ($page-1));
  34. $result = $query->execute();
  35. $images = [];
  36. $i = 0;
  37. while($row = $result->fetchArray()){
  38. $images[$i] = $row;
  39. $i++;
  40. }
  41. return $images;
  42. }
  43. public function getEnhacements($id) {
  44. $query = $this->con->prepare('SELECT daylight_pass, sat_type
  45. FROM decoded_passes WHERE id = ?;');
  46. $query->bindValue(1, $id);
  47. $result = $query->execute();
  48. $pass = $result->fetchArray();
  49. switch($pass['sat_type']) {
  50. case 0:
  51. $enhacements = "-122-rectified.jpg";
  52. break;
  53. case 1:
  54. if ($pass['daylight_pass'] == 1) {
  55. $enhacements = ['-ZA.jpg','-MCIR.jpg','-MCIR-precip.jpg','-MSA.jpg','-MSA-precip.jpg','-HVC.jpg','-HVC-precip.jpg','-HVCT.jpg','-HVCT-precip.jpg'];
  56. } else {
  57. $enhacements = ['-ZA.jpg','-MCIR.jpg','-MCIR-precip.jpg'];
  58. }
  59. break;
  60. }
  61. return $enhacements;
  62. }
  63. public function getPath($id) {
  64. $query = $this->con->prepare('SELECT file_path FROM decoded_passes
  65. WHERE id = ?;');
  66. $query->bindValue(1, $id);
  67. $result = $query->execute();
  68. $image = $result->fetchArray();
  69. return $image['file_path'];
  70. }
  71. }
  72. ?>