1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
outcomingattachmentmanager.php
См. документацию.
1<?php
2
3
4namespace Bitrix\Calendar\ICal;
5
6
7use Bitrix\Calendar\ICal\Basic\{AttachmentManager, Dictionary};
8use Bitrix\Mail\User;
9use Bitrix\Main\Loader;
10use Bitrix\Main\Localization\Loc;
11use Bitrix\Calendar\ICal\Builder\
12{
15 Event,
18 Timezone};
19use Bitrix\Calendar\Util;
20
22{
23 private ?array $event;
24 private ?AttendeesCollection $attendees;
25 private ?string $attachment = '';
26 private ?string $method;
27 private ?string $uid = '';
28
29 public function __construct($data, $attendees, $method)
30 {
31 $this->event = $data;
32 $this->attendees = $attendees;
33 $this->method = $method;
34 }
35
37 {
38 $requestEvent = $this->prepareRequestEvent();
39 $this->uid = $requestEvent['DAV_XML_ID'];
40
41 $event = Event::create($requestEvent, EventFactoryInterface::REQUEST)
42 ->setAttendees($this->attendees)
43 ->setOrganizer($this->attendees[$requestEvent['MEETING_HOST']], $this->getReplyAddress());
44
45 $this->attachment = Calendar::createInstance()
46 ->setMethod(Dictionary::METHODS[$this->method])
47 ->setTimezones(Timezone::createInstance()
48 ->setTimezoneId($requestEvent['TZ_FROM'])
49 ->setObservance(StandardObservances::createInstance()
50 ->setOffsetFrom($requestEvent['TZ_FROM'])
51 ->setOffsetTo($requestEvent['TZ_TO'])
52 ->setDTStart()
53 )
54 )
55 ->addEvent($event)
56 ->get();
57
58 return $this;
59 }
60
62 {
63 $this->uid = $this->event['DAV_XML_ID'];
64
65 $event = Event::create($this->event, EventFactoryInterface::REPLY)
66 ->setAttendees($this->attendees);
67
68 $this->attachment = Calendar::createInstance()
69 ->setMethod(Dictionary::METHODS[$this->method])
70 ->addEvent($event)
71 ->get();
72
73 return $this;
74 }
75
77 {
78 $event = Event::create($this->event, EventFactoryInterface::CANCEL)
79 ->setAttendees($this->attendees)
80 ->setOrganizer($this->attendees[$this->event['MEETING_HOST']], $this->getReplyAddress());
81
82 $this->attachment = Calendar::createInstance()
83 ->setMethod(Dictionary::METHODS[$this->method])
84 ->addEvent($event)
85 ->get();
86
87 return $this;
88 }
89
90 public function getAttachment(): string
91 {
92 return $this->attachment;
93 }
94
95 public function getUid(): ?string
96 {
97 return $this->uid;
98 }
99
100 private function getReplyAddress(): string
101 {
102 if (Loader::includeModule('mail'))
103 {
104 [$replyTo, $backUrl] = User::getReplyTo(
105 SITE_ID,
106 $this->event['OWNER_ID'],
107 'ICAL_INVENT',
108 $this->event['PARENT_ID'],
109 SITE_ID
110 );
111 }
112
113 return $replyTo;
114 }
115
116 private function prepareRequestEvent(): array
117 {
119
120 if (!empty($event['ATTACHES']))
121 {
122 $filesDesc = [];
123 foreach ($event['ATTACHES'] as $attach)
124 {
125 $filesDesc[] = $attach['name'] . ' (' . $attach['link'] . ')';
126 }
127
128 if (!empty($event['DESCRIPTION']))
129 {
130 $event['DESCRIPTION'] .= "\r\n";
131 }
132 $event['DESCRIPTION'] .= Loc::getMessage('EC_FILES_TITLE') . ': ' . implode(', ', $filesDesc);
133 }
134
135 return $event;
136 }
137}
static createInstance(string $name=null)
Определения calendar.php:27
__construct($data, $attendees, $method)
Определения outcomingattachmentmanager.php:29
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$uid
Определения hot_keys_act.php:8
if($request->getPost('Update') !==null) elseif( $request->getPost( 'Apply') !==null) elseif($request->getPost('RestoreDefaults') !==null) $backUrl
Определения options.php:66
$event
Определения prolog_after.php:141
const SITE_ID
Определения sonet_set_content_view.php:12