Ejemplo n.º 1
0
 public function postLoad()
 {
     parent::__construct();
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function buildPropertyBag()
 {
     $propertyBag = new PropertyBag();
     // mandatory information
     $propertyBag->set('UID', $this->uniqueId);
     $propertyBag->add(new DateTimeProperty('DTSTART', $this->dtStart, $this->noTime, $this->useTimezone, $this->useUtc));
     $propertyBag->set('SEQUENCE', $this->sequence);
     $propertyBag->set('TRANSP', $this->transparency);
     if ($this->status) {
         $propertyBag->set('STATUS', $this->status);
     }
     // An event can have a 'dtend' or 'duration', but not both.
     if (null != $this->dtEnd) {
         $propertyBag->add(new DateTimeProperty('DTEND', $this->dtEnd, $this->noTime, $this->useTimezone, $this->useUtc));
     } elseif (null != $this->duration) {
         $propertyBag->set('DURATION', $this->duration->format('P%dDT%hH%iM%sS'));
     }
     // optional information
     if (null != $this->url) {
         $propertyBag->set('URL', $this->url);
     }
     if (null != $this->location) {
         $propertyBag->set('LOCATION', $this->location);
         if (null != $this->locationGeo) {
             $propertyBag->add(new Property('X-APPLE-STRUCTURED-LOCATION', 'geo:' . $this->locationGeo, array('VALUE' => 'URI', 'X-ADDRESS' => $this->location, 'X-APPLE-RADIUS' => 49, 'X-TITLE' => $this->locationTitle)));
         }
     }
     if (null != $this->summary) {
         $propertyBag->set('SUMMARY', $this->summary);
     }
     if (null != $this->attendees) {
         $propertyBag->add($this->attendees);
     }
     $propertyBag->set('CLASS', $this->isPrivate ? 'PRIVATE' : 'PUBLIC');
     if (null != $this->description) {
         $propertyBag->set('DESCRIPTION', $this->description);
     }
     if (null != $this->recurrenceRule) {
         $propertyBag->set('RRULE', $this->recurrenceRule);
     }
     if (null != $this->recurrenceId) {
         $this->recurrenceId->applyTimeSettings($this->noTime, $this->useTimezone, $this->useUtc);
         $propertyBag->add($this->recurrenceId);
     }
     if (!empty($this->exDates)) {
         $propertyBag->add(new DateTimesProperty('EXDATE', $this->exDates, $this->noTime, $this->useTimezone, $this->useUtc));
     }
     if ($this->cancelled) {
         $propertyBag->set('STATUS', 'CANCELLED');
     }
     if (null != $this->organizer) {
         $propertyBag->add($this->organizer);
     }
     if ($this->noTime) {
         $propertyBag->set('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE');
     }
     if (null != $this->categories) {
         $propertyBag->set('CATEGORIES', $this->categories);
     }
     $propertyBag->add(new DateTimeProperty('DTSTAMP', $this->dtStamp ?: new \DateTime(), false, false, true));
     if ($this->created) {
         $propertyBag->add(new DateTimeProperty('CREATED', $this->created, false, false, true));
     }
     if ($this->modified) {
         $propertyBag->add(new DateTimeProperty('LAST-MODIFIED', $this->modified, false, false, true));
     }
     return $propertyBag;
 }