Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
groupaction.php
1
<?php
2
3
namespace
Bitrix\Main\Grid\Panel\Action
;
4
5
use
Bitrix\Main\Filter\Filter
;
6
use
Bitrix\Main\Grid\Panel\Action\Group\GroupChildAction
;
7
use
Bitrix\Main\Grid\Panel\Actions
;
8
use
Bitrix\Main\Grid\Panel\Types
;
9
use
Bitrix\Main\HttpRequest
;
10
use
Bitrix\Main\Localization\Loc
;
11
use
Bitrix\Main\Result
;
12
13
abstract
class
GroupAction
implements
Action
14
{
18
private
array $items;
19
25
final
public
static
function
getId
(): string
26
{
27
return
'group_action'
;
28
}
29
33
abstract
protected
function
prepareChildItems
(): array;
34
40
private
function
getChildItems(): array
41
{
42
$this->items ??= $this->
prepareChildItems
();
43
44
return
$this->items;
45
}
46
50
public
function
getControl
(): ?array
51
{
52
$items = $this->getGroupDropdownItems();
53
if
(empty($items))
54
{
55
return
null
;
56
}
57
58
return
[
59
'TYPE'
=>
Types::DROPDOWN
,
60
'ID'
=> static::getId(),
61
'NAME'
=> static::getId(),
62
'ITEMS'
=> [
63
[
64
'NAME'
=>
Loc::getMessage
(
'MAIN_GRID_PANEL_GROUP_ACTIONS_ITEM_PLACEHOLDER'
),
65
'VALUE'
=>
'default'
,
66
'ONCHANGE'
=> [
67
[
68
'ACTION'
=>
Actions::RESET_CONTROLS
,
69
],
70
],
71
],
72
... $items,
73
],
74
];
75
}
76
82
private
function
getGroupDropdownItems(): array
83
{
84
$result = [];
85
86
foreach
($this->getChildItems() as $item)
87
{
88
$result[] = $item->getDropdownItem();
89
}
90
91
return
$result;
92
}
93
97
final
public
function
processRequest
(
HttpRequest
$request,
bool
$isSelectedAllRows, ?
Filter
$filter): ?
Result
98
{
99
$controls = $request->getPost(
'controls'
);
100
$itemId = (string)($controls[static::getId()] ??
''
);
101
if
(empty($itemId))
102
{
103
return
null
;
104
}
105
106
foreach
($this->getChildItems() as $item)
107
{
108
if
($item::getId() === $itemId)
109
{
110
return
$item->processRequest($request, $isSelectedAllRows, $filter);
111
}
112
}
113
114
return
null
;
115
}
116
}
Bitrix\Main\Filter\Filter
Definition
filter.php:5
Bitrix\Main\Grid\Panel\Action\Group\GroupChildAction
Definition
groupchildaction.php:11
Bitrix\Main\Grid\Panel\Action\GroupAction
Definition
groupaction.php:14
Bitrix\Main\Grid\Panel\Action\GroupAction\prepareChildItems
prepareChildItems()
Bitrix\Main\Grid\Panel\Action\GroupAction\processRequest
processRequest(HttpRequest $request, bool $isSelectedAllRows, ?Filter $filter)
Definition
groupaction.php:97
Bitrix\Main\Grid\Panel\Action\GroupAction\getControl
getControl()
Definition
groupaction.php:50
Bitrix\Main\Grid\Panel\Action\GroupAction\getId
static getId()
Definition
groupaction.php:25
Bitrix\Main\Grid\Panel\Actions
Definition
actions.php:13
Bitrix\Main\Grid\Panel\Actions\RESET_CONTROLS
const RESET_CONTROLS
Definition
actions.php:24
Bitrix\Main\Grid\Panel\Types
Definition
types.php:12
Bitrix\Main\Grid\Panel\Types\DROPDOWN
const DROPDOWN
Definition
types.php:13
Bitrix\Main\HttpRequest
Definition
httprequest.php:20
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\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\Result
Definition
result.php:14
Bitrix\Main\Grid\Panel\Action\Action
Definition
action.php:18
Bitrix\Main\Grid\Panel\Action
Definition
action.php:3
modules
main
lib
grid
panel
action
groupaction.php
Создано системой
1.10.0