3namespace Bitrix\Calendar\ICal\MailInvitation;
5use Bitrix\Calendar\Core;
6use Bitrix\Calendar\Public;
7use Bitrix\Calendar\Sharing;
8use Bitrix\Calendar\SerializeObject;
9use Bitrix\Calendar\Util;
10use Bitrix\Main\ArgumentException;
11use Bitrix\Main\LoaderException;
12use Bitrix\Main\Mail\Event;
13use Bitrix\Main\NotImplementedException;
14use Bitrix\Main\ObjectPropertyException;
15use Bitrix\Main\SystemException;
16use Bitrix\Main\Type\DateTime;
48 protected ?
string $uid =
'';
62 $this->
event = $event;
75 $this->
event = $event;
88 public function send(): bool
90 if ($this->event ===
null || $this->context ===
null)
106 $status = CEvent::sendImmediate(
117 return $status === Event::SEND_RESULT_SUCCESS;
123 "=Reply-To" =>
"{$this->getAddresser()->getFullName()} <{$this->getAddresser()->getEmail()}>",
124 "=From" =>
"{$this->getAddresser()->getFullName()} <{$this->getAddresser()->getEmail()}>",
134 private function getBaseTemplateParams():
array
143 'EVENT_NAME' => $this->
event[
'NAME'],
144 'DATE_FROM' => $this->
event[
'DATE_FROM'],
145 'DATE_TO' => $this->
event[
'DATE_TO'],
146 'IS_FULL_DAY' => $this->
event[
'DT_SKIP_TIME'] ===
'Y',
147 'TZ_FROM' => $this->
event[
'TZ_FROM'],
148 'TZ_TO' => $this->
event[
'TZ_TO'],
149 'AVATARS' => $this->
event[
'AVATARS'],
150 'OWNER_STATUS' => $this->
event[
'OWNER_STATUS'],
153 'DETAIL_LINK' => $detailLink,
171 $rrule = \CCalendarEvent::ParseRRULE($this->event[
'RRULE']);
172 if (is_array($rrule))
174 return Helper::getIcalTemplateRRule(
177 'DATE_FROM' => $this->event[
'DATE_FROM'],
190 return static::METHOD;
198 return $this->
event ?? [];
206 $this->counterInvitations++;
230 return $this->context->getAddresser();
238 return $this->context->getReceiver();
246 return $this->
event[
'ID'] ??
null;
254 return (
int) ($this->
event[
'PARENT_ID'] ?? 0);
263 return 'ical body message';
271 if (!empty($siteName = \COption::GetOptionString(
"main",
"site_name",
'',
'-')))
273 return "[{$siteName}]";
292 $serverName = \COption::GetOptionString(
"main",
"server_name",
$GLOBALS[
"SERVER_NAME"]);
294 return "<CALENDAR_EVENT_{$this->getEventParentId()}@{$serverName}>";
310 return (
int) $this->
event[
'OWNER_ID'];
313 private function getFormattedDate(DateTime $formattedDate,
string $dtSkipTime): string
315 $timestamp = \CCalendar::Timestamp($formattedDate,
false, $dtSkipTime !==
'Y');
317 return \CCalendar::Date($timestamp);
330 $dtSkipTime = $this->
event[
'DT_SKIP_TIME'];
331 $this->
event[
'DATE_FROM'] = $this->getFormattedDate($this->event[
'DATE_FROM'], $dtSkipTime);
332 $this->
event[
'DATE_TO'] = $this->getFormattedDate($this->event[
'DATE_TO'], $dtSkipTime);
333 $this->
event[
'DATE_CREATE'] = $this->
event[
'DATE_CREATE']->toString();
334 $this->
event[
'TIMESTAMP_X'] = $this->
event[
'TIMESTAMP_X']->toString();
336 $this->
event[
'MEETING'] = unserialize($this->event[
'MEETING'], [
'allowed_classes' =>
false]);
337 $this->
event[
'REMIND'] = unserialize($this->event[
'REMIND'], [
'allowed_classes' =>
false]);
338 $this->
event[
'RRULE'] = \CCalendarEvent::ParseRRULE($this->event[
'RRULE']);
339 $this->
event[
'ATTENDEES_CODES'] = !empty($this->event[
'ATTENDEES_CODES']) && is_string($this->event[
'ATTENDEES_CODES'])
340 ? explode(
',', $this->event[
'ATTENDEES_CODES'])
343 $this->
event[
'ICAL_ORGANIZER'] = Helper::getAttendee($this->event[
'MEETING_HOST'], $this->event[
'PARENT_ID'],
false);
344 $this->
event[
'ICAL_ATTACHES'] = Helper::getMailAttaches(
346 $this->event[
'MEETING_HOST'],
347 $this->event[
'PARENT_ID']
353 $attendees = \CCalendarEvent::GetAttendees([$this->event[
'PARENT_ID']],
false)[$this->
event[
'PARENT_ID']] ?? [];
355 $ownerId = (int)$this->event[
'OWNER_ID'];
356 $owner = current(array_filter(
358 static fn($attendee) => (
int)$attendee[
'USER_ID'] === $ownerId,
361 $this->
event[
'OWNER_STATUS'] = $owner[
'STATUS'];
363 $this->
event[
'AVATARS'] = [];
364 if (!$this->event[
'MEETING'][
'HIDE_GUESTS'])
366 usort($attendees,
static fn(
$a, $b) => ((
int)$b[
'USER_ID'] === $ownerId) - ((
int)
$a[
'USER_ID'] === $ownerId));
367 foreach ($attendees as $attendee)
369 $this->
event[
'AVATARS'][] = $attendee[
'AVATAR'];
371 $this->
event[
'ICAL_ATTENDEES'] = Helper::getAttendeesByEventParentId($this->event[
'PARENT_ID']);
static createInstance(array $event, Context $context)
setCounterInvitations(?int $counterInvitations)
incrementCounterInvitations()
__construct(array $event, Context $context)
getEventDateCreateTimestamp()
executeAfterSuccessfulInvitation()
static getDetailLink(int $eventId, int $userId, int $dateCreateTimestamp)
static prepareEventDescriptionForIcs(Event $event)
static getTimestamp($date, $round=true, $getTime=true)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$GLOBALS['____1690880296']
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']