diff --git a/config.php b/config.php new file mode 100644 index 0000000..cb63b2c --- /dev/null +++ b/config.php @@ -0,0 +1,12 @@ + + +// Name of the Church (Will be shown in the title) +define('NAME_OF_CHURCH', 'Kirche Neuwies'); + +// Set the URL to the calendar (ICS-file, eg. https://neuwies.churchtools.de/?q=churchcal/ical +define('URL_TO_CALENDAR', 'https://neuwies.churchtools.de/?q=churchcal/ical'); + + + + +?> diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..164cbec Binary files /dev/null and b/favicon.ico differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..3a4c836 --- /dev/null +++ b/index.php @@ -0,0 +1,249 @@ + + + + + + + +
+ +startDateForm: $startDateForm\n"); + } + + $startDateCleaned = str_replace(" ", "", $startDateForm); + // $startDateCleaned = str_replace(".", " ", $startDateForm); + list($day, $month, $year) = explode(".", trim($startDateCleaned)); + + if(defined('DEBUG')) { + echo("
startDateCleaned: $startDateCleaned\n"); + echo("
Day, Month, Year: $day, $month, $year\n"); + } + + + if(isset($_GET['timeSpan'])) { + $timeSpan = $_GET['timeSpan']; + } + else{ + $timeSpan = "1week"; + } + + if(defined('DEBUG')) { + echo("
timeSpan: $timeSpan\n"); + } + + + if($timeSpan == "1week"){ + $timeSpanDays = 7; + $mode = "weeks"; + } + elseif($timeSpan == "2weeks"){ + $timeSpanDays = 14; + $mode = "weeks"; + } + elseif($timeSpan == "3weeks"){ + $timeSpanDays = 21; + $mode = "weeks"; + } + elseif($timeSpan == "4weeks"){ + $timeSpanDays = 28; + $mode = "weeks"; + } + elseif($timeSpan == "16weeks"){ + $timeSpanDays = 28*4; + $mode = "weeks"; + } + elseif($timeSpan == "nextmonth" or $timeSpan == "afternextmonth"){ + $mode = "months"; + } + else{ + die("Unbekannte Angabe für timeSpan!"); + } + + + + if(defined('DEBUG')) { + echo("
mode: $mode\n"); + } + + + if($mode == "weeks"){ + $timeSpanSeconds = 3600 * 24 * $timeSpanDays; + // print_r($dateParts); + + // echo("
Month: -" . $dateParts[2] . "- => " . $monthDE[$dateParts[2]] . "\n"); + echo("
startDMY: $startDMY\n"); + echo("
mktime(0, 0, 0, $month, $day, $year);\n"); + echo("
endDMY: $endDMY\n"); + } + + } + else{ //months + $firstDayOfCurrentMonth = date("Y-m-01"); //2017-07-01 + // $firstDayOfCurrentMonth = date("2016-12-1"); //test + // $firstDayOfCurrentMonth = date("2017-1-1"); //test + // $firstDayOfCurrentMonth = date("2017-2-1"); //test + if($timeSpan == "nextmonth"){ + $firstOfMonth = strtotime ( '+1 month' , strtotime ( $firstDayOfCurrentMonth ) ) ; + } + else{ //after next month + $firstOfMonth = strtotime ( '+2 month' , strtotime ( $firstDayOfCurrentMonth ) ) ; + } + + $lastDayOfMonth = strtotime ( '+1 month' , $firstOfMonth) - 1; //first day of next month minus 1 second + + $startDateIcs = strftime("%Y%m%dT000000Z", $firstOfMonth); + $endDateIcs = strftime("%Y%m%dT235959Z", $lastDayOfMonth); + + $monthNo = strftime("%m", $firstOfMonth); + $month = $monthNames[$monthNo-1]; + $year = strftime("%Y", $firstOfMonth); + + if(defined('DEBUG')) { + echo("
startDateIcs: $startDateIcs ($firstOfMonth)"); + echo("
endDateIcs: $endDateIcs ($lastDayOfMonth)"); + echo("
firstOfMonth: $firstOfMonth ($monthNo)"); + } + + } + ?> + + + +