----- Original Message ----- From: VamVan <vamseevan@xxxxxxxxx> To: php-general@xxxxxxxxxxxxx Date: Thu, 13 Mar 2008 16:21:37 -0700 Subject: class for generating ics or vcs file > Hello All, > > Can anyone share with me a simple class or code that can generate vcs > or ics calendar file in php, that can be imported in to outlook. I started making my own a while ago and never totally finished it. I think it does actually work, but is somewhat incomplete and unpolished. You're welcome to what I started if it helps. It's relatively simple stuff (at least for the basic events). I left in the notes I was keeping in comments with reference links and sample ICS data: -TG <? ########################################################### # Notes ########################################################### ### Two good links about iCal and PHP ## http://www.phpbuilder.com/columns/chow20021007.php3?print_mode=1 ## http://en.wikipedia.org/wiki/ICalendar ### Simple iCal example /* BEGIN:VCALENDAR VERSION:2.0 PRODID:-//GSA Calendar//NONSGML v1.0//EN BEGIN:VEVENT DTSTART:20080131T035959Z DTEND:20080131T170000Z SUMMARY:Test ICS download and integrate END:VEVENT END:VCALENDAR */ ### Sample Outlook 2003 iCal invite /* BEGIN:VCALENDAR PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN VERSION:2.0 METHOD:REQUEST BEGIN:VEVENT ATTENDEE;CN="Anthony Rogers";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:arogers@xxxxxxxxx ATTENDEE;CN=ccardon@xxxxxxxxxxxxxxxxxxxxx;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:ccardon@xxxxxxxxxxxxxxxxxxxxx ATTENDEE;CN=tgryffyn@xxxxxxxxxxxxxxxxxx;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:tgryffyn@xxxxxxxxxxxxxxxxxx DTSTART:20080111T193000Z DTEND:20080111T210000Z TRANSP:OPAQUE SEQUENCE:0 UID:040000008200E00074C5B7101A82E008000000005035EA6DAB52C8010000000000000000100 000007401AA7720FA544DB3F1ADFE59AB3172 DTSTAMP:20080109T154318Z DESCRIPTION:\nSince Cathy and Jes are Pacific Time it will be 11:30 - 1:00pm for them. \n\n SUMMARY:Updated: Web Redesign & HighWire Discussion PRIORITY:1 X-MICROSOFT-CDO-IMPORTANCE:2 CLASS:PUBLIC END:VEVENT END:VCALENDAR */ # Mandatory fields? $appname = "App Name"; $dtstart = "20080131T153000Z"; $dtend = "20080131T170000Z"; $summary = "This is a test summary"; $filename = "Cal_$dtstart.ics"; $summary = str_replace("\r", "=0D=0A=", $summary); $vCalStart = date("Ymd\THi00", $row['EventStart']); $vCalEnd = date("Ymd\THi00", $row['EventEnd']); # Optional fields $description = "This is a longer description of what the event is all about. This part is optional I believe"; $attendees[] = array("Name"=>"", "Role"=>"", "RSVP"=>"", "MailTo"=>""); $transp = "OPAQUE"; $sequence = "0"; $uid = ""; $dtstamp = ""; $priority = "1"; $xmicrosoftcdoimportance = "2"; $class = "PUBLIC"; header("Content-type: text/calendar"); header("Content-Disposition: inline; filename=$filename"); echo "BEGIN:VCALENDAR\n"; // echo "VERSION:2.0\n"; echo "PRODID:-//$appname//NONSGML v1.0//EN\n"; echo "BEGIN:VEVENT\n"; echo "DTSTART:$dtstart\n"; echo "DTEND:$dtend\n"; echo "SUMMARY:$summary\n"; echo "DESCRIPTION:$description\n"; echo "END:VEVENT\n"; echo "END:VCALENDAR\n"; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php