phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] calendar/inc class.bocalendar.inc.php class.boi...


From: Dave Hall
Subject: [Phpgroupware-cvs] calendar/inc class.bocalendar.inc.php class.boi...
Date: Sat, 07 Jan 2006 11:14:56 +0000

CVSROOT:        /cvsroot/phpgroupware
Module name:    calendar
Branch:         
Changes by:     Dave Hall <address@hidden>      06/01/07 11:14:56

Modified files:
        inc            : class.bocalendar.inc.php 
                         class.boicalendar.inc.php 
                         class.socalendar.inc.php 
                         class.socalendar_sql.inc.php 

Log message:
        pre groupdav stuff, docs, formatting, cleanups and minor fixes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/class.bocalendar.inc.php.diff?tr1=1.102&tr2=1.103&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/class.boicalendar.inc.php.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/class.socalendar.inc.php.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/calendar/inc/class.socalendar_sql.inc.php.diff?tr1=1.40&tr2=1.41&r1=text&r2=text

Patches:
Index: calendar/inc/class.bocalendar.inc.php
diff -u calendar/inc/class.bocalendar.inc.php:1.102 
calendar/inc/class.bocalendar.inc.php:1.103
--- calendar/inc/class.bocalendar.inc.php:1.102 Fri Dec 16 13:24:44 2005
+++ calendar/inc/class.bocalendar.inc.php       Sat Jan  7 11:14:56 2006
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-       /* $Id: class.bocalendar.inc.php,v 1.102 2005/12/16 13:24:44 skwashd 
Exp $ */
+       /* $Id: class.bocalendar.inc.php,v 1.103 2006/01/07 11:14:56 skwashd 
Exp $ */
 
        class bocalendar
        {
@@ -148,8 +148,8 @@
 
                                foreach($this->grants as $grantor => $rights)
                                {
-                                       print_debug('Grantor',$grantor);
-                                       print_debug('Rights',$rights);
+                                       print_debug('Grantor', $grantor);
+                                       print_debug('Rights', $rights);
                                }
                        }
 
@@ -1432,9 +1432,9 @@
 
                function display_status($user_status)
                {
-                       if(@$this->prefs['calendar']['display_status'] && 
$user_status)
+                       if( isset($this->prefs['calendar']['display_status']) 
&& $this->prefs['calendar']['display_status'] && $user_status)
                        {
-                               $user_status = 
substr($this->get_long_status($user_status),0,1);
+                               $user_status = 
substr($this->get_long_status($user_status), 0, 1);
 
                                return ' ('.$user_status.')';
                        }
@@ -1444,6 +1444,24 @@
                        }
                }
 
+               function get_event_etags($event_id = 0)
+               {
+                       //this is a little convoluted, but it is a decent 
compromise
+                       $can_read = array();
+                       foreach ( $this->grants as $acct_id => $rights )
+                       {
+                               if ( $rights & PHPGW_ACL_READ )
+                               {
+                                       $person_id = 
$this->contacts->is_contact($acct_id);
+                                       if ( $person_id ) 
+                                       {
+                                               $can_read[] = $person_id;
+                                       }
+                               }
+                       }
+                       return $this->so->get_event_etags( $can_read, $event_id 
);
+               }
+
                function get_long_status($status_short)
                {
                        switch ($status_short)
Index: calendar/inc/class.boicalendar.inc.php
diff -u calendar/inc/class.boicalendar.inc.php:1.31 
calendar/inc/class.boicalendar.inc.php:1.32
--- calendar/inc/class.boicalendar.inc.php:1.31 Fri Dec 16 13:24:44 2005
+++ calendar/inc/class.boicalendar.inc.php      Sat Jan  7 11:14:56 2006
@@ -10,7 +10,7 @@
  *  option) any later version.                                              *
  \**************************************************************************/
 
-/* $Id: class.boicalendar.inc.php,v 1.31 2005/12/16 13:24:44 skwashd Exp $ */
+/* $Id: class.boicalendar.inc.php,v 1.32 2006/01/07 11:14:56 skwashd Exp $ */
 
 define('FOLD_LENGTH',75);
 
@@ -40,9 +40,9 @@
 /*
  * Class
  */
-define('PRIVATE',0);
-define('PUBLIC',1);
-define('CONFIDENTIAL',3);
+define('PHPGW_ICAL_PRIVATE',0);
+define('PHPGW_ICAL_PUBLIC',1);
+define('PHPGW_ICAL_CONFIDENTIAL',3);
 
 /*
  * Transparency
@@ -108,906 +108,906 @@
        {
                $this->property = array
                        (
-                               'action'        => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'valarm'        => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'attach'        => array
-                                               (
-                                                       'type'          => 
'uri',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'valarm'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'attendee'      => array
-                                               (
-                                                       'type'          => 
'cal-address',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'valarm'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'categories'    => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'class'         => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'comment'       => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'daylight'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'standard'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'valarm'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'completed'     => array
-                                               (
-                                                       'type'          => 
'date-time',
-                                                       'to_text'       => 
False,
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'contact'       => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
        'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'created'       => array
-                                               (
-                                                       'type'          => 
'date-time',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'description'   => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'valarm'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'dtend'         => array
-                                               (
-                                                       'type'          => 
'date-time',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'dtstamp'       => array
-                                               (
-                                                       'type'          => 
'date-time',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),                      
-
-                               'dtstart'       => array
-                                               (
-                                                       'type'          => 
'date-time',
-                                                       'to_text'       => 
False,
-                                                       'daylight'      => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'standard'      => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'due'           => array
-                                               (
-                                                       'type'          => 
'date-time',
-                                                       'to_text'       => 
False,
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'duration'      => array
-                                               (
-                                                       'type'          => 
'duration',
-                                                       'to_text'       => 
False,
-                                                       'valarm'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'exdate'        => array
-                                               (
-                                                       'type'          => 
'date-time',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'exrule'        => array
-                                               (
-                                                       'type'          => 
'recur',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'freebusy'      => array
-                                               (
-                                                       'type'          => 
'freebusy',
-                                                       'to_text'       => 
False,
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
+                        'action'       => array
+                        (
+                         'type'                => 'text',
+                         'to_text'     => True,
+                         'valarm'      => array
+                         (
+                          'state'              => 'required',
+                          'multiples'  => False
+                         )
+                        ),
+
+                        'attach'       => array
+                        (
+                         'type'                => 'uri',
+                         'to_text'     => True,
+                         'vevent'      => array
+                         (
+                          'state'              => 'optional',
+                          'multiples'  => True
+                         ),
+                         'vtodo'               => array
+                         (
+                          'state'              => 'optional',
+                          'multiples'  => True
+                         ),
+                         'vjournal'    => array
+                         (
+                          'state'              => 'optional',
+                          'multiples'  => True
+                         ),
+                         'valarm'      => array
+                         (
+                          'state'              => 'optional',
+                          'multiples'  => True
+                         )
+                         ),
+
+                         'attendee'    => array
+                                 (
+                                  'type'               => 'cal-address',
+                                  'to_text'    => False,
+                                  'vevent'     => array
+                                  (
+                                   'state'             => 'optional',
+                                   'multiples' => True
+                                  ),
+                                  'vtodo'              => array
+                                  (
+                                   'state'             => 'optional',
+                                   'multiples' => True
+                                  ),
+                                  'vjournal'   => array
+                                  (
+                                   'state'             => 'optional',
+                                   'multiples' => True
+                                  ),
+                                  'valarm'     => array
+                                  (
+                                   'state'             => 'optional',
+                                   'multiples' => True
+                                  ),
+                                  'vfreebusy'  => array
+                                          (
+                                           'state'             => 'optional',
+                                           'multiples' => True
+                                          )
+                                          ),
+
+                                  'categories' => array
+                                          (
+                                           'type'              => 'text',
+                                           'to_text'   => True,
+                                           'vevent'    => array
+                                           (
+                                            'state'            => 'optional',
+                                            'multiples'        => True
+                                           ),
+                                           'vtodo'             => array
+                                           (
+                                            'state'            => 'optional',
+                                            'multiples'        => False
+                                           ),
+                                           'vjournal'  => array
+                                           (
+                                            'state'            => 'optional',
+                                            'multiples'        => True
+                                           )
+                                          ),
+
+                                  'class'              => array
+                                          (
+                                           'type'              => 'text',
+                                           'to_text'   => True,
+                                           'vevent'    => array
+                                           (
+                                            'state'            => 'optional',
+                                            'multiples'        => False
+                                           ),
+                                           'vtodo'             => array
+                                           (
+                                            'state'            => 'optional',
+                                            'multiples'        => False
+                                           ),
+                                           'vjournal'  => array
+                                           (
+                                            'state'            => 'optional',
+                                            'multiples'        => False
+                                           )
+                                          ),
+
+                                  'comment'    => array
+                                          (
+                                           'type'              => 'text',
+                                           'to_text'   => True,
+                                           'daylight'  => array
+                                           (
+                                            'state'            => 'optional',
+                                            'multiples'        => True
+                                           ),
+                                           'standard'  => array
+                                           (
+                                            'state'            => 'optional',
+                                            'multiples'        => True
+                                           ),
+                                           'valarm'    => array
+                                           (
+                                            'state'            => 'optional',
+                                            'multiples'        => True
+                                           ),
+                                           'vevent'    => array
+                                           (
+                                            'state'            => 'optional',
+                                            'multiples'        => True
+                                           ),
+                                           'vfreebusy' => array
+                                                   (
+                                                    'state'            => 
'optional',
+                                                    'multiples'        => True
+                                                   ),
+                                           'vjournal'  => array
+                                                   (
+                                                    'state'            => 
'optional',
+                                                    'multiples'        => True
+                                                   ),
+                                           'vtodo'             => array
+                                                   (
+                                                    'state'            => 
'optional',
+                                                    'multiples'        => True
+                                                   )
+                                                   ),
+
+                                           'completed' => array
+                                                   (
+                                                    'type'             => 
'date-time',
+                                                    'to_text'  => False,
+                                                    'vtodo'            => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => False
+                                                    )
+                                                   ),
 
-                               'geo'           => array
-                                               (
-                                                       'type'          => 
'float',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
+                                           'contact'   => array
+                                                   (
+                                                    'type'             => 
'text',
+                                                    'to_text'  => True,
+                                                    'vevent'   => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => True
+                                                    ),
+                                                    'vfreebusy'        => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => False
+                                                    ),
+                                                    'vjournal' => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => True
+                                                    )
+                                                   ),
 
-                               'last_modified' => array
-                                               (
-                                                       'type'          => 
'date-time',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtimezone'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
+                                           'created'   => array
+                                                   (
+                                                    'type'             => 
'date-time',
+                                                    'to_text'  => False,
+                                                    'vevent'   => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => False
+                                                    ),
+                                                    'vtodo'            => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => False
+                                                    ),
+                                                    'vjournal' => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => False
+                                                    )
+                                                   ),
 
-                               'location'      => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
+                                           'description'       => array
+                                                   (
+                                                    'type'             => 
'text',
+                                                    'to_text'  => True,
+                                                    'vevent'   => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => False
+                                                    ),
+                                                    'vtodo'            => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => False
+                                                    ),
+                                                    'vjournal' => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => True
+                                                    ),
+                                                    'valarm'   => array
+                                                    (
+                                                     'state'           => 
'optional',
+                                                     'multiples'       => False
+                                                    )
+                                                    ),
 
-                               'method'        => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'ical'  => array
-                                                               (
+                                                    'dtend'            => array
+                                                            (
+                                                             'type'            
=> 'date-time',
+                                                             'to_text' => 
False,
+                                                             'vevent'  => array
+                                                             (
+                                                              'state'          
=> 'optional',
+                                                              'multiples'      
=> False
+                                                             ),
+                                                             'vfreebusy'       
=> array
+                                                             (
+                                                              'state'          
=> 'optional',
+                                                              'multiples'      
=> False
+                                                             )
+                                                            ),
+
+                                                    'dtstamp'  => array
+                                                            (
+                                                             'type'            
=> 'date-time',
+                                                             'to_text' => 
False,
+                                                             'vevent'  => array
+                                                             (
+                                                              'state'          
=> 'optional',
+                                                              'multiples'      
=> False
+                                                             ),
+                                                             'vtodo'           
=> array
+                                                             (
+                                                              'state'          
=> 'optional',
+                                                              'multiples'      
=> False
+                                                             ),
+                                                             'vjournal'        
=> array
+                                                             (
+                                                              'state'          
=> 'optional',
+                                                              'multiples'      
=> True
+                                                             ),
+                                                             'vfreebusy'       
=> array
+                                                             (
+                                                              'state'          
=> 'optional',
+                                                              'multiples'      
=> False
+                                                             )
+                                                             ),                
        
+
+                                                             'dtstart' => array
+                                                                     (
+                                                                      'type'   
        => 'date-time',
+                                                                      
'to_text'        => False,
+                                                                      
'daylight'       => array
+                                                                      (
                                                                        'state' 
        => 'required',
                                                                        
'multiples'     => False
-                                                               )
-                                               ),
-
-                               'organizer'     => array
-                                               (
-                                                       'type'          => 
'cal-address',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'percent_complete' => array
-                                               (
-                                                       'type'          => 
'integer',
-                                                       'to_text'       => 
False,
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'priority'      => array
-                                               (
-                                                       'type'          => 
'integer',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'prodid'        => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'ical'          => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'rdate'         => array
-                                               (
-                                                       'type'          => 
'date-time',
-                                                       'to_text'       => 
False,
-                                                       'daylight'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'standard'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'recurrence_id' => array
-                                               (
-                                                       'type'          => 
'date-time',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'related_to'    => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'request_status'=> array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'resources'     => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => 
False,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
        'state'         => 'optional',
-                                                                               
        'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-
-                               'rrule'         => array
-                                               (
-                                                       'type'          => 
'recur',
-                                                       'to_text'       => 
False,
-                                                       'daylight'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'standard'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'sequence'      => array
-                                               (
-                                                       'type'          => 
'integer',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
+                                                                      ),
+                                                                      
'standard'       => array
+                                                                      (
+                                                                       'state' 
        => 'required',
+                                                                       
'multiples'     => False
+                                                                      ),
+                                                                      'vevent' 
=> array
+                                                                      (
+                                                                       'state' 
        => 'optional',
+                                                                       
'multiples'     => False
+                                                                      ),
+                                                                      
'vfreebusy'      => array
+                                                                      (
+                                                                       'state' 
        => 'optional',
+                                                                       
'multiples'     => False
+                                                                      ),
+                                                                      
'vjournal'       => array
+                                                                              (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                              
),
+                                                                      'vtodo'  
        => array
+                                                                              (
+                                                                               
'state'         => 'optional',
+                                                                               
'multiples'     => False
+                                                                              )
+                                                                              
),
+
+                                                                      'due'    
        => array
+                                                                              (
+                                                                               
'type'          => 'date-time',
+                                                                               
'to_text'       => False,
+                                                                               
'vtodo'         => array
+                                                                               
(
+                                                                               
 'state'                => 'optional',
+                                                                               
 'multiples'    => False
+                                                                               
)
+                                                                              
),
 
-                               'status'        => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
+                                                                      
'duration'       => array
+                                                                              (
+                                                                               
'type'          => 'duration',
+                                                                               
'to_text'       => False,
+                                                                               
'valarm'        => array
+                                                                               
(
+                                                                               
 'state'                => 'optional',
+                                                                               
 'multiples'    => False
+                                                                               
),
+                                                                               
'vevent'        => array
+                                                                               
(
+                                                                               
 'state'                => 'optional',
+                                                                               
 'multiples'    => False
+                                                                               
),
+                                                                               
'vfreebusy'     => array
+                                                                               
(
+                                                                               
 'state'                => 'optional',
+                                                                               
 'multiples'    => False
+                                                                               
),
+                                                                               
'vtodo'         => array
+                                                                               
(
+                                                                               
 'state'                => 'optional',
+                                                                               
 'multiples'    => False
+                                                                               
)
+                                                                               
),
 
-                               'summary'       => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'valarm'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-                               
-                               'transp'        => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-                               
-                               'trigger'       => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'valarm'        => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-                                               
-                               'tzid'          => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vtimezone'     => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-                                               
-                               'tzname'        => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'daylight'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       ),
-                                                       'standard'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => True
-                                                                       )
-                                               ),
-
-                               'tzoffsetfrom'  => array
-                                               (
-                                                       'type'          => 
'utc-offset',
-                                                       'to_text'       => True,
-                                                       'daylight'      => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'standard'      => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-                                               
-                               'tzoffsetto'    => array
-                                               (
-                                                       'type'          => 
'utc-offset',
-                                                       'to_text'       => True,
-                                                       'daylight'      => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'standard'      => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-                               
-                               'tzurl'         => array
-                                               (
-                                                       'type'          => 
'uri',
-                                                       'to_text'       => True,
-                                                       'vtimezone'     => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       
-                                               ),
-                                               
-                               'uid'           => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-                                               
-                               'url'           => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'vevent'        => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vfreebusy'     => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vjournal'      => array
-                                                                       (
-                                                                               
'state'         => 'optional',
-                                                                               
'multiples'     => False
-                                                                       ),
-                                                       'vtodo'         => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               ),
-                                               
-                               'version'       => array
-                                               (
-                                                       'type'          => 
'text',
-                                                       'to_text'       => True,
-                                                       'ical'          => array
-                                                                       (
-                                                                               
'state'         => 'required',
-                                                                               
'multiples'     => False
-                                                                       )
-                                               )
-                       ));
+                                                                               
'exdate'        => array
+                                                                               
        (
+                                                                               
         'type'         => 'date-time',
+                                                                               
         'to_text'      => False,
+                                                                               
         'vevent'       => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => True
+                                                                               
         ),
+                                                                               
         'vjournal'     => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => True
+                                                                               
         ),
+                                                                               
         'vtodo'                => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => True
+                                                                               
         )
+                                                                               
        ),
+
+                                                                               
'exrule'        => array
+                                                                               
        (
+                                                                               
         'type'         => 'recur',
+                                                                               
         'to_text'      => False,
+                                                                               
         'vevent'       => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => True
+                                                                               
         ),
+                                                                               
         'vjournal'     => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => True
+                                                                               
         ),
+                                                                               
         'vtodo'                => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => True
+                                                                               
         )
+                                                                               
        ),
+
+                                                                               
'freebusy'      => array
+                                                                               
        (
+                                                                               
         'type'         => 'freebusy',
+                                                                               
         'to_text'      => False,
+                                                                               
         'vfreebusy'    => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => True
+                                                                               
         )
+                                                                               
        ),
+
+                                                                               
'geo'           => array
+                                                                               
        (
+                                                                               
         'type'         => 'float',
+                                                                               
         'to_text'      => True,
+                                                                               
         'vevent'       => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => False
+                                                                               
         ),
+                                                                               
         'vtodo'                => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => False
+                                                                               
         )
+                                                                               
        ),
+
+                                                                               
'last_modified' => array
+                                                                               
        (
+                                                                               
         'type'         => 'date-time',
+                                                                               
         'to_text'      => False,
+                                                                               
         'vevent'       => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => False
+                                                                               
         ),
+                                                                               
         'vtodo'                => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => False
+                                                                               
         ),
+                                                                               
         'vjournal'     => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => False
+                                                                               
         ),
+                                                                               
         'vtimezone'    => array
+                                                                               
         (
+                                                                               
          'state'               => 'optional',
+                                                                               
          'multiples'   => False
+                                                                               
         )
+                                                                               
         ),
+
+                                                                               
         'location'     => array
+                                                                               
                 (
+                                                                               
                  'type'                => 'text',
+                                                                               
                  'to_text'     => True,
+                                                                               
                  'vevent'      => array
+                                                                               
                  (
+                                                                               
                   'state'              => 'optional',
+                                                                               
                   'multiples'  => False
+                                                                               
                  ),
+                                                                               
                  'vtodo'               => array
+                                                                               
                  (
+                                                                               
                   'state'              => 'optional',
+                                                                               
                   'multiples'  => False
+                                                                               
                  )
+                                                                               
                 ),
+
+                                                                               
         'method'       => array
+                                                                               
                 (
+                                                                               
                  'type'                => 'text',
+                                                                               
                  'to_text'     => True,
+                                                                               
                  'ical'        => array
+                                                                               
                  (
+                                                                               
                   'state'              => 'required',
+                                                                               
                   'multiples'  => False
+                                                                               
                  )
+                                                                               
                 ),
+
+                                                                               
         'organizer'    => array
+                                                                               
                 (
+                                                                               
                  'type'                => 'cal-address',
+                                                                               
                  'to_text'     => False,
+                                                                               
                  'vevent'      => array
+                                                                               
                  (
+                                                                               
                   'state'              => 'optional',
+                                                                               
                   'multiples'  => False
+                                                                               
                  ),
+                                                                               
                  'vtodo'               => array
+                                                                               
                  (
+                                                                               
                   'state'              => 'optional',
+                                                                               
                   'multiples'  => False
+                                                                               
                  ),
+                                                                               
                  'vjournal'    => array
+                                                                               
                  (
+                                                                               
                   'state'              => 'optional',
+                                                                               
                   'multiples'  => False
+                                                                               
                  ),
+                                                                               
                  'vfreebusy'   => array
+                                                                               
                  (
+                                                                               
                   'state'              => 'optional',
+                                                                               
                   'multiples'  => False
+                                                                               
                  )
+                                                                               
                  ),
+
+                                                                               
                  'percent_complete' => array
+                                                                               
                          (
+                                                                               
                           'type'               => 'integer',
+                                                                               
                           'to_text'    => False,
+                                                                               
                           'vtodo'              => array
+                                                                               
                           (
+                                                                               
                            'state'             => 'optional',
+                                                                               
                            'multiples' => False
+                                                                               
                           )
+                                                                               
                          ),
+
+                                                                               
                  'priority'    => array
+                                                                               
                          (
+                                                                               
                           'type'               => 'integer',
+                                                                               
                           'to_text'    => True,
+                                                                               
                           'vevent'     => array
+                                                                               
                           (
+                                                                               
                            'state'             => 'optional',
+                                                                               
                            'multiples' => False
+                                                                               
                           ),
+                                                                               
                           'vtodo'              => array
+                                                                               
                           (
+                                                                               
                            'state'             => 'optional',
+                                                                               
                            'multiples' => False
+                                                                               
                           )
+                                                                               
                          ),
+
+                                                                               
                  'prodid'      => array
+                                                                               
                          (
+                                                                               
                           'type'               => 'text',
+                                                                               
                           'to_text'    => True,
+                                                                               
                           'ical'               => array
+                                                                               
                           (
+                                                                               
                            'state'             => 'required',
+                                                                               
                            'multiples' => False
+                                                                               
                           )
+                                                                               
                          ),
+
+                                                                               
                  'rdate'               => array
+                                                                               
                          (
+                                                                               
                           'type'               => 'date-time',
+                                                                               
                           'to_text'    => False,
+                                                                               
                           'daylight'   => array
+                                                                               
                           (
+                                                                               
                            'state'             => 'optional',
+                                                                               
                            'multiples' => True
+                                                                               
                           ),
+                                                                               
                           'standard'   => array
+                                                                               
                           (
+                                                                               
                            'state'             => 'optional',
+                                                                               
                            'multiples' => True
+                                                                               
                           ),
+                                                                               
                           'vevent'     => array
+                                                                               
                           (
+                                                                               
                            'state'             => 'optional',
+                                                                               
                            'multiples' => True
+                                                                               
                           ),
+                                                                               
                           'vtodo'              => array
+                                                                               
                           (
+                                                                               
                            'state'             => 'optional',
+                                                                               
                            'multiples' => True
+                                                                               
                           ),
+                                                                               
                           'vjournal'   => array
+                                                                               
                                   (
+                                                                               
                                    'state'             => 'optional',
+                                                                               
                                    'multiples' => True
+                                                                               
                                   )
+                                                                               
                                   ),
+
+                                                                               
                           'recurrence_id'      => array
+                                                                               
                                   (
+                                                                               
                                    'type'              => 'date-time',
+                                                                               
                                    'to_text'   => False,
+                                                                               
                                    'vevent'    => array
+                                                                               
                                    (
+                                                                               
                                     'state'            => 'optional',
+                                                                               
                                     'multiples'        => False
+                                                                               
                                    ),
+                                                                               
                                    'vjournal'  => array
+                                                                               
                                    (
+                                                                               
                                     'state'            => 'optional',
+                                                                               
                                     'multiples'        => False
+                                                                               
                                    ),
+                                                                               
                                    'vtodo'             => array
+                                                                               
                                    (
+                                                                               
                                     'state'            => 'optional',
+                                                                               
                                     'multiples'        => False
+                                                                               
                                    )
+                                                                               
                                   ),
+
+                                                                               
                           'related_to' => array
+                                                                               
                                   (
+                                                                               
                                    'type'              => 'text',
+                                                                               
                                    'to_text'   => False,
+                                                                               
                                    'vevent'    => array
+                                                                               
                                    (
+                                                                               
                                     'state'            => 'optional',
+                                                                               
                                     'multiples'        => False
+                                                                               
                                    ),
+                                                                               
                                    'vjournal'  => array
+                                                                               
                                    (
+                                                                               
                                     'state'            => 'optional',
+                                                                               
                                     'multiples'        => True
+                                                                               
                                    ),
+                                                                               
                                    'vtodo'             => array
+                                                                               
                                    (
+                                                                               
                                     'state'            => 'optional',
+                                                                               
                                     'multiples'        => True
+                                                                               
                                    )
+                                                                               
                                   ),
+
+                                                                               
                           'request_status'=> array
+                                                                               
                                   (
+                                                                               
                                    'type'              => 'text',
+                                                                               
                                    'to_text'   => True,
+                                                                               
                                    'vevent'    => array
+                                                                               
                                    (
+                                                                               
                                     'state'            => 'optional',
+                                                                               
                                     'multiples'        => False
+                                                                               
                                    ),
+                                                                               
                                    'vtodo'             => array
+                                                                               
                                    (
+                                                                               
                                     'state'            => 'optional',
+                                                                               
                                     'multiples'        => False
+                                                                               
                                    ),
+                                                                               
                                    'vjournal'  => array
+                                                                               
                                    (
+                                                                               
                                     'state'            => 'optional',
+                                                                               
                                     'multiples'        => True
+                                                                               
                                    ),
+                                                                               
                                    'vfreebusy' => array
+                                                                               
                                    (
+                                                                               
                                     'state'            => 'optional',
+                                                                               
                                     'multiples'        => True
+                                                                               
                                    )
+                                                                               
                                    ),
+
+                                                                               
                                    'resources' => array
+                                                                               
                                            (
+                                                                               
                                             'type'             => 'text',
+                                                                               
                                             'to_text'  => False,
+                                                                               
                                             'vevent'   => array
+                                                                               
                                             (
+                                                                               
                                              'state'           => 'optional',
+                                                                               
                                              'multiples'       => False
+                                                                               
                                             ),
+                                                                               
                                             'vtodo'            => array
+                                                                               
                                             (
+                                                                               
                                              'state'           => 'optional',
+                                                                               
                                              'multiples'       => False
+                                                                               
                                             )
+                                                                               
                                            ),
+
+                                                                               
                                    'rrule'             => array
+                                                                               
                                            (
+                                                                               
                                             'type'             => 'recur',
+                                                                               
                                             'to_text'  => False,
+                                                                               
                                             'daylight' => array
+                                                                               
                                             (
+                                                                               
                                              'state'           => 'optional',
+                                                                               
                                              'multiples'       => True
+                                                                               
                                             ),
+                                                                               
                                             'standard' => array
+                                                                               
                                             (
+                                                                               
                                              'state'           => 'optional',
+                                                                               
                                              'multiples'       => True
+                                                                               
                                             ),
+                                                                               
                                             'vevent'   => array
+                                                                               
                                             (
+                                                                               
                                              'state'           => 'optional',
+                                                                               
                                              'multiples'       => True
+                                                                               
                                             ),
+                                                                               
                                             'vtodo'            => array
+                                                                               
                                             (
+                                                                               
                                              'state'           => 'optional',
+                                                                               
                                              'multiples'       => True
+                                                                               
                                             ),
+                                                                               
                                             'vjournal' => array
+                                                                               
                                                     (
+                                                                               
                                                      'state'           => 
'optional',
+                                                                               
                                                      'multiples'       => True
+                                                                               
                                                     )
+                                                                               
                                                     ),
+
+                                                                               
                                             'sequence' => array
+                                                                               
                                                     (
+                                                                               
                                                      'type'            => 
'integer',
+                                                                               
                                                      'to_text' => True,
+                                                                               
                                                      'vevent'  => array
+                                                                               
                                                      (
+                                                                               
                                                       'state'          => 
'optional',
+                                                                               
                                                       'multiples'      => False
+                                                                               
                                                      ),
+                                                                               
                                                      'vjournal'        => array
+                                                                               
                                                      (
+                                                                               
                                                       'state'          => 
'optional',
+                                                                               
                                                       'multiples'      => False
+                                                                               
                                                      ),
+                                                                               
                                                      'vtodo'           => array
+                                                                               
                                                      (
+                                                                               
                                                       'state'          => 
'optional',
+                                                                               
                                                       'multiples'      => False
+                                                                               
                                                      )
+                                                                               
                                                     ),
+
+                                                                               
                                             'status'   => array
+                                                                               
                                                     (
+                                                                               
                                                      'type'            => 
'text',
+                                                                               
                                                      'to_text' => True,
+                                                                               
                                                      'vevent'  => array
+                                                                               
                                                      (
+                                                                               
                                                       'state'          => 
'optional',
+                                                                               
                                                       'multiples'      => False
+                                                                               
                                                      ),
+                                                                               
                                                      'vjournal'        => array
+                                                                               
                                                      (
+                                                                               
                                                       'state'          => 
'optional',
+                                                                               
                                                       'multiples'      => False
+                                                                               
                                                      ),
+                                                                               
                                                      'vtodo'           => array
+                                                                               
                                                      (
+                                                                               
                                                       'state'          => 
'optional',
+                                                                               
                                                       'multiples'      => False
+                                                                               
                                                      )
+                                                                               
                                                     ),
+
+                                                                               
                                             'summary'  => array
+                                                                               
                                                     (
+                                                                               
                                                      'type'            => 
'text',
+                                                                               
                                                      'to_text' => True,
+                                                                               
                                                      'vevent'  => array
+                                                                               
                                                      (
+                                                                               
                                                       'state'          => 
'optional',
+                                                                               
                                                       'multiples'      => False
+                                                                               
                                                      ),
+                                                                               
                                                      'vtodo'           => array
+                                                                               
                                                      (
+                                                                               
                                                       'state'          => 
'optional',
+                                                                               
                                                       'multiples'      => False
+                                                                               
                                                      ),
+                                                                               
                                                      'vjournal'        => array
+                                                                               
                                                      (
+                                                                               
                                                       'state'          => 
'optional',
+                                                                               
                                                       'multiples'      => False
+                                                                               
                                                      ),
+                                                                               
                                                      'valarm'  => array
+                                                                               
                                                      (
+                                                                               
                                                       'state'          => 
'optional',
+                                                                               
                                                       'multiples'      => False
+                                                                               
                                                      )
+                                                                               
                                                      ),
+
+                                                                               
                                                      'transp'  => array
+                                                                               
                                                              (
+                                                                               
                                                               'type'           
=> 'text',
+                                                                               
                                                               'to_text'        
=> True,
+                                                                               
                                                               'vevent' => array
+                                                                               
                                                               (
+                                                                               
                                                                'state'         
=> 'optional',
+                                                                               
                                                                'multiples'     
=> False
+                                                                               
                                                               )
+                                                                               
                                                              ),
+
+                                                                               
                                                      'trigger' => array
+                                                                               
                                                              (
+                                                                               
                                                               'type'           
=> 'text',
+                                                                               
                                                               'to_text'        
=> True,
+                                                                               
                                                               'valarm' => array
+                                                                               
                                                               (
+                                                                               
                                                                'state'         
=> 'optional',
+                                                                               
                                                                'multiples'     
=> False
+                                                                               
                                                               )
+                                                                               
                                                              ),
+
+                                                                               
                                                      'tzid'            => array
+                                                                               
                                                              (
+                                                                               
                                                               'type'           
=> 'text',
+                                                                               
                                                               'to_text'        
=> True,
+                                                                               
                                                               'vtimezone'      
=> array
+                                                                               
                                                               (
+                                                                               
                                                                'state'         
=> 'required',
+                                                                               
                                                                'multiples'     
=> False
+                                                                               
                                                               )
+                                                                               
                                                              ),
+
+                                                                               
                                                      'tzname'  => array
+                                                                               
                                                              (
+                                                                               
                                                               'type'           
=> 'text',
+                                                                               
                                                               'to_text'        
=> True,
+                                                                               
                                                               'daylight'       
=> array
+                                                                               
                                                               (
+                                                                               
                                                                'state'         
=> 'optional',
+                                                                               
                                                                'multiples'     
=> True
+                                                                               
                                                               ),
+                                                                               
                                                               'standard'       
=> array
+                                                                               
                                                               (
+                                                                               
                                                                'state'         
=> 'optional',
+                                                                               
                                                                'multiples'     
=> True
+                                                                               
                                                               )
+                                                                               
                                                              ),
+
+                                                                               
                                                      'tzoffsetfrom'    => array
+                                                                               
                                                              (
+                                                                               
                                                               'type'           
=> 'utc-offset',
+                                                                               
                                                               'to_text'        
=> True,
+                                                                               
                                                               'daylight'       
=> array
+                                                                               
                                                               (
+                                                                               
                                                                'state'         
=> 'required',
+                                                                               
                                                                'multiples'     
=> False
+                                                                               
                                                               ),
+                                                                               
                                                               'standard'       
=> array
+                                                                               
                                                               (
+                                                                               
                                                                'state'         
=> 'required',
+                                                                               
                                                                'multiples'     
=> False
+                                                                               
                                                               )
+                                                                               
                                                              ),
+
+                                                                               
                                                      'tzoffsetto'      => array
+                                                                               
                                                              (
+                                                                               
                                                               'type'           
=> 'utc-offset',
+                                                                               
                                                               'to_text'        
=> True,
+                                                                               
                                                               'daylight'       
=> array
+                                                                               
                                                               (
+                                                                               
                                                                'state'         
=> 'required',
+                                                                               
                                                                'multiples'     
=> False
+                                                                               
                                                               ),
+                                                                               
                                                               'standard'       
=> array
+                                                                               
                                                               (
+                                                                               
                                                                'state'         
=> 'required',
+                                                                               
                                                                'multiples'     
=> False
+                                                                               
                                                               )
+                                                                               
                                                              ),
+
+                                                                               
                                                      'tzurl'           => array
+                                                                               
                                                              (
+                                                                               
                                                               'type'           
=> 'uri',
+                                                                               
                                                               'to_text'        
=> True,
+                                                                               
                                                               'vtimezone'      
=> array
+                                                                               
                                                               (
+                                                                               
                                                                'state'         
=> 'optional',
+                                                                               
                                                                'multiples'     
=> False
+
+                                                                               
                                                               ),
+
+                                                                               
                                                               'uid'            
=> array
+                                                                               
                                                               (
+                                                                               
                                                                'type'          
=> 'text',
+                                                                               
                                                                'to_text'       
=> True,
+                                                                               
                                                                'vevent'        
=> array
+                                                                               
                                                                (
+                                                                               
                                                                 'state'        
        => 'required',
+                                                                               
                                                                 'multiples'    
=> False
+                                                                               
                                                                ),
+                                                                               
                                                                'vfreebusy'     
=> array
+                                                                               
                                                                (
+                                                                               
                                                                 'state'        
        => 'required',
+                                                                               
                                                                 'multiples'    
=> False
+                                                                               
                                                                ),
+                                                                               
                                                                'vjournal'      
=> array
+                                                                               
                                                                (
+                                                                               
                                                                 'state'        
        => 'required',
+                                                                               
                                                                 'multiples'    
=> False
+                                                                               
                                                                ),
+                                                                               
                                                                'vtodo'         
=> array
+                                                                               
                                                                (
+                                                                               
                                                                 'state'        
        => 'required',
+                                                                               
                                                                 'multiples'    
=> False
+                                                                               
                                                                )
+                                                                               
                                                                ),
+
+                                                                               
                                                                'url'           
=> array
+                                                                               
                                                                        (
+                                                                               
                                                                         'type' 
        => 'text',
+                                                                               
                                                                         
'to_text'      => True,
+                                                                               
                                                                         
'vevent'       => array
+                                                                               
                                                                         (
+                                                                               
                                                                          
'state'               => 'required',
+                                                                               
                                                                          
'multiples'   => False
+                                                                               
                                                                         ),
+                                                                               
                                                                         
'vfreebusy'    => array
+                                                                               
                                                                         (
+                                                                               
                                                                          
'state'               => 'required',
+                                                                               
                                                                          
'multiples'   => False
+                                                                               
                                                                         ),
+                                                                               
                                                                         
'vjournal'     => array
+                                                                               
                                                                         (
+                                                                               
                                                                          
'state'               => 'optional',
+                                                                               
                                                                          
'multiples'   => False
+                                                                               
                                                                         ),
+                                                                               
                                                                         
'vtodo'                => array
+                                                                               
                                                                         (
+                                                                               
                                                                          
'state'               => 'required',
+                                                                               
                                                                          
'multiples'   => False
+                                                                               
                                                                         )
+                                                                               
                                                                         ),
+
+                                                                               
                                                                         
'version'      => array
+                                                                               
                                                                                
 (
+                                                                               
                                                                                
  'type'                => 'text',
+                                                                               
                                                                                
  'to_text'     => True,
+                                                                               
                                                                                
  'ical'                => array
+                                                                               
                                                                                
  (
+                                                                               
                                                                                
   'state'              => 'required',
+                                                                               
                                                                                
   'multiples'  => False
+                                                                               
                                                                                
  )
+                                                                               
                                                                                
 )
+                                                                               
                                                                                
 ));
 
                $this->parameter = array(
                                'altrep'                => array(
@@ -1476,18 +1476,19 @@
                }
        }
 
-       function set_var(&$event,$type,$value)
+       function set_var(&$event, $type, $value)
        {
                $type = strtolower(str_replace('-','_',$type));
                $event[$type] = $value;
                if(is_string($value))
                {
-                       $this->debug("Setting ".$type." = ".$value);
+                       $this->debug("Setting $type = ".$value, __LINE__, 
__FILE__);
                }
                else
                {
-                       $this->debug("Setting ".$type." = 
"._debug_array($value,False));
+                       $this->debug("Setting $type = 
"._debug_array($value,False), __LINE__, __FILE__);
                }
+               //$this->debug('event: ' . _debug_array($event, false), 
__LINE__, __FILE__);
        }
 
        function read_line_unfold($ical_text)
@@ -1621,9 +1622,14 @@
                $event['x_type'][] = $temp_x_type;
        }
 
-       function parse_parameters(&$event,$majortype,$value)
+       function parse_parameters(&$event, $majortype, $value)
        {
-               if(!ereg('[\=\;]',$value))
+               if ( $majortype == 'attendee' )
+               {
+                       $this->debug = true;
+               }
+
+               if ( strpos($value, '=') === False && strpos($value, ';') === 
False )
                {
                        $return_value[] = array(
                                        'param' => $majortype,
@@ -1631,11 +1637,11 @@
                                        );
                        $value = '';
                }
-               elseif(ereg('(.*(\:\\\\)?.*):(.*)',$value,$temp))
+               elseif(ereg('(.*(\:\\\\)?.*):(.*)', $value, $temp))
                {
-                       $this->debug('Value : '._debug_array($temp,False));
-                       $this->debug('Param '.$majortype.' Value : '.$temp[3]);
-                       if($temp[3])
+                       $this->debug('Value : '._debug_array($temp ,False), 
__LINE__, __FILE__);
+                       $this->debug('Param '.$majortype.' Value : '.$temp[3], 
__LINE__, __FILE__);
+                       if($temp[3]) //do we have an email address?
                        {
                                $return_value[] = array(
                                                'param' => $majortype,
@@ -1643,32 +1649,30 @@
                                                );
                                $value = str_replace(':MAILTO','',$temp[1]);
                        }
-                       while(ereg('(([A-Z\-]*)[=]([[:alnum:] 
\_\)\(\/\$\.\,\:\\\|\*\&\^\%\#\!\~\"\?\&address@hidden<\>\-]*))([\;]?)(.*)',$value,$temp))
+                       while(ereg('(([A-Z\-]*)[=]([[:alnum:] 
\_\)\(\/\$\.\,\:\\\|\*\&\^\%\#\!\~\"\?\&address@hidden<\>\-]*))([\;]?)(.*)', 
$value, $temp))
                        {
-                               $this->debug('Value : 
'._debug_array($temp,False));
-                               $this->debug('Param '.$temp[2].' Value : 
'.$temp[3]);
-                               $return_value[] = array(
+                               $this->debug('Value : 
'._debug_array($temp,False), __LINE__, __FILE__);
+                               $this->debug('Param '.$temp[2].' Value : 
'.$temp[3], __LINE__, __FILE__);
+                               $return_value[] = Array(
                                                'param' => $temp[2],
                                                'value' => $temp[3]
                                                );
-                               $value = chop($temp[5]);
-                               $this->debug('Value would be = '.$value);
-                               flush();
+                               $value = rtrim($temp[5]);
+                               $this->debug('Value would be = '.$value, 
__LINE__, __FILE__);
                        }
                }
                else
                {
-                       while(ereg('(([A-Z\-]*)[=]([[:alnum:] 
\_\)\(\/\$\.\,\:\\\|\*\&\^\%\#\!\~\"\?\&address@hidden<\>\-]*))([\;]?)(.*)',$value,$temp))
+                       while(ereg('(([A-Z\-]*)[=]([[:alnum:] 
\_\)\(\/\$\.\,\:\\\|\*\&\^\%\#\!\~\"\?\&address@hidden<\>\-]*))([\;]?)(.*)', 
$value, $temp))
                        {
-                               $this->debug('Value : 
'._debug_array($temp,False));
-                               $this->debug('Param '.$temp[2].' Value : 
'.$temp[3]);
-                               $return_value[] = array(
+                               $this->debug('Value : 
'._debug_array($temp,False), __LINE__, __FILE__);
+                               $this->debug('Param '.$temp[2].' Value : 
'.$temp[3], __LINE__, __FILE__);
+                               $return_value[] = Array(
                                                'param' => $temp[2],
                                                'value' => $temp[3]
                                                );
-                               $value = chop($temp[5]);
-                               $this->debug('Value would be = '.$value);
-                               flush();
+                               $value = rtrim($temp[5]);
+                               $this->debug('Value would be = '.$value, 
__LINE__, __FILE__);
                        }
                }
 
@@ -1677,7 +1681,7 @@
                        $return_value = array();
                }
 
-               for($i=0;$i<count($return_value);$i++)
+               for( $i = 0; $i < count($return_value) ; ++$i)
                {
                        $name = strtolower($return_value[$i]['param']);
                        $value = 
$this->strip_quotes($return_value[$i]['value']);
@@ -1702,7 +1706,7 @@
                                        }
                                }
                        }
-                       $this->debug('name : '.$name.' : Param = '.$param);
+                       $this->debug('name : '.$name.' : Param = '.$param, 
__LINE__, __FILE__);
                        if(@$this->parameter[$param]['properties'][$majortype])
                        {
                                switch(@$this->parameter[$param]['type'])
@@ -1731,7 +1735,7 @@
                                                
$this->set_var($event,$name,intval($value));
                                                break;
                                        case 'value':
-                                               
if(@$this->property[$majortype]['type'] == 'date-time')
+                                               
if($this->property[$majortype]['type'] == 'date-time')
                                                {
                                                        if ($majortype == 
'exdate')
                                                        {
@@ -1746,23 +1750,29 @@
                                                                
$this->set_var($event[$majortype],$param,$this->switch_date($value));
                                                        }
                                                }
-                                               elseif($value <> "\\n" && 
$value)
+                                               elseif($value != "\\n" && 
$value)
                                                {
                                                        
$this->set_var($event[$majortype],$param,$value);
                                                }
-                                               $this->debug('Event : 
'._debug_array($event,False));
+                                               $this->debug('Event : 
'._debug_array($event,False), __LINE__, __FILE__);
                                                break;
                                }
+
                        }
-               }                               
+               }
+               if ( $majortype == 'attendee' )
+               {
+                       $this->debug = false;
+               }
+
        }
 
-       function parse_value(&$event,$majortype,$value,$mode)
+       function parse_value(&$event, $majortype, $value, $mode)
        {
                $var = array();
                $this->debug('Mode : '.$mode.' Majortype : '.$majortype);
                $this->parse_parameters($var,$majortype,$value);
-               if($this->property[$majortype][$mode]['multiples'])
+               if ( isset($this->property[$majortype][$mode]['multiples']) && 
$this->property[$majortype][$mode]['multipass'] )
                {
                        $this->debug(_debug_array($var,False));
                        $event[$majortype][] = $var;
@@ -1776,18 +1786,16 @@
                                $this->debug('Got a DATE-TIME type!');
                                $t_var = $var[$majortype];
                                unset($var[$majortype]);
-                               reset($t_var);
-                               while(list($key,$val) = each($t_var))
+                               foreach ( $t_var as $key => $val )
                                {
                                        $var[$key] = $val;
                                }
-                               $this->debug($majortype.' : 
'._debug_array($var,False));
+                               $this->debug("$majortype : 
"._debug_array($var,False));
                        }
-                       $this->set_var($event,$majortype,$var);
+                       $this->set_var($event, $majortype, $var);
                }
        }
 
-
        /*
         * Build-Card Functions
         */
@@ -1903,7 +1911,8 @@
                                                $str .= 
';'.$this->build_xtype($event['x_type'][$j],'=');
                                        }
                                }
-                               if(!empty($event['value']))
+
+                               if(isset($event[$key]) && 
@$this->parameter[$key]['properties'][$property])
                                {
                                        if($property == 'trigger')
                                        {
@@ -1916,6 +1925,7 @@
                                        $str .= 
$seperator.($this->parameter['value']['to_text']?$this->to_text($event['value']):$event['value']);
                                        $str .= "\r\n";
                                }
+
                                if($include_mailto == True)
                                {
                                        $key = 'mailto';
@@ -1924,6 +1934,7 @@
                                        $str .= ($ret_value?':'.$ret_value:'');
                                        $str .= "\r\n";
                                }
+
                                if($include_datetime == True || 
@$this->property[$property]['type'] == 'date-time')
                                {
                                        $str .= 
':'.date('Ymd\THis',mktime($event['hour'],$event['min'],$event['sec'],$event['month'],$event['mday'],$event['year'])).(address@hidden($event['tzid'])?'Z':'');
@@ -1938,7 +1949,6 @@
                error_log('build_text-----event: '. serialize($event));
                $str = '';
                $param = $this->find_parameters($property);
-#while(list($dumb_key,$key) = each($param))
                foreach ($param as $key) 
                {
                        if(!empty($event[$key]) && $key != 'value')
@@ -1981,15 +1991,18 @@
        function build_card_internals($ical_item,$event)
        {
                $prop = $this->find_properties($ical_item);
-               reset($prop);
-#while(list($dumb_key,$key) = each($prop))
-               foreach($prop as $key) 
+
+               if ( !is_array($prop) )
                {
-                       $value  = $key;
-                       $varray = $this->property[$key];
-                       $type   = $varray['type'];
+                       $prop = array();
+               }
+
+               foreach ( $prop as $value )
+               {
+                       $varray =& $this->property[$value];
+                       $type = $varray['type'];
                        $to_text = $varray['to_text'];
-                       $state  = @$varray[$ical_item]['state'];
+                       $state = @$varray[$ical_item]['state'];
                        $multiples  = @$varray[$ical_item]['multiples'];
                        switch($type)
                        {
@@ -2166,13 +2179,13 @@
                        switch($var)
                        {
                                case 'PRIVATE':
-                                       return PRIVATE;
+                                       return PHPGW_ICAL_PRIVATE;
                                        break;
                                case 'PUBLIC':
-                                       return PUBLIC;
+                                       return PHPGW_ICAL_PUBLIC;
                                        break;
                                case 'CONFIDENTIAL':
-                                       return CONFIDENTIAL;
+                                       return PHPGW_ICAL_CONFIDENTIAL;
                                        break;
                        }
                }
@@ -2180,13 +2193,13 @@
                {
                        switch(intval($var))
                        {
-                               case PRIVATE:
+                               case PHPGW_ICAL_PRIVATE:
                                        return 'PRIVATE';
                                        break;
-                               case PUBLIC:
+                               case PHPGW_ICAL_PUBLIC:
                                        return 'PUBLIC';
                                        break;
-                               case CONFIDENTIAL:
+                               case PHPGW_ICAL_CONFIDENTIAL:
                                        return 'CONFIDENTIAL';
                                        break;
                        }
@@ -3058,15 +3071,14 @@
                $str .= "\r\n";
                $str .= 
$this->fold('METHOD'.$this->build_text($ical['method'],'method'));
                $str .= "\r\n";
-               while(list($key,$vtype) = each($var))
+               foreach ( $var as $key => $vtype )
                {
-                       if($ical[$vtype])
+                       if ( isset($ical[$vtype]) && $ical[$vtype] )
                        {
-                               for($i=0;$i<count($ical[$vtype]);$i++)
+                               for ( $i = 0; $i < count($ical[$vtype]); ++$i )
                                {
                                        $str .= 
'BEGIN:V'.strtoupper($vtype)."\r\n";
-                                       $str .= 
$this->build_card_internals('v'.$vtype,$ical[$vtype][$i]);
-                                       $str = substr($str,0,-2);
+                                       $str .= 
$this->build_card_internals("v$vtype", $ical[$vtype][$i] );
                                        $str .= 
'END:V'.strtoupper($vtype)."\r\n";
                                }
                        }
@@ -3225,22 +3237,29 @@
                        $GLOBALS['phpgw']->common->phpgw_exit();                
                
                }
 
-               if(!is_object($GLOBALS['uicalendar']))
+               if( !isset($GLOBALS['uicalendar']) || 
!is_object($GLOBALS['uicalendar']) )
                {
-                       $so_event = createobject('calendar.socalendar',
-                                       array(
-                                               'owner' => 0,
-                                               'filter'        => '',
-                                               'category'      => ''
-                                            )
-                                       );
+                       if ( !isset($GLOBALS['bocalendar']) || 
!is_object($GLOBALS['bocalendar']) )
+                       {
+                               $so_event = createobject('calendar.socalendar',
+                                               Array(
+                                                       'owner'         => 0,
+                                                       'filter'        => '',
+                                                       'category'      => ''
+                                                    )
+                                               );
+                       }
+                       else
+                       {
+                               $so_event = &$GLOBALS['bocalendar']->so;
+                       }
                }
                else
                {
-                       $so_event = $GLOBALS['uicalendar']->bo->so;
+                       $so_event = &$GLOBALS['uicalendar']->bo->so;
                }
 
-               $datetime_vars = array(
+               $datetime_vars = Array(
                                'start' => 'dtstart',
                                'end'   => 'dtend',
                                'modtime'       => 'dtstamp',
@@ -3793,6 +3812,7 @@
                if ( isset($params['chunk_split']) )
                {
                        $this->chunk_split = $params['chunk_split'];
+                       $method = ($params['method'] ? $params['method'] : 
'publish');
                }
 
                $method = ($params['method']?$params['method']:"publish");
@@ -3804,7 +3824,36 @@
                                'uid'           => 'uid'
                                );
 
-               $cats = CreateObject('phpgwapi.categories');
+               $cats = CreateObject('phpgwapi.categories', 0, 'calendar');
+               $contacts = createObject('phpgwapi.contacts');
+
+
+               if ( !isset($db) || !is_object($db) )
+               {
+                       $db =& $GLOBALS['phpgw']->db;
+               }
+
+               if( !isset($GLOBALS['uicalendar']) || 
!is_object($GLOBALS['uicalendar']) )
+               {
+                       if ( !isset($GLOBALS['bocalendar']) || 
!is_object($GLOBALS['bocalendar']) )
+                       {
+                               $so_event = createobject('calendar.socalendar',
+                                               Array(
+                                                       'owner'         => 0,
+                                                       'filter'        => '',
+                                                       'category'      => ''
+                                                    )
+                                               );
+                       }
+                       else
+                       {
+                               $so_event = &$GLOBALS['bocalendar']->so;
+                       }
+               }
+               else
+               {
+                       $so_event = &$GLOBALS['uicalendar']->bo->so;
+               }
 
                include(PHPGW_SERVER_ROOT.'/calendar/setup/setup.inc.php');
                if(!is_array($event_id))
@@ -3827,66 +3876,19 @@
                $this->set_var($ical['method'],'value',strtoupper($method));
                unset($version, $versiona);
 
-               
if(!$GLOBALS['phpgw_info']['flags']['included_classes']['uicalendar'])
-               {
-                       
if(!$GLOBALS['phpgw_info']['flags']['included_classes']['bocalendar'])
-                       {
-                               $so_event = createobject('calendar.socalendar',
-                                               array(
-                                                       'owner' => 0,
-                                                       'filter'        => '',
-                                                       'category'      => ''
-                                                    )
-                                               );
-                       }
-                       else
-                       {
-                               $so_event = $GLOBALS['bocalendar']->so;
-                       }
-               }
-               else
-               {
-                       $so_event = $GLOBALS['uicalendar']->bo->so;
-               }
-
-
-               while(list($key,$value) = each($ids))
+               foreach ( $ids as $key => $value )
                {
                        $ical_event = array();
                        $event = $so_event->read_entry($value);
 
-                       if($event['alarm'])
+                       if( isset($event['alarm']) && is_array($event['alarm']) 
)
                        {
-                               while(list($dummy,$alarm) = 
each($event['alarm']))
+                               foreach ( $event['alarm'] as $alarm )
                                {
-                                       $ical_temp = array();
+                                       $ical_temp = Array();
                                        $ical_temp['action']['value'] = 
'DISPLAY';
                                        $ical_temp['description']['value'] = 
$alarm['text'];
-
-                                       // Calculate the Period of Time for 
alarmmanagement
-                                       $eventstart = 
mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$event['start']['month'],$event['start']['mday'],$event['start']['year']);
-                                       $alarmtime = $eventstart - 
$alarm['time'];
-
-                                       $alarmday = date('d', $alarmtime)-1;
-                                       $alarmhour = date('H', $alarmtime)-1;
-                                       $alarmmin = date('i', $alarmtime);
-
-                                       // Construct the PT String
-                                       if ($alarmday>0)
-                                       {
-                                               $alarmstring = $alarmday . 'D';
-                                       }
-                                       if ($alarmhour>0)
-                                       {
-                                               $alarmstring .= $alarmhour . 
'H';
-                                       }
-                                       if ($alarmmin>0)
-                                       {
-                                               $alarmstring .= $alarmmin . 'M';
-                                       }
-
-                                       
$this->set_var($ical_temp['trigger'],'value','RELATED=START:-PT' . 
$alarmstring,'valarm');
-                                       
//$this->set_var($ical_temp['trigger'],'value','VALUE=DATE-TIME:'.date('Ymd\THis\Z',$alarm['time']),'valarm');
+                                       $this->set_var($ical_temp['trigger'], 
'value', 'VALUE=DATE-TIME:' . date('Ymd\THis\Z', $alarm['time']), 'valarm');
                                        $ical_event['alarm'][] = $ical_temp;
                                }
                        }
@@ -3894,71 +3896,92 @@
                        $ical_event['priority'] = $event['priority'];
                        $ical_event['class'] = intval($event['public']);
                        $dtstart_mktime = $so_event->maketime($event['start']);
-                       
$this->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'vevent');
+                       $this->parse_value($ical_event, 'dtstart', 
date('Ymd\THis\Z', $dtstart_mktime), 'vevent');
                        $dtend_mktime = $so_event->maketime($event['end']);
-                       
$this->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'vevent');
+                       $this->parse_value($ical_event,'dtend', 
date('Ymd\THis\Z', $dtend_mktime), 'vevent');
                        $mod_mktime = $so_event->maketime($event['modtime']);
-                       
$this->parse_value($ical_event,'last_modified',date('Ymd\THis\Z',$mod_mktime),'vevent');
-                       @reset($string_array);
-                       while(list($ical_value,$event_value) = 
each($string_array))
-                       {
-                               if($event[$event_value])
+                       $this->parse_value($ical_event, 'last_modified', 
date('Ymd\THis\Z', $mod_mktime), 'vevent');
+
+                       foreach( $string_array as $ical_value => $event_value)
+
+                               if ($event['category'])
                                {
-                                       
$this->set_var($ical_event[$ical_value],'value',$event[$event_value]);
+                                       $cats->categories(0,'calendar');
+                                       $category = 
explode(',',$event['category']);
+                                       @reset($category);
+                                       while(list($key,$cat) = each($category))
+                                       {
+                                               $_cat = 
$cats->return_single($cat);
+                                               $cat_string[] = 
$_cat[0]['name'];
+                                       }
+                                       @reset($cat_string);
+                                       
$this->set_var($ical_event['categories'],'value',implode($cat_string,','));
                                }
-                       }
 
-                       if ($event['category'])
+                       if ( isset($event['category']) && 
strlen($event['category']) )
                        {
-                               $cats->categories(0,'calendar');
-                               $category = explode(',',$event['category']);
-                               @reset($category);
-                               while(list($key,$cat) = each($category))
+                               $category = explode(',', $event['category']);
+
+                               $cat_strings = array();
+                               foreach ( $category as $key => $cat )
                                {
-                                       $_cat = $cats->return_single($cat);
-                                       $cat_string[] = $_cat[0]['name'];
+                                       $cat_data = $cats->return_single($cat);
+                                       $cat_strings[] = $cat_data[0]['name'];
                                }
-                               @reset($cat_string);
-                               
$this->set_var($ical_event['categories'],'value',implode($cat_string,','));
+                               $this->set_var($ical_event['categories'], 
'value', implode(',', $cat_strings) );
+                               unset($cat_strings);
                        }
 
                        if( is_array($event['participants']) && 
count($event['participants']) > 1)
                        {
-                               if(!is_object($db))
+                               if ($method != 'reply' || $part == 
$GLOBALS['phpgw_info']['user']['account_id'])
                                {
-                                       $db =& $GLOBALS['phpgw']->db;
+                                       
$this->parse_value($ical_event,'attendee',$str,'vevent');
                                }
 
-                               $contacts = createObject('phpgwapi.contacts');
-
                                foreach($event['participants'] as $part => 
$status)
                                {
-                                       $name = 
$contacts->get_contact_name($part);
-
-                                       $owner_status = 
$this->switch_partstat(intval($this->switch_phpgw_status($event['participants'][$part])));
+                                       if ( !intval($part) )
+                                       {
+                                               continue; //dud entry!
+                                       }
 
-                                       $mailto = $contacts->get_email($part);
+                                       //trims are used as there is sometimes 
needles whitespace
+                                       $name = 
trim(@$contacts->get_contact_name($part));
 
-                                       $str = 
'CN="'.$name.'";PARTSTAT='.$owner_status.':'.$mailto;
-                                       if($part == $event['owner'])
+                                       if ( !strlen($name) )
                                        {
-                                               $str = 'ROLE=CHAIR;'.$str;
+                                               continue; //no name no point!
                                        }
-                                       else
+
+                                       $owner_status = 
$this->switch_partstat(intval($this->switch_phpgw_status($event['participants'][$part])));
+
+                                       $str = 
"PARTSTAT={$owner_status};CN=\"{$name}\":MAILTO:";
+
+                                       $mailto = 
trim($contacts->get_email($part));
+                                       if ( strlen($mailto) )
                                        {
-                                               $str = 
'ROLE=REQ-PARTICIPANT;'.$str;
+                                               $str .= "{$mailto}";
                                        }
-                                       if ($method != 'reply' || $part == 
$GLOBALS['phpgw_info']['user']['account_id'])
+
+                                       if($part == $event['owner'])
                                        {
-                                               
$this->parse_value($ical_event,'attendee',$str,'vevent');
+                                               $str = "ROLE=CHAIR;{$str}";
+                                               $this->parse_value($ical_event, 
'organizer', $str, 'vevent');
                                        }
-                                       if($part == $event['owner'])
+                                       else
                                        {
-                                               
$this->parse_value($ical_event,'organizer',$str,'vevent');
+                                               $str = 
"ROLE=REQ-PARTICIPANT;{$str}";
+                                               if ( $method != 'reply' || 
$part == $GLOBALS['phpgw_info']['user']['person_id'])
+                                               {
+                                                       
$this->parse_value($ical_event, 'attendee', $str, 'vevent');
+                                               }
                                        }
+                                       
$this->parse_value($ical_event,'organizer',$str,'vevent');
                                }
                        }
-                       if($event['recur_type'])
+
+                       if( isset($event['recur_type']) )
                        {
                                $str = '';
                                switch($event['recur_type'])
@@ -4106,11 +4129,14 @@
                return $this->build_ical($ical);
        }
 
-       function debug($str='')
+       function debug($str='', $line = __LINE__, $file = __FILE__)
        {
                if($this->debug_str)
                {
-                       echo $str."<br />\n";
+                       if($this->debug)
+                       {
+                               error_log("{$str} in {$file} at {$line}");
+                       }
                }
        }
 }
Index: calendar/inc/class.socalendar.inc.php
diff -u calendar/inc/class.socalendar.inc.php:1.31 
calendar/inc/class.socalendar.inc.php:1.32
--- calendar/inc/class.socalendar.inc.php:1.31  Fri Dec 16 13:24:44 2005
+++ calendar/inc/class.socalendar.inc.php       Sat Jan  7 11:14:56 2006
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: class.socalendar.inc.php,v 1.31 2005/12/16 13:24:44 skwashd Exp $ */
+  /* $Id: class.socalendar.inc.php,v 1.32 2006/01/07 11:14:56 skwashd Exp $ */
 
        class socalendar
        {
@@ -179,6 +179,14 @@
                        return 
$this->cal->get_event_ids($search_repeats,$sql,$search_extra);
                }
 
+               /**
+               * Get a list of events and their "etags"
+               */
+               function get_event_etags($userids, $event_id = 0)
+               {
+                       return $this->cal->get_event_etags($userids, $event_id);
+               }
+
                function find_uid($uid)
                {
                        $uid_parts = explode('/', $uid);
Index: calendar/inc/class.socalendar_sql.inc.php
diff -u calendar/inc/class.socalendar_sql.inc.php:1.40 
calendar/inc/class.socalendar_sql.inc.php:1.41
--- calendar/inc/class.socalendar_sql.inc.php:1.40      Fri Dec 16 13:24:44 2005
+++ calendar/inc/class.socalendar_sql.inc.php   Sat Jan  7 11:14:56 2006
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: class.socalendar_sql.inc.php,v 1.40 2005/12/16 13:24:44 skwashd Exp 
$ */
+  /* $Id: class.socalendar_sql.inc.php,v 1.41 2006/01/07 11:14:56 skwashd Exp 
$ */
 
 if (@$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar_'])
 {
@@ -561,6 +561,65 @@
                return $retval;
        }
 
+       function get_event_etags($user_ids, $event_id = 0)
+       {
+               if ( $this->debug )
+               {
+                       error_log('socal_sql:: get_event_etags(' . 
print_r($user_ids, true) . ", $event_id)" );
+               }
+
+               if ( !is_array($user_ids) )
+               {
+                       if ( $this->debug )
+                       {
+                               error_log('user_ids is not an array, returning 
an empty array!');
+                       }
+                       return array();
+               }
+               
+               $event_sql = '';
+               if ( $event_id > 0 )
+               {
+                       $event_sql = ' AND phpgw_cal.cal_id = ' . 
intval($event_id);
+               }
+               
+               $sql = 'SELECT DISTINCT phpgw_cal.cal_id, phpgw_cal.mdatetime'
+                               . ' FROM phpgw_cal LEFT JOIN phpgw_cal_user on 
(phpgw_cal_user.cal_id = phpgw_cal.cal_id)'
+                               . ' WHERE (phpgw_cal_user.cal_id = 
phpgw_cal.cal_id) '
+                               . ' AND ( phpgw_cal_user.cal_login IN (' . 
implode(',', $user_ids) . ') OR phpgw_cal.owner IN(' . implode(',', $user_ids) 
. ') )'
+                               . $event_sql;
+
+               unset($event_sql);
+
+               if($this->debug)
+               {
+                       error_log("FULL SQL : {$sql}");
+               }
+               
+               $this->stream->query($sql,__LINE__,__FILE__);
+
+               $retval = array();
+               if($this->stream->num_rows() == 0)
+               {
+                       if($this->debug)
+                       {
+                               error_log('No records found!');
+                       }
+                       return $retval;
+               }
+
+               while($this->stream->next_record())
+               {
+                       $retval[intval($this->stream->f('cal_id'))] = 
intval($this->stream->f('cal_id')) . ':' . intval($this->stream->f('mdatetime') 
);
+               }
+
+               if($this->debug)
+               {
+                       error_log('Records found!');
+               }
+               return $retval;
+       }
+
        function save_event(&$event)
        {
                $locks = array(




reply via email to

[Prev in Thread] Current Thread [Next in Thread]