1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
counterprovider.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Integration\Tasks
;
4
5
use
Bitrix\Main\Loader
;
6
use
Bitrix\Socialnetwork\Internals\Space\Counter\Dictionary
;
7
use
Bitrix\Socialnetwork\Internals\Space\Counter\ProviderInterface
;
8
use Bitrix\Tasks\Internals\Counter;
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
(!$this->isTasksModuleAvailable())
19
{
20
return
$result
;
21
}
22
23
return
Counter::getInstance($this->userId)->get(Counter\CounterDictionary::COUNTER_MEMBER_TOTAL, $spaceId);
24
}
25
26
public
function
getValue
(
int
$spaceId = 0,
array
$metrics = []): int
27
{
28
$result
= 0;
29
30
if
(!$this->isTasksModuleAvailable())
31
{
32
return
$result
;
33
}
34
35
foreach
($metrics as $metric)
36
{
37
switch
($metric)
38
{
39
case
Dictionary::COUNTERS_TASKS_TOTAL:
40
return
$this->
getTotal
($spaceId);
41
//TODO: other cases...
42
}
43
}
44
45
return
$result
;
46
}
47
48
public
function
getAvailableMetrics
():
array
49
{
50
return
[
51
Dictionary::COUNTERS_TASKS_TOTAL,
52
];
53
}
54
55
private
function
isTasksModuleAvailable(): bool
56
{
57
return
Loader::includeModule(
'tasks'
);
58
}
59
}
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Main\Loader
Определения
loader.php:13
Bitrix\Socialnetwork\Integration\Tasks\CounterProvider
Определения
counterprovider.php:11
Bitrix\Socialnetwork\Integration\Tasks\CounterProvider\getValue
getValue(int $spaceId=0, array $metrics=[])
Определения
counterprovider.php:26
Bitrix\Socialnetwork\Integration\Tasks\CounterProvider\__construct
__construct(private int $userId)
Определения
counterprovider.php:12
Bitrix\Socialnetwork\Integration\Tasks\CounterProvider\getTotal
getTotal(int $spaceId=0)
Определения
counterprovider.php:14
Bitrix\Socialnetwork\Integration\Tasks\CounterProvider\getAvailableMetrics
getAvailableMetrics()
Определения
counterprovider.php:48
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\Tasks
Определения
counterprovider.php:3
bitrix
modules
socialnetwork
lib
integration
tasks
counterprovider.php
Создано системой
1.14.0