• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/tracking/provider.php
  • Класс: Bitrix\Crm\Tracking\Provider
  • Вызов: Provider::getChannels
static function getChannels()
{
	$list = [
		[
			'CODE' => Channel\Base::Site24,
			'ICON_CLASS' => 'ui-icon ui-icon-service-site-b24',
			'CONFIGURED' => true,
			'CONFIGURABLE' => false,
		],
		[
			'CODE' => Channel\Base::Shop24,
			'ICON_CLASS' => 'ui-icon ui-icon-service-estore',
			'CONFIGURED' => true,
			'CONFIGURABLE' => false,
		],
		[
			'CODE' => Channel\Base::CrmShop,
			'ICON_CLASS' => 'ui-icon crm-tracking-ui-tile-crm-shop',
			'CONFIGURED' => true,
			'CONFIGURABLE' => true,
		],
		[
			'CODE' => Channel\Base::Site,
			'ICON_CLASS' => 'ui-icon ui-icon-service-site',
			'CONFIGURABLE' => true,
			'CONFIGURED' => !empty(self::getReadySites()),
		],
		[
			'CODE' => Channel\Base::Call,
			'ICON_CLASS' => 'ui-icon ui-icon-service-calltracking',
			'CONFIGURED' => self::hasSourcesWithFilledPool(Communication\Type::PHONE),
			'CONFIGURABLE' => true,
		],
		[
			'CODE' => Channel\Base::Mail,
			'ICON_CLASS' => 'ui-icon ui-icon-service-envelope',
			'CONFIGURED' => self::hasSourcesWithFilledPool(Communication\Type::EMAIL),
			'CONFIGURABLE' => true,
		],
		[
			'CODE' => Channel\Base::Order,
			'ICON_CLASS' => 'ui-icon ui-icon-service-estore',
			'CONFIGURED' => Channel\Order::isConfiguredRemote(),
			'CONFIGURABLE' => true,
		],
	];

	foreach ($list as $index => $item)
	{
		$channel = Channel\Factory::create($item['CODE']);
		$item['NAME'] = $channel->getGridName();
		$item['SHORT_NAME'] = $channel->getName();
		$item['ITEMS'] = $channel->getItems();
		$list[$index] = $item;
	}

	if (!Loader::includeModule('intranet'))
	{
		return $list;
	}

	$existedCodes = array_column($list, 'CODE');
	$contactCenter = new Intranet\ContactCenter();
	$itemList = $contactCenter->getItems([
		'MODULES' => ['imopenlines', 'crm'],
		'ACTIVE' => 'Y', 'IS_LOAD_INNER_ITEMS' => 'N',
	]);
	foreach ($itemList as $moduleId => $items)
	{
		foreach ($items as $itemId => $item)
		{
			if (in_array($itemId, ['calltracking', 'crm_shop', 'baseconnector']))
			{
				continue;
			}

			$itemId = $itemId === 'widget' ? Channel\Base::Button : $itemId;
			if (!$item['SELECTED'] || in_array($itemId, $existedCodes))
			{
				continue;
			}
			$list[] = [
				'CODE' => $itemId,
				'NAME' => $item['NAME'],
				'SHORT_NAME' => $item['NAME'],
				'ITEMS' => [],
				'ICON_CLASS' => $item['LOGO_CLASS'],
				'CONFIGURED' => true,
				'CONFIGURABLE' => false,
			];
		}
	}

	return $list;
}