Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
sendereditinvitation.php
1
<?php
2
3
4
namespace
Bitrix\Calendar\ICal\MailInvitation
;
5
6
use
Bitrix\Main\Loader
;
7
use
Bitrix\Main\Localization\Loc
;
8
use
Bitrix\Main\ObjectException
;
9
use
Bitrix\Main\Text\Encoding
;
10
11
class
SenderEditInvitation
extends
SenderInvitation
12
{
13
public
const
METHOD
=
'edit'
;
14
public
const
DECISION_CHANGE
=
'C'
;
18
private
$changeFields;
19
20
24
public
function
executeAfterSuccessfulInvitation
(): void
25
{
26
}
27
32
protected
function
getContent
(): array
33
{
34
$attachmentManager =
new
AttachmentEditManager
($this->event);
35
$this->uid = $attachmentManager->getUid();
36
37
if
(!$this->uid)
38
{
39
return
[];
40
}
41
42
return
[[
43
'CONTENT'
=> Encoding::convertEncoding($attachmentManager->getContent(), SITE_CHARSET,
"utf-8"
),
44
'CONTENT_TYPE'
=>
self::CONTENT_TYPE
,
45
'METHOD'
=> mb_strtolower(self::METHOD),
46
'CHARSET'
=>
self::CHARSET
,
47
'NAME'
=>
self::ATTACHMENT_NAME
,
48
'ID'
=>
Helper::getUniqId
(),
49
]];
50
}
51
56
protected
function
getMailEventField
(): array
57
{
58
return
[
59
"=Reply-To"
=>
"{$this->context->getAddresser()->getFullName()} <{$this->context->getAddresser()->getEmail()}>"
,
60
"=From"
=>
"{$this->context->getAddresser()->getFullName()} <{$this->context->getAddresser()->getEmail()}>"
,
61
"=Message-Id"
=> $this->
getMessageId
(),
62
"=In-Reply-To"
=> $this->
getMessageReplyTo
(),
63
'EMAIL_FROM'
=> $this->context->getAddresser()->getEmail(),
64
'EMAIL_TO'
=> $this->context->getReceiver()->getEmail(),
65
'MESSAGE_SUBJECT'
=> $this->
getSubjectMessage
(),
66
'MESSAGE_PHP'
=> $this->
getBodyMessage
(),
67
'CONFIRM_CODE'
=>
'TRUE'
,
68
'NAME'
=> $this->
event
[
'NAME'
],
69
'METHOD'
=>
self::METHOD
,
70
'CHANGE_FIELDS_TITLE'
=> $this->
getChangeFieldsTitle
(),
71
'DETAIL_LINK'
=>
Helper::getDetailLink
(
72
$this->
getEventId
(),
73
$this->
getEventOwnerId
(),
74
$this->
getEventDateCreateTimestamp
()
75
),
76
'DECISION_YES_LINK'
=>
Helper::getPubEventLinkWithParameters
(
77
$this->
getEventId
(),
78
$this->
getEventOwnerId
(),
79
$this->
getEventDateCreateTimestamp
(),
80
self::DECISION_YES
81
),
82
'DECISION_NO_LINK'
=>
Helper::getPubEventLinkWithParameters
(
83
$this->
getEventId
(),
84
$this->
getEventOwnerId
(),
85
$this->
getEventDateCreateTimestamp
(),
86
self::DECISION_NO
87
),
88
'CHANGE_DECISION_LINK'
=>
Helper::getPubEventLinkWithParameters
(
89
$this->
getEventId
(),
90
$this->
getEventOwnerId
(),
91
$this->
getEventDateCreateTimestamp
(),
92
self::DECISION_CHANGE
93
),
94
'REQUEST_DECISION'
=> $this->
event
[
'MEETING'
][
'REINVITE'
] ?
'Y'
:
'N'
,
95
'DATE_FROM'
=> $this->
event
[
'DATE_FROM'
],
96
'DATE_TO'
=> $this->
event
[
'DATE_TO'
],
97
'TZ_FROM'
=> $this->
event
[
'TZ_FROM'
],
98
'TZ_TO'
=> $this->
event
[
'TZ_TO'
],
99
'FULL_DAY'
=> $this->
event
[
'SKIP_TIME'
] ?
'Y'
:
'N'
,
100
'CHANGE_FIELDS'
=> $this->
getChangeFieldsString
(),
101
];
102
}
103
107
protected
function
getMessageReplyTo
(): string
108
{
109
return
$this->
getMessageId
();
110
}
111
115
protected
function
getChangeFieldsTitle
(): string
116
{
117
$fields = $this->context->getChangeFields();
118
if
(count($fields) === 1)
119
{
120
switch
($fields[0][
'fieldKey'
])
121
{
122
case
'DATE_FROM'
:
123
return
Loc::getMessage
(
'EC_CALENDAR_ICAL_MAIL_CHANGE_FIELD_TITLE_DATE'
);
124
case
'LOCATION'
:
125
return
Loc::getMessage
(
'EC_CALENDAR_ICAL_MAIL_CHANGE_FIELD_TITLE_LOCATION'
);
126
case
'ATTENDEES'
:
127
return
Loc::getMessage
(
'EC_CALENDAR_ICAL_MAIL_CHANGE_FIELD_TITLE_ATTENDEES'
);
128
case
'RRULE'
:
129
return
Loc::getMessage
(
'EC_CALENDAR_ICAL_MAIL_CHANGE_FIELD_TITLE_RRULE'
);
130
case
'NAME'
:
131
return
Loc::getMessage
(
'EC_CALENDAR_ICAL_MAIL_CHANGE_FIELD_TITLE_NAME'
);
132
default
:
133
return
Loc::getMessage
(
'EC_CALENDAR_ICAL_MAIL_METHOD_EDIT'
);
134
}
135
}
136
137
return
Loc::getMessage
(
'EC_CALENDAR_ICAL_MAIL_METHOD_EDIT'
);
138
}
139
143
protected
function
getSubjectTitle
(): string
144
{
145
if
(Loader::includeModule(
'bitrix24'
) && \CBitrix24::isFreeLicense())
146
{
147
return
Loc::getMessage
(
"EC_CALENDAR_ICAL_MAIL_METHOD_EDIT"
);
148
}
149
150
return
Loc::getMessage
(
"EC_CALENDAR_ICAL_MAIL_METHOD_EDIT"
) .
": {$this->event['NAME']}"
;
151
}
152
153
protected
function
getChangeFieldsString
(): string
154
{
155
$res = [];
156
if
(count($this->context->getChangeFields()) > 0)
157
{
158
foreach
($this->context->getChangeFields() as $changeField)
159
{
160
$res[] = $changeField[
'fieldKey'
];
161
}
162
}
163
return
implode(
';'
, $res);
164
}
165
}
Bitrix\Calendar\ICal\MailInvitation\AttachmentEditManager
Definition
attachmenteditmanager.php:21
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\SenderEditInvitation
Definition
sendereditinvitation.php:12
Bitrix\Calendar\ICal\MailInvitation\SenderEditInvitation\getMessageReplyTo
getMessageReplyTo()
Definition
sendereditinvitation.php:107
Bitrix\Calendar\ICal\MailInvitation\SenderEditInvitation\getChangeFieldsTitle
getChangeFieldsTitle()
Definition
sendereditinvitation.php:115
Bitrix\Calendar\ICal\MailInvitation\SenderEditInvitation\DECISION_CHANGE
const DECISION_CHANGE
Definition
sendereditinvitation.php:14
Bitrix\Calendar\ICal\MailInvitation\SenderEditInvitation\getContent
getContent()
Definition
sendereditinvitation.php:32
Bitrix\Calendar\ICal\MailInvitation\SenderEditInvitation\getChangeFieldsString
getChangeFieldsString()
Definition
sendereditinvitation.php:153
Bitrix\Calendar\ICal\MailInvitation\SenderEditInvitation\getSubjectTitle
getSubjectTitle()
Definition
sendereditinvitation.php:143
Bitrix\Calendar\ICal\MailInvitation\SenderEditInvitation\METHOD
const METHOD
Definition
sendereditinvitation.php:13
Bitrix\Calendar\ICal\MailInvitation\SenderEditInvitation\getMailEventField
getMailEventField()
Definition
sendereditinvitation.php:56
Bitrix\Calendar\ICal\MailInvitation\SenderEditInvitation\executeAfterSuccessfulInvitation
executeAfterSuccessfulInvitation()
Definition
sendereditinvitation.php:24
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\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\ObjectException
Definition
exception.php:192
Bitrix\Main\Text\Encoding
Definition
encoding.php:8
Bitrix\Calendar\ICal\MailInvitation
Definition
attachmentcancelmanager.php:4
modules
calendar
lib
ical
mailinvitation
sendereditinvitation.php
Создано системой
1.10.0