• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/controller/controlbutton.php
  • Класс: BitrixIntranetControllerControlButton
  • Вызов: ControlButton::getVideoCallChatAction
public function getVideoCallChatAction($entityType, $entityId, $entityData = [])
{
	if (!$entityType || !$entityId)
	{
		$this->addError(new Error(Loc::getMessage('INTRANET_CONTROL_BUTTON_ENTITY_ERROR')));
		return null;
	}

	if (!Loader::includeModule('im'))
	{
		$this->addError(new Error(Loc::getMessage('INTRANET_CONTROL_BUTTON_IM_ERROR'), 'create_chat_error'));
		return null;
	}

	$userCount = 0;

	if ($entityType === 'task')
	{
		$taskData = $this->getTaskData($entityId);
		$userCount = count($taskData['USER_IDS']);
	}
	elseif ($entityType === 'calendar_event')
	{
		$calendarData = $this->getCalendarData($entityId, $entityData);
		$userCount = count($calendarData['USER_IDS']);
	}
	elseif ($entityType === 'workgroup' && Loader::includeModule('socialnetwork'))
	{
		$userCount = Workgroup::getNumberOfMembers($entityId);
	}

	if ($userCount > BitrixImCallCall::getMaxParticipants())
	{
		$this->addError(new Error(Loc::getMessage('INTRANET_CONTROL_BUTTON_VIDEOCALL_LIMIT')));
		return null;
	}

	if ($userCount === 1)
	{
		$this->addError(new Error(Loc::getMessage('INTRANET_CONTROL_BUTTON_VIDEOCALL_SELF_ERROR')));
		return null;
	}

	return $this->getChatAction($entityType, $entityId);
}