Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
eventcloner.php
1<?php
2
4
18
20{
21 private Event $originalEvent;
22
23 public function __construct(Event $originalEvent)
24 {
25 $this->originalEvent = $originalEvent;
26 }
27
31 protected function getId(): ?int
32 {
33 return $this->originalEvent->getId();
34 }
35
39 protected function getParentId(): ?int
40 {
41 return $this->originalEvent->getParentId();
42 }
43
47 protected function getName(): string
48 {
49 return $this->originalEvent->getName() ?? '';
50 }
51
55 protected function getStartTimezone(): ?DateTimeZone
56 {
57 return $this->originalEvent->getStartTimeZone()
58 ? new DateTimeZone(clone $this->originalEvent->getStartTimeZone()->getTimeZone())
59 : null
60 ;
61 }
62
66 protected function getEndTimezone(): ?DateTimeZone
67 {
68 return $this->originalEvent->getEndTimeZone()
69 ? new DateTimeZone(clone $this->originalEvent->getEndTimeZone()->getTimeZone())
70 : null
71 ;
72 }
73
80 {
81 if ($this->originalEvent->getRecurringRule())
82 {
83 $result = clone $this->originalEvent->getRecurringRule();
84 if ($result->hasUntil())
85 {
86 $result->setUntil($this->cloneDate($result->getUntil()));
87 }
88
89 return $result;
90 }
91
92 return null;
93 }
94
98 protected function getLocation(): ?Location
99 {
100 return $this->originalEvent->getLocation() ? clone $this->originalEvent->getLocation() : null;
101 }
102
108 protected function getStart(): Date
109 {
110 return $this->cloneDate($this->originalEvent->getStart());
111 }
112
118 protected function getEnd(): Date
119 {
120 return $this->cloneDate($this->originalEvent->getEnd());
121 }
122
126 protected function getFullDay(): bool
127 {
128 return $this->originalEvent->isFullDayEvent();
129 }
130
134 protected function getAttendees(): ?AttendeeCollection
135 {
136 return $this->originalEvent->getAttendeesCollection();
137 }
138
144 protected function getReminders(): RemindCollection
145 {
146 $result = new RemindCollection();
147 if ($this->originalEvent->getRemindCollection())
148 {
149 $result
150 ->setCollection($this->originalEvent->getRemindCollection()->getCollection())
151 ->setSingle($this->originalEvent->getRemindCollection()->isSingle())
152 ;
153 if ($this->originalEvent->getRemindCollection()->getEventStart())
154 {
155 $result->setEventStart($this->cloneDate($this->originalEvent->getRemindCollection()->getEventStart()));
156 }
157 else if ($this->originalEvent->getStart())
158 {
159 $result->setEventStart($this->cloneDate($this->originalEvent->getStart()));
160 }
161 }
162
163 return $result;
164 }
165
169 protected function getDescription(): ?string
170 {
171 return $this->originalEvent->getDescription();
172 }
173
177 protected function getSection(): Section
178 {
179 return $this->originalEvent->getSection();
180 }
181
185 protected function getColor(): ?string
186 {
187 return $this->originalEvent->getColor();
188 }
189
193 protected function getTransparency(): ?string
194 {
195 return $this->originalEvent->getTransparent();
196 }
197
201 protected function getImportance(): ?string
202 {
203 return $this->originalEvent->getImportance();
204 }
205
209 protected function getAccessibility(): ?string
210 {
211 return $this->originalEvent->getAccessibility();
212 }
213
217 protected function getIsPrivate(): bool
218 {
219 return $this->originalEvent->isPrivate();
220 }
221
225 protected function getEventHost(): ?Role
226 {
227 return $this->cloneRole($this->originalEvent->getEventHost());
228 }
229
233 protected function getCreator(): ?Role
234 {
235 return $this->cloneRole($this->originalEvent->getCreator());
236 }
237
241 protected function getOwner(): ?Role
242 {
243 return $this->cloneRole($this->originalEvent->getOwner());
244 }
245
250 {
251 return $this->originalEvent->getMeetingDescription()
252 ? clone $this->originalEvent->getMeetingDescription()
253 : null;
254 }
255
259 protected function getVersion(): int
260 {
261 return $this->originalEvent->getVersion();
262 }
263
267 protected function getCalendarType(): ?string
268 {
269 return $this->originalEvent->getCalendarType();
270 }
271
275 protected function getSpecialLabel(): ?string
276 {
277 return $this->originalEvent->getSpecialLabel();
278 }
279
283 protected function getUid(): ?string
284 {
285 return $this->originalEvent->getUid();
286 }
287
291 protected function isDeleted(): bool
292 {
293 return $this->originalEvent->isDeleted();
294 }
295
299 protected function isActive(): bool
300 {
301 return $this->originalEvent->isActive();
302 }
303
307 protected function getRecurrenceId(): ?int
308 {
309 return $this->originalEvent->getRecurrenceId();
310 }
311
317 protected function getOriginalDate(): ?Date
318 {
319 return $this->cloneDate($this->originalEvent->getOriginalDateFrom());
320 }
321
327 protected function getDateCreate(): ?Date
328 {
329 return $this->cloneDate($this->originalEvent->getDateCreate());
330 }
331
337 protected function getDateModified(): ?Date
338 {
339 return $this->cloneDate($this->originalEvent->getDateModified());
340 }
341
346 {
347 return clone $this->originalEvent->getExcludedDateCollection();
348 }
349
353 protected function isMeeting(): bool
354 {
355 return $this->originalEvent->isMeeting();
356 }
357
361 protected function getMeetingStatus(): ?string
362 {
363 return $this->originalEvent->getMeetingStatus();
364 }
365
369 protected function getRelations(): ?Relations
370 {
371 return $this->originalEvent->getRelations()
372 ? clone $this->originalEvent->getRelations()
373 : null;
374 }
375
382 private function cloneDate(?Date $date): ?Date
383 {
384 $format = 'YmdHisO';
385 return $date
386 ? Date::createDateTimeFromFormat($date->format($format), $format)
387 : null
388 ;
389 }
390
396 private function cloneRole(?Role $role): ?Role
397 {
398 return $role ?
399 new Role($role->getRoleEntity())
400 : null
401 ;
402 }
403}
format(string $format=null)
Definition date.php:107