Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
tags.php
1
<?php
2
10
namespace
Bitrix\Socialnetwork\Helper\UI\Grid\Workgroup
;
11
12
use
Bitrix\Main\Web\Json
;
13
use
Bitrix\Socialnetwork\Item\Workgroup\AccessManager
;
14
15
class
Tags
16
{
17
public
static
function
getValue
(array $tags = [], array $params = []): array
18
{
19
$result = [
20
'items'
=> [],
21
];
22
23
$group = ($params[
'GROUP'
] ??
null
);
24
if
(!$group)
25
{
26
return
$result;
27
}
28
29
$groupId = (int)$group->get(
'ID'
);
30
$gridId = (string)($params[
'GRID_ID'
] ??
''
);
31
$filterField = (string)($params[
'FILTER_FIELD'
] ??
''
);
32
$currentUserRelation = ($params[
'CURRENT_USER_RELATION'
] ??
null
);
33
34
if
(
35
$groupId <= 0
36
|| $gridId ===
''
37
|| $filterField ===
''
38
)
39
{
40
return
$result;
41
}
42
43
$accessManager =
new
AccessManager
(
44
$group,
45
$currentUserRelation,
46
$currentUserRelation
47
);
48
49
if
($accessManager->canModify())
50
{
51
$result[
'addButton'
] = [
52
'events'
=> [
53
'click'
=>
'
54
BX.Socialnetwork.UI.Grid.TagController
55
.onTagAddClick.bind(BX.Socialnetwork.UI.Grid.TagController, '
. $groupId .
')'
,
56
],
57
];
58
}
59
60
foreach
($tags as $tag)
61
{
62
$encodedData =
Json::encode
([
'TAG'
=> $tag]);
63
64
$selected = (
65
$filterField !==
''
66
&& isset($params[
'FILTER_DATA'
][$filterField])
67
&& $params[
'FILTER_DATA'
][$filterField] === $tag
68
);
69
70
$result[
'items'
][] = [
71
'text'
=> $tag,
72
'active'
=> $selected,
73
'events'
=> [
74
'click'
=>
'
75
BX.Socialnetwork.UI.Grid.TagController
76
.onTagClick.bind(BX.Socialnetwork.UI.Grid.TagController, '
. $encodedData .
')'
,
77
],
78
];
79
}
80
81
return
$result;
82
}
83
}
Bitrix\Main\Web\Json
Definition
json.php:11
Bitrix\Main\Web\Json\encode
static encode($data, $options=null)
Definition
json.php:24
Bitrix\Socialnetwork\Helper\UI\Grid\Workgroup\Tags
Definition
tags.php:16
Bitrix\Socialnetwork\Helper\UI\Grid\Workgroup\Tags\getValue
static getValue(array $tags=[], array $params=[])
Definition
tags.php:17
Bitrix\Socialnetwork\Item\Workgroup\AccessManager
Definition
accessmanager.php:18
Bitrix\Socialnetwork\Helper\UI\Grid\Workgroup
Definition
actions.php:10
modules
socialnetwork
lib
helper
ui
grid
workgroup
tags.php
Создано системой
1.10.0