28 $userId = $this->getContext()->getUserId();
31 $calendarLink->setEntity($calendar)->setChatId($chatId)->setAuthorId($userId);
33 if (isset($messageId))
35 $calendarLink->setMessageId($messageId);
40 if (!$sendMessageResult->isSuccess())
42 $result->addErrors($sendMessageResult->getErrors());
45 $systemMessageId = $sendMessageResult->getResult();
47 $calendarLink->setMessageId($messageId ?: $systemMessageId);
48 $saveResult = $calendarLink->save();
50 if (!$saveResult->isSuccess())
52 return $result->addErrors($saveResult->getErrors());
56 ->setContext($this->context)
57 ->sendFull($calendarLink, self::ADD_CALENDAR_EVENT, [
'RECIPIENT' => $calendar->getMembersIds()])
78 LinkCalendarIndexTable::delete($calendarLink->
getPrimaryId());
79 $saveResult = $calendarLink->
save();
81 if (!$saveResult->isSuccess())
83 return $result->addErrors($saveResult->getErrors());
87 ->setContext($this->context)
88 ->sendFull($calendarLink, self::UPDATE_CALENDAR_EVENT, [
'RECIPIENT' => $calendarLink->
getEntity()->getMembersIds()])
117 if (!Loader::includeModule(
'calendar'))
122 $chat->setContext($this->context);
124 $randomPostfix = mt_rand() & 1000;
125 $data[
'params'][
'sliderId'] =
"im:chat{$chat->getChatId()}{$randomPostfix}";
127 $userIds = $chat->getRelations(
129 'SELECT' => [
'ID',
'USER_ID',
'CHAT_ID'],
130 'FILTER' => [
'ACTIVE' =>
true,
'ONLY_INTERNAL_TYPE' =>
true],
133 )->
getUsers()->filterExtranet()->getIds();
134 $users = array_values(array_map(
static fn($item) => [
'id' => (
int)$item,
'entityId' =>
'user'], $userIds));
135 $data[
'params'][
'participantsEntityList'] = $users;
139 $message->setContext($this->context);
140 $data[
'params'][
'entryDescription'] = \CIMShare::PrepareText([
141 'CHAT_ID' => $chat->getChatId(),
142 'MESSAGE_ID' => $message->getMessageId(),
143 'MESSAGE_TYPE' => $chat->
getType(),
144 'MESSAGE' => $message->getMessage(),
145 'AUTHOR_ID' => $message->getAuthorId(),
146 'FILES' => $this->getFilesForPrepareText($message)
150 return $result->setResult($data);
197 $genderModifier = ($this->getContext()->getUser()->getGender() ===
'F') ?
'_F' :
'';
203 'IM_CHAT_CALENDAR_REGISTER_FROM_MESSAGE_NOTIFICATION' . $genderModifier,
205 '#LINK#' => $calendar->
getEntity()->getUrl(),
206 '#USER_ID#' => $this->getContext()->getUserId(),
215 'IM_CHAT_CALENDAR_REGISTER_FROM_CHAT_NOTIFICATION' . $genderModifier,
217 '#LINK#' => $calendar->
getEntity()->getUrl(),
218 '#USER_ID#' => $this->getContext()->getUserId(),
219 '#EVENT_TITLE#' => $calendar->
getEntity()->getTitle(),