2001-06-10 06:02:50 +02:00
< ? php
/************************************************************************** \
* phpGroupWare - Calendar *
* http :// www . phpgroupware . org *
* Based on Webcalendar by Craig Knudsen < cknudsen @ radix . net > *
* http :// www . radix . net /~ cknudsen *
* Modified by Mark Peters < skeeter @ phpgroupware . org > *
* -------------------------------------------- *
* 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$ */
2001-08-04 03:34:49 +02:00
$phpgw_flags = Array (
'currentapp' => 'calendar' ,
'noappheader' => True ,
'noappfooter' => True
);
$phpgw_info [ 'flags' ] = $phpgw_flags ;
2001-06-10 06:02:50 +02:00
include ( '../header.inc.php' );
2001-08-04 03:34:49 +02:00
echo " Start Time : " . $phpgw -> common -> show_date () . " <br> \n " ;
2001-07-09 13:35:13 +02:00
@ set_time_limit ( 0 );
2001-08-04 03:34:49 +02:00
$icsfile = PHPGW_APP_INC . '/events.ics' ;
$fp = fopen ( $icsfile , 'rt' );
2001-07-09 13:35:13 +02:00
$contents = explode ( " \n " , fread ( $fp , filesize ( $icsfile )));
2001-06-10 06:02:50 +02:00
fclose ( $fp );
2001-08-04 03:34:49 +02:00
// $vcal = CreateObject('calendar.vCalendar');
2001-06-10 06:02:50 +02:00
2001-08-04 03:34:49 +02:00
// $vcalendar = $vcal->read($contents);
2001-06-10 06:02:50 +02:00
2001-08-04 03:34:49 +02:00
// echo "function_exists = ".function_exists("\$vcalendar->read()")."<br>\n";
2001-08-15 20:06:55 +02:00
$vcalendar = ExecMethod ( 'calendar.vCalendar.read' , $contents );
2001-08-04 03:34:49 +02:00
2001-08-27 13:23:44 +02:00
echo " Product ID = " . $vcalendar [ 'prodid' ][ 'value' ] . " <br> \n " ;
echo " Method = " . $vcalendar [ 'method' ][ 'value' ] . " <br> \n " ;
echo " Version = " . $vcalendar [ 'version' ][ 'value' ] . " <br> \n " ;
2001-06-25 00:13:17 +02:00
2001-08-27 13:23:44 +02:00
for ( $i = 0 ; $i < count ( $vcalendar [ 'event' ]); $i ++ )
2001-07-09 13:35:13 +02:00
{
2001-08-27 13:23:44 +02:00
echo " <br> \n EVENT<br> \n " ;
if ( $vcalendar [ 'event' ][ $i ][ 'uid' ])
2001-07-09 13:35:13 +02:00
{
2001-08-27 13:23:44 +02:00
echo 'UID = ' . $vcalendar [ 'event' ][ $i ][ 'uid' ][ 'value' ] . " <br> \n " ;
2001-07-09 13:35:13 +02:00
}
2001-08-27 13:23:44 +02:00
if ( $vcalendar [ 'event' ][ $i ][ 'calscale' ])
2001-07-05 19:04:52 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Calscale = " . $vcalendar [ 'event' ][ $i ][ 'calscale' ] . " <br> \n " ;
2001-07-05 19:04:52 +02:00
}
2001-08-27 13:23:44 +02:00
if ( $vcalendar [ 'event' ][ $i ][ 'description' ][ 'value' ])
2001-07-02 05:31:13 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Description (Value) = " . $vcalendar [ 'event' ][ $i ][ 'description' ][ 'value' ] . " <br> \n " ;
2001-07-02 05:31:13 +02:00
}
2001-08-27 13:23:44 +02:00
if ( $vcalendar [ 'event' ][ $i ][ 'description' ][ 'altrep' ])
2001-07-02 05:31:13 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Description (Alt Rep) = " . $vcalendar [ 'event' ][ $i ][ 'description' ][ 'altrep' ] . " <br> \n " ;
2001-07-02 05:31:13 +02:00
}
2001-08-27 13:23:44 +02:00
if ( $vcalendar [ 'event' ][ $i ][ 'description' ][ 'x_type' ])
2001-07-09 13:35:13 +02:00
{
2001-08-27 13:23:44 +02:00
for ( $j = 0 ; $j < count ( $vcalendar [ 'event' ][ $i ][ 'description' ][ 'x_type' ]); $j ++ )
2001-07-09 13:35:13 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Description (X- " . $vcalendar [ 'event' ][ $i ][ 'description' ][ 'x_type' ][ $j ][ 'name' ] . " ) = " . $vcalendar -> event [ $i ] -> description -> x_type [ $j ] -> value . " <br> \n " ;
2001-07-09 13:35:13 +02:00
}
}
2001-08-27 13:23:44 +02:00
if ( $vcalendar [ 'event' ][ $i ][ 'summary' ][ 'value' ])
2001-07-05 19:04:52 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Summary = " . $vcalendar [ 'event' ][ $i ][ 'summary' ][ 'value' ] . " <br> \n " ;
2001-07-05 19:04:52 +02:00
}
2001-08-27 13:23:44 +02:00
if ( ! empty ( $vcalendar [ 'event' ][ $i ][ 'comment' ]))
2001-07-05 19:04:52 +02:00
{
2001-08-27 13:23:44 +02:00
for ( $j = 0 ; $j < count ( $vcalendar [ 'event' ][ $i ][ 'comment' ]); $j ++ )
2001-07-05 19:04:52 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Comment = " . $vcalendar [ 'event' ][ $i ][ 'comment' ][ $j ][ 'value' ] . " <br> \n " ;
2001-07-05 19:04:52 +02:00
}
}
2001-08-27 13:23:44 +02:00
if ( $vcalendar [ 'event' ][ $i ][ 'location' ][ 'value' ])
2001-07-05 19:04:52 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Location = " . $vcalendar [ 'event' ][ $i ][ 'location' ][ 'value' ] . " <br> \n " ;
2001-07-05 19:04:52 +02:00
}
2001-08-27 13:23:44 +02:00
echo " Sequence = " . $vcalendar [ 'event' ][ $i ][ 'sequence' ] . " <br> \n " ;
// echo _debug_array($vcalendar['event'][$i]['dtstart'])."<br>\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 ) . " <br> \n " ;
if ( $vcalendar [ 'event' ][ $i ][ 'dtstart' ][ 'tzid' ])
2001-07-09 13:35:13 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Date Start TZID : " . $vcalendar [ 'event' ][ $i ][ 'dtstart' ][ 'tzid' ] . " <br> \n " ;
2001-07-09 13:35:13 +02:00
}
2001-08-27 13:23:44 +02:00
if ( $vcalendar [ 'event' ][ $i ][ 'rrule' ])
2001-07-05 19:04:52 +02:00
{
2001-08-27 13:23:44 +02:00
for ( $j = 0 ; $j < count ( $vcalendar [ 'event' ][ $i ][ 'rrule' ]); $j ++ )
2001-07-09 13:35:13 +02:00
{
2001-08-27 13:23:44 +02:00
if ( $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'freq' ])
{
echo " Recurrence : Frequency = " . $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'freq' ] . " <br> \n " ;
}
if ( $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'byday' ])
{
echo " Recurrence : Byday = " . $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'byday' ] . " <br> \n " ;
}
if ( $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'until' ])
{
echo " Recurrence : Until = " . date ( 'Ymd' , mktime ( $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'until' ][ 'hour' ], $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'until' ][ 'min' ], $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'until' ][ 'sec' ], $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'until' ][ 'month' ], $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'until' ][ 'mday' ], $vcalendar [ 'event' ][ $i ][ 'rrule' ][ $j ][ 'until' ][ 'year' ])) . " <br> \n " ;
}
2001-07-09 13:35:13 +02:00
}
2001-07-05 19:04:52 +02:00
}
2001-08-27 13:23:44 +02:00
echo " Class = " . $vCalendar -> switch_class ( $vcalendar [ 'event' ][ $i ][ 'class' ]) . " <br> \n " ;
if ( $vcalendar [ 'event' ][ $i ][ 'organizer' ])
2001-07-02 05:31:13 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Organizer = " . $vcalendar [ 'event' ][ $i ][ 'organizer' ][ 'mailto' ][ 'user' ] . '@' . $vcalendar [ 'event' ][ $i ][ 'organizer' ][ 'mailto' ][ 'host' ] . " <br> \n " ;
if ( $vcalendar [ 'event' ][ $i ][ 'organizer' ][ 'dir' ])
2001-07-09 13:35:13 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Organizer Dir = " . $vcalendar [ 'event' ][ $i ][ 'organizer' ][ 'dir' ] . " <br> \n " ;
2001-07-09 13:35:13 +02:00
}
2001-07-02 05:31:13 +02:00
}
2001-08-27 13:23:44 +02:00
for ( $j = 0 ; $j < count ( $vcalendar [ 'event' ][ $i ][ 'attendee' ]); $j ++ )
2001-06-25 00:13:17 +02:00
{
2001-08-27 13:23:44 +02:00
echo " <br> \n Attendee[ $j ] CN = " . $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'cn' ] . " <br> \n " ;
if ( $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'dir' ])
2001-07-02 05:31:13 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Attendee[ $j ] Dir = " . $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'dir' ] . " <br> \n " ;
2001-07-02 05:31:13 +02:00
}
2001-08-27 13:23:44 +02:00
echo " Attendee[ $j ] Address = " . $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'mailto' ][ 'user' ] . '@' . $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'mailto' ][ 'host' ] . " <br> \n " ;
echo " Attendee[ $j ] Role = " . $vCalendar -> switch_role ( $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'role' ]) . " <br> \n " ;
echo " Attendee[ $j ] RSVP = " . $vCalendar -> switch_rsvp ( $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'rsvp' ]) . " <br> \n " ;
// echo "Attendee[$j] RSVP = ".$vcalendar['event'][$i]['attendee'][$j]['rsvp']."<br>\n";
if ( $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'x_type' ])
2001-08-04 03:34:49 +02:00
{
2001-08-27 13:23:44 +02:00
for ( $k = 0 ; $k < count ( $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'x_type' ]); $k ++ )
2001-08-04 03:34:49 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Attendee[ $j ] (X- " . $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'x_type' ][ $k ][ 'name' ] . " ) = " . $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'x_type' ][ $k ][ 'value' ] . " <br> \n " ;
2001-08-04 03:34:49 +02:00
}
}
2001-08-27 13:23:44 +02:00
if ( $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'delegated_from' ][ 'user' ] && $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'delegated_from' ][ 'host' ])
2001-06-25 00:13:17 +02:00
{
2001-08-27 13:23:44 +02:00
echo " Attendee[ $j ] DELEGATED_FROM = " . $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'delegated_from' ][ 'user' ] . '@' . $vcalendar [ 'event' ][ $i ][ 'attendee' ][ $j ][ 'delegated_from' ][ 'host' ] . " <br> \n " ;
2001-06-25 00:13:17 +02:00
}
}
2001-08-27 13:23:44 +02:00
if ( $vcalendar [ 'event' ][ $i ][ 'alarm' ])
{
for ( $j = 0 ; $j < count ( $vcalendar [ 'event' ][ $i ][ 'alarm' ]); $j ++ )
{
echo " Alarm # $j <br> \n " ;
}
}
2001-06-25 00:13:17 +02:00
}
2001-08-04 03:34:49 +02:00
/*
2001-06-25 00:13:17 +02:00
for ( $i = 0 ; $i < count ( $vcalendar -> todo ); $i ++ )
2001-06-10 19:05:51 +02:00
{
2001-06-25 00:13:17 +02:00
echo " <br> \n TODO<br> \n " ;
2001-07-05 19:04:52 +02:00
if ( $vcalendar -> todo [ $i ] -> summary -> value )
{
echo " Summary = " . $vcalendar -> todo [ $i ] -> summary -> value . " <br> \n " ;
}
2001-07-02 05:31:13 +02:00
if ( $vcalendar -> todo [ $i ] -> description -> value )
{
echo " Description (Value) = " . $vcalendar -> todo [ $i ] -> description -> value . " <br> \n " ;
}
if ( $vcalendar -> todo [ $i ] -> description -> altrep )
{
echo " Description (Alt Rep) = " . $vcalendar -> todo [ $i ] -> description -> altrep . " <br> \n " ;
}
2001-07-05 19:04:52 +02:00
if ( $vcalendar -> event [ $i ] -> location -> value )
{
echo " Location = " . $vcalendar -> todo [ $i ] -> location -> value . " <br> \n " ;
}
2001-06-25 00:13:17 +02:00
echo " Sequence = " . $vcalendar -> todo [ $i ] -> sequence . " <br> \n " ;
2001-08-04 03:34:49 +02:00
echo " Date Start : " . $phpgw -> common -> show_date ( mktime ( $vcalendar -> todo [ $i ] -> dtstart -> value -> hour , $vcalendar -> todo [ $i ] -> dtstart -> value -> min , $vcalendar -> todo [ $i ] -> dtstart -> value -> sec , $vcalendar -> todo [ $i ] -> dtstart -> value -> month , $vcalendar -> todo [ $i ] -> dtstart -> value -> mday , $vcalendar -> todo [ $i ] -> dtstart -> value -> year ) - $phpgw -> calendar -> datatime -> tz_offset ) . " <br> \n " ;
2001-07-05 19:04:52 +02:00
echo " Class = " . $vcalendar -> todo [ $i ] -> class -> value . " <br> \n " ;
2001-06-10 19:05:51 +02:00
}
2001-06-25 00:13:17 +02:00
2001-08-27 13:23:44 +02:00
*/
2001-06-25 00:13:17 +02:00
include ( PHPGW_APP_INC . '/../setup/setup.inc.php' );
2001-08-27 13:23:44 +02:00
$vCalendar -> set_var ( $vcalendar [ 'prodid' ], 'value' , '-//phpGroupWare//phpGroupWare ' . $setup_info [ 'calendar' ][ 'version' ] . ' MIMEDIR//' . strtoupper ( $phpgw_info [ 'user' ][ 'preferences' ][ 'common' ][ 'lang' ]));
2001-06-25 00:13:17 +02:00
echo " <br><br><br> \n " ;
2001-08-27 13:23:44 +02:00
echo nl2br ( execmethod ( 'calendar.vCalendar.build_vcal' , $vcalendar ));
2001-08-04 03:34:49 +02:00
echo " End Time : " . $phpgw -> common -> show_date () . " <br> \n " ;
2001-06-10 06:02:50 +02:00
$phpgw -> common -> phpgw_footer ();
?>