• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Link/Reminder/ReminderService.php
  • Класс: BitrixImV2LinkReminderReminderService
  • Вызов: ReminderService::sendNotifyAboutReminder
protected function sendNotifyAboutReminder(ReminderItem $reminder): Result
{
	$result = new Result();

	$attach = new CIMMessageParamAttach();

	$user = $reminder->getEntity()->getAuthor();

	if ($user !== null)
	{
		$attach->AddUser([
			'NAME' => $user->getFullName(),
			'AVATAR' => $user->getAvatar(),
		]);
	}

	$attach->AddMessage($reminder->getEntity()->getPreviewMessage());

	$notifyParams = [
		'TO_USER_ID' => $reminder->getAuthorId(),
		'FROM_USER_ID' => 0,
		'NOTIFY_TYPE' => IM_NOTIFY_SYSTEM,
		'NOTIFY_MODULE' => 'im',
		'NOTIFY_SUB_TAG' => $this->getSubTag($reminder),
		'NOTIFY_MESSAGE' => $this->getNotifyMessageText($reminder, false),
		'NOTIFY_MESSAGE_OUT' => $this->getNotifyMessageText($reminder, true),
		'ATTACH' => $attach
	];

	$notifyId = CIMNotify::Add($notifyParams);

	if ($notifyId === false)
	{
		return $result->addError(new ReminderError(ReminderError::REMINDER_NOTIFY_ADD_ERROR));
	}

	return $result;
}