Monatsvorhersage erst nach button
This commit is contained in:
@@ -11,6 +11,7 @@ $publicBasePath = './';
|
||||
$currentYear = (int) date('Y');
|
||||
$selectedYear = isset($_GET['year']) ? (int) $_GET['year'] : $currentYear;
|
||||
$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
|
||||
@@ -241,6 +242,25 @@ $seasonChanges = [];
|
||||
$timeChanges = [];
|
||||
$monthEventList = [];
|
||||
$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')) {
|
||||
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;
|
||||
$chartTimezone = (string) (($currentLocation['timezone'] ?? null) ?: 'Europe/Berlin');
|
||||
|
||||
if ($shouldRunForecast) {
|
||||
|
||||
$monthTime = $monthSkyTimes[$selectedMonth];
|
||||
$chartLocalTime = new DateTimeImmutable(
|
||||
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);
|
||||
$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);
|
||||
}
|
||||
?>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="run" value="1">
|
||||
|
||||
<label class="monatsvorhersage-field">
|
||||
<span>Jahr</span>
|
||||
<select name="year">
|
||||
@@ -2399,10 +2424,11 @@ $observationTipCalendarFilenameJson = json_encode(sprintf('astrotools-monatserei
|
||||
</label>
|
||||
|
||||
<div class="monatsvorhersage-actions">
|
||||
<button type="submit">Sternkarte laden</button>
|
||||
<button type="submit">Monatsvorhersage berechnen</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php if ($shouldRunForecast): ?>
|
||||
<section class="monatsnarrativ-card">
|
||||
<div class="monatskarte-header">
|
||||
<div>
|
||||
@@ -2516,6 +2542,19 @@ $observationTipCalendarFilenameJson = json_encode(sprintf('astrotools-monatserei
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</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>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user