Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
senderrequestinvitation.php
1
<?php
2
3
4
namespace
Bitrix\Calendar\ICal\MailInvitation
;
5
6
7
use
Bitrix\Calendar\Internals\EventTable
;
8
use
Bitrix\Main\Loader
;
9
use
Bitrix\Main\Localization\Loc
;
10
use
Bitrix\Main\ORM\Data\UpdateResult
;
11
use
Bitrix\Main\Text\Encoding
;
12
use CCalendarEvent;
13
14
class
SenderRequestInvitation
extends
SenderInvitation
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
(),
58
$this->
getEventDateCreateTimestamp
()
59
),
60
'DECISION_YES_LINK'
=>
Helper::getPubEventLinkWithParameters
(
61
$this->
getEventId
(),
62
$this->
getEventOwnerId
(),
63
$this->
getEventDateCreateTimestamp
(),
64
self::DECISION_YES
65
),
66
'DECISION_NO_LINK'
=>
Helper::getPubEventLinkWithParameters
(
67
$this->
getEventId
(),
68
$this->
getEventOwnerId
(),
69
$this->
getEventDateCreateTimestamp
(),
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
{
127
return
Helper::getIcalTemplateRRule
(
128
$rrule,
129
[
130
'DATE_FROM'
=> $this->event[
'DATE_FROM'
],
131
]
132
);
133
}
134
135
return
''
;
136
}
137
}
Bitrix\Calendar\ICal\MailInvitation\AttachmentRequestManager
Definition
attachmentrequestmanager.php:20
Bitrix\Calendar\ICal\MailInvitation\Helper\getUniqId
static getUniqId()
Definition
helper.php:161
Bitrix\Calendar\ICal\MailInvitation\Helper\getDetailLink
static getDetailLink(int $eventId, int $userId, int $dateCreateTimestamp)
Definition
helper.php:335
Bitrix\Calendar\ICal\MailInvitation\Helper\getPubEventLinkWithParameters
static getPubEventLinkWithParameters(int $eventId, int $userId, int $dateCreateTimestamp, string $decision)
Definition
helper.php:347
Bitrix\Calendar\ICal\MailInvitation\Helper\getIcalTemplateRRule
static getIcalTemplateRRule(array $rrule=null, array $params=null)
Definition
helper.php:92
Bitrix\Calendar\ICal\MailInvitation\SenderInvitation
Definition
senderinvitation.php:24
Bitrix\Calendar\ICal\MailInvitation\SenderInvitation\getEventOwnerId
getEventOwnerId()
Definition
senderinvitation.php:305
Bitrix\Calendar\ICal\MailInvitation\SenderInvitation\ATTACHMENT_NAME
const ATTACHMENT_NAME
Definition
senderinvitation.php:31
Bitrix\Calendar\ICal\MailInvitation\SenderInvitation\getSubjectMessage
getSubjectMessage()
Definition
senderinvitation.php:267
Bitrix\Calendar\ICal\MailInvitation\SenderInvitation\CHARSET
const CHARSET
Definition
senderinvitation.php:27
Bitrix\Calendar\ICal\MailInvitation\SenderInvitation\getMessageId
getMessageId()
Definition
senderinvitation.php:275
Bitrix\Calendar\ICal\MailInvitation\SenderInvitation\getBodyMessage
getBodyMessage()
Definition
senderinvitation.php:191
Bitrix\Calendar\ICal\MailInvitation\SenderInvitation\getEventId
getEventId()
Definition
senderinvitation.php:175
Bitrix\Calendar\ICal\MailInvitation\SenderInvitation\CONTENT_TYPE
const CONTENT_TYPE
Definition
senderinvitation.php:28
Bitrix\Calendar\ICal\MailInvitation\SenderInvitation\getEventDateCreateTimestamp
getEventDateCreateTimestamp()
Definition
senderinvitation.php:297
Bitrix\Calendar\ICal\MailInvitation\SenderRequestInvitation
Definition
senderrequestinvitation.php:15
Bitrix\Calendar\ICal\MailInvitation\SenderRequestInvitation\getMessageReplyTo
getMessageReplyTo()
Definition
senderrequestinvitation.php:84
Bitrix\Calendar\ICal\MailInvitation\SenderRequestInvitation\getRRuleString
getRRuleString()
Definition
senderrequestinvitation.php:122
Bitrix\Calendar\ICal\MailInvitation\SenderRequestInvitation\getContent
getContent()
Definition
senderrequestinvitation.php:22
Bitrix\Calendar\ICal\MailInvitation\SenderRequestInvitation\getSubjectTitle
getSubjectTitle()
Definition
senderrequestinvitation.php:92
Bitrix\Calendar\ICal\MailInvitation\SenderRequestInvitation\METHOD
const METHOD
Definition
senderrequestinvitation.php:16
Bitrix\Calendar\ICal\MailInvitation\SenderRequestInvitation\getMailEventField
getMailEventField()
Definition
senderrequestinvitation.php:41
Bitrix\Calendar\ICal\MailInvitation\SenderRequestInvitation\executeAfterSuccessfulInvitation
executeAfterSuccessfulInvitation()
Definition
senderrequestinvitation.php:106
Bitrix\Calendar\Internals\EventTable
Definition
event.php:27
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Data\UpdateResult
Definition
updateresult.php:14
Bitrix\Main\Text\Encoding
Definition
encoding.php:8
Bitrix\Calendar\ICal\MailInvitation
Definition
attachmentcancelmanager.php:4
modules
calendar
lib
ical
mailinvitation
senderrequestinvitation.php
Создано системой
1.10.0