• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/ui/spotlight.php
  • Класс: BitrixMainUISpotlight
  • Вызов: Spotlight::isAvailable
public function isAvailable($userId = false)
{
	$now = time();

	if (
		($this->getStartDate() && $now < $this->getStartDate()) ||
		($this->getEndDate() && $now > $this->getEndDate())
	)
	{
		return false;
	}

	$userId = $this->getUserId($userId);
	if ($userId < 1)
	{
		return false;
	}

	if ($this->isViewed($userId))
	{
		return false;
	}

	$activationDate = $this->getActivationDate();
	if ($this->getLifetime() && $activationDate + $this->getLifetime() < $now)
	{
		return false;
	}

	$userType = $this->getUserType();
	if ($userType !== static::USER_TYPE_ALL)
	{
		$registerDate = $this->getRegisterDate($userId);
		if ($registerDate === false)
		{
			return false;
		}

		$newUserDate = $activationDate - $this->getUserTimeSpan();
		if ($userType === static::USER_TYPE_OLD && $registerDate > $newUserDate)
		{
			return false;
		}

		if ($userType === static::USER_TYPE_NEW && $registerDate < $newUserDate)
		{
			return false;
		}
	}

	return true;
}