• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/userabsence.php
  • Класс: BitrixIntranetUserAbsence
  • Вызов: UserAbsence::isAbsent
static function isAbsent($userId, bool $returnToDate = false)
{
	$result = self::getCurrentMonth();

	if (isset($result[$userId]))
	{
		$now = new BitrixMainTypeDateTime();
		$nowTs = $now->getTimestamp();

		foreach ($result[$userId] as $vacation)
		{
			if (isset($vacation['IS_VACATION']) && !$vacation['IS_VACATION'])
			{
				continue;
			}

			if ($nowTs >= $vacation['DATE_FROM_TS'] && $nowTs < $vacation['DATE_TO_TS'])
			{
				if ($returnToDate)
				{
					return $vacation;
				}

				return true;
			}
		}
	}

	return false;
}