1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
counter.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Component\LogList;
4
5
class
Counter
6
{
7
protected
$component
;
8
protected
$processorInstance
;
9
protected
$request
;
10
11
protected
$emptyCounter
=
false
;
12
13
public
function
__construct
(
$params
)
14
{
15
if
(!empty(
$params
[
'component'
]))
16
{
17
$this->component =
$params
[
'component'
];
18
}
19
if
(!empty(
$params
[
'processorInstance'
]))
20
{
21
$this->processorInstance =
$params
[
'processorInstance'
];
22
}
23
if
(!empty(
$params
[
'request'
]))
24
{
25
$this->request =
$params
[
'request'
];
26
}
27
else
28
{
29
$this->request =
Util::getRequest
();
30
}
31
}
32
33
public
function
getRequest
()
34
{
35
return
$this->request
;
36
}
37
38
protected
function
getComponent
()
39
{
40
return
$this->component
;
41
}
42
43
protected
function
getProcessorInstance
()
44
{
45
return
$this->processorInstance
;
46
}
47
48
public
function
setEmptyCounter
($value =
false
): void
49
{
50
$this->emptyCounter = $value;
51
}
52
53
public
function
getEmptyCounter
(): bool
54
{
55
return
$this->emptyCounter
;
56
}
57
58
public
function
processCounterTypeData
(&
$result
): void
59
{
60
$params
= $this->
getComponent
()->arParams;
61
62
$result
[
'COUNTER_TYPE'
] = \CUserCounter::LIVEFEED_CODE;
63
64
if
(
$params
[
'GROUP_ID'
] > 0)
65
{
66
$result
[
'COUNTER_TYPE'
] = \CUserCounter::LIVEFEED_CODE .
'SG'
.
$params
[
'GROUP_ID'
];
67
}
68
elseif
(
69
$params
[
'IS_CRM'
] ===
'Y'
70
&& (
71
$params
[
'SET_LOG_COUNTER'
] !==
'N'
72
||
$params
[
'SET_LOG_PAGE_CACHE'
] !==
'N'
73
)
74
)
75
{
76
$result
[
'COUNTER_TYPE'
] = (
77
is_set
(
$params
[
'CUSTOM_DATA'
])
78
&&
is_set
(
$params
[
'CUSTOM_DATA'
][
'CRM_PRESET_TOP_ID'
])
79
&&
$params
[
'CUSTOM_DATA'
][
'CRM_PRESET_TOP_ID'
] ===
'all'
80
?
'CRM_**_ALL'
81
:
'CRM_**'
82
);
83
}
84
elseif
((
$params
[
'EXACT_EVENT_ID'
] ??
''
) ===
'blog_post'
)
85
{
86
$result
[
'COUNTER_TYPE'
] =
'blog_post'
;
87
}
88
}
89
90
public
function
clearLogCounter
(&
$result
): void
91
{
92
$params
= $this->
getComponent
()->arParams;
93
94
if
(
95
$params
[
'SET_LOG_COUNTER'
] !==
'Y'
96
|| (isset(
$result
[
'EXPERT_MODE_SET'
]) &&
$result
[
'EXPERT_MODE_SET'
])
97
|| !
Util::checkUserAuthorized
()
98
)
99
{
100
return
;
101
}
102
103
if
(
104
(
int
)
$result
[
'LOG_COUNTER'
] > 0
105
|| $this->
getEmptyCounter
()
106
)
107
{
108
\CUserCounter::clear(
109
$result
[
'currentUserId'
],
110
$result
[
'COUNTER_TYPE'
],
111
[
SITE_ID
,
'**'
],
112
true
,
// sendPull
113
true
// multiple
114
);
115
116
if
((
int
)
$result
[
'LOG_COUNTER_IMPORTANT'
] > 0)
117
{
118
\CUserCounter::clear(
119
$result
[
'currentUserId'
],
120
'BLOG_POST_IMPORTANT'
,
121
SITE_ID
122
);
123
}
124
125
$res
= getModuleEvents(
'socialnetwork'
,
'OnSonetLogCounterClear'
);
126
while
($eventFields =
$res
->fetch())
127
{
128
executeModuleEventEx($eventFields, [
$result
[
'COUNTER_TYPE'
], (
int
)
$result
[
'LAST_LOG_TS'
] ]);
129
}
130
}
131
elseif
(in_array(
$result
[
'COUNTER_TYPE'
], [
'**'
,
'CRM_**'
],
true
))
// set last date only
132
{
133
$pool =
\Bitrix\Main\Application::getInstance
()->getConnectionPool();
134
$pool->useMasterOnly(
true
);
135
136
\CUserCounter::clear(
137
$result
[
'currentUserId'
],
138
$result
[
'COUNTER_TYPE'
],
139
[
SITE_ID
,
'**'
],
140
false
,
// sendPull
141
false
,
// multiple
142
false
// cleanCache
143
);
144
145
$pool->useMasterOnly(
false
);
146
}
147
}
148
149
public
function
setLogCounter
(&
$result
): void
150
{
151
$params
= $this->
getComponent
()->arParams;
152
153
$result
[
'LOG_COUNTER'
] = 0;
154
$result
[
'LOG_COUNTER_IMPORTANT'
] = 0;
155
156
if
(
157
$params
[
'SET_LOG_COUNTER'
] !==
'Y'
158
|| !
Util::checkUserAuthorized
()
159
)
160
{
161
return
;
162
}
163
164
$counters
= \CUserCounter::getValues(
$result
[
'currentUserId'
],
SITE_ID
);
165
166
if
(isset(
$counters
[
'BLOG_POST_IMPORTANT'
]))
167
{
168
$result
[
'LOG_COUNTER_IMPORTANT'
] = (int)
$counters
[
'BLOG_POST_IMPORTANT'
];
169
}
170
171
if
(isset(
$counters
[
$result
[
'COUNTER_TYPE'
]]))
172
{
173
$result
[
'LOG_COUNTER'
] = (int)
$counters
[
$result
[
'COUNTER_TYPE'
]];
174
}
175
else
176
{
177
$this->
setEmptyCounter
(
true
);
178
$result[
'LOG_COUNTER'
] = 0;
179
}
180
}
181
}
Bitrix\Main\Application\getInstance
static getInstance()
Определения
application.php:98
Bitrix\Socialnetwork\Component\LogList\Counter
Определения
counter.php:6
Bitrix\Socialnetwork\Component\LogList\Counter\clearLogCounter
clearLogCounter(&$result)
Определения
counter.php:90
Bitrix\Socialnetwork\Component\LogList\Counter\$component
$component
Определения
counter.php:7
Bitrix\Socialnetwork\Component\LogList\Counter\getComponent
getComponent()
Определения
counter.php:38
Bitrix\Socialnetwork\Component\LogList\Counter\getEmptyCounter
getEmptyCounter()
Определения
counter.php:53
Bitrix\Socialnetwork\Component\LogList\Counter\setLogCounter
setLogCounter(&$result)
Определения
counter.php:149
Bitrix\Socialnetwork\Component\LogList\Counter\setEmptyCounter
setEmptyCounter($value=false)
Определения
counter.php:48
Bitrix\Socialnetwork\Component\LogList\Counter\__construct
__construct($params)
Определения
counter.php:13
Bitrix\Socialnetwork\Component\LogList\Counter\$processorInstance
$processorInstance
Определения
counter.php:8
Bitrix\Socialnetwork\Component\LogList\Counter\getProcessorInstance
getProcessorInstance()
Определения
counter.php:43
Bitrix\Socialnetwork\Component\LogList\Counter\$request
$request
Определения
counter.php:9
Bitrix\Socialnetwork\Component\LogList\Counter\getRequest
getRequest()
Определения
counter.php:33
Bitrix\Socialnetwork\Component\LogList\Counter\processCounterTypeData
processCounterTypeData(&$result)
Определения
counter.php:58
Bitrix\Socialnetwork\Component\LogList\Counter\$emptyCounter
$emptyCounter
Определения
counter.php:11
Bitrix\Socialnetwork\Component\LogList\Util\checkUserAuthorized
static checkUserAuthorized()
Определения
util.php:20
Bitrix\Socialnetwork\Component\LogListCommon\Util\getRequest
static getRequest()
Определения
util.php:7
$res
$res
Определения
filter_act.php:7
$result
$result
Определения
get_property_values.php:14
is_set
is_set($a, $k=false)
Определения
tools.php:2133
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
$counters
$counters
Определения
options.php:100
SITE_ID
const SITE_ID
Определения
sonet_set_content_view.php:12
bitrix
modules
socialnetwork
lib
component
loglist
counter.php
Создано системой
1.14.0