Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
range.php
1<?php
2
3namespace Bitrix\Main\Filter;
4
5use \Bitrix\Main\UI\Filter\NumberType;
6
7class Range
8{
9 public static function prepareFrom(array &$filter, $name, $value)
10 {
11 if($value !== '')
12 {
13 $typeKey = "{$name}_numsel";
14 $operation = '>=';
15 if(isset($filter[$typeKey]))
16 {
17 if($filter[$typeKey] === NumberType::MORE)
18 {
19 $operation = '>';
20 }
21 unset($filter[$typeKey]);
22 }
23 $filter["$operation{$name}"] = $value;
24 }
25 unset($filter["{$name}_from"]);
26 }
27
28 public static function prepareTo(array &$filter, $name, $value)
29 {
30 if($value !== '')
31 {
32 $typeKey = "{$name}_numsel";
33 $operation = '<=';
34 if(isset($filter[$typeKey]))
35 {
36 if($filter[$typeKey] === NumberType::LESS)
37 {
38 $operation = '<';
39 }
40 unset($filter[$typeKey]);
41 }
42 $filter["$operation{$name}"] = $value;
43 }
44 unset($filter["{$name}_to"]);
45 }
46}
static prepareTo(array &$filter, $name, $value)
Definition range.php:28
static prepareFrom(array &$filter, $name, $value)
Definition range.php:9