53 $this->contained_type =
null;
54 $this->primary_component =
null;
55 $this->timezones = array();
56 if ( empty($content) || is_array($content) ) {
57 parent::__construct();
59 $this->
AddProperty(
'PRODID',
'-//davical.org//NONSGML AWL Calendar//EN');
62 if ( !empty($content) ) {
63 foreach( $content AS $k => $v ) {
69 parent::__construct($content);
71 if(isset($components) && count($components) > 0){
72 foreach( $components AS $k => $comp ) {
73 if ( $comp->GetType() ==
'VTIMEZONE' ) {
76 else if ( empty($this->contained_type) ) {
77 $this->contained_type = $comp->GetType();
78 $this->primary_component = $comp;
83 if ( !isset($this->contained_type) && !empty($this->timezones) ) {
84 $this->contained_type =
'VTIMEZONE';
85 $this->primary_component = reset($this->timezones);
122 if ( !isset($this->organizer) ) {
124 $organizer = (count($organizers) > 0 ? $organizers[0] :
false);
125 $this->organizer = (empty($organizer) ? false : $organizer );
126 if ( $this->organizer ) {
127 $this->schedule_agent = $organizer->GetParameterValue(
'SCHEDULE-AGENT');
128 if ( empty($schedule_agent) ) $this->schedule_agent =
'SERVER';
131 return $this->organizer;
173 if ($v->GetType() ==
'VEVENT' || $v->GetType() ==
'VTODO' ) {
174 $new_attendees = array();
175 foreach( $v->GetProperties() AS $p ) {
176 if ( $p->Name() ==
'ATTENDEE' ) {
177 if ( $p->Value() == $email || $p->Value() ==
'mailto:'.$email ) {
178 $new_attendees[] = $statusProperty;
181 $new_attendees[] = clone($p);
185 $v->SetProperties($new_attendees,
'ATTENDEE');
186 $this->attendees =
null;
187 $this->rendered =
null;
344 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 );
345 static $resource_components = array(
'VEVENT'=>1,
'VTODO'=>1,
'VJOURNAL'=>1 );
346 $this->
MaskComponents(array(
'VTIMEZONE'=>1,
'VEVENT'=>1,
'VTODO'=>1,
'VJOURNAL'=>1 ),
false);
348 if ( isset($this->rendered) ) unset($this->rendered);
350 if ( isset($resource_components[$comp->GetType()] ) ) {
351 if ( isset($comp->rendered) ) unset($comp->rendered);
352 $comp->AddProperty(
'SUMMARY', translate(
'Busy') );
364 $iTIP = clone($this);
365 static $keep_properties = array(
'DTSTART'=>1,
'DURATION'=>1,
'DTEND'=>1,
'DUE'=>1,
'UID'=>1,
366 'SEQUENCE'=>1,
'ORGANIZER'=>1,
'ATTENDEE'=>1 );
367 static $resource_components = array(
'VEVENT'=>1,
'VTODO'=>1,
'VJOURNAL'=>1 );
368 $iTIP->MaskComponents($resource_components,
false);
369 $iTIP->MaskProperties($keep_properties, $resource_components );
370 $iTIP->AddProperty(
'METHOD',$method);
371 if ( isset($iTIP->rendered) ) unset($iTIP->rendered);
372 if ( !empty($attendee_value) ) {
373 $iTIP->attendees = array();
374 foreach( $iTIP->GetComponents() AS $comp ) {
375 if ( isset($resource_components[$comp->GetType()] ) ) {
376 foreach( $comp->GetProperties() AS $k=> $property ) {
377 switch( $property->Name() ) {
379 if ( $property->Value() == $attendee_value )
380 $iTIP->attendees[] = $property->ClearParameters(array(
'CUTYPE'=>
true,
'SCHEDULE-STATUS'=>
true));
382 $comp->clearPropertyAt($k);
386 $comp->AddProperty(
'DTSTAMP', date(
'Ymd\THis\Z'));