• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Timeline/Item/Activity/Tasks/Comment.php
  • Класс: Bitrix\Crm\Service\Timeline\Item\Activity\Tasks\Comment
  • Вызов: Comment::getUpdatedBlock
public function getUpdatedBlock(AssociatedEntityModel $model, \Bitrix\Tasks\Internals\TaskObject $task)
{
	$data = $model->get('SETTINGS');
	$responsibleId = $model->get('RESPONSIBLE_ID');
	$lastCommentDate = $data['LAST_COMMENT_DATE'] ?? time();
	$unreadCommentsCount = TaskCounter::getCommentsCount($task->getId(), $responsibleId);

	$unreadCommentsCountBlock = new Text();
	$unreadCommentsCountBlock->setValue($unreadCommentsCount);

	$lastCommentDateBlock = new Date();
	$lastCommentDateBlock->setDate(DateTime::createFromTimestamp($lastCommentDate));

	$contentBlock = ContentBlockFactory::createLineOfTextFromTemplate($this->getTemplate($unreadCommentsCount), [
			'#COMMENT_COUNT#' => $unreadCommentsCountBlock,
			'#DATE_TIME#' => $lastCommentDateBlock,
		]
	);

	$updatedBlockObject = new ContentBlockWithTitle();
	$updatedBlockObject
		->setInline()
		->setTitle(Loc::getMessage('TASKS_TASK_COMMENT_DEAL_UPDATED'))
		->setContentBlock($contentBlock)
	;

	return $updatedBlockObject;
}