Initial commit
This commit is contained in:
70
make_ical.php
Normal file
70
make_ical.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
require_once("config.inc.php");
|
||||
|
||||
header('Content-type: text/calendar; charset=utf-8');
|
||||
header('Content-Disposition: inline; filename=SPACEmon.ics');
|
||||
|
||||
//Termine auslesen
|
||||
|
||||
|
||||
#$sel_termine = "select date_format(t_wann, '%Y%m%dT%H%i00') as von, date_format(t_bis, '%Y%m%dT%H%i00') as bis, t_was, t_id, t_user FROM spacemon_termine where t_bis>current_timestamp order by t_wann asc;";
|
||||
$sel_termine = "select date_format(datum, '%Y%m%dT093000') as von, date_format(datum, '%Y%m%dT103000') as bis, vorwort, botschaft, textwort, inhalt, zusammenfassung, kontext, lid FROM quelle where datum >current_timestamp order by datum asc;";
|
||||
$result1 = @mysql_query($sel_termine);
|
||||
|
||||
// the iCal date format. Note the Z on the end indicates a UTC timestamp. + INTERVAL -2 HOUR
|
||||
define('DATE_ICAL', 'Ymd\THis\Z');
|
||||
|
||||
// max line length is 75 chars. New line is \\n
|
||||
|
||||
$output = "BEGIN:VCALENDAR
|
||||
METHOD:PUBLISH
|
||||
VERSION:2.0
|
||||
CALSCALE:GREGORIAN
|
||||
PRODID:-//AS//LG Kalender//DE\n
|
||||
";
|
||||
|
||||
$output .= "X-WR-CALNAME:SPACEmon
|
||||
X-MS-OLK-WKHRSTART;TZID=\"Mitteleuropäische Zeit\":060000
|
||||
X-MS-OLK-WKHREND;TZID=\"Mitteleuropäische Zeit\":200000
|
||||
X-MS-OLK-WKHRDAYS:MO,TU,WE,TH,FR
|
||||
X-WR-TIMEZONE:Europe/Berlin
|
||||
BEGIN:VTIMEZONE
|
||||
TZID:Europe/Berlin
|
||||
BEGIN:DAYLIGHT
|
||||
TZOFFSETFROM:+0100
|
||||
TZOFFSETTO:+0200
|
||||
DTSTART:19810329T020000
|
||||
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
|
||||
TZNAME:CEST
|
||||
END:DAYLIGHT
|
||||
BEGIN:STANDARD
|
||||
TZOFFSETFROM:+0200
|
||||
TZOFFSETTO:+0100
|
||||
DTSTART:19961027T030000
|
||||
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
|
||||
TZNAME:CET
|
||||
END:STANDARD
|
||||
END:VTIMEZONE
|
||||
";
|
||||
|
||||
|
||||
// loop over events
|
||||
while ($row = mysql_fetch_assoc($result1)) {
|
||||
$output .=
|
||||
"BEGIN:VEVENT
|
||||
SUMMARY;LANGUAGE=de:Gottesdienst
|
||||
UID:".$row['lid']."
|
||||
DTSTART;TZID=Europe/Berlin:".$row['von']."
|
||||
DTEND;TZID=Europe/Berlin:".$row['bis']."
|
||||
END:VEVENT\n
|
||||
";
|
||||
|
||||
}
|
||||
|
||||
|
||||
// close calendar
|
||||
$output .= "END:VCALENDAR";
|
||||
|
||||
echo $output;
|
||||
|
||||
?>
|
Reference in New Issue
Block a user