21 require_once(
'vComponent.php');
35 private $primary_component;
39 private $schedule_agent;
52 $this->contained_type = null;
53 $this->primary_component = null;
54 $this->timezones = array();
55 if ( empty($content) || is_array($content) ) {
56 parent::__construct();
58 $this->
AddProperty(
'PRODID',
'-//davical.org//NONSGML AWL Calendar//EN');
61 if ( !empty($content) ) {
62 foreach( $content AS $k => $v ) {
68 parent::__construct($content);
70 if(isset($components) && count($components) > 0){
71 foreach( $components AS $k => $comp ) {
72 if ( $comp->GetType() ==
'VTIMEZONE' ) {
75 else if ( empty($this->contained_type) ) {
76 $this->contained_type = $comp->GetType();
77 $this->primary_component = $comp;
82 if ( !isset($this->contained_type) && !empty($this->timezones) ) {
83 $this->contained_type =
'VTIMEZONE';
84 $this->primary_component = reset($this->timezones);
96 dbg_error_log(
'ERROR',
'Ignoring invalid VTIMEZONE with no TZID parameter!');
97 dbg_log_array(
'LOG',
'vTimezone', $vtz,
true);
100 $this->timezones[$tzid] = $vtz;
111 if ( empty($this->timezones[$tzid]) )
return null;
112 return $this->timezones[$tzid];
121 if ( !isset($this->organizer) ) {
123 $organizer = (count($organizers) > 0 ? $organizers[0] :
false);
124 $this->organizer = (empty($organizer) ? false : $organizer );
125 if ( $this->organizer ) {
126 $this->schedule_agent = $organizer->GetParameterValue(
'SCHEDULE-AGENT');
127 if ( empty($schedule_agent) ) $this->schedule_agent =
'SERVER';
130 return $this->organizer;
139 if ( !isset($this->schedule_agent) ) $this->
GetOrganizer();
140 return $this->schedule_agent;
148 if ( !isset($this->attendees) ) {
149 $this->attendees = array();
152 if ( count ( $wr_attendees ) > 0 ) {
153 dbg_error_log(
'PUT',
'Non-compliant iCal request. Using X-WR-ATTENDEE property' );
154 foreach( $wr_attendees AS $k => $v ) {
158 $this->attendees = $attendees;
160 return $this->attendees;
172 if ($v->GetType() ==
'VEVENT' || $v->GetType() ==
'VTODO' ) {
173 $new_attendees = array();
174 foreach( $v->GetProperties() AS $p ) {
175 if ( $p->Name() ==
'ATTENDEE' ) {
176 if ( $p->Value() == $email || $p->Value() ==
'mailto:'.$email ) {
177 $new_attendees[] = $statusProperty;
180 $new_attendees[] = clone($p);
184 $v->SetProperties($new_attendees,
'ATTENDEE');
185 $this->attendees = null;
186 $this->rendered = null;
198 $this->rendered = null;
200 if ($v->GetType() ==
'VEVENT' || $v->GetType() ==
'VTODO' ) {
201 $v->SetProperties(array($statusProperty),
'ORGANIZER');
202 $this->organizer = null;
203 $this->rendered = null;
220 dbg_error_log(
'vCalendar',
':StartFilter we have %d filters to test', count($filters) );
222 if ( count($filters) != 1 )
return false;
224 $tag = $filters[0]->GetNSTag();
225 $name = $filters[0]->GetAttribute(
"name");
226 if ( $tag !=
"urn:ietf:params:xml:ns:caldav:comp-filter" || $name !=
'VCALENDAR' )
return false;
227 return $this->
TestFilter($filters[0]->GetContent());
239 $tzid = olson_from_tzstring($tzstring);
240 if ( !empty($tzid) )
return $tzid;
242 $tzstring = $vtz->
GetPValue(
'X-LIC-LOCATION');
243 $tzid = olson_from_tzstring($tzstring);
244 if ( !empty($tzid) )
return $tzid;
246 $tzcdo = $vtz->
GetPValue(
'X-MICROSOFT-CDO-TZID');
247 if ( empty($tzcdo) )
return null;
253 case 0:
return(
'UTC');
254 case 1:
return(
'Europe/London');
255 case 2:
return(
'Europe/Lisbon');
256 case 3:
return(
'Europe/Paris');
257 case 4:
return(
'Europe/Berlin');
258 case 5:
return(
'Europe/Bucharest');
259 case 6:
return(
'Europe/Prague');
260 case 7:
return(
'Europe/Athens');
261 case 8:
return(
'America/Brasilia');
262 case 9:
return(
'America/Halifax');
263 case 10:
return(
'America/New_York');
264 case 11:
return(
'America/Chicago');
265 case 12:
return(
'America/Denver');
266 case 13:
return(
'America/Los_Angeles');
267 case 14:
return(
'America/Anchorage');
268 case 15:
return(
'Pacific/Honolulu');
269 case 16:
return(
'Pacific/Apia');
270 case 17:
return(
'Pacific/Auckland');
271 case 18:
return(
'Australia/Brisbane');
272 case 19:
return(
'Australia/Adelaide');
273 case 20:
return(
'Asia/Tokyo');
274 case 21:
return(
'Asia/Singapore');
275 case 22:
return(
'Asia/Bangkok');
276 case 23:
return(
'Asia/Kolkata');
277 case 24:
return(
'Asia/Muscat');
278 case 25:
return(
'Asia/Tehran');
279 case 26:
return(
'Asia/Baghdad');
280 case 27:
return(
'Asia/Jerusalem');
281 case 28:
return(
'America/St_Johns');
282 case 29:
return(
'Atlantic/Azores');
283 case 30:
return(
'America/Noronha');
284 case 31:
return(
'Africa/Casablanca');
285 case 32:
return(
'America/Argentina/Buenos_Aires');
286 case 33:
return(
'America/La_Paz');
287 case 34:
return(
'America/Indiana/Indianapolis');
288 case 35:
return(
'America/Bogota');
289 case 36:
return(
'America/Regina');
290 case 37:
return(
'America/Tegucigalpa');
291 case 38:
return(
'America/Phoenix');
292 case 39:
return(
'Pacific/Kwajalein');
293 case 40:
return(
'Pacific/Fiji');
294 case 41:
return(
'Asia/Magadan');
295 case 42:
return(
'Australia/Hobart');
296 case 43:
return(
'Pacific/Guam');
297 case 44:
return(
'Australia/Darwin');
298 case 45:
return(
'Asia/Shanghai');
299 case 46:
return(
'Asia/Novosibirsk');
300 case 47:
return(
'Asia/Karachi');
301 case 48:
return(
'Asia/Kabul');
302 case 49:
return(
'Africa/Cairo');
303 case 50:
return(
'Africa/Harare');
304 case 51:
return(
'Europe/Moscow');
305 case 53:
return(
'Atlantic/Cape_Verde');
306 case 54:
return(
'Asia/Yerevan');
307 case 55:
return(
'America/Panama');
308 case 56:
return(
'Africa/Nairobi');
309 case 58:
return(
'Asia/Yekaterinburg');
310 case 59:
return(
'Europe/Helsinki');
311 case 60:
return(
'America/Godthab');
312 case 61:
return(
'Asia/Rangoon');
313 case 62:
return(
'Asia/Kathmandu');
314 case 63:
return(
'Asia/Irkutsk');
315 case 64:
return(
'Asia/Krasnoyarsk');
316 case 65:
return(
'America/Santiago');
317 case 66:
return(
'Asia/Colombo');
318 case 67:
return(
'Pacific/Tongatapu');
319 case 68:
return(
'Asia/Vladivostok');
320 case 69:
return(
'Africa/Ndjamena');
321 case 70:
return(
'Asia/Yakutsk');
322 case 71:
return(
'Asia/Dhaka');
323 case 72:
return(
'Asia/Seoul');
324 case 73:
return(
'Australia/Perth');
325 case 74:
return(
'Asia/Riyadh');
326 case 75:
return(
'Asia/Taipei');
327 case 76:
return(
'Australia/Sydney');
343 static $keep_properties = array(
'DTSTAMP'=>1,
'DTSTART'=>1,
'RRULE'=>1,
'DURATION'=>1,
'DTEND'=>1,
'DUE'=>1,
'UID'=>1,
'CLASS'=>1,
'TRANSP'=>1,
'CREATED'=>1,
'LAST-MODIFIED'=>1 );
344 static $resource_components = array(
'VEVENT'=>1,
'VTODO'=>1,
'VJOURNAL'=>1 );
345 $this->
MaskComponents(array(
'VTIMEZONE'=>1,
'VEVENT'=>1,
'VTODO'=>1,
'VJOURNAL'=>1 ),
false);
347 if ( isset($this->rendered) ) unset($this->rendered);
349 if ( isset($resource_components[$comp->GetType()] ) ) {
350 if ( isset($comp->rendered) ) unset($comp->rendered);
351 $comp->AddProperty(
'SUMMARY', translate(
'Busy') );
363 $iTIP = clone($this);
364 static $keep_properties = array(
'DTSTART'=>1,
'DURATION'=>1,
'DTEND'=>1,
'DUE'=>1,
'UID'=>1,
365 'SEQUENCE'=>1,
'ORGANIZER'=>1,
'ATTENDEE'=>1 );
366 static $resource_components = array(
'VEVENT'=>1,
'VTODO'=>1,
'VJOURNAL'=>1 );
367 $iTIP->MaskComponents($resource_components,
false);
368 $iTIP->MaskProperties($keep_properties, $resource_components );
369 $iTIP->AddProperty(
'METHOD',$method);
370 if ( isset($iTIP->rendered) ) unset($iTIP->rendered);
371 if ( !empty($attendee_value) ) {
372 $iTIP->attendees = array();
373 foreach( $iTIP->GetComponents() AS $comp ) {
374 if ( isset($resource_components[$comp->GetType()] ) ) {
375 foreach( $comp->GetProperties() AS $k=> $property ) {
376 switch( $property->Name() ) {
378 if ( $property->Value() == $attendee_value )
379 $iTIP->attendees[] = $property->ClearParameters(array(
'CUTYPE'=>
true,
'SCHEDULE-STATUS'=>
true));
381 $comp->clearPropertyAt($k);
384 $property->Value( $property->Value() + 1);
388 $comp->AddProperty(
'DTSTAMP', date(
'Ymd\THis\Z'));
401 if ( empty($this->primary_component) )
return null;
402 return $this->primary_component->GetPValue(
'UID');
412 if ( empty($this->primary_component) )
return;
413 $this->primary_component->SetProperties( array(
new vProperty(
'UID', $newUid) ),
'UID');
GetOlsonName(vComponent $vtz)
AddComponent( $new_component)
__construct($content=null)
UpdateOrganizerStatus(vProperty $statusProperty)
AddTimeZone(vComponent $vtz, $in_components=false)
MaskProperties( $keep, $component_list=null)
UpdateAttendeeStatus( $email, vProperty $statusProperty)
GetComponents( $type=null, $normal_match=true)
MaskComponents( $keep, $recursive=true)
GetPropertiesByPath( $path)
GetItip($method, $attendee_value)
AddProperty( $new_property, $value=null, $parameters=null)