Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
groups.php
1<?
3
6
8{
9 public function getData($params = array())
10 {
11 $result = array(
12 'ITEMS' => array(),
13 'ITEMS_LAST' => array(),
14 'ADDITIONAL_INFO' => array(
15 'SORT_SELECTED' => 100
16 )
17 );
18
19 $entityType = Handler::ENTITY_TYPE_GROUPS;
20
21 $options = (!empty($params['options']) ? $params['options'] : array());
22
23 if (
24 !empty($options['enableAll'])
25 && $options['enableAll'] == 'Y'
27 )
28 {
29 $allowToAllDestination = (
30 !isset($options['context'])
31 || !in_array($options['context'], [ 'BLOG_POST', 'FEED_FILTER_TO' ])
32 || \Bitrix\Socialnetwork\ComponentHelper::getAllowToAllDestination()
33 );
34 if ($allowToAllDestination)
35 {
36 $result['ITEMS_LAST'][] = 'UA';
37 }
38
39 $result['ITEMS']['UA'] = array(
40 'id' => 'UA',
41 'name' => Loc::getMessage(
42 ModuleManager::isModuleInstalled('intranet')
43 ? 'MAIN_UI_SELECTOR_ITEM_TOALL_INTRANET'
44 : 'MAIN_UI_SELECTOR_ITEM_TOALL'
45 ),
46 'searchable' => ($allowToAllDestination ? 'Y' : 'N')
47 );
48 }
49
50 if (
51 !empty($options['enableEmpty'])
52 && $options['enableEmpty'] == 'Y'
53 )
54 {
55 $result['ITEMS_LAST'][] = 'EMPTY';
56
57 $result['ITEMS']['EMPTY'] = array(
58 'id' => 'EMPTY',
59 'name' => Loc::getMessage('MAIN_UI_SELECTOR_ITEM_EMPTY'),
60 'searchable' => 'N'
61 );
62 }
63
64 if (
65 !empty($options['enableUserManager'])
66 && $options['enableUserManager'] == 'Y'
67 )
68 {
69 $result['ITEMS_LAST'][] = 'USER_MANAGER';
70
71 $result['ITEMS']['USER_MANAGER'] = array(
72 'id' => 'USER_MANAGER',
73 'name' => Loc::getMessage('MAIN_UI_SELECTOR_ITEM_USER_MANAGER'),
74 'searchable' => 'N'
75 );
76 }
77
78 return $result;
79 }
80
81 public function getItemName($itemCode = '')
82 {
83 $result = '';
84
85 switch($itemCode)
86 {
87 case 'EMPTY':
88 $result = Loc::getMessage('MAIN_UI_SELECTOR_ITEM_EMPTY');
89 break;
90 case 'UA':
91 $result = Loc::getMessage(
92 ModuleManager::isModuleInstalled('intranet')
93 ? 'MAIN_UI_SELECTOR_ITEM_TOALL_INTRANET'
94 : 'MAIN_UI_SELECTOR_ITEM_TOALL'
95 );
96 break;
97 default:
98 }
99
100 return $result;
101 }
102}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29