1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
datacounter.php
См. документацию.
1
<?php
8
namespace
Bitrix\Sender\Connector;
9
10
use Bitrix\Sender\Recipient;
11
16
class
DataCounter
17
{
19
public
$data
;
20
26
public
function
__construct
(
array
$data
)
27
{
28
$this->data =
array
();
29
$types =
Recipient\Type::getList
();
30
foreach
(
$data
as $typeId =>
$count
)
31
{
32
if
(is_numeric($typeId))
33
{
34
$typeId = (int) $typeId;
35
}
36
$typeId = $typeId ?:
Recipient\Type::EMAIL
;
37
$typeId = is_numeric($typeId) ? $typeId :
Recipient\Type::getId
($typeId);
38
if
($typeId && !in_array($typeId, $types))
39
{
40
continue
;
41
}
42
43
$this->data[$typeId] = (int)
$count
;
44
}
45
}
46
52
public
function
getSummary
()
53
{
54
$summary = 0;
55
foreach
($this->data as $typeId =>
$count
)
56
{
57
$summary +=
$count
;
58
}
59
60
return
$summary;
61
}
62
69
public
function
getCount
($typeId)
70
{
71
return
isset($this->data[$typeId]) ? $this->data[$typeId] : 0;
72
}
73
80
public
function
leave
($leaveTypeId =
null
)
81
{
82
if
(!$leaveTypeId)
83
{
84
return
$this;
85
}
86
87
foreach
($this->data as $typeId =>
$count
)
88
{
89
if
($leaveTypeId == $typeId)
90
{
91
continue
;
92
}
93
94
unset($this->data[$typeId]);
95
}
96
97
return
$this;
98
}
99
105
public
function
getList
()
106
{
107
return
$this->data
;
108
}
109
115
public
function
getArray
()
116
{
117
$counters
=
array
();
118
foreach
($this->data as $typeId =>
$count
)
119
{
120
$counters
[] =
array
(
121
'typeId'
=> $typeId,
122
'typeCode'
=>
Recipient
\
Type::getCode
($typeId),
123
'typeName'
=>
Recipient
\
Type::getName
($typeId),
124
'count'
=>
$count
125
);
126
}
127
128
$result
=
self::getDefaultArray
();
129
$result
[
'summary'
] = $this->
getSummary
();
130
$result
[
'counters'
] =
$counters
;
131
132
return
$result
;
133
}
134
140
public
function
getArrayCounters
()
141
{
142
$counters
=
array
();
143
foreach
($this->data as $typeId =>
$count
)
144
{
145
$counters
[$typeId] =
$count
;
146
}
147
148
return
$counters
;
149
}
150
156
public
static
function
getDefaultArray
()
157
{
158
return
array
(
159
'summary'
=> 0,
160
'counters'
=>
array
()
161
);
162
}
163
}
$count
$count
Определения
admin_tab.php:4
Bitrix\Main\Error\getCode
getCode()
Определения
error.php:54
Bitrix\Main\IO\FileSystemEntry\getName
getName()
Определения
filesystementry.php:70
Bitrix\Sender\Connector\DataCounter
Определения
datacounter.php:17
Bitrix\Sender\Connector\DataCounter\getArrayCounters
getArrayCounters()
Определения
datacounter.php:140
Bitrix\Sender\Connector\DataCounter\getArray
getArray()
Определения
datacounter.php:115
Bitrix\Sender\Connector\DataCounter\getList
getList()
Определения
datacounter.php:105
Bitrix\Sender\Connector\DataCounter\$data
$data
Определения
datacounter.php:19
Bitrix\Sender\Connector\DataCounter\getCount
getCount($typeId)
Определения
datacounter.php:69
Bitrix\Sender\Connector\DataCounter\getSummary
getSummary()
Определения
datacounter.php:52
Bitrix\Sender\Connector\DataCounter\leave
leave($leaveTypeId=null)
Определения
datacounter.php:80
Bitrix\Sender\Connector\DataCounter\getDefaultArray
static getDefaultArray()
Определения
datacounter.php:156
Bitrix\Sender\Connector\DataCounter\__construct
__construct(array $data)
Определения
datacounter.php:26
Bitrix\Sender\Internals\ClassConstant\getList
static getList()
Определения
classconstant.php:80
Bitrix\Sender\Internals\ClassConstant\getId
static getId($code)
Определения
classconstant.php:145
Bitrix\Sender\Recipient\Type\EMAIL
const EMAIL
Определения
type.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
$result
$result
Определения
get_property_values.php:14
Bitrix\Sender\Recipient
Определения
agent.php:8
$counters
$counters
Определения
options.php:100
bitrix
modules
sender
lib
connector
datacounter.php
Создано системой
1.14.0