Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
panel.php
1
<?php
2
3
namespace
Bitrix\Main\Grid\Panel
;
4
5
use
Bitrix\Main\Filter\Filter
;
6
use
Bitrix\Main\Grid\GridRequest
;
7
use
Bitrix\Main\Grid\GridResponse
;
8
use
Bitrix\Main\Grid\Panel\Action\DataProvider
;
9
use
Bitrix\Main\Grid\Panel\Action\Action
;
10
use
Bitrix\Main\Grid\Panel\Action\GroupAction
;
11
use
Bitrix\Main\Grid\UI\Response\GridResponseFactory
;
12
13
class
Panel
14
{
18
private
array $actions;
22
private
array $controls;
26
private
array $providers;
27
31
public
function
__construct
(
DataProvider
...$providers)
32
{
33
$this->providers = [];
34
foreach
($providers as $provider)
35
{
36
$this->providers[] = $provider;
37
}
38
}
39
43
final
public
function
getActions
(): array
44
{
45
if
(!isset($this->actions))
46
{
47
$this->actions = [];
48
49
foreach
($this->providers as $provider)
50
{
51
foreach
($provider->prepareActions() as $action)
52
{
53
$this->actions[$action::getId()] ??= $action;
54
}
55
}
56
}
57
58
return
$this->actions;
59
}
60
61
final
protected
function
getActionById
(
string
$id): ?
Action
62
{
63
if
(empty($id))
64
{
65
return
null
;
66
}
67
68
return
$this->
getActions
()[$id] ??
null
;
69
}
70
74
public
function
getControls
(): array
75
{
76
if
(!isset($this->controls))
77
{
78
$this->controls = [];
79
80
foreach
($this->providers as $extraProvider)
81
{
82
$this->controls += $extraProvider->prepareControls();
83
}
84
}
85
86
return
$this->controls;
87
}
88
97
public
function
processRequest
(
GridRequest
$request, ?
Filter
$filter): ?
GridResponse
98
{
99
$result =
null
;
100
101
if
(!check_bitrix_sessid())
102
{
103
return
null
;
104
}
105
106
// direct actions
107
$action = $this->
getActionById
(
108
$request->
getPanelActionId
() ??
''
109
);
110
if
($action)
111
{
112
$result = $action->processRequest(
113
$request->getHttpRequest(),
114
$request->isSelectedAllPanelRows(),
115
$filter
116
);
117
}
118
else
119
{
120
// group actions
121
$groupAction = $this->
getActionById
(GroupAction::getId());
122
if
($groupAction)
123
{
124
$result = $groupAction->processRequest(
125
$request->getHttpRequest(),
126
$request->isSelectedAllPanelGroupRows(),
127
$filter
128
);
129
}
130
}
131
132
return
133
isset($result)
134
? (
new
GridResponseFactory
)->createFromResult($result)
135
: null
136
;
137
}
138
}
Bitrix\Main\Filter\Filter
Definition
filter.php:5
Bitrix\Main\Grid\Panel\Action\DataProvider
Definition
dataprovider.php:10
Bitrix\Main\Grid\Panel\Action\GroupAction
Definition
groupaction.php:14
Bitrix\Main\Grid\Panel\Panel
Definition
panel.php:14
Bitrix\Main\Grid\Panel\Panel\getControls
getControls()
Definition
panel.php:74
Bitrix\Main\Grid\Panel\Panel\getActionById
getActionById(string $id)
Definition
panel.php:61
Bitrix\Main\Grid\Panel\Panel\__construct
__construct(DataProvider ... $providers)
Definition
panel.php:31
Bitrix\Main\Grid\Panel\Panel\processRequest
processRequest(GridRequest $request, ?Filter $filter)
Definition
panel.php:97
Bitrix\Main\Grid\Panel\Panel\getActions
getActions()
Definition
panel.php:43
Bitrix\Main\Grid\UI\Response\GridResponseFactory
Definition
gridresponsefactory.php:10
Bitrix\Main\Grid\GridRequest
Definition
gridrequest.php:17
Bitrix\Main\Grid\GridRequest\getPanelActionId
getPanelActionId()
Bitrix\Main\Grid\GridResponse
Definition
gridresponse.php:13
Bitrix\Main\Grid\Panel\Action\Action
Definition
action.php:18
Bitrix\Main\Grid\Panel
modules
main
lib
grid
panel
panel.php
Создано системой
1.10.0