FilterOption::getNewDateType

  1. Bitrix24 API (v. 23.675.0)
  2. catalog
  3. FilterOption
  4. getNewDateType
  • Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/update/filteroption.php
  • Класс: BitrixCatalogUpdateFilterOption
  • Вызов: FilterOption::getNewDateType
protected function getNewDateType($oldDateType, $oldDateValue)
{
	$newDateType = DateType::EXACT;

	switch ($oldDateType)
	{
		case "day":
			switch ($oldDateValue)
			{
				case "previous":
					$newDateType = DateType::YESTERDAY;
					break;
				case "current":
					$newDateType = DateType::CURRENT_DAY;
					break;
				case "next":
					$newDateType = DateType::TOMORROW;
					break;
			}
			break;
		case "week":
			switch ($oldDateValue)
			{
				case "previous":
					$newDateType = DateType::LAST_WEEK;
					break;
				case "current":
					$newDateType = DateType::CURRENT_WEEK;
					break;
				case "next":
					$newDateType = DateType::NEXT_WEEK;
					break;
			}
			break;
		case "month":
			switch ($oldDateValue)
			{
				case "previous":
					$newDateType = DateType::LAST_MONTH;
					break;
				case "current":
					$newDateType = DateType::CURRENT_MONTH;
					break;
				case "next":
					$newDateType = DateType::NEXT_MONTH;
					break;
			}
			break;
		case "quarter":
			switch ($oldDateValue)
			{
				case "current":
					$newDateType = DateType::CURRENT_QUARTER;
					break;
				case "previous":
				case "next":
					$newDateType = DateType::RANGE;
					break;
			}
			break;
		case "year":
			$newDateType = DateType::RANGE;
			break;
		case "exact":
			$newDateType = DateType::EXACT;
			break;
		case "before":
		case "after":
		case "interval":
			$newDateType = DateType::RANGE;
			break;
	}

	return $newDateType;
}

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