• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/ustat/ustat.php
  • Класс: BitrixIntranetUStatUStat
  • Вызов: UStat::checkTodayAbsence
static function checkTodayAbsence($absenceData)
{
	$todayTimestamp = mktime(0, 0, 0);
	$tomorrowTimeStamp = mktime(0, 0, 0, date('n'), date('j')+1);

	foreach ($absenceData as $absence)
	{
		if (
			// today is one of absence day
			($absence['DT_FROM_TS'] < $todayTimestamp && $absence['DT_TO_TS'] >= $tomorrowTimeStamp) ||
			// today
			($absence['DT_FROM_TS'] == $todayTimestamp && $absence['DT_TO_TS'] == $todayTimestamp) ||
			// until this day
			($absence['DT_FROM_TS'] < $todayTimestamp && $absence['DT_TO_TS'] == $todayTimestamp) ||
			// since this day
			($absence['DT_FROM_TS'] == $todayTimestamp && $absence['DT_TO_TS'] >= $tomorrowTimeStamp)
		)
		{
			return true;
		}
	}

	return false;
}