1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
eventcloner.php
См. документацию.
1<?php
2
3namespace Bitrix\Calendar\Core\Builders;
4
5use Bitrix\Calendar\Core\Base\Date;
6use Bitrix\Calendar\Core\Base\DateTimeZone;
7use Bitrix\Calendar\Core\Builders\EventOption\EventOptionBuilderFromArray;
8use Bitrix\Calendar\Core\Event\Event;
9use Bitrix\Calendar\Core\Event\Properties\AttendeeCollection;
10use Bitrix\Calendar\Core\Event\Properties\ExcludedDatesCollection;
11use Bitrix\Calendar\Core\Event\Properties\Location;
12use Bitrix\Calendar\Core\Event\Properties\MeetingDescription;
13use Bitrix\Calendar\Core\Event\Properties\RecurringEventRules;
14use Bitrix\Calendar\Core\Event\Properties\Relations;
15use Bitrix\Calendar\Core\Event\Properties\RemindCollection;
16use Bitrix\Calendar\Core\eventoption\EventOption;
17use Bitrix\Calendar\Core\Mappers\Factory;
18use Bitrix\Calendar\Core\Role\Role;
19use Bitrix\Calendar\Core\Section\Section;
20use Bitrix\Main\DI\ServiceLocator;
21use Bitrix\Main\ObjectException;
22
24{
25 private Event $originalEvent;
26
27 public function __construct(Event $originalEvent)
28 {
29 $this->originalEvent = $originalEvent;
30 }
31
35 protected function getId(): ?int
36 {
37 return $this->originalEvent->getId();
38 }
39
43 protected function getParentId(): ?int
44 {
45 return $this->originalEvent->getParentId();
46 }
47
51 protected function getName(): string
52 {
53 return $this->originalEvent->getName() ?? '';
54 }
55
59 protected function getStartTimezone(): ?DateTimeZone
60 {
61 return $this->originalEvent->getStartTimeZone()
62 ? new DateTimeZone(clone $this->originalEvent->getStartTimeZone()->getTimeZone())
63 : null
64 ;
65 }
66
70 protected function getEndTimezone(): ?DateTimeZone
71 {
72 return $this->originalEvent->getEndTimeZone()
73 ? new DateTimeZone(clone $this->originalEvent->getEndTimeZone()->getTimeZone())
74 : null
75 ;
76 }
77
84 {
85 if ($this->originalEvent->getRecurringRule())
86 {
87 $result = clone $this->originalEvent->getRecurringRule();
88 if ($result->hasUntil())
89 {
90 $result->setUntil($this->cloneDate($result->getUntil()));
91 }
92
93 return $result;
94 }
95
96 return null;
97 }
98
102 protected function getLocation(): ?Location
103 {
104 return $this->originalEvent->getLocation() ? clone $this->originalEvent->getLocation() : null;
105 }
106
112 protected function getStart(): Date
113 {
114 return $this->cloneDate($this->originalEvent->getStart());
115 }
116
122 protected function getEnd(): Date
123 {
124 return $this->cloneDate($this->originalEvent->getEnd());
125 }
126
130 protected function getFullDay(): bool
131 {
132 return $this->originalEvent->isFullDayEvent();
133 }
134
138 protected function getAttendees(): ?AttendeeCollection
139 {
140 return $this->originalEvent->getAttendeesCollection();
141 }
142
148 protected function getReminders(): RemindCollection
149 {
151 if ($this->originalEvent->getRemindCollection())
152 {
153 $result
154 ->setCollection($this->originalEvent->getRemindCollection()->getCollection())
155 ->setSingle($this->originalEvent->getRemindCollection()->isSingle())
156 ;
157 if ($this->originalEvent->getRemindCollection()->getEventStart())
158 {
159 $result->setEventStart($this->cloneDate($this->originalEvent->getRemindCollection()->getEventStart()));
160 }
161 else if ($this->originalEvent->getStart())
162 {
163 $result->setEventStart($this->cloneDate($this->originalEvent->getStart()));
164 }
165 }
166
167 return $result;
168 }
169
173 protected function getDescription(): ?string
174 {
175 return $this->originalEvent->getDescription();
176 }
177
181 protected function getSection(): Section
182 {
183 return $this->originalEvent->getSection();
184 }
185
189 protected function getColor(): ?string
190 {
191 return $this->originalEvent->getColor();
192 }
193
197 protected function getTransparency(): ?string
198 {
199 return $this->originalEvent->getTransparent();
200 }
201
205 protected function getImportance(): ?string
206 {
207 return $this->originalEvent->getImportance();
208 }
209
213 protected function getAccessibility(): ?string
214 {
215 return $this->originalEvent->getAccessibility();
216 }
217
221 protected function getIsPrivate(): bool
222 {
223 return $this->originalEvent->isPrivate();
224 }
225
229 protected function getEventHost(): ?Role
230 {
231 return $this->cloneRole($this->originalEvent->getEventHost());
232 }
233
237 protected function getCreator(): ?Role
238 {
239 return $this->cloneRole($this->originalEvent->getCreator());
240 }
241
245 protected function getOwner(): ?Role
246 {
247 return $this->cloneRole($this->originalEvent->getOwner());
248 }
249
254 {
255 return $this->originalEvent->getMeetingDescription()
256 ? clone $this->originalEvent->getMeetingDescription()
257 : null;
258 }
259
263 protected function getVersion(): int
264 {
265 return $this->originalEvent->getVersion();
266 }
267
271 protected function getCalendarType(): ?string
272 {
273 return $this->originalEvent->getCalendarType();
274 }
275
279 protected function getSpecialLabel(): ?string
280 {
281 return $this->originalEvent->getSpecialLabel();
282 }
283
287 protected function getUid(): ?string
288 {
289 return $this->originalEvent->getUid();
290 }
291
295 protected function isDeleted(): bool
296 {
297 return $this->originalEvent->isDeleted();
298 }
299
303 protected function isActive(): bool
304 {
305 return $this->originalEvent->isActive();
306 }
307
311 protected function getRecurrenceId(): ?int
312 {
313 return $this->originalEvent->getRecurrenceId();
314 }
315
321 protected function getOriginalDate(): ?Date
322 {
323 return $this->cloneDate($this->originalEvent->getOriginalDateFrom());
324 }
325
331 protected function getDateCreate(): ?Date
332 {
333 return $this->cloneDate($this->originalEvent->getDateCreate());
334 }
335
341 protected function getDateModified(): ?Date
342 {
343 return $this->cloneDate($this->originalEvent->getDateModified());
344 }
345
350 {
351 return clone $this->originalEvent->getExcludedDateCollection();
352 }
353
357 protected function isMeeting(): bool
358 {
359 return $this->originalEvent->isMeeting();
360 }
361
365 protected function getMeetingStatus(): ?string
366 {
367 return $this->originalEvent->getMeetingStatus();
368 }
369
373 protected function getRelations(): ?Relations
374 {
375 return $this->originalEvent->getRelations()
376 ? clone $this->originalEvent->getRelations()
377 : null;
378 }
379
386 private function cloneDate(?Date $date): ?Date
387 {
388 $format = 'YmdHisO';
389 return $date
390 ? Date::createDateTimeFromFormat($date->format($format), $format)
391 : null
392 ;
393 }
394
400 private function cloneRole(?Role $role): ?Role
401 {
402 return $role ?
403 new Role($role->getRoleEntity())
404 : null
405 ;
406 }
407
408 protected function getEventOption(): ?EventOption
409 {
410 return null;
411 }
412
413 protected function getDtLength(): ?int
414 {
415 return null;
416 }
417
418 protected function getCollabId(): ?int
419 {
420 return null;
421 }
422}
__construct(Event $originalEvent)
Определения eventcloner.php:27
Определения date.php:9
format($format)
Определения date.php:110
$result
Определения get_property_values.php:14