Holiday::getList

  1. Bitrix24 API (v. 23.675.0)
  2. sender
  3. Holiday
  4. getList
  • Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/integration/sender/holiday.php
  • Класс: Bitrix\Sender\Integration\Sender\Holiday
  • Вызов: Holiday::getList
static function getList($languageId = LANGUAGE_ID)
{
	switch ($languageId)
	{
		case 'ru':
			$listLocal = ['feb14', 'feb23', 'mar8', 'halloween', 'new_year'];
			break;

		case 'ua':
			$listLocal = ['feb14', 'day_mar8', 'halloween', 'new_year'];
			break;

		default:
			$listLocal = ['feb14', 'halloween', 'thanks', 'christmas'];
	}

	$list = [];
	foreach ($listLocal as $code)
	{
		if (!isset(self::$list[$code]))
		{
			continue;
		}

		$period = self::$list[$code];
		if (is_array($period[0]))
		{
			$date = null;
			$dateFrom = self::createDate($period[0][0], $period[0][1]);
			$dateTo = self::createDate($period[1][0], $period[1][1]);
		}
		else
		{
			$date = self::createDate($period[0], $period[1]);
			$dateFrom = self::createDate($period[0], $period[1])->add('-5 days');
			$dateTo = self::createDate($period[0], $period[1])->add('+3 days');
		}

		$list[] = new self($code, $date, $dateFrom, $dateTo);
	}

	return $list;
}

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