ActivityDynamic::getList

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. ActivityDynamic
  4. getList
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/widget/data/activity/activitydynamic.php
  • Класс: Bitrix\Crm\Widget\Data\Activity\ActivityDynamic
  • Вызов: ActivityDynamic::getList
public function getList(array $params)
{
	/** @var Filter $filter */
	$filter = isset($params['filter']) ? $params['filter'] : null;
	if(!($filter instanceof Filter))
		throw new Main\ObjectNotFoundException("The 'filter' is not found in params.");

	$source = new ActivityChannelStatistics(array());
	$results = $source->getList(
		array(
			'filter' => $filter,
			'select' => array(array('name' => 'COUNT', 'aggregate' => 'COUNT')),
			'group' => array(
//						ActivityChannelStatistics::GROUP_BY_DATE,
//						ActivityChannelStatistics::GROUP_BY_USER,
				ActivityChannelStatistics::GROUP_BY_CHANNEL,
				ActivityChannelStatistics::GROUP_BY_DIRECTION
			)
		)
	);
	$items = array();
	foreach (self::getChannelData() as $i => $item)
	{
		if (!isset($item["URL"]))
		{
			foreach($item['PARAMS'] as $k => $v)
				$filter->setExtraParam($k, $v);
			$item["URL"] = $source->getDetailsPageUrl(array('filter' => $filter));
		}
		$items[$i] = $item;
	}
	if (\Bitrix\Crm\Integration\Channel\VoxImplantTracker::getInstance()->isEnabled() &&
		\Bitrix\Crm\Integration\Channel\VoxImplantTracker::getInstance()->isInUse())
	{
		$deleteItems = array(
			\Bitrix\Crm\Integration\Channel\ChannelType::VOXIMPLANT_NAME => 0,
			\Bitrix\Crm\Integration\Channel\ChannelType::VOXIMPLANT_NAME.'|'.\CVoxImplantConfig::LINK_BASE_NUMBER => 0);
		foreach ($results as $res)
		{
			if (isset($deleteItems[$res["CHANNEL_ID"]]))
			{
				unset($deleteItems[$res["CHANNEL_ID"]]);
				if (empty($deleteItems))
					break;
			}
		}
		foreach ($deleteItems as $k => $c)
			unset($items[$k]);
	}
	else if (\Bitrix\Crm\Integration\Channel\VoxImplantTracker::getInstance()->isEnabled())
	{
		unset($items[\Bitrix\Crm\Integration\Channel\ChannelType::VOXIMPLANT_NAME]);
	}

	return array(
		array(
			"title" => GetMessage("CRM_ACTIVITY_DYNAMIC_TITLE"),
			"html" => self::parseTemplate(self::getGroups(), $items, ($results?:array())),
		)
	);
}

Добавить комментарий