* * http://www.radix.net/~cknudsen * * Modified by Mark Peters * * -------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * \**************************************************************************/ /* $Id$ */ $phpgw_info['flags']['currentapp'] = 'calendar'; include('../header.inc.php'); @set_time_limit(0); $icsfile=PHPGW_APP_INC.'/small_test.ics'; $fp=fopen($icsfile,'r'); $contents = explode("\n",fread($fp, filesize($icsfile))); fclose($fp); $vcal = CreateObject('calendar.vCalendar'); $vcalendar = $vcal->read($contents); echo "Product ID = ".$vcalendar->prodid->value."
\n"; echo "Method = ".$vcalendar->method->value."
\n"; echo "Version = ".$vcalendar->version->value."
\n"; for($i=0;$itimezone);$i++) { echo "
\nTIMEZONE
\n"; if($vcalendar->timezone[$i]->tzdata) { for($j=0;$jtimezone[$i]->tzdata);$j++) { echo "TZDATA #$j
\n"; } } } for($i=0;$ievent);$i++) { echo "
\nEVENT
\n"; if($vcalendar->event[$i]->calscale->value) { echo "Calscale = ".$vcalendar->event[$i]->calscale->value."
\n"; } if($vcalendar->event[$i]->description->value) { echo "Description (Value) = ".$vcalendar->event[$i]->description->value."
\n"; } if($vcalendar->event[$i]->description->altrep) { echo "Description (Alt Rep) = ".$vcalendar->event[$i]->description->altrep."
\n"; } if($vcalendar->event[$i]->description->x_type) { for($j=0;$jevent[$i]->description->x_type);$j++) { echo "Description (X-".$vcalendar->event[$i]->description->x_type[$j]->name.") = ".$vcalendar->event[$i]->description->x_type[$j]->value."
\n"; } } if($vcalendar->event[$i]->summary->value) { echo "Summary = ".$vcalendar->event[$i]->summary->value."
\n"; } if(!empty($vcalendar->event[$i]->comment)) { for($j=0;$jevent[$i]->comment);$j++) { echo "Comment = ".$vcalendar->event[$i]->comment[$j]->value."
\n"; } } if($vcalendar->event[$i]->location->value) { echo "Location = ".$vcalendar->event[$i]->location->value."
\n"; } echo "Sequence = ".$vcalendar->event[$i]->sequence."
\n"; echo "Date Start : ".$phpgw->common->show_date(mktime($vcalendar->event[$i]->dtstart->hour,$vcalendar->event[$i]->dtstart->min,$vcalendar->event[$i]->dtstart->sec,$vcalendar->event[$i]->dtstart->month,$vcalendar->event[$i]->dtstart->mday,$vcalendar->event[$i]->dtstart->year) - $phpgw->calendar->datatime->tz_offset)."
\n"; if($vcalendar->event[$i]->dtstart->tzid) { echo "Date Start TZID : ".$vcalendar->event[$i]->dtstart->tzid."
\n"; } if($vcalendar->event[$i]->rrule) { for($j=0;$jevent[$i]->rrule);$j++) { echo "Recurrence : Frequency = ".$vcalendar->event[$i]->rrule[$j]->freq." Count = ".$vcalendar->event[$i]->rrule[$j]->count."
\n"; } } echo "Class = ".$vcalendar->event[$i]->class->value."
\n"; if($vcalendar->event[$i]->organizer) { echo "Organizer = ".$vcalendar->event[$i]->organizer->mailto->user.'@'.$vcalendar->event[$i]->organizer->mailto->host."
\n"; if($vcalendar->event[$i]->organizer->dir) { echo "Organizer Dir = ".$vcalendar->event[$i]->organizer->dir."
\n"; } } for($j=0;$jevent[$i]->attendee);$j++) { echo "
\nAttendee[$j] CN = ".$vcalendar->event[$i]->attendee[$j]->cn."
\n"; if($vcalendar->event[$i]->attendee[$j]->dir) { echo "Attendee[$j] Dir = ".$vcalendar->event[$i]->attendee[$j]->dir."
\n"; } echo "Attendee[$j] Address = ".$vcalendar->event[$i]->attendee[$j]->mailto->user.'@'.$vcalendar->event[$i]->attendee[$j]->mailto->host."
\n"; echo "Attendee[$j] Role = ".$vcal->switch_role($vcalendar->event[$i]->attendee[$j]->role)."
\n"; echo "Attendee[$j] RSVP = ".$vcal->switch_rsvp($vcalendar->event[$i]->attendee[$j]->rsvp)."
\n"; // echo "Attendee[$j] RSVP = ".$vcalendar->event[$i]->attendee[$j]->rsvp."
\n"; if($vcalendar->event[$i]->attendee[$j]->delegated_from->user && $vcalendar->event[$i]->attendee[$j]->delegated_from->host) { echo "Attendee[$j] DELEGATED_FROM = ".$vcalendar->event[$i]->attendee[$j]->delegated_from->user.'@'.$vcalendar->event[$i]->attendee[$j]->delegated_from->host."
\n"; } } } for($i=0;$itodo);$i++) { echo "
\nTODO
\n"; if($vcalendar->todo[$i]->summary->value) { echo "Summary = ".$vcalendar->todo[$i]->summary->value."
\n"; } if($vcalendar->todo[$i]->description->value) { echo "Description (Value) = ".$vcalendar->todo[$i]->description->value."
\n"; } if($vcalendar->todo[$i]->description->altrep) { echo "Description (Alt Rep) = ".$vcalendar->todo[$i]->description->altrep."
\n"; } if($vcalendar->event[$i]->location->value) { echo "Location = ".$vcalendar->todo[$i]->location->value."
\n"; } echo "Sequence = ".$vcalendar->todo[$i]->sequence."
\n"; echo "Date Start : ".$phpgw->common->show_date(mktime($vcalendar->todo[$i]->dtstart->hour,$vcalendar->todo[$i]->dtstart->min,$vcalendar->todo[$i]->dtstart->sec,$vcalendar->todo[$i]->dtstart->month,$vcalendar->todo[$i]->dtstart->mday,$vcalendar->todo[$i]->dtstart->year) - $phpgw->calendar->datatime->tz_offset)."
\n"; echo "Class = ".$vcalendar->todo[$i]->class->value."
\n"; } include(PHPGW_APP_INC.'/../setup/setup.inc.php'); $vcal->set_var($vcalendar->prodid,'value','-//phpGroupWare//phpGroupWare '.$setup_info['calendar']['version'].' MIMEDIR//'.strtoupper($phpgw_info['user']['preferences']['common']['lang'])); echo "


\n"; echo nl2br($vcal->build_vcal($vcalendar)); $phpgw->common->phpgw_footer(); ?>