Monatsvorhersage erst nach button
This commit is contained in:
@@ -11,6 +11,7 @@ $publicBasePath = './';
|
|||||||
$currentYear = (int) date('Y');
|
$currentYear = (int) date('Y');
|
||||||
$selectedYear = isset($_GET['year']) ? (int) $_GET['year'] : $currentYear;
|
$selectedYear = isset($_GET['year']) ? (int) $_GET['year'] : $currentYear;
|
||||||
$selectedMonth = isset($_GET['month']) ? max(1, min(12, (int) $_GET['month'])) : (int) date('n');
|
$selectedMonth = isset($_GET['month']) ? max(1, min(12, (int) $_GET['month'])) : (int) date('n');
|
||||||
|
$shouldRunForecast = isset($_GET['run']) && $_GET['run'] === '1';
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Bereits berechnete Bausteine der Monatsvorschau
|
// Bereits berechnete Bausteine der Monatsvorschau
|
||||||
@@ -241,6 +242,25 @@ $seasonChanges = [];
|
|||||||
$timeChanges = [];
|
$timeChanges = [];
|
||||||
$monthEventList = [];
|
$monthEventList = [];
|
||||||
$starDataError = null;
|
$starDataError = null;
|
||||||
|
$monthNarrativeText = '';
|
||||||
|
$observationTipInsertSql = '';
|
||||||
|
$observationTipCalendarIcs = '';
|
||||||
|
$chartConfig = null;
|
||||||
|
$chartConfigJson = 'null';
|
||||||
|
$starDataJson = '[]';
|
||||||
|
$lineStarDataJson = '[]';
|
||||||
|
$constellationLinesJson = '[]';
|
||||||
|
$messierDataJson = '[]';
|
||||||
|
$planetDataJson = '[]';
|
||||||
|
$moonDataJson = 'null';
|
||||||
|
$monthChartCometsJson = '[]';
|
||||||
|
$moonPhaseEventsJson = '[]';
|
||||||
|
$starDataErrorJson = 'null';
|
||||||
|
$observationTipCalendarIcsJson = '""';
|
||||||
|
$observationTipCalendarFilenameJson = json_encode(
|
||||||
|
sprintf('astrotools-monatsereignisse-%04d-%02d.ics', $selectedYear, $selectedMonth),
|
||||||
|
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES
|
||||||
|
);
|
||||||
|
|
||||||
if (!function_exists('buildMonthOccultationStarLabel')) {
|
if (!function_exists('buildMonthOccultationStarLabel')) {
|
||||||
function buildMonthOccultationStarLabel(array $row): string
|
function buildMonthOccultationStarLabel(array $row): string
|
||||||
@@ -1228,6 +1248,8 @@ $chartLongitude = isset($currentLocation['longitude']) ? (float) $currentLocatio
|
|||||||
$chartElevation = isset($currentLocation['elevation']) && $currentLocation['elevation'] !== null ? (float) $currentLocation['elevation'] : 640.0;
|
$chartElevation = isset($currentLocation['elevation']) && $currentLocation['elevation'] !== null ? (float) $currentLocation['elevation'] : 640.0;
|
||||||
$chartTimezone = (string) (($currentLocation['timezone'] ?? null) ?: 'Europe/Berlin');
|
$chartTimezone = (string) (($currentLocation['timezone'] ?? null) ?: 'Europe/Berlin');
|
||||||
|
|
||||||
|
if ($shouldRunForecast) {
|
||||||
|
|
||||||
$monthTime = $monthSkyTimes[$selectedMonth];
|
$monthTime = $monthSkyTimes[$selectedMonth];
|
||||||
$chartLocalTime = new DateTimeImmutable(
|
$chartLocalTime = new DateTimeImmutable(
|
||||||
sprintf('%04d-%02d-15 %02d:%02d:00', $selectedYear, $selectedMonth, $monthTime['hour'], $monthTime['minute']),
|
sprintf('%04d-%02d-15 %02d:%02d:00', $selectedYear, $selectedMonth, $monthTime['hour'], $monthTime['minute']),
|
||||||
@@ -2366,6 +2388,7 @@ $moonPhaseEventsJson = json_encode($moonPhaseEvents, JSON_UNESCAPED_UNICODE | JS
|
|||||||
$starDataErrorJson = json_encode($starDataError, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
$starDataErrorJson = json_encode($starDataError, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
$observationTipCalendarIcsJson = json_encode($observationTipCalendarIcs, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
$observationTipCalendarIcsJson = json_encode($observationTipCalendarIcs, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
$observationTipCalendarFilenameJson = json_encode(sprintf('astrotools-monatsereignisse-%04d-%02d.ics', $selectedYear, $selectedMonth), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
$observationTipCalendarFilenameJson = json_encode(sprintf('astrotools-monatsereignisse-%04d-%02d.ics', $selectedYear, $selectedMonth), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<section class="card monatsvorhersage-card">
|
<section class="card monatsvorhersage-card">
|
||||||
@@ -2376,6 +2399,8 @@ $observationTipCalendarFilenameJson = json_encode(sprintf('astrotools-monatserei
|
|||||||
<p>Die Sternkarte wird für den 15. des gewählten Monats mit der festen Monatsuhrzeit erzeugt.</p>
|
<p>Die Sternkarte wird für den 15. des gewählten Monats mit der festen Monatsuhrzeit erzeugt.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="run" value="1">
|
||||||
|
|
||||||
<label class="monatsvorhersage-field">
|
<label class="monatsvorhersage-field">
|
||||||
<span>Jahr</span>
|
<span>Jahr</span>
|
||||||
<select name="year">
|
<select name="year">
|
||||||
@@ -2399,10 +2424,11 @@ $observationTipCalendarFilenameJson = json_encode(sprintf('astrotools-monatserei
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="monatsvorhersage-actions">
|
<div class="monatsvorhersage-actions">
|
||||||
<button type="submit">Sternkarte laden</button>
|
<button type="submit">Monatsvorhersage berechnen</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<?php if ($shouldRunForecast): ?>
|
||||||
<section class="monatsnarrativ-card">
|
<section class="monatsnarrativ-card">
|
||||||
<div class="monatskarte-header">
|
<div class="monatskarte-header">
|
||||||
<div>
|
<div>
|
||||||
@@ -2516,6 +2542,19 @@ $observationTipCalendarFilenameJson = json_encode(sprintf('astrotools-monatserei
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<?php else: ?>
|
||||||
|
<section class="monatsnarrativ-card">
|
||||||
|
<div class="monatskarte-header">
|
||||||
|
<div>
|
||||||
|
<h3>Monatsvorhersage</h3>
|
||||||
|
<p><?= htmlspecialchars($months[$selectedMonth] . ' ' . (string) $selectedYear, ENT_QUOTES, 'UTF-8') ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="monatskarte-footer">
|
||||||
|
<p class="monatsnarrativ-text">Bitte zuerst Jahr und Monat auswaehlen und dann auf „Monatsvorhersage berechnen“ klicken.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user