diff --git a/sternwarte/DB4js_all.php b/sternwarte/DB4js_all.php index 8515705..ab60a35 100644 --- a/sternwarte/DB4js_all.php +++ b/sternwarte/DB4js_all.php @@ -164,6 +164,7 @@ class DB $st->execute($params); return $st->fetchAll(); } + //"SELECT * FROM SoFue2 WHERE deleted=0 AND status=? AND wtermin >= NOW() ORDER BY wtermin DESC, id DESC LIMIT ? OFFSET ?" public static function one(string $sql, array $params = []): ?array { @@ -527,22 +528,88 @@ class RepoSoFue } public static function getRecords(string $status = 'all', int $rows = 10, int $page = 1, ?string $termin = null): array { - $offset = ($page - 1) * $rows; + // Lastdate: 9 Monate zurück + $lastdate = new DateTime(); + $lastdate->sub(new DateInterval('P9M')); + $lastdateStr = $lastdate->format('Y-m-d'); + $params = []; - $sql = "SELECT * FROM " . TBL_SOFUE . " WHERE deleted=0"; + $countSql = "SELECT COUNT(*) as count FROM " . TBL_SOFUE . " WHERE deleted=0"; + + // WHERE Bedingungen aufbauen if ($status !== 'all') { - $sql .= " AND status=?"; - $params[] = (int)$status; + if ((int)$status === 4) { + $countSql .= " AND stattgefunden=1"; + } else { + $countSql .= " AND status=?"; + $params[] = (int)$status; + } } - if ($termin) { - $sql .= " AND wtermin=?"; - $params[] = $termin; + // Bei status=4 (stattgefunden) macht 'neu' keinen Sinn, ignoriere termin + // termin kann 'all', 'neu' sein - nur 'neu' wird behandelt + if ($termin === 'neu' && (int)$status !== 4) { + $countSql .= " AND wtermin >= NOW()"; } + + // Lastdate-Filter auch beim Count hinzufügen + $countSql .= " AND DATE(wtermin) >= ?"; + $params[] = $lastdateStr; + + // Anzahl der Records holen + $countResult = DB::one($countSql, $params); + $count = (int)($countResult['count'] ?? 0); + + // Anzahl der Seiten berechnen + $totalPages = $rows > 0 ? ceil($count / $rows) : 1; + + // Falls angeforderte Seite > Anzahl der Seiten, letzte Seite verwenden + if ($page > $totalPages && $totalPages > 0) { + $page = $totalPages; + } + + // Start-Record berechnen + $offset = $rows * ($page - 1); + if ($offset < 0) { + $offset = 0; + } + + // Daten abrufen mit lastdate-Filter + $sql = "SELECT * FROM " . TBL_SOFUE . " WHERE deleted=0"; + $dataParams = []; + + if ($status !== 'all') { + if ((int)$status === 4) { + $sql .= " AND stattgefunden=1"; + } else { + $sql .= " AND status=?"; + $dataParams[] = (int)$status; + } + } + // Bei status=4 (stattgefunden) macht 'neu' keinen Sinn, ignoriere termin + // termin kann 'all', 'neu' sein - nur 'neu' wird behandelt + if ($termin === 'neu' && (int)$status !== 4) { + $sql .= " AND wtermin >= NOW()"; + } + + // Lastdate-Filter hinzufügen + $sql .= " AND DATE(wtermin) >= ?"; + $dataParams[] = $lastdateStr; + $sql .= " ORDER BY wtermin DESC, id DESC LIMIT ? OFFSET ?"; - $params[] = $rows; - $params[] = $offset; - return DB::all($sql, $params); + $dataParams[] = $rows; + $dataParams[] = $offset; + + $records = DB::all($sql, $dataParams); + + // Response mit Pagination-Info + return [ + 'page' => $page, + 'total' => $totalPages, + 'records' => $count, + 'rows' => $records + ]; } +// "SELECT * FROM SoFue2 WHERE deleted=0 AND stattgefunden=1 AND wtermin >= NOW() AND DATE(wtermin) >= ? ORDER BY wtermin DESC, id DESC LIMIT ? OFFSET ?" public static function update(int $id, array $d): int { $sql = "UPDATE " . TBL_SOFUE . " SET mitarbeiter=?,status=?,bemerkung=?,wtermin=?,atermin=?,erledigt_datum=? WHERE id=?"; @@ -611,6 +678,183 @@ class RepoStatistik } } +// ---- Statistik Jahre Repository (StatistikJahre table) ---- +class RepoStatistikJahre +{ + const TBL = 'StatistikJahre'; + + public static function getByDate(string $datum): ?array + { + return DB::one("SELECT * FROM " . self::TBL . " WHERE datum=?", [$datum]); + } + + public static function getByYear(int $year): array + { + $sql = "SELECT * FROM " . self::TBL . " WHERE YEAR(datum)=? ORDER BY datum"; + $data = DB::all($sql, [$year]); + + // Calculate sums + $sumB = 0; + $sumA = 0; + $sumBZ = 0; + $sumBT = 0; + foreach ($data as $row) { + $sumB += ($row['besucherNormal'] ?? 0) + ($row['besucherSonder'] ?? 0) + ($row['besucherToT'] ?? 0); + $sumA += ($row['fuehrungen'] ?? 0) + ($row['beobachtungen'] ?? 0) + ($row['techdienst'] ?? 0); + $sumBZ += ($row['beoZeit'] ?? 0); + $sumBT += ($row['beoTage'] ?? 0); + } + + // Get Gesamt bemerkung + $gesamt = DB::one("SELECT bemerkung FROM StatistikGesamt WHERE jahr=?", [$year]); + $bemG = $gesamt['bemerkung'] ?? ''; + + return [ + 'data' => $data, + 'sumB' => $sumB, + 'sumA' => $sumA, + 'sumBZ' => $sumBZ, + 'sumBT' => $sumBT, + 'bemG' => $bemG + ]; + } + + public static function createOrUpdate(array $post): array + { + $existing = self::getByDate($post['datum']); + + if (!$existing) { + // Insert + $sql = "INSERT INTO " . self::TBL . " (fuehrungen, beobachtungen, techdienst, besucherNormal, besucherSonder, besucherToT, bemerkung, datum, beoZeit, beoTage) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + DB::exec($sql, [ + $post['fueh'] ?? 0, + $post['beob'] ?? 0, + $post['tech'] ?? 0, + $post['besN'] ?? 0, + $post['besS'] ?? 0, + $post['besT'] ?? 0, + $post['beme'] ?? '', + $post['datum'], + $post['beoZ'] ?? 0, + $post['beoT'] ?? 0 + ]); + } else { + // Update + $sql = "UPDATE " . self::TBL . " SET fuehrungen=?, beobachtungen=?, techdienst=?, besucherNormal=?, besucherSonder=?, besucherToT=?, bemerkung=?, beoZeit=?, beoTage=? WHERE datum=?"; + DB::exec($sql, [ + $post['fueh'] ?? 0, + $post['beob'] ?? 0, + $post['tech'] ?? 0, + $post['besN'] ?? 0, + $post['besS'] ?? 0, + $post['besT'] ?? 0, + $post['beme'] ?? '', + $post['beoZ'] ?? 0, + $post['beoT'] ?? 0, + $post['datum'] + ]); + } + + return ['datum' => $post['datum']]; + } + + public static function getYearList(): array + { + $sql = "SELECT YEAR(datum) as jahr FROM " . self::TBL . " GROUP BY YEAR(datum) ORDER BY YEAR(datum) DESC"; + $rows = DB::all($sql); + return array_map(fn($r) => (int)$r['jahr'], $rows); + } +} + +// ---- Statistik Gesamt Repository (StatistikGesamt table) ---- +class RepoStatistikGesamt +{ + const TBL = 'StatistikGesamt'; + + public static function getAll(): array + { + $data = DB::all("SELECT * FROM " . self::TBL . " ORDER BY jahr DESC"); + + // Get last date info + $lastYearRow = DB::one("SELECT MAX(YEAR(datum)) as lastYear FROM StatistikJahre"); + $lastYear = $lastYearRow['lastYear'] ?? date('Y'); + + $fullYear = DB::all("SELECT * FROM StatistikJahre WHERE YEAR(datum)=?", [$lastYear]); + + // Calculate sums + $sumB = DB::one("SELECT SUM(besucher) as sum FROM " . self::TBL)['sum'] ?? 0; + $sumA = DB::one("SELECT SUM(aktivitaeten) as sum FROM " . self::TBL)['sum'] ?? 0; + + return [ + 'data' => $data, + 'lastDate' => [ + 'lastYear' => (int)$lastYear, + 'fullYear' => $fullYear + ], + 'sumB' => (int)$sumB, + 'sumA' => (int)$sumA + ]; + } + + public static function getByYear(int $year): ?array + { + return DB::one("SELECT * FROM " . self::TBL . " WHERE jahr=?", [$year]); + } + + public static function createOrUpdate(array $post): array + { + $existing = self::getByYear((int)$post['jahr']); + + if (!$existing) { + // Insert + $sql = "INSERT INTO " . self::TBL . " (aktivitaeten, besucher, bemerkung, jahr) VALUES (?, ?, ?, ?)"; + DB::exec($sql, [ + $post['suma'] ?? 0, + $post['sumb'] ?? 0, + $post['bemG'] ?? '', + $post['jahr'] + ]); + } else { + // Update + $sql = "UPDATE " . self::TBL . " SET aktivitaeten=?, besucher=?, bemerkung=? WHERE jahr=?"; + DB::exec($sql, [ + $post['suma'] ?? 0, + $post['sumb'] ?? 0, + $post['bemG'] ?? '', + $post['jahr'] + ]); + } + + return ['datum' => $post['jahr']]; + } +} + +// ---- Kalender Repository ---- +class RepoKalender +{ + const TBL = 'kalender'; + + public static function getEntries(string $start, string $end): array + { + $s = date('Ymd', strtotime($start)); + $e = date('Ymd', strtotime($end)); + return DB::all("SELECT * FROM " . self::TBL . " WHERE start >= ? AND start <= ?", [$s, $e]); + } + + public static function insert(array $data): bool + { + $sql = "INSERT INTO " . self::TBL . " (start, end, title, description) VALUES (?, ?, ?, ?)"; + DB::exec($sql, [$data['start'], $data['end'] ?? $data['start'], $data['title'], $data['description'] ?? '']); + return true; + } + + public static function delete(int $id): bool + { + DB::exec("DELETE FROM " . self::TBL . " WHERE id=?", [$id]); + return true; + } +} + // ---- Email Service (einfach) ---- class Mailer { @@ -671,37 +915,25 @@ class Commands { public const MAP = [ 'PING' => 'Health-Check', - 'GET_ANMELD' => 'Liste Anmeldungen für fid', - 'GET_ANMELDNEW' => 'Anmeldungen-Varianten (legacy: special/date)', - 'GET_SONDERNEW' => 'Sonderführungen-Varianten (legacy: special/date)', + 'GET_ANMELD' => 'Liste Anmeldungen für fid/Datum', + 'GET_ANMELDNEW' => 'Anmeldungen-Varianten (special/date)', 'GET_TEILN_ID' => 'Teilnehmer nach id', 'GET_TEILN_NAME' => 'Teilnehmer nach Name/Vorname', - 'GET_GROUP' => 'Gruppenbezeichnung für fdates dateTime', - 'GET_ONEANMELD' => 'Eine Anmeldung nach id', - 'GET_COUNTS' => 'Summe Anmeldungen für fid', - 'GET_COUNTS_DATE' => 'Summe Anmeldungen für Datum (YYYY-MM-DD)', - 'INSERT_TLN' => 'Anmeldung anlegen', + 'GET_COUNTS' => 'Summe Anmeldungen für fid/Datum', + 'GET_COUNTS_DATE' => 'Summe Anmeldungen für Datum', 'UPDATE_TLN' => 'Anmeldung ändern', 'DELETE_TLN' => 'Anmeldung löschen', - 'UPDATE_TLN_BULK' => 'Mehrere Anmeldungen Feld-Update (legacy updateEntries)', + 'UPDATE_TLN_BULK' => 'Mehrere Anmeldungen Feld-Update', 'DELETEONE' => 'Teilnehmer löschen (Alias)', 'GET_LASTANMELDUNG' => 'Letzte Anmeldung (Datum) ab Start', 'UPDATECOUNT' => 'Zähler in fdatum1 für Datum reduzieren', - 'GET_SOFIANMELD' => 'Alle/sofue_id bezogene Sonderführungs-Anmeldungen', - 'GET_ONESOFIANMELD' => 'Eine Sonderführungs-Anmeldung', - 'GET_SOFIANMELD_COUNT' => 'Zähler Sonderführungs-Anmeldungen', - 'INSERT_SOFIANMELD' => 'Neue Sonderführungs-Anmeldung', - 'UPDATE_SOFIANMELD' => 'Sonderführungs-Anmeldung ändern', - 'DELETE_SOFIANMELD' => 'Sonderführungs-Anmeldung löschen', 'GET_TERMINE' => 'Termine öffentliche Führungen', 'GET_DATES' => 'Nächste Führungstermine (limit + ab Datum)', - 'GET_ONETERMIN' => 'Termin nach id', 'GET_FID' => 'Fid für Datum', 'GET_TIME' => 'Uhrzeit für Datum', 'GET_BEOS' => 'Liste BEOs optional nur Guides', 'GET_ONEBEO' => 'Ein BEO nach name', 'GET_ONE' => 'Sonderführung nach id', - 'GET_ONETERMIN_SOFUE' => 'Sonderführung nach Termin', 'GET_MANY' => 'Gefilterte Sonderführungen', 'UPDATE' => 'Sonderführung Standard-Update', 'UPDATEAFTER' => 'Nachbearbeitung Sonderführung', @@ -710,11 +942,28 @@ class Commands 'GET_STATISTIK_ANMELD' => 'Statistik öffentliche Führungen Jahr', 'GET_STATISTIK_BEO' => 'Statistik BEO Jahr', 'GET_STATISTIK_GESAMT' => 'Gesamtstatistik Jahr', - 'SEND_CONFIRMATION' => 'Einfache Bestätigungs-Mail', + 'SENDMYMAIL' => 'Mail mit BCC versenden', 'SENDMAILZUSAGE' => 'Zusage an Anfragenden', 'SENDMAIL2BEO' => 'Mail an Mitarbeiter', 'SENDMAIL2LISTE' => 'Mail an Verteiler', - 'PUT2KALENDER' => 'Kalender-Eintrag (Platzhalter)', + 'PUT2KALENDER' => 'Kalender-Eintrag', + 'GET_FDATES' => 'Führungstermine für Kalenderansicht', + 'GET_CALENTRIES' => 'Kalendereinträge abrufen', + 'PUT_CALENTRY' => 'Kalendereintrag erstellen', + 'DEL_CALENTRY' => 'Kalendereintrag löschen', + 'GET_YEARS' => 'Liste verfügbare Jahre (Statistik)', + 'GET_ONE_A' => 'Statistik-Eintrag für Datum', + 'GET_ALL_A' => 'Alle Statistik-Einträge für Jahr', + 'CRUP_A' => 'Statistik-Eintrag erstellen/aktualisieren (Jahre)', + 'GET_ALL_G' => 'Gesamtstatistik alle Jahre', + 'GET_ONE_G' => 'Gesamtstatistik für Jahr', + 'CRUP_G' => 'Gesamtstatistik erstellen/aktualisieren', + 'GET_TIME_BY_DATE' => 'Uhrzeit für Datum abrufen', + 'DELETE_ENTRY' => 'Anmeldung löschen (Storno)', + 'GET_FUEHRUNGEN' => 'Führungen in Zeitbereich', + 'UPDATETLNFD' => 'Teilnehmer-Datum aktualisieren', + 'SEND_MAIL_HTML' => 'Mail versenden (Text)', + 'GET_ALLTEILN' => 'Alle Teilnehmer ab Datum', 'LIST_COMMANDS' => 'Liste aller Kommandos' ]; } @@ -754,22 +1003,11 @@ try { $special = $input['special'] ?? 'alllater'; $date = $input['date'] ?? date('Ymd'); respond(RepoAnmeld::getNew($special, $date)); - case 'GET_SONDERNEW': - $special = $input['special'] ?? 'alllater'; - $date = $input['date'] ?? date('Ymd'); - if ($special !== 'alllater') respond([]); - respond(RepoSoFue::getAfterDate($date)); case 'GET_TEILN_ID': $r = RepoAnmeld::getById((int)$input['id'], $typ); respond($r ? [$r] : []); case 'GET_TEILN_NAME': respond(RepoAnmeld::getByName($input['name'])); - case 'GET_GROUP': - $grp = RepoFdates::groupByDate($input['date']); - respond(['grp' => $grp]); - case 'GET_ONEANMELD': - $r = RepoAnmeld::getById((int)$input['id'], $typ); - respond($r ?: ['error' => 'Not found']); case 'GET_COUNTS': if (isset($input['fdate'])) { respond(RepoAnmeld::countByDate($input['fdate'], $typ)); @@ -786,11 +1024,6 @@ try { respondError('Missing identifier for GET_COUNTS'); case 'GET_COUNTS_DATE': respond(['count' => RepoAnmeld::countByDate($input['date'], $typ)]); - case 'INSERT_TLN': - if (!isset($input['name'], $input['email'], $input['anzahl'], $input['fid'])) respondError('Missing fields'); - if (!filter_var($input['email'], FILTER_VALIDATE_EMAIL)) respondError('Invalid email'); - $id = RepoAnmeld::insert($input); - respond(['success' => true, 'id' => $id]); case 'UPDATE_TLN': if (!isset($input['id'])) respondError('id missing'); RepoAnmeld::update((int)$input['id'], $input); @@ -809,28 +1042,6 @@ try { $n = RepoAnmeld::bulkUpdateField($ids, (string)$input['field'], $val); respond(['success' => $n > 0, 'updated' => $n]); - // Sonderführungs-Anmeldungen - case 'GET_SOFIANMELD': - if (isset($input['sofue_id'])) respond(RepoSoFiAnmeld::getBySoFue((int)$input['sofue_id'])); - respond(RepoSoFiAnmeld::getAll()); - case 'GET_ONESOFIANMELD': - $r = RepoSoFiAnmeld::getById((int)$input['id']); - respond($r ?: ['error' => 'Not found']); - case 'GET_SOFIANMELD_COUNT': - respond(['count' => RepoSoFiAnmeld::countBySoFue((int)$input['sofue_id'])]); - case 'INSERT_SOFIANMELD': - if (!isset($input['name'], $input['email'], $input['anzahl'], $input['sofue_id'])) respondError('Missing fields'); - if (!filter_var($input['email'], FILTER_VALIDATE_EMAIL)) respondError('Invalid email'); - $id = RepoSoFiAnmeld::insert($input); - respond(['success' => true, 'id' => $id]); - case 'UPDATE_SOFIANMELD': - if (!isset($input['id'])) respondError('id missing'); - RepoSoFiAnmeld::update((int)$input['id'], $input); - respond(['success' => true]); - case 'DELETE_SOFIANMELD': - RepoSoFiAnmeld::delete((int)$input['id']); - respond(['success' => true]); - // Termine case 'GET_TERMINE': respond(RepoTermine::getAll(($input['includeOld'] ?? 'false') === 'true')); @@ -838,9 +1049,6 @@ try { $amount = isset($input['anzahl']) ? (int)$input['anzahl'] : 50; $from = $input['date'] ?? date('Ymd'); respond(RepoTermine::getNextDates($amount, $from, $typ)); - case 'GET_ONETERMIN': - $r = RepoTermine::getById((int)$input['id']); - respond($r ?: ['error' => 'Not found']); case 'GET_FID': respond(['fid' => RepoTermine::fidByDate($input['datum'], $typ)]); case 'GET_TIME': @@ -866,9 +1074,6 @@ try { case 'GET_ONE': $r = RepoSoFue::getById((int)$input['id']); respond($r ?: ['error' => 'Not found']); - case 'GET_ONETERMIN_SOFUE': - $r = RepoSoFue::getByTermin($input['termin']); - respond($r ?: ['error' => 'Not found']); case 'GET_MANY': respond(RepoSoFue::getRecords($input['status'] ?? 'all', (int)($input['rows'] ?? 10), (int)($input['page'] ?? 1), $input['termin'] ?? null)); case 'UPDATE': @@ -901,10 +1106,6 @@ try { respond(RepoStatistik::gesamt((int)($input['year'] ?? date('Y')))); // Mail - case 'SEND_CONFIRMATION': - if (!isset($input['to'], $input['subject'], $input['body'])) respondError('Missing mail fields'); - $ok = Mailer::sendPlain($input['to'], $input['subject'], $input['body']); - respond(['success' => $ok]); case 'SENDMYMAIL': // Legacy-compatible mail send with BCC list $subject = $input['subject'] ?? ($input['betreff'] ?? null); @@ -949,6 +1150,107 @@ try { if (!isset($input['id'], $input['termin'], $input['mitarbeiter'])) respondError('Missing fields'); error_log('Kalender-Eintrag: ' . $input['id'] . ' ' . $input['termin'] . ' ' . $input['mitarbeiter']); respond(['success' => true]); + case 'GET_FDATES': + // Returns führungen for calendar display + $start = $input['start'] ?? date('Ymd'); + $end = $input['end'] ?? date('Ymd', strtotime('+1 year')); + $s = date('Ymd', strtotime($start)); + $e = date('Ymd', strtotime($end)); + $sql = "SELECT * FROM " . TBL_FDATUM . " WHERE datum >= ? AND datum <= ? ORDER BY datum ASC"; + $rows = DB::all($sql, [$s, $e]); + $result = []; + foreach ($rows as $r) { + $count = RepoAnmeld::countByDate($r['datum'], 'regular'); + $result[] = [ + 'start' => $r['datum'], + 'uhr' => substr($r['uhrzeit'] ?? '', 0, 2), + 'title' => $r['gruppe'] ?? '', + 'count' => $count + ]; + } + respond($result); + case 'GET_CALENTRIES': + respond(RepoKalender::getEntries($input['start'], $input['end'])); + case 'PUT_CALENTRY': + RepoKalender::insert($input['data']); + respond(['success' => true]); + case 'DEL_CALENTRY': + RepoKalender::delete((int)$input['id']); + respond(['success' => true]); + + // Statistik - Jahre + case 'GET_YEARS': + respond(RepoStatistikJahre::getYearList()); + case 'GET_ONE_A': + $datum = $input['datum'] ?? respondError('datum missing'); + $result = RepoStatistikJahre::getByDate($datum); + if ($result) { + // Add bemG from Gesamt + $year = substr($datum, 0, 4); + $gesamt = RepoStatistikGesamt::getByYear((int)$year); + $result['bemG'] = $gesamt['bemerkung'] ?? ''; + } + respond($result ?: ['error' => 'Not found']); + case 'GET_ALL_A': + $year = (int)($input['jahr'] ?? date('Y')); + respond(RepoStatistikJahre::getByYear($year)); + case 'CRUP_A': + if (!isset($input['toInsert'])) respondError('toInsert missing'); + respond(RepoStatistikJahre::createOrUpdate($input['toInsert'])); + + // Statistik - Gesamt + case 'GET_ALL_G': + respond(RepoStatistikGesamt::getAll()); + case 'GET_ONE_G': + $year = (int)($input['jahr'] ?? date('Y')); + $result = RepoStatistikGesamt::getByYear($year); + respond($result ?: ['error' => 'Not found']); + case 'CRUP_G': + if (!isset($input['toInsert'])) respondError('toInsert missing'); + respond(RepoStatistikGesamt::createOrUpdate($input['toInsert'])); + + // Storno module commands + case 'GET_TIME_BY_DATE': + $dt = $input['dt'] ?? respondError('dt missing'); + $typ = $input['typ'] ?? 'regular'; + if ($typ === 'sonnen') { + respond(['time' => '11 Uhr']); + } + $time = DB::one("SELECT uhrzeit FROM " . TBL_FDATUM . " WHERE datum=?", [$dt]); + respond(['time' => $time['uhrzeit'] ?? '']); + case 'DELETE_ENTRY': + $id = (int)($input['id'] ?? respondError('id missing')); + DB::exec("DELETE FROM " . TBL_ANMELD . " WHERE id=?", [$id]); + respond(['success' => true]); + case 'GET_FUEHRUNGEN': + $start = $input['start'] ?? respondError('start missing'); + $end = $input['end'] ?? respondError('end missing'); + $typ = $input['typ'] ?? 'regular'; + $table = ($typ === 'sonnen') ? 'sonnedatum' : TBL_FDATUM; + $sql = "SELECT * FROM $table WHERE datum >= ? AND datum <= ? ORDER BY datum ASC"; + respond(DB::all($sql, [$start, $end])); + case 'UPDATETLNFD': + if (!isset($input['id'], $input['fdatum'], $input['fid'])) respondError('Missing fields'); + $sql = "UPDATE " . TBL_ANMELD . " SET fdatum=?, fid=?, abgesagt=NULL WHERE id=?"; + DB::exec($sql, [$input['fdatum'], $input['fid'], $input['id']]); + respond(['success' => true]); + case 'SEND_MAIL_HTML': + if (!isset($input['subject'], $input['to'], $input['body_txt'])) respondError('Missing mail fields'); + require_once __DIR__ . '/phpmailer/dosendmail.php'; + // Note: body_html is ignored because sendmail doesn't support it + $result = sendmail( + $input['subject'], + 'noreply@sternwarte-welzheim.de', + $input['body_txt'], + [], + [], + is_array($input['to']) ? $input['to'] : [$input['to']] + ); + respond(['success' => !($result['error'] ?? false)]); + case 'GET_ALLTEILN': + $fdatum = $input['fdatum'] ?? respondError('fdatum missing'); + $sql = "SELECT * FROM " . TBL_ANMELD . " WHERE fdatum >= ? ORDER BY fid ASC"; + respond(DB::all($sql, [$fdatum])); case 'LIST_COMMANDS': respond(['commands' => Commands::MAP, 'count' => count(Commands::MAP)]); diff --git a/sternwarte/anmeldung.php b/sternwarte/anmeldung.php index 19b79d9..426b9e6 100644 --- a/sternwarte/anmeldung.php +++ b/sternwarte/anmeldung.php @@ -292,7 +292,6 @@ "$stern_vorname $stern_name am " . preg_replace("/(\d+) Uhr/","um $0",$stern_datum) . " für $stern_teil $person " . // $stern_teil == 1 ? "Person" : "Personen" . ".\r\n\r\n" . - "Bitte bringen Sie diese Bestätigung als Ausdruck oder digital zur Führung mit. \r\n\r\n". "Die Führung findet NUR bei sternklarem Himmel statt. Falls der Himmel bedeckt ist \r\n" . "und die Führung ausfällt, erhalten Sie bis spätestens eine Stunde vor Führungsbeginn \r\n" . "eine Email. Sie können sich dann gerne zu einem neuen Termin anmelden.\r\n\r\n" . @@ -379,8 +378,7 @@
Wenn Sie alle Felder ausgefüllt und abgeschickt haben (mit dem "Anmeldung senden"-Knopf), - erhalten Sie eine Anmeldebestätigung per e-mail. Diese bitte unbedingt zur Führung - ausgedruckt oder in digitaler Form mitbringen! + erhalten Sie eine Anmeldebestätigung per e-mail. diff --git a/sternwarte/index_maint.php b/sternwarte/index_maint.php index 6f68601..cd5c480 100755 --- a/sternwarte/index_maint.php +++ b/sternwarte/index_maint.php @@ -87,7 +87,7 @@ include 'maintenance.php'; Für diese Führungen gelten folgende Regeln
$stern_vorname $stern_name um $stern_zeit Uhr " . "für $stern_teil $person.
" . - "Bitte bringen Sie diese Bestätigung als Ausdruck oder digital zur Führung mit.
".
- "Ohne diese Bestätigung erfolgt ausnahmslos kein Einlass.
Die Führung findet nur bei klarem Himmel statt. Falls der Himmel bedeckt ist " . "und die Führung ausfällt, erhalten Sie bis spätestens eine Stunde vor Beginn der Finsternis " . "eine Email.
" . @@ -357,8 +353,7 @@
Wenn Sie alle Felder ausgefüllt und abgeschickt haben (mit dem "Anmeldung senden"-Knopf), - erhalten Sie eine Anmeldebestätigung per e-mail. Diese bitte unbedingt zur Führung - ausgedruckt oder in digitaler Form mitbringen! + erhalten Sie eine Anmeldebestätigung per e-mail.
Hinweis zum Datenschutz: Datenschutzerklärung
-Letzte Änderungen: 2022-08-17 rxf
+Letzte Änderungen: 2025-12-01 rxf