• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integrity/actualranking.php
  • Класс: Bitrix\Crm\Integrity\ActualRanking
  • Вызов: ActualRanking::rank
public function rank($entityTypeId, array $list, $isRankable = true)
{
	$this->clearRuntime();
	$this->entityTypeId = $entityTypeId;
	$this->setRankedList($list);

	if (count($this->list) === 0)
	{
		return $this;
	}

	if ($isRankable)
	{
		// filter or sort by custom modifiers
		$this->runModifiers();

		// filter by active status
		$this->filterByActiveStatus();

		if (count($this->list) === 0)
		{
			return $this;
		}
	}
	else
	{
		$this->entityId = $this->list[0];
		return $this;
	}

	// ranking by dynamics
	$this->rankByDynamics();

	// ranking by deals
	$findDealsOnly = !$this->entityId ? false : true;
	$this->rankByDeals($findDealsOnly);

	// ranking by orders
	$findOrdersOnly = !$this->entityId ? false : true;
	$this->rankByOrders($findOrdersOnly);

	// ranking by repeated leads
	$findLeadsOnly = !$this->entityId ? false : true;
	$this->rankByLeads($findLeadsOnly);

	// other ranking
	// ...

	// default ranking
	if (!$this->entityId)
	{
		$this->rankByDefaults();
	}

	return $this;
}