• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/ui/preview/task.php
  • Класс: BitrixTasksUiPreviewTask
  • Вызов: Task::getImAttach
static function getImAttach(array $params)
{
	if (!Loader::includeModule('im'))
	{
		return false;
	}

	$taskId = (int)$params['taskId'];
	if (!$taskId)
	{
		return false;
	}

	$task = new CTaskItem($taskId, static::getUser()->getId());
	if (!$task)
	{
		return false;
	}

	try
	{
		$select = ['ID', 'TITLE', 'DESCRIPTION', 'CREATED_BY', 'RESPONSIBLE_ID', 'STATUS', 'DEADLINE', 'GROUP_ID'];
		$taskData = $task->getData(false, ['select' => $select], false);
	}
	catch (TasksException $exception)
	{
		return false;
	}

	$taskData['LINK'] = CTaskNotifications::getNotificationPath(
		['ID' => $taskData['RESPONSIBLE_ID']],
		$taskData['ID']
	);

	$attach = new CIMMessageParamAttach(1, '#E30000');
	$attach->AddUser([
		'NAME' => CTextParser::clearAllTags($taskData['TITLE']),
		'LINK' => $taskData['LINK'],
	]);
	$attach->AddDelimiter();
	$attach->AddGrid(static::getImAttachGrid($taskData));

	return $attach;
}