Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
counter.php
1
<?php
2
namespace
Bitrix\Socialnetwork\Integration\Pull
;
3
4
use
Bitrix\Main\EventResult
;
5
use
Bitrix\Main\Localization\Loc
;
6
use
Bitrix\Main\ModuleManager
;
7
8
class
Counter
9
{
10
const
TYPE_LIVEFEED
=
'livefeed'
;
11
const
MODULE_ID
=
'socialnetwork'
;
12
13
public
static
function
onGetMobileCounterTypes
(\
Bitrix
\Main\
Event
$event)
14
{
15
return
new
EventResult
(EventResult::SUCCESS, Array(
16
self::TYPE_LIVEFEED => Array(
17
'NAME'
=>
Loc::getMessage
(ModuleManager::isModuleInstalled(
'intranet'
) ?
'SONET_COUNTER_TYPE_LIVEFEED2'
:
'SONET_COUNTER_TYPE_LIVEFEED'
),
18
'DEFAULT'
=>
true
19
)
20
), self::MODULE_ID);
21
}
22
23
public
static
function
onGetMobileCounter
(\
Bitrix
\Main\
Event
$event)
24
{
25
$params = $event->getParameters();
26
27
$counters = \CUserCounter::getGroupedCounters(
28
\CUserCounter::GetAllValues($params[
'USER_ID'
])
29
);
30
31
$counter = isset($counters[$params[
'SITE_ID'
]][\CUserCounter::LIVEFEED_CODE])? $counters[$params[
'SITE_ID'
]][\CUserCounter::LIVEFEED_CODE]: 0;
32
$counter = $counter > 0? $counter: 0;
33
34
return
new
EventResult
(EventResult::SUCCESS, Array(
35
'TYPE'
=> self::TYPE_LIVEFEED,
36
'COUNTER'
=> $counter
37
), self::MODULE_ID);
38
}
39
}
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\EventResult
Definition
eventresult.php:5
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ModuleManager
Definition
modulemanager.php:5
Bitrix\Socialnetwork\Integration\Pull\Counter
Definition
counter.php:9
Bitrix\Socialnetwork\Integration\Pull\Counter\MODULE_ID
const MODULE_ID
Definition
counter.php:11
Bitrix\Socialnetwork\Integration\Pull\Counter\TYPE_LIVEFEED
const TYPE_LIVEFEED
Definition
counter.php:10
Bitrix\Socialnetwork\Integration\Pull\Counter\onGetMobileCounterTypes
static onGetMobileCounterTypes(\Bitrix\Main\Event $event)
Definition
counter.php:13
Bitrix\Socialnetwork\Integration\Pull\Counter\onGetMobileCounter
static onGetMobileCounter(\Bitrix\Main\Event $event)
Definition
counter.php:23
Bitrix\Socialnetwork\Integration\Pull
Definition
counter.php:2
Bitrix
modules
socialnetwork
lib
integration
pull
counter.php
Создано системой
1.10.0