Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
counter.php
1<?php
3
7
8class 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}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static onGetMobileCounterTypes(\Bitrix\Main\Event $event)
Definition counter.php:13
static onGetMobileCounter(\Bitrix\Main\Event $event)
Definition counter.php:23