Browse Source

dump DB to ICS now functionnal

master
n0m1s 11 years ago
parent
commit
191484ec66
3 changed files with 19 additions and 15 deletions
  1. +9
    -10
      calendar.php
  2. +10
    -5
      calendar.php~
  3. BIN
      testdb.db

+ 9
- 10
calendar.php View File

@ -5,19 +5,14 @@
# exit; # exit;
# } # }
header('Content-type: text/calendar; charset=utf-8'); header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: inline; filename=calendar.ics');
header('Content-Disposition: inline; filename=kiwicalendar.ics');
include("./getEvents.php"); include("./getEvents.php");
$icalheader = "BEGIN:VCALENDAR $icalheader = "BEGIN:VCALENDAR
VERSION:2.0 VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN"
PRODID:KiWiCalendar v1.0//EN
";
$icalfooter = "END:VCALENDAR"; $icalfooter = "END:VCALENDAR";
#"BEGIN:VEVENT
#UID:" . md5(uniqid(mt_rand(), true)) . "@yourhost.test
#DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
#DTSTART:19970714T170000Z
#DTEND:19970715T035959Z
#SUMMARY:Bastille Day Party"
$events = getEvents(); $events = getEvents();
@ -27,8 +22,12 @@ PRODID:-//hacksw/handcal//NONSGML v1.0//EN"
{ {
echo "BEGIN:VEVENT echo "BEGIN:VEVENT
SUMMARY:".$event["titre"]." SUMMARY:".$event["titre"]."
"."END:VEVENT";
DTSTART:".date("Ymd\THis",strtotime($event["dtstart"]))."
DTEND:".date("Ymd\THis",strtotime($event["dtend"]))."
LOCATION:".$event["localisation"]."
CATEGORIES:"."<TODO : categorie>"."
DESCRIPTION:".$event["description"]."
END:VEVENT\n";
} }
echo $icalfooter; echo $icalfooter;
print_r($events);
?> ?>

+ 10
- 5
calendar.php~ View File

@ -5,19 +5,20 @@
# exit; # exit;
# } # }
header('Content-type: text/calendar; charset=utf-8'); header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: inline; filename=calendar.ics');
header('Content-Disposition: inline; filename=kiwicalendar.ics');
include("./getEvents.php"); include("./getEvents.php");
$icalheader = "BEGIN:VCALENDAR $icalheader = "BEGIN:VCALENDAR
VERSION:2.0 VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN"
PRODID:KiWiCalendar v1.0//EN
";
$icalfooter = "END:VCALENDAR"; $icalfooter = "END:VCALENDAR";
#"BEGIN:VEVENT #"BEGIN:VEVENT
#UID:" . md5(uniqid(mt_rand(), true)) . "@yourhost.test #UID:" . md5(uniqid(mt_rand(), true)) . "@yourhost.test
#DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z #DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z
#DTSTART:19970714T170000Z #DTSTART:19970714T170000Z
#DTEND:19970715T035959Z #DTEND:19970715T035959Z
SUMMARY:Bastille Day Party"
#SUMMARY:Bastille Day Party"
$events = getEvents(); $events = getEvents();
@ -27,8 +28,12 @@ SUMMARY:Bastille Day Party"
{ {
echo "BEGIN:VEVENT echo "BEGIN:VEVENT
SUMMARY:".$event["titre"]." SUMMARY:".$event["titre"]."
"."END:VEVENT";
DTSTART:".date("Ymd\THis",strtotime($event["dtstart"]))."
DTEND:".date("Ymd\THis",strtotime($event["dtend"]))."
LOCATION:".$event["localisation"]."
CATEGORIES:"."<TODO : categorie>"."
DESCRIPTION:".$event["description"]."
END:VEVENT\n";
} }
echo $icalfooter; echo $icalfooter;
print_r($events);
?> ?>

BIN
testdb.db View File


Loading…
Cancel
Save