Verbessere Sichtbarkeitsfarben der Planeten auf der Startseite
This commit is contained in:
+20
-2
@@ -106,18 +106,23 @@ if (!function_exists('planetVisibilityClass')) {
|
|||||||
|
|
||||||
$astroDusk = eventDateTime($ev['astro_dusk'] ?? []);
|
$astroDusk = eventDateTime($ev['astro_dusk'] ?? []);
|
||||||
$astroDawnNext = eventDateTime($evNext['astro_dawn'] ?? []);
|
$astroDawnNext = eventDateTime($evNext['astro_dawn'] ?? []);
|
||||||
|
$nauticalDusk = eventDateTime($ev['nautical_dusk'] ?? []);
|
||||||
$civilDusk = eventDateTime($ev['civil_dusk'] ?? []);
|
$civilDusk = eventDateTime($ev['civil_dusk'] ?? []);
|
||||||
|
$nauticalDawnNext = eventDateTime($evNext['nautical_dawn'] ?? []);
|
||||||
$civilDawnNext = eventDateTime($evNext['civil_dawn'] ?? []);
|
$civilDawnNext = eventDateTime($evNext['civil_dawn'] ?? []);
|
||||||
|
|
||||||
$nightSeconds = 0;
|
$nightSeconds = 0;
|
||||||
|
$nauticalSeconds = 0;
|
||||||
$twilightSeconds = 0;
|
$twilightSeconds = 0;
|
||||||
$visibleSeconds = 0;
|
$visibleSeconds = 0;
|
||||||
|
|
||||||
foreach ($intervals as [$from, $to]) {
|
foreach ($intervals as [$from, $to]) {
|
||||||
$visibleSeconds += intervalDurationSeconds($from, $to);
|
$visibleSeconds += intervalDurationSeconds($from, $to);
|
||||||
$nightSeconds += intervalOverlapSeconds($from, $to, $astroDusk, $astroDawnNext);
|
$nightSeconds += intervalOverlapSeconds($from, $to, $astroDusk, $astroDawnNext);
|
||||||
$twilightSeconds += intervalOverlapSeconds($from, $to, $civilDusk, $astroDusk);
|
$nauticalSeconds += intervalOverlapSeconds($from, $to, $nauticalDusk, $astroDusk);
|
||||||
$twilightSeconds += intervalOverlapSeconds($from, $to, $astroDawnNext, $civilDawnNext);
|
$nauticalSeconds += intervalOverlapSeconds($from, $to, $astroDawnNext, $nauticalDawnNext);
|
||||||
|
$twilightSeconds += intervalOverlapSeconds($from, $to, $civilDusk, $nauticalDusk);
|
||||||
|
$twilightSeconds += intervalOverlapSeconds($from, $to, $nauticalDawnNext, $civilDawnNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($visibleSeconds <= 0) {
|
if ($visibleSeconds <= 0) {
|
||||||
@@ -125,11 +130,24 @@ if (!function_exists('planetVisibilityClass')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$nightRatio = $nightSeconds / $visibleSeconds;
|
$nightRatio = $nightSeconds / $visibleSeconds;
|
||||||
|
$darkRatio = ($nightSeconds + $nauticalSeconds) / $visibleSeconds;
|
||||||
|
|
||||||
if ($nightSeconds >= 3600 && $nightRatio >= 0.35) {
|
if ($nightSeconds >= 3600 && $nightRatio >= 0.35) {
|
||||||
return ['class' => 'planet-visibility-good', 'label' => 'nachts gut sichtbar'];
|
return ['class' => 'planet-visibility-good', 'label' => 'nachts gut sichtbar'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (($nightSeconds + $nauticalSeconds) >= 5400 && $darkRatio >= 0.35) {
|
||||||
|
return ['class' => 'planet-visibility-good', 'label' => 'in dunkler Daemmerung gut sichtbar'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($nightSeconds > 0) {
|
||||||
|
return ['class' => 'planet-visibility-warn', 'label' => 'nur teilweise in der astronomischen Nacht'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($nauticalSeconds > 0) {
|
||||||
|
return ['class' => 'planet-visibility-warn', 'label' => 'nur in nautischer Daemmerung sichtbar'];
|
||||||
|
}
|
||||||
|
|
||||||
if (($nightSeconds + $twilightSeconds) > 0) {
|
if (($nightSeconds + $twilightSeconds) > 0) {
|
||||||
return ['class' => 'planet-visibility-warn', 'label' => 'nur teilweise nachts / in der Dämmerung'];
|
return ['class' => 'planet-visibility-warn', 'label' => 'nur teilweise nachts / in der Dämmerung'];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user