From 06ceb9183ba498e92352cfb49741a631f60acd06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 13 Jul 2026 13:18:56 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A4mmerungsgrafik=20als=20Jahresansicht=20h?= =?UTF-8?q?inzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/auth_helpers.php | 1 + public/daemmerungszeiten.php | 1614 ++++++++++++++++++++++++++++++++++ public/header.php | 1 + 3 files changed, 1616 insertions(+) create mode 100644 public/daemmerungszeiten.php diff --git a/public/auth_helpers.php b/public/auth_helpers.php index a537259..abdba8c 100644 --- a/public/auth_helpers.php +++ b/public/auth_helpers.php @@ -122,6 +122,7 @@ function manageablePublicPages(): array 'mars.php' => 'Mars', 'jupitersystem.php' => 'Jupitersystem', 'tagbogen.php' => 'Tagbogen', + 'daemmerungszeiten.php' => 'Dämmerungszeiten', 'sternenhimmel.php' => 'Sternenhimmel', 'drehbare_sternkarte.php' => 'Drehbare Sternkarte', 'meteorshowers.php' => 'Meteorströme', diff --git a/public/daemmerungszeiten.php b/public/daemmerungszeiten.php new file mode 100644 index 0000000..2ded712 --- /dev/null +++ b/public/daemmerungszeiten.php @@ -0,0 +1,1614 @@ + PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + ]); + + $locationStmt = $pdo->prepare( + "SELECT id, name, latitude, longitude, elevation, timezone, is_default + FROM app_user_locations + WHERE user_id = ? + ORDER BY is_default DESC, name ASC, id ASC" + ); + $locationStmt->execute([(int) $_SESSION['user_id']]); + + while ($row = $locationStmt->fetch()) { + if ($row['latitude'] === null || $row['longitude'] === null) { + continue; + } + + $availableLocations[] = [ + 'id' => $row['id'] !== null ? (int) $row['id'] : null, + 'name' => trim((string) ($row['name'] ?? 'Standort')), + 'latitude' => (float) $row['latitude'], + 'longitude' => (float) $row['longitude'], + 'elevation' => $row['elevation'] !== null ? (float) $row['elevation'] : 0.0, + 'timezone' => trim((string) ($row['timezone'] ?? 'Europe/Berlin')), + 'is_default' => !empty($row['is_default']), + ]; + } + } catch (Throwable $e) { + $availableLocations = []; + $pdo = null; + } +} + +require __DIR__ . '/header.php'; + +$initialLocation = [ + 'id' => isset($currentLocation['id']) ? (int) $currentLocation['id'] : null, + 'name' => $currentLocation['name'] ?? 'Sternwarte Sonneberg', + 'latitude' => isset($currentLocation['latitude']) ? (float) $currentLocation['latitude'] : 50.3597, + 'longitude' => isset($currentLocation['longitude']) ? (float) $currentLocation['longitude'] : 11.1907, + 'timezone' => $currentLocation['timezone'] ?? 'Europe/Berlin', +]; + +if (!$availableLocations) { + $availableLocations[] = [ + 'id' => $initialLocation['id'], + 'name' => $initialLocation['name'], + 'latitude' => $initialLocation['latitude'], + 'longitude' => $initialLocation['longitude'], + 'elevation' => isset($currentLocation['elevation']) && $currentLocation['elevation'] !== null ? (float) $currentLocation['elevation'] : 0.0, + 'timezone' => $initialLocation['timezone'], + 'is_default' => true, + ]; +} +?> + + + + + +
+
+
+

Standort und Jahr

+

+ Die Grafik zeigt jeden Tag des gewählten Jahres als senkrechte Spur. Von oben nach unten läuft die lokale Uhrzeit des Standorts, farblich getrennt nach Nacht, astronomischer, nautischer und bürgerlicher Dämmerung sowie Tag. +

+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + + +
+ + + + + + + + + + + + +
+ +
+

Aktuelle Auswertung

+
+
+
Standort
+
-
+
+
+
Zeitzone
+
-
+
+
+
Längster Tag
+
-
+
+
+
Längste astronomische Nacht
+
-
+
+
+
+
+ +
+
+
+

Dämmerungsgrafik

+
Berechnung läuft für den gewählten Standort.
+
+
Initialisiere …
+
+ +
+ +
+
+ +
+
+
+ + + + diff --git a/public/header.php b/public/header.php index 50b0d6c..0f306a1 100644 --- a/public/header.php +++ b/public/header.php @@ -167,6 +167,7 @@ $menuGroups = [ ['href' => 'drehbare_sternkarte.php', 'label' => 'Drehbare Sternkarte'], ['href' => 'satellitenhimmel.php', 'label' => 'Satellitenhimmel'], ['href' => 'tagbogen.php', 'label' => 'Tagbogen'], + ['href' => 'daemmerungszeiten.php', 'label' => 'Dämmerungszeiten'], ['href' => 'meteorshowers.php', 'label' => 'Meteorströme'], ['href' => 'comets.php', 'label' => 'Kometen'], ],