1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
filter.php
См. документацию.
1
<?php
8
namespace
Bitrix\Sender\Stat
;
9
10
use
Bitrix\Main\ArgumentException
;
11
use
Bitrix\Main\Type\DateTime
;
12
13
class
Filter
14
{
15
CONST
PERIOD_WEEK
= 7;
16
CONST
PERIOD_MONTH
= 30;
17
CONST
PERIOD_MONTH_3
= 90;
18
CONST
PERIOD_MONTH_6
= 180;
19
CONST
PERIOD_MONTH_12
= 365;
20
21
protected
$values
=
array
(
22
'authorId'
=>
null
,
23
'chainId'
=>
null
,
24
'mailingId'
=>
null
,
25
'postingId'
=>
null
,
26
'periodFrom'
=>
null
,
27
'periodTo'
=>
null
,
28
'period'
=>
null
29
);
30
31
public
function
__construct
(
array
$values
=
array
())
32
{
33
foreach
(
$values
as
$name
=> $value)
34
{
35
$this->
set
(
$name
, $value);
36
}
37
}
38
39
public
function
set
(
$name
, $value =
null
)
40
{
41
if
(!array_key_exists(
$name
, $this->values))
42
{
43
throw
new
ArgumentException
(
"Unknown filter \"$name\""
);
44
}
45
46
if
($value ===
'all'
)
47
{
48
$value =
null
;
49
}
50
51
if
(
$name
==
'period'
)
52
{
53
$this->
setPeriod
($value);
54
}
55
56
$this->values[
$name
] = $value;
57
}
58
59
public
function
get
(
$name
)
60
{
61
if
(!array_key_exists(
$name
, $this->values))
62
{
63
throw
new
ArgumentException
(
"Unknown filter \"$name\""
);
64
}
65
66
return
$this->values[
$name
];
67
}
68
69
public
function
getNames
()
70
{
71
return
array_keys($this->values);
72
}
73
74
public
function
getMappedArray
(
array
$map
,
array
$filter
=
array
())
75
{
76
foreach
(
$map
as
$name
=> $mappedName)
77
{
78
if
(!array_key_exists(
$name
, $this->values))
79
{
80
throw
new
ArgumentException
(
"Unknown filter \"$name\""
);
81
}
82
83
if
(!$this->values[
$name
])
84
{
85
if
(isset(
$filter
[$mappedName]))
86
{
87
unset(
$filter
[$mappedName]);
88
}
89
90
continue
;
91
}
92
93
$filter
[$mappedName] = $this->values[
$name
];
94
}
95
96
return
$filter
;
97
}
98
99
public
function
clear
()
100
{
101
foreach
($this->values as
$name
=> $value)
102
{
103
$this->values[
$name
] =
null
;
104
}
105
}
106
107
protected
function
setPeriod
($period = self::PERIOD_MONTH)
108
{
109
$date =
new
DateTime
();
110
$date->add(
'-'
. $period .
' DAY'
);
111
$this->
set
(
'periodFrom'
, $date);
112
$this->
set
(
'periodTo'
);
113
}
114
}
115
Bitrix\Main\ArgumentException
Определения
ArgumentException.php:9
Bitrix\Main\Type\DateTime
Определения
datetime.php:9
Bitrix\Sender\Stat\Filter\__construct
__construct(array $values=array())
Определения
filter.php:31
Bitrix\Sender\Stat\Filter\setPeriod
setPeriod($period=self::PERIOD_MONTH)
Определения
filter.php:107
Bitrix\Sender\Stat\Filter\getNames
getNames()
Определения
filter.php:69
Bitrix\Sender\Stat\Filter\PERIOD_MONTH
CONST PERIOD_MONTH
Определения
filter.php:16
Bitrix\Sender\Stat\Filter\clear
clear()
Определения
filter.php:99
Bitrix\Sender\Stat\Filter\PERIOD_MONTH_12
CONST PERIOD_MONTH_12
Определения
filter.php:19
Bitrix\Sender\Stat\Filter\PERIOD_MONTH_6
CONST PERIOD_MONTH_6
Определения
filter.php:18
Bitrix\Sender\Stat\Filter\getMappedArray
getMappedArray(array $map, array $filter=array())
Определения
filter.php:74
Bitrix\Sender\Stat\Filter\PERIOD_MONTH_3
CONST PERIOD_MONTH_3
Определения
filter.php:17
Bitrix\Sender\Stat\Filter\PERIOD_WEEK
CONST PERIOD_WEEK
Определения
filter.php:15
Bitrix\Sender\Stat\Filter\$values
$values
Определения
filter.php:21
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$filter
$filter
Определения
iblock_catalog_list.php:54
$name
$name
Определения
menu_edit.php:35
$map
$map
Определения
config.php:5
Bitrix\Main\Filter
Bitrix\Sender\Stat
Определения
filter.php:8
bitrix
modules
sender
lib
stat
filter.php
Создано системой
1.14.0