[[?php
/*** Veranstaltungsplan automatisch generiert aus der Datenbank von www.evangelische-termine.de ***/
/*** $dauer = Anzahl der anzuzeigenden Tage ***/
$dauer =28;
$timestamp = time(); $startdatum = date("Y-m-d", $timestamp); $startdatumt = date("d.m.", $timestamp);
$timestamp = time() + ($dauer*24*3600); $enddatum = date("Y-m-d", $timestamp); $enddatumt = date("d.m.Y", $timestamp);
/* echo $startdatum; echo $enddatum; */
$json = file_get_contents('https://www.evangelische-termine.de/json?vid=699&start=' . $startdatum . '&end=' . $enddatum);
# $json = file_get_contents('http://localhost/phptest/daten0401.json'); /* Testdaten */
$dataObject = json_decode($json);
$i = 0;
if (!function_exists('str_contains')) {
function str_contains( $haystack, $needle) {
return $needle !== '' && mb_strpos($haystack, $needle) !== false;
} }
if (!function_exists('str_ends_with')) {
function str_ends_with(string $haystack, string $needle): bool {
$needle_len = strlen($needle);
return ($needle_len === 0 || 0 === substr_compare($haystack, $needle, - $needle_len));
} }
echo '[[h1 style="text-align: center; margin-bottom: 0.5rem; margin-top: -0.5rem; "]]';
echo 'EVANGELISCHER KIRCHENANZEIGER';
echo '[[/h1]]';
echo '[[h3 style="margin-bottom: 0.65rem; margin-top: 0em; text-align: center;"]]';
echo 'GOTTESDIENSTE UND VERANSTALTUNGEN vom ';
echo $startdatumt . ' – ' . $enddatumt;
echo '[[/h3]]';
echo '[[table class="rahmen" cellpadding="5"]]';
echo '[[tbody]]';
echo '[[!--tr]]';
echo '[[td colspan="3" style="text-align: center;" valign="top"]]';
echo '[[p]]';
echo '[[strong]]';
echo 'Wegen der CoronaKrise finden Gottesdienste nur in der Christuskirche Berchtesgaden, in der Kirche
„Zum Guten Hirten“ Ramsau und in der Insulakirche
Bischofswiesen-Strub statt.';
echo '[[/strong]]';
echo '[[/p]]';
echo '[[p]]';
echo '[[span style="color: #ff0000;"]]';
echo '[[strong]]';
echo '[[a href="https://www.berchtesgaden-evangelisch.de/schutzmassnahmen" style="color: #ff0000;"]]';
echo 'Die aktuellen Corona-Vorschriften für Gottesdienste und Gemeindeveranstaltungen finden Sie hier!';
echo '[[/a]]';
echo '[[/strong]]';
echo '[[/span]]';
echo '[[br]]';
echo '(16. Bayerische Infektionsschutzmaßnahmenverordnung)';
echo '[[/p]]';
echo '[[/td]]';
echo '[[/tr--]]';
$monat = '';
$startdatum = '';
foreach($dataObject as $v) {
/* $i++; */
$record = $dataObject[$i]->Veranstaltung;
/* echo ' ' . $record->START_MONAT . '[[br]]'; */
/* Monatszeile */
if ($monat != $record->START_MONAT) {
$monat = $record->START_MONAT;
echo '[[tr]]';
echo '[[td colspan="3" style="text-align: center; background-color: #dcc;"]]';
echo '[[strong]]';
echo $monat;
echo '[[/strong]]';
echo '[[/td]]';
echo '[[/tr]]';
}
/* Tageszeile */
if ($startdatum != $record->START_DATUM) {
$startdatum = $record->START_DATUM;
$k = strpos($startdatum, '.');
$starttag = substr($startdatum, 0, $k);
/* echo 'k = ' . $k . ' | ' . $starttag; */
echo '[[tr]]';
if ($record->WOCHENTAG_START_KURZ == 'So') {
echo '[[td colspan="3" style="background-color: #ddd;" valign="top"]]'; }
else
{echo '[[td colspan="3" valign="top"]]'; }
echo '[[strong]]';
echo $record->WOCHENTAG_START_LANG . ', ' . $starttag . '. ' . $record->START_MONAT;
if ($record->WOCHENTAG_START_KURZ == 'So') {
echo ' – ' . $record->LITURG_BEZ;
}
echo '[[/strong]][[/td]] [[/tr]]';
}
/* Veranstaltungszeile */
echo '[[tr]]';
echo '[[td width="25%" valign="top"]]';
if (stripos($record->_place_NAME, $record->_place_CITY) === false) {
echo $record->_place_CITY . ', '; }
echo $record->_place_NAME;
echo '[[/td]]';
echo '[[td width="7%" align="center" valign="top"]]';
echo $record->START_UHRZEIT;
echo '[[/td]]';
echo '[[td]]';
echo '[[strong]]';
echo $record->_event_TITLE;
echo '[[/strong]]';
if ($record->SUBTITLE != '') {
echo '[[br]]';
/* Vornamen einfügen */
$temp = $record->SUBTITLE;
if (str_contains($temp, 'Kindergottesdienst')) {
$temp = str_replace("Kindergottesdienst", "[[strong]][[font color=red]]Kindergottesdienst[[/font]][[/strong]]", $temp); }
if (str_contains($temp, 'Pfarrer Höglauer')) {
$temp = str_replace("Pfarrer Höglauer", "Pfarrer Josef Höglauer", $temp); }
if (str_contains($temp, 'Pfarrer Gerstner')) {
$temp = str_replace("Pfarrer Gerstner", "Pfarrer Christian Gerstner", $temp); }
if (str_contains($temp, 'Prädikant Bechtel')) {
$temp = str_replace("Prädikant Bechtel", "Prädikant Rolf Bechtel", $temp); }
if (str_contains($temp, 'Pfarrer i. R. Wagner')) {
$temp = str_replace("Pfarrer i. R. Wagner", "Pfarrer i. R. Hans-Peter Wagner", $temp); }
if (str_contains($temp, 'Prädikantin Landes')) {
$temp = str_replace("Prädikantin Landes", "Prädikantin Ruth Landes", $temp); }
echo $temp;
}
/* statt echo $record->SUBTITLE;} */
if ($record->_event_SHORT_DESCRIPTION != '') {
echo '[[br]]';
echo $record->_event_SHORT_DESCRIPTION; }
if ($record->_event_LONG_DESCRIPTION != '') {
echo '[[br]]';
echo $record->_event_LONG_DESCRIPTION; }
/* externer Link */
$tempurl = $record->_event_LINK;
if (($tempurl !== "") && (!str_ends_with($tempurl, 'berchtesgaden-evangelisch.de'))) {
echo '[[br /]]';
echo '[[p style="margin-top: 0.5em;"]]Weitere Informationen finden Sie [[strong]][[a href=' . $tempurl . ' target="_blank" title="Weitere Informationen"]]hier[[/a]][[/strong]].[[/p]]';
}
echo '[[/td]]';
echo '[[/tr]]';
$i++;
}
echo '[[/tbody]]';
echo '[[/table]]';
?]]
