Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
event.php
1<?php
2
4
18
19class Event implements EntityInterface
20{
21 private const MIN_MEETING_PARTICIPANT = 2;
22
26 protected ?int $id = null;
30 protected ?string $name = null;
38 protected ?Location $location = null;
42 protected ?Date $start = null;
46 protected ?Date $end = null;
50 protected bool $isFullDay = true;
62 protected ?string $description = null;
66 protected ?string $color = null;
70 protected ?string $transparent = null;
74 protected ?Section $section = null;
78 protected ?string $importance = null;
82 protected ?string $accessibility = 'busy';
86 protected bool $isPrivate = false;
90 protected ?Role $eventHost = null;
94 protected ?Role $creator = null;
98 protected ?Role $owner = null;
106 protected ?int $version = 0;
111 protected ?string $eventType = null;
116 protected ?string $calType = null;
120 protected ?string $uid = null;
124 protected bool $isActive = true;
128 protected bool $isDeleted = false;
132 protected ?int $recurrenceId = null;
136 protected ?Date $originalDateFrom = null;
140 protected ?Date $dateCreate = null;
144 protected ?Date $dateModified = null;
152 protected ?DateTimeZone $startTimeZone = null;
156 protected ?DateTimeZone $endTimeZone = null;
160 private ?int $parentId = null;
164 private bool $isMeeting = false;
168 private ?string $meetingStatus = null;
172 private ?Relations $relations = null;
173
178 public static function fromBuilder(Builder $builder): Event
179 {
180 return $builder->build();
181 }
182
186 public function __toString()
187 {
188 return $this->name ?? '';
189 }
190
195 public function setName(?string $name): Event
196 {
197 $this->name = $name ? Emoji::decode($name) : $name;
198
199 return $this;
200 }
201
207 {
208 $this->recurringRule = $recurringRule;
209
210 return $this;
211 }
212
218 {
219 $this->location = $location;
220
221 return $this;
222 }
223
229 public function setStart(?Date $start): Event
230 {
231 $this->start = $start;
232
233 return $this;
234 }
235
241 public function setStartTimeZone(?DateTimeZone $timezone): Event
242 {
243 $this->startTimeZone = $timezone;
244
245 return $this;
246 }
247
253 public function setEndTimeZone(?DateTimeZone $timezone): Event
254 {
255 $this->endTimeZone = $timezone;
256 return $this;
257 }
258
264 public function setEnd(?Date $end): Event
265 {
266 $this->end = $end;
267
268 return $this;
269 }
270
275 public function setAttendeesCollection(?AttendeeCollection $collection): Event
276 {
277 $this->attendeeCollection = $collection;
278
279 return $this;
280 }
281
286 public function setIsFullDay(bool $isFullDay): Event
287 {
288 $this->isFullDay = $isFullDay;
289
290 return $this;
291 }
292
298 public function setRemindCollection(?Properties\RemindCollection $remindCollection): Event
299 {
300 $this->remindCollection = $remindCollection;
301
302 return $this;
303 }
304
309 public function setSection(?Section $section): Event
310 {
311 $this->section = $section;
312
313 return $this;
314 }
315
320 public function setDescription(?string $description): Event
321 {
322 $this->description = $description ? Emoji::decode($description) : $description;
323
324 return $this;
325 }
326
331 public function setColor(?string $color): Event
332 {
333 $this->color = $color;
334
335 return $this;
336 }
337
342 public function setAccessibility(?string $accessibility): Event
343 {
344 $this->accessibility = $accessibility;
345
346 return $this;
347 }
348
353 public function setImportance(?string $importance): Event
354 {
355 $this->importance = $importance;
356
357 return $this;
358 }
359
364 public function setIsPrivate(bool $isPrivate): Event
365 {
366 $this->isPrivate = $isPrivate;
367
368 return $this;
369 }
370
376 {
377 $this->eventHost = $eventHost;
378
379 return $this;
380 }
381
386 public function setCreator(?Role $creator): Event
387 {
388 $this->creator = $creator;
389
390 return $this;
391 }
392
397 public function setOwner(?Role $owner): Event
398 {
399 $this->owner = $owner;
400
401 return $this;
402 }
403
408 public function setVersion(int $version): Event
409 {
410 $this->version = $version;
411
412 return $this;
413 }
414
420 {
421 $this->originalDateFrom = $originalDateFrom;
422
423 return $this;
424 }
425
430 public function setRecurrenceId(?int $recurrenceId): Event
431 {
432 $this->recurrenceId = $recurrenceId;
433
434 return $this;
435 }
436
442 {
443 $this->dateCreate = $dateCreate;
444
445 return $this;
446 }
447
453 {
454 $this->dateModified = $dateModified;
455
456 return $this;
457 }
458
463 public function setIsActive(bool $isActive): Event
464 {
465 $this->isActive = $isActive;
466
467 return $this;
468 }
469
474 public function setIsDeleted(bool $isDeleted): Event
475 {
476 $this->isDeleted = $isDeleted;
477
478 return $this;
479 }
480
485 public function setUid(?string $uid): Event
486 {
487 $this->uid = $uid;
488
489 return $this;
490 }
491
496 public function setTransparent(?string $transparent): Event
497 {
498 $this->transparent = $transparent;
499
500 return $this;
501 }
502
508 {
509 $this->excludedDateCollection = $excludedDateCollection;
510
511 return $this;
512 }
513
521 public function setEventType(?string $eventType): Event
522 {
523 $this->eventType = $eventType;
524
525 return $this;
526 }
527
533 public function setSpecialLabel(?string $label): Event
534 {
535 $this->eventType = $label;
536
537 return $this;
538 }
539
546 {
547 $this->meetingDescription = $meetingDescription;
548
549 return $this;
550 }
551
557 public function setRelations(?Relations $relations): Event
558 {
559 $this->relations = $relations;
560
561 return $this;
562 }
563
564
568 public function getName(): ?string
569 {
570 return $this->name;
571 }
572
577 {
579 }
580
584 public function getLocation(): ?Location
585 {
586 return $this->location;
587 }
588
592 public function getStart(): Date
593 {
594 return $this->start;
595 }
596
600 public function getStartTimeZone(): ?DateTimeZone
601 {
603 }
604
608 public function getEndTimeZone(): ?DateTimeZone
609 {
610 return $this->endTimeZone;
611 }
612
616 public function getEnd(): Date
617 {
618 return $this->end;
619 }
620
625 {
626 if (is_null($this->attendeeCollection))
627 {
628 $this->initAttendeesCollection();
629 }
631 }
632
636 public function getDescription(): ?string
637 {
638 return $this->description;
639 }
640
644 public function getOwner(): ?Role
645 {
646 return $this->owner;
647 }
648
652 public function getCreator(): ?Role
653 {
654 return $this->creator;
655 }
656
660 public function getEventHost(): ?Role
661 {
662 return $this->eventHost;
663 }
664
668 public function getIsPrivate(): bool
669 {
670 return $this->isPrivate;
671 }
672
676 public function isPrivate(): bool
677 {
678 return $this->isPrivate;
679 }
680
684 public function getAccessibility(): ?string
685 {
687 }
688
692 public function getImportance(): ?string
693 {
694 return $this->importance;
695 }
696
700 public function getSection(): Section
701 {
702 if ($this->section === null)
703 {
704 $this->initSection();
705 }
706
707 return $this->section;
708 }
709
713 public function getColor(): ?string
714 {
715 return $this->color;
716 }
717
721 public function getTransparent(): ?string
722 {
723 return $this->transparent;
724 }
725
730 {
732 }
733
737 public function getRelations(): ?Relations
738 {
739 return $this->relations;
740 }
741
745 public function getVersion(): int
746 {
747 return $this->version;
748 }
749
755 public function getEventType(): ?string
756 {
757 return $this->eventType;
758 }
759
763 public function getSpecialLabel(): ?string
764 {
765 return $this->eventType;
766 }
767
771 public function getUid(): ?string
772 {
773 return $this->uid;
774 }
775
779 public function isActive(): bool
780 {
781 return $this->isActive;
782 }
783
787 public function isDeleted(): bool
788 {
789 return $this->isDeleted;
790 }
791
795 public function isInstance(): bool
796 {
797 return $this->recurrenceId && $this->originalDateFrom;
798 }
799
803 public function getRecurrenceId(): ?int
804 {
805 return $this->recurrenceId;
806 }
807
811 public function getOriginalDateFrom(): ?Date
812 {
814 }
815
819 public function getDateCreate(): ?Date
820 {
821 return $this->dateCreate;
822 }
823
827 public function getDateModified(): ?Date
828 {
829 return $this->dateModified;
830 }
831
839
843 public function isFullDayEvent(): bool
844 {
845 return $this->isFullDay;
846 }
847
851 public function isRecurrence(): bool
852 {
853 return $this->recurringRule && $this->recurringRule->getFrequency();
854 }
855
859 public function isSingle(): bool
860 {
861 return !$this->isInstance() && !$this->isRecurrence();
862 }
863
867 public function isBaseEvent(): bool
868 {
869 return ($this->id === $this->parentId) && ($this->id !== null);
870 }
871
875 public function getRemindCollection(): ?Properties\RemindCollection
876 {
878 }
879
883 public function isMeeting(): bool
884 {
885 if ($this->isMeeting === false)
886 {
887 return $this->attendeeCollection
888 && count($this->attendeeCollection) >= self::MIN_MEETING_PARTICIPANT;
889 }
890
891 return true;
892 }
893
897 public function getId(): ?int
898 {
899 return $this->id;
900 }
901
906 public function setId(?int $id): Event
907 {
908 $this->id = $id;
909
910 return $this;
911 }
912
913 private function initAttendeesCollection(): void
914 {
915 // TODO: need to implement a logic
916 $this->attendeeCollection = new AttendeeCollection();
917 }
918
919 private function initSection(): void
920 {
921 // TODO: need to implement a logic
922 $this->section = new Section();
923 }
924
929 public function setParentId(?int $parentId): Event
930 {
931 $this->parentId = $parentId;
932
933 return $this;
934 }
935
939 public function getParentId(): ?int
940 {
941 return $this->parentId;
942 }
943
948 public function setIsMeeting(bool $isMeeting): Event
949 {
950 $this->isMeeting = $isMeeting;
951
952 return $this;
953 }
954
959 public function setMeetingStatus(?string $meetingStatus): Event
960 {
961 $this->meetingStatus = $meetingStatus;
962
963 return $this;
964 }
965
969 public function getMeetingStatus(): ?string
970 {
971 return $this->meetingStatus;
972 }
973
977 public function isNew(): bool
978 {
979 return $this->id === 0 || $this->id === null;
980 }
981
985 public function upVersion(): self
986 {
987 $this->version++;
988
989 return $this;
990 }
991
995 public function getCalendarType(): ?string
996 {
997 return $this->calType;
998 }
999
1005 public function setCalendarType(?string $calendarType): self
1006 {
1007 $this->calType = $calendarType;
1008 return $this;
1009 }
1010}
setMeetingDescription(?MeetingDescription $meetingDescription)
Definition event.php:545
setRemindCollection(?Properties\RemindCollection $remindCollection)
Definition event.php:298
setParentId(?int $parentId)
Definition event.php:929
setIsMeeting(bool $isMeeting)
Definition event.php:948
setSection(?Section $section)
Definition event.php:309
setIsPrivate(bool $isPrivate)
Definition event.php:364
setStartTimeZone(?DateTimeZone $timezone)
Definition event.php:241
setRelations(?Relations $relations)
Definition event.php:557
MeetingDescription $meetingDescription
Definition event.php:102
setAccessibility(?string $accessibility)
Definition event.php:342
setIsFullDay(bool $isFullDay)
Definition event.php:286
setEventType(?string $eventType)
Definition event.php:521
setSpecialLabel(?string $label)
Definition event.php:533
Properties RemindCollection $remindCollection
Definition event.php:58
RecurringEventRules $recurringRule
Definition event.php:34
setAttendeesCollection(?AttendeeCollection $collection)
Definition event.php:275
setRecurrenceId(?int $recurrenceId)
Definition event.php:430
static fromBuilder(Builder $builder)
Definition event.php:178
setRecurringRule(?RecurringEventRules $recurringRule)
Definition event.php:206
setEndTimeZone(?DateTimeZone $timezone)
Definition event.php:253
setMeetingStatus(?string $meetingStatus)
Definition event.php:959
setTransparent(?string $transparent)
Definition event.php:496
ExcludedDatesCollection $excludedDateCollection
Definition event.php:148
setImportance(?string $importance)
Definition event.php:353
setIsActive(bool $isActive)
Definition event.php:463
setLocation(?Location $location)
Definition event.php:217
setCalendarType(?string $calendarType)
Definition event.php:1005
AttendeeCollection $attendeeCollection
Definition event.php:54
setDateCreate(?Date $dateCreate)
Definition event.php:441
setExcludedDateCollection(?ExcludedDatesCollection $excludedDateCollection)
Definition event.php:507
setOriginalDateFrom(?Date $originalDateFrom)
Definition event.php:419
setEventHost(?Role $eventHost)
Definition event.php:375
setDescription(?string $description)
Definition event.php:320
setDateModified(?Date $dateModified)
Definition event.php:452
setIsDeleted(bool $isDeleted)
Definition event.php:474