32 $data = $message->getBody();
34 if (empty($data[
'eventId']))
39 $eventId = (int)$data[
'eventId'];
41 $eventArray = EventTable::getList([
44 ->where(
'DELETED',
'N')
45 ->where(
'ID', $eventId)
57 'ID' => $event->getId(),
58 'ATTENDEES' => \CCalendar::GetDestinationUsers($event->getAttendeesCollection()->getAttendeesCodes()),
59 'REMIND' => unserialize($eventArray[
'REMIND'], [
'allowed_classes' =>
false]),
63 $event->getCalendarType() === Core\
Event\Tools\Dictionary::CALENDAR_TYPE[
'group']
64 && Loader::includeModule(
'socialnetwork')
70 if ($event->getRecurringRule())
87 && Loader::includeModule(
'im')
88 && $event->getMeetingDescription()
89 && !empty($event->getMeetingDescription()->getFields()[
'CHAT_ID'])
92 $currentAttendees = $fields[
'ATTENDEES'];
94 $event->getMeetingDescription()->getFields()[
'CHAT_ID'],
95 $fields[
'MEETING_HOST'] ??
null,
96 array_diff($previousAttendees ?? [], $currentAttendees),
100 if (!empty($newHostEventData))
104 \CCalendar::ClearCache();
120 $groupMembers = \Bitrix\Socialnetwork\UserToGroupTable::query()
121 ->setSelect([
'USER_ID',
'ROLE'])
122 ->addFilter(
'GROUP_ID', $event->
getOwner()->getId())
126 foreach ($groupMembers as $groupMember)
130 $eventHostId = (int)$groupMember[
'USER_ID'];
132 if (($groupMember[
'ROLE'] ??
null) === \Bitrix\Socialnetwork\UserToGroupTable::ROLE_OWNER)
134 $groupOwnerId = (int)$groupMember[
'USER_ID'];
138 $isEventHostGroupMember = !empty($eventHostId);
159 $fields[
'ATTENDEES'] = \CCalendar::GetDestinationUsers($fields[
'ATTENDEES_CODES']);
161 if (is_array($fields[
'ATTENDEES']) && !in_array($groupOwnerId, $fields[
'ATTENDEES'],
true))
163 $fields[
'ATTENDEES'][] = $groupOwnerId;
164 $fields[
'ATTENDEES_CODES'] = array_merge([
'U'. $groupOwnerId],$fields[
'ATTENDEES_CODES']);
166 $fields[
'ATTENDEES'] = array_unique($fields[
'ATTENDEES']);
168 $groupOwner = \CUser::GetByID($groupOwnerId)->Fetch();
169 $fields[
'MEETING_HOST'] = $groupOwnerId;
172 $meetingFields[
'HOST_NAME'] = ltrim($groupOwner[
'NAME'] .
' ' . $groupOwner[
'LAST_NAME']);
173 $meetingFields[
'MEETING_CREATOR'] = $groupOwnerId;
175 $fields[
'MEETING'] = $meetingFields;
256 ?
int $newMeetingHostId,
257 array $deletedAttendeesIds
262 $chat = new \CIMChat($newMeetingHostId);
263 if ($newMeetingHostId > 0)
265 $chat->SetOwner($chatId, $newMeetingHostId,
false);
267 foreach ($deletedAttendeesIds as $deletedAttendeeId)
269 $chat->DeleteUser($chatId, $deletedAttendeeId,
false);