/**
  * @param \OCA\Calendar\IObject|\OCA\Calendar\IObjectCollection $data
  * @param TimezoneMapper $timezones
  * @param int $statusCode
  */
 public function __construct($data, TimezoneMapper $timezones = null, $statusCode = Http::STATUS_OK)
 {
     $vobject = $data->getVObject();
     if ($vobject) {
         if ($timezones) {
             SabreUtility::addMissingVTimezones($vobject, $timezones);
         }
         $serialized = $vobject->serialize();
         parent::__construct($serialized, $statusCode, ['Content-type' => 'text/calendar; charset=utf-8']);
         if ($data instanceof IObject) {
             $this->setETag($data->getEtag(true));
         }
     } else {
         parent::__construct(null, HTTP::STATUS_NO_CONTENT);
     }
 }
 /**
  * @param ICalendar $calendar
  * @param \OCA\Calendar\IObject|\OCA\Calendar\IObjectCollection $data
  * @param TimezoneMapper $timezones
  */
 public function __construct(ICalendar $calendar, $data, TimezoneMapper $timezones)
 {
     $vobject = $data->getVObject();
     if ($vobject) {
         if ($timezones) {
             SabreUtility::addMissingVTimezones($vobject, $timezones);
         }
         $serialized = $vobject->serialize();
         $contentType = 'application/octet-stream';
         $filename = $calendar->getPublicUri();
         if ($data instanceof IObject) {
             $filename .= '-' . $data->getSummary();
         }
         $filename .= '.ics';
         parent::__construct($serialized, $filename, $contentType);
     }
 }
Ejemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function listAll($type = ObjectType::ALL)
 {
     if (!$this->objects instanceof IObjectCollection) {
         $this->findAll();
         if (!$this->objects instanceof IObjectCollection) {
             return [];
         }
     }
     return $this->objects->listAll($type);
 }