Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
senderrequestinvitation.php
1<?php
2
3
5
6
12use CCalendarEvent;
13
15{
16 public const METHOD = 'request';
17
22 protected function getContent(): array
23 {
24 $attachmentManager = new AttachmentRequestManager($this->event);
25 $this->uid = $attachmentManager->getUid();
26
27 return [[
28 'CONTENT' => Encoding::convertEncoding($attachmentManager->getContent(), SITE_CHARSET, "utf-8"),
29 'CONTENT_TYPE' => self::CONTENT_TYPE,
30 'METHOD' => mb_strtolower(self::METHOD),
31 'CHARSET' => self::CHARSET,
32 'NAME' => self::ATTACHMENT_NAME,
33 'ID' => Helper::getUniqId(),
34 ]];
35 }
36
41 protected function getMailEventField(): array
42 {
43 return [
44 "=Reply-To" => "{$this->context->getAddresser()->getFullName()} <{$this->context->getAddresser()->getEmail()}>",
45 "=From" => "{$this->context->getAddresser()->getFullName()} <{$this->context->getAddresser()->getEmail()}>",
46 "=Message-Id" => $this->getMessageId(),
47 "=In-Reply-To" => $this->getMessageReplyTo(),
48 'EMAIL_FROM' => $this->context->getAddresser()->getEmail(),
49 'EMAIL_TO' => $this->context->getReceiver()->getEmail(),
50 'MESSAGE_SUBJECT' => $this->getSubjectMessage(),
51 'MESSAGE_PHP' => $this->getBodyMessage(),
52 'CONFIRM_CODE' => 'TRUE',
53 'NAME' => $this->event['NAME'],
54 'METHOD' => self::METHOD,
55 'DETAIL_LINK' => Helper::getDetailLink(
56 $this->getEventId(),
57 $this->getEventOwnerId(),
59 ),
60 'DECISION_YES_LINK' => Helper::getPubEventLinkWithParameters(
61 $this->getEventId(),
62 $this->getEventOwnerId(),
64 self::DECISION_YES
65 ),
66 'DECISION_NO_LINK' => Helper::getPubEventLinkWithParameters(
67 $this->getEventId(),
68 $this->getEventOwnerId(),
70 self::DECISION_NO
71 ),
72 'DATE_FROM' => $this->event['DATE_FROM'],
73 'DATE_TO' => $this->event['DATE_TO'],
74 'TZ_FROM' => $this->event['TZ_FROM'],
75 'TZ_TO' => $this->event['TZ_TO'],
76 'FULL_DAY' => $this->event['SKIP_TIME'] ? 'Y' : 'N',
77 'RRULE' => $this->getRRuleString()
78 ];
79 }
80
84 protected function getMessageReplyTo(): string
85 {
86 return $this->getMessageId();
87 }
88
92 protected function getSubjectTitle(): string
93 {
94 if (Loader::includeModule('bitrix24') && \CBitrix24::isFreeLicense())
95 {
96 return Loc::getMessage("EC_CALENDAR_ICAL_MAIL_METHOD_REQUEST");
97 }
98
99 return Loc::getMessage("EC_CALENDAR_ICAL_MAIL_METHOD_REQUEST") . ": {$this->event['NAME']}";
100 }
101
106 public function executeAfterSuccessfulInvitation(): bool
107 {
108 $result = EventTable::update(
109 $this->getEventId(),
110 [
111 'DAV_XML_ID' => $this->getUId(),
112// 'MEETING_STATUS' => 'Q',
113 ]
114 );
115
116 return ($result instanceof UpdateResult) && $result->isSuccess();
117 }
118
122 protected function getRRuleString(): string
123 {
124 $rrule = CCalendarEvent::ParseRRULE($this->event['RRULE']);
125 if (is_array($rrule))
126 {
128 $rrule,
129 [
130 'DATE_FROM' => $this->event['DATE_FROM'],
131 ]
132 );
133 }
134
135 return '';
136 }
137}
static getDetailLink(int $eventId, int $userId, int $dateCreateTimestamp)
Definition helper.php:335
static getPubEventLinkWithParameters(int $eventId, int $userId, int $dateCreateTimestamp, string $decision)
Definition helper.php:347
static getIcalTemplateRRule(array $rrule=null, array $params=null)
Definition helper.php:92
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29