• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Timeline/Item/Activity/SignDocument.php
  • Класс: Bitrix\Crm\Service\Timeline\Item\Activity\SignDocument
  • Вызов: SignDocument::getContentBlocks
public function getContentBlocks(): ?array
{
	$blocks = [];
	if (!\Bitrix\Crm\Activity\Provider\SignDocument::isActive())
	{
		return [(new ContentBlock\Text())->setValue(Loc::getMessage('CRM_TIMELINE_ACTIVITY_SIGN_NOT_EXISTS'))];
	}

	if ($this->getSignDocument())
	{
		$blocks[] = $this->getDocumentBlock();
	}

	$activityData = $this->getAssociatedEntityModel()->toArray();
	$deadLine = $this->getDeadline();

	if (\Bitrix\Crm\Activity\Provider\SignDocument::checkUpdatePermission($activityData))
	{
		$activityDeadLine = (new ContentBlock\EditableDate())
				->setDate($deadLine)
				->setAction(
					(new Layout\Action\JsEvent($this->getType() . ':UpdateActivityDeadline'))
						->addActionParamInt('activityId', $this->getActivityId())
				);
	}
	else
	{
		$activityDeadLine = (new ContentBlock\Text())->setValue($deadLine);
	}

	$blocks['titleAndDeadline'] = (new Layout\Body\ContentBlock\ContentBlockWithTitle())
				->setTitle(Loc::getMessage('CRM_TIMELINE_ACTIVITY_SIGN_DOCUMENT_TITLE_AND_DEADLINE'))
				->setContentBlock($activityDeadLine);

	$document = $this->getDocument();

	if ($document)
	{
		$blocks['updatedAt'] = (new Layout\Body\ContentBlock\ContentBlockWithTitle())
			->setTitle(Loc::getMessage('CRM_TIMELINE_ACTIVITY_SIGN_DOCUMENT_UPDATED_AT'))
			->setContentBlock(
				(new Layout\Body\ContentBlock\Date())
					->setDate(
						$document->getUpdatedTime()
							->toUserTime()
					)
			);
	}

	$blocks['myCompany'] = (new Layout\Body\ContentBlock\ContentBlockWithTitle())
				->setTitle(Loc::getMessage('CRM_TYPE_ITEM_FIELD_MYCOMPANY_ID'))
				->setContentBlock(
					(new Layout\Body\ContentBlock\Text())
						->setValue($this->getMyCompanyCaption())
	);

	if ($document)
	{
		$clientCount = 1;
		/** @var Contact $contact */
		foreach ($document->getContacts() as $contact)
		{
			$blocks['client' . $clientCount] =
				(new Layout\Body\ContentBlock\ContentBlockWithTitle())
					->setTitle(
						Loc::getMessage('CRM_TIMELINE_ACTIVITY_SIGN_DOCUMENT_CONTER_AGENT')
					)
					->setContentBlock(
						(new Layout\Body\ContentBlock\Text())
							->setValue($contact->getFormattedName())
					)
			;

			$clientCount++;
		}
	}

	return $blocks;
}