1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
counterprovider.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Integration\SocialNetwork\WorkGroup
;
4
5
use
Bitrix\Socialnetwork\Internals\Counter
;
6
use
Bitrix\Socialnetwork\Internals\Counter\CounterDictionary
;
7
use
Bitrix\Socialnetwork\Internals\Space\Counter\Dictionary
;
8
use
Bitrix\Socialnetwork\Internals\Space\Counter\ProviderInterface
;
9
10
class
CounterProvider
implements
ProviderInterface
11
{
12
public
function
__construct
(
private
int
$userId
) { }
13
14
public
function
getTotal
(
int
$spaceId = 0): int
15
{
16
$result
= 0;
17
18
if
($spaceId === 0)
19
{
20
return
$result
;
21
}
22
23
$metrics = [
24
CounterDictionary::COUNTER_WORKGROUP_REQUESTS_IN,
25
];
26
27
foreach
($metrics as $metric)
28
{
29
$result
+=
Counter::getInstance
($this->userId)->get($metric, $spaceId)[
'all'
];
30
}
31
32
return
$result
;
33
}
34
35
public
function
getValue
(
int
$spaceId = 0,
array
$metrics = []): int
36
{
37
$result
= 0;
38
39
if
($spaceId === 0)
40
{
41
return
$result
;
42
}
43
44
foreach
($metrics as $metric)
45
{
46
switch
($metric)
47
{
48
case
Dictionary::COUNTERS_WORKGROUP_TOTAL:
49
return
$this->
getTotal
($spaceId);
50
case
Dictionary::COUNTERS_WORKGROUP_REQUEST_OUT:
51
$result
+=
Counter::getInstance
($this->userId)->get(
52
CounterDictionary::COUNTER_WORKGROUP_REQUESTS_OUT,
53
$spaceId)[
'all'
];
54
break
;
55
}
56
}
57
58
return
$result
;
59
}
60
61
public
function
getAvailableMetrics
():
array
62
{
63
return
[
64
Dictionary::COUNTERS_WORKGROUP_TOTAL,
65
];
66
}
67
}
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Main\Application\getInstance
static getInstance()
Определения
application.php:98
Bitrix\Socialnetwork\Integration\SocialNetwork\WorkGroup\CounterProvider
Определения
counterprovider.php:11
Bitrix\Socialnetwork\Integration\SocialNetwork\WorkGroup\CounterProvider\getValue
getValue(int $spaceId=0, array $metrics=[])
Определения
counterprovider.php:35
Bitrix\Socialnetwork\Integration\SocialNetwork\WorkGroup\CounterProvider\__construct
__construct(private int $userId)
Определения
counterprovider.php:12
Bitrix\Socialnetwork\Integration\SocialNetwork\WorkGroup\CounterProvider\getTotal
getTotal(int $spaceId=0)
Определения
counterprovider.php:14
Bitrix\Socialnetwork\Integration\SocialNetwork\WorkGroup\CounterProvider\getAvailableMetrics
getAvailableMetrics()
Определения
counterprovider.php:61
Bitrix\Socialnetwork\Internals\Counter\CounterDictionary
Определения
counterdictionary.php:11
Bitrix\Socialnetwork\Internals\Space\Counter\Dictionary
Определения
dictionary.php:8
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\Socialnetwork\Internals\Space\Counter\ProviderInterface
Определения
providerinterface.php:6
Bitrix\Socialnetwork\Integration\SocialNetwork\WorkGroup
Определения
counterprovider.php:3
Bitrix\Socialnetwork\Internals\Counter
Определения
countercontroller.php:9
bitrix
modules
socialnetwork
lib
integration
socialnetwork
workgroup
counterprovider.php
Создано системой
1.14.0