• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/integration/im/notification/usecase/taskexpiressoon.php
  • Класс: BitrixTasksIntegrationIMNotificationUseCaseTaskExpiresSoon
  • Вызов: TaskExpiresSoon::createNotification
private function createNotification(string $locKey, Message $message, TaskObject $task): Notification
{
	$title = new NotificationTaskTitle($task);
	$deadline = clone $task->getDeadline();
	$deadline->addSecond(CTimeZone::GetOffset($message->getRecepient()->getId(), true));
	$formattedDeadline = $deadline->format(UI::getHumanTimeFormat($deadline->getTimestamp()));

	$notification = new Notification(
		$locKey,
		$message
	);

	$notification->setParams([
		'NOTIFY_EVENT' => 'task_expired_soon',
	]);

	$notification->addTemplate(
		new NotificationTemplate(
			'#TASK_TITLE#',
			$title->getFormatted($message->getRecepient()->getLang())
		)
	);

	$notification->addTemplate(
		new NotificationTemplate(
			'#DEADLINE_TIME#',
			$formattedDeadline
		)
	);

	return $notification;
}