5use Bitrix\Calendar\ICal\Basic\AttachPropertytype;
18 public const TYPE =
'VEVENT';
24 private $description =
'';
28 private $withTimezone =
false;
29 private $classification =
null;
30 private $transparent =
null;
31 private $attendees = [];
32 private $organizer =
null;
33 private $status =
null;
36 private $location =
null;
38 private $sequence = 0;
39 private $attaches = [];
40 private $exdates = [];
50 return new self($uid);
72 $this->rrule = $rrule;
83 $this->withTime = $withTime;
94 $this->location = $location;
105 $this->modified = $modified;
117 $this->sequence = $sequence;
141 $this->starts = $starts;
163 $this->name = $name ? Emoji::decode($name) :
Loc::getMessage(
'CAL_ICAL_NEW_EVENT');
174 $this->description = $description ? Emoji::decode($description) : $description;
185 $this->address = $address;
196 $this->created = $created;
207 $this->withTimezone = $withTimeZone;
218 $this->classification = $classification;
229 $this->transparent = $transparent;
240 foreach ($attendees as $attendee)
245 $attendee->getEmail(),
246 $attendee->getFullName(),
247 $attendee->getStatus(),
248 $attendee->getRole(),
249 $attendee->getCuType(),
250 $attendee->getMailTo(),
285 $this->status = $status;
296 $this->attaches[] = $attaches;
307 $this->exdates = $exdates;
318 $this->dtStamp = $dtStamp;
339 $content = Content::getInstance(self::TYPE)
341 ->textProperty(
'SUMMARY', $this->name)
342 ->textProperty(
'DESCRIPTION', $this->description)
343 ->textProperty(
'LOCATION', $this->address)
344 ->textProperty(
'CLASS', $this->classification)
345 ->textProperty(
'TRANSP', $this->transparent)
346 ->textProperty(
'STATUS', $this->status)
347 ->textProperty(
'LOCATION', $this->location)
348 ->textProperty(
'SEQUENCE', $this->sequence)
350 ->dateTimeProperty(
'DTSTART', $this->starts, $this->withTime, $this->withTimezone)
351 ->dateTimeProperty(
'DTEND', $this->ends, $this->withTime, $this->withTimezone)
352 ->dateTimeProperty(
'DTSTAMP', $this->dtStamp,
true,
false,
true)
353 ->dateTimeProperty(
'CREATED', $this->created,
true,
false,
true)
354 ->dateTimeProperty(
'LAST-MODIFIED', $this->modified,
true,
false,
true)
355 ->subComponent(...$this->alerts);
357 foreach ($this->attendees as $attendee)
362 if ($this->isRecurringEvent())
366 if (!empty($this->exdates))
368 foreach ($this->exdates as $exdate)
370 $content->dateTimeProperty(
'EXDATE', $exdate, $this->withTime, $this->withTimezone);
375 if (!empty($this->attaches))
377 foreach ($this->attaches as $attach)
383 if (!empty($this->url))
385 $content->textProperty(
'URL', $this->url);
394 private function isRecurringEvent(): bool
396 return !empty($this->rrule) && !empty($this->rrule->freq) && $this->rrule->freq !==
'NONE';
static getInstance($names, AttachProperty $attach)
static createInstance($names, AttendeesProperty $calendarAddress)
textProperty($names, ?string $value, bool $disableEscaping=false)
static createInstance($names, RecurrenceRuleProperty $rrule)
setExdates(array $exdates=null)
setTransparent(string $transparent)
setAttaches(array $attaches=null)
setRRule(RecurrenceRuleProperty $rrule=null)
setName(string $name=null)
setCreatedAt(Date $created)
setWithTime(bool $withTime=false)
setAttendees(iterable $attendees)
setWithTimezone(bool $withTimeZone)
setOrganizer(Attendee $organizer, string $mailTo)
setStatus(string $status)
setStartsAt(Date $starts)
static createInstance($uid)
setAddress(string $address=null)
setLocation(string $location=null)
setDtStamp(Date $dtStamp)
setSequence(int $sequence)
setClassification(string $classification=null)
setDescription(string $description=null)
setModified(Date $modified)
static getMessage($code, $replace=null, $language=null)