Add support for CUTYPE parameter for event attendees

This commit is contained in:
Thomas Bruederli 2013-05-16 09:23:48 +02:00
parent 7aa8ecfef6
commit 06e7b093ba

View file

@ -43,6 +43,14 @@ abstract class kolab_format_xcal extends kolab_format
'CHAIR' => kolabformat::Chair, 'CHAIR' => kolabformat::Chair,
); );
protected $cutype_map = array(
'INDIVIDUAL' => kolabformat::CutypeIndividual,
'GROUP' => kolabformat::CutypeGroup,
'ROOM' => kolabformat::CutypeRoom,
'RESOURCE' => kolabformat::CutypeResource,
'UNKNOWN' => kolabformat::CutypeUnknown,
);
protected $rrule_type_map = array( protected $rrule_type_map = array(
'MINUTELY' => RecurrenceRule::Minutely, 'MINUTELY' => RecurrenceRule::Minutely,
'HOURLY' => RecurrenceRule::Hourly, 'HOURLY' => RecurrenceRule::Hourly,
@ -121,6 +129,7 @@ abstract class kolab_format_xcal extends kolab_format
} }
$role_map = array_flip($this->role_map); $role_map = array_flip($this->role_map);
$cutype_map = array_flip($this->cutype_map);
$part_status_map = array_flip($this->part_status_map); $part_status_map = array_flip($this->part_status_map);
$attvec = $this->obj->attendees(); $attvec = $this->obj->attendees();
for ($i=0; $i < $attvec->size(); $i++) { for ($i=0; $i < $attvec->size(); $i++) {
@ -129,6 +138,7 @@ abstract class kolab_format_xcal extends kolab_format
if ($cr->email() != $object['organizer']['email']) { if ($cr->email() != $object['organizer']['email']) {
$object['attendees'][] = array( $object['attendees'][] = array(
'role' => $role_map[$attendee->role()], 'role' => $role_map[$attendee->role()],
'cutype' => $cutype_map[$attendee->cutype()],
'status' => $part_status_map[$attendee->partStat()], 'status' => $part_status_map[$attendee->partStat()],
'rsvp' => $attendee->rsvp(), 'rsvp' => $attendee->rsvp(),
'email' => $cr->email(), 'email' => $cr->email(),
@ -250,6 +260,7 @@ abstract class kolab_format_xcal extends kolab_format
$att->setContact($cr); $att->setContact($cr);
$att->setPartStat($this->part_status_map[$attendee['status']]); $att->setPartStat($this->part_status_map[$attendee['status']]);
$att->setRole($this->role_map[$attendee['role']] ? $this->role_map[$attendee['role']] : kolabformat::Required); $att->setRole($this->role_map[$attendee['role']] ? $this->role_map[$attendee['role']] : kolabformat::Required);
$att->setCutype($this->cutype_map[$attendee['cutype']] ? $this->cutype_map[$attendee['cutype']] : kolabformat::CutypeIndividual);
$att->setRSVP((bool)$attendee['rsvp']); $att->setRSVP((bool)$attendee['rsvp']);
if ($att->isValid()) { if ($att->isValid()) {