Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
workgroup.php
1<?php
2
10
14
15Loc::loadMessages(__FILE__);
16
18{
19 public static function getFilterPresetList($params): array
20 {
21 $result = [];
22
23 $currentUserId = (int) ($params['currentUserId'] ?? 0);
24 $contextUserId = (int) ($params['contextUserId'] ?? 0);
25 $mode = (string) ($params['mode'] ?? '');
26
27 $renderPartsUser = new \Bitrix\Socialnetwork\Livefeed\RenderParts\User(['skipLink' => true]);
28
29 if (Option::get('socialnetwork', 'work_with_closed_groups', 'N') !== 'Y')
30 {
31 $activeFields = [
32 'CLOSED' => 'N',
33 ];
34
35 if ($mode === WorkgroupList::MODE_USER && $currentUserId !== $contextUserId)
36 {
37 $userLabel = '';
38 if ($renderData = $renderPartsUser->getData($contextUserId))
39 {
40 $userLabel = $renderData['name'];
41 }
42 $activeFields['MEMBER'] = 'U' . $contextUserId;
43 $activeFields['MEMBER_label'] = $userLabel;
44 }
45
46 $result['active'] = [
47 'name' => Loc::getMessage('SONET_C36_T_FILTER_PRESET_ACTIVE'),
48 'fields' => $activeFields,
49 'default' => ($mode === WorkgroupList::MODE_COMMON),
50 ];
51 }
52
53 if ($currentUserId > 0)
54 {
55 $userLabel = '';
56 if ($renderData = $renderPartsUser->getData($currentUserId))
57 {
58 $userLabel = $renderData['name'];
59 }
60
61 $result['my'] = [
62 'name' => Loc::getMessage('SONET_C36_T_FILTER_PRESET_MY'),
63 'fields' => [
64 'MEMBER' => 'U' . $currentUserId,
65 'MEMBER_label' => $userLabel,
66 ],
67 'disallow_for_all' => true,
68 'default' => (
69 $mode === WorkgroupList::MODE_USER
70 || in_array(
71 $mode,
72 WorkgroupList::getTasksModeList(),
73 true
74 )
75 ),
76 ];
77 $result['favorites'] = [
78 'name' => Loc::getMessage('SONET_C36_T_FILTER_PRESET_FAVORITES'),
79 'fields' => [
80 'FAVORITES' => 'Y',
81 ],
82 ];
83 }
84
85 if (
86 !empty($params['extranetSiteId'])
87 && SITE_ID !== $params['extranetSiteId']
88 )
89 {
90 $result['extranet'] = [
91 'name' => Loc::getMessage('SONET_C36_T_FILTER_PRESET_EXTRANET'),
92 'fields' => [
93 'EXTRANET' => 'Y',
94 ],
95 ];
96 }
97
98 if (Option::get('socialnetwork', 'work_with_closed_groups', 'N') !== 'Y')
99 {
100 $result['archive'] = [
101 'name' => Loc::getMessage('SONET_C36_T_FILTER_PRESET_ARCHIVE'),
102 'fields' => [
103 'CLOSED' => 'Y',
104 ],
105 ];
106 }
107
108 return $result;
109 }
110}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29