1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
rows.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Main\Grid\Row;
4
5
use Bitrix\Main\Grid\GridRequest;
6
use Bitrix\Main\Grid\GridResponse;
7
use Bitrix\Main\Grid\Row\Action\DataProvider;
8
use Bitrix\Main\Grid\Row\Action\Action;
9
use Bitrix\Main\Grid\UI\Response\GridResponseFactory;
10
20
class
Rows
21
{
26
private
array
$actions;
27
28
protected
RowAssembler
$rowAssembler
;
29
33
protected
array
$actionsProviders
;
34
39
public
function
__construct
(
RowAssembler
$rowAssembler
,
DataProvider
...
$actionsProviders
)
40
{
41
$this->rowAssembler =
$rowAssembler
;
42
43
$this->actionsProviders = [];
44
foreach
(
$actionsProviders
as
$provider
)
45
{
46
$this->actionsProviders[] =
$provider
;
47
}
48
}
49
57
public
function
prepareRows
(iterable $rawRows):
array
58
{
59
$result
= [];
60
61
foreach
($rawRows as $row)
62
{
63
$result
[] = $this->
prepareRow
($row);
64
}
65
66
return
$this->rowAssembler->prepareRows(
$result
);
67
}
68
76
protected
function
prepareRow
(
array
$rawValue):
array
77
{
78
$result
= [
79
'data'
=> $rawValue,
80
];
81
82
if
(isset($rawValue[
'ID'
]))
83
{
84
$result
[
'id'
] = $rawValue[
'ID'
];
85
}
86
87
if
(!empty($this->actionsProviders))
88
{
89
$result
[
'actions'
] = [];
90
91
foreach
($this->actionsProviders as
$provider
)
92
{
93
$result
[
'actions'
] +=
$provider
->prepareControls($rawValue);
94
}
95
}
96
97
return
$result
;
98
}
99
103
final
public
function
getActions
():
array
104
{
105
if
(!isset($this->actions))
106
{
107
$this->actions = [];
108
109
foreach
($this->actionsProviders as
$provider
)
110
{
111
foreach
(
$provider
->prepareActions() as
$action
)
112
{
113
$this->actions[$action::getId()] ??=
$action
;
114
}
115
}
116
}
117
118
return
$this->actions;
119
}
120
128
final
protected
function
getActionById
(
string
$id): ?
Action
129
{
130
if
(empty($id))
131
{
132
return
null
;
133
}
134
135
return
$this->
getActions
()[$id] ??
null
;
136
}
137
145
public
function
processRequest
(
GridRequest
$request
): ?
GridResponse
146
{
147
$result
=
null
;
148
149
if
(!
check_bitrix_sessid
())
150
{
151
return
null
;
152
}
153
154
$actionId =
$request
->getRowActionId();
155
if
(isset($actionId))
156
{
157
$action
= $this->
getActionById
($actionId);
158
if
(
$action
)
159
{
160
$result
=
$action
->processRequest(
$request
->getHttpRequest());
161
}
162
}
163
164
return
165
isset(
$result
)
166
? (
new
GridResponseFactory
)->createFromResult(
$result
)
167
: null
168
;
169
}
170
}
$provider
if(!Loader::includeModule('messageservice')) $provider
Определения
callback_ednaruimhpx.php:21
$request
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения
catalog_reindex.php:36
Bitrix\Main\Grid\Row\Action\DataProvider
Определения
dataprovider.php:8
Bitrix\Main\Grid\Row\RowAssembler
Определения
rowassembler.php:35
Bitrix\Main\Grid\Row\Rows
Определения
rows.php:21
Bitrix\Main\Grid\Row\Rows\processRequest
processRequest(GridRequest $request)
Определения
rows.php:145
Bitrix\Main\Grid\Row\Rows\getActionById
getActionById(string $id)
Определения
rows.php:128
Bitrix\Main\Grid\Row\Rows\prepareRow
prepareRow(array $rawValue)
Определения
rows.php:76
Bitrix\Main\Grid\Row\Rows\__construct
__construct(RowAssembler $rowAssembler, DataProvider ... $actionsProviders)
Определения
rows.php:39
Bitrix\Main\Grid\Row\Rows\$actionsProviders
array $actionsProviders
Определения
rows.php:33
Bitrix\Main\Grid\Row\Rows\prepareRows
prepareRows(iterable $rawRows)
Определения
rows.php:57
Bitrix\Main\Grid\Row\Rows\$rowAssembler
RowAssembler $rowAssembler
Определения
rows.php:28
Bitrix\Main\Grid\Row\Rows\getActions
getActions()
Определения
rows.php:103
Bitrix\Main\Grid\UI\Response\GridResponseFactory
Определения
gridresponsefactory.php:10
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
Bitrix\Main\Grid\GridRequest
Определения
gridrequest.php:17
Bitrix\Main\Grid\GridResponse
Определения
gridresponse.php:13
check_bitrix_sessid
check_bitrix_sessid($varname='sessid')
Определения
tools.php:4686
Bitrix\Main\Grid\Row\Action
Определения
action.php:3
$action
$action
Определения
file_dialog.php:21
bitrix
modules
main
lib
grid
row
rows.php
Создано системой
1.14.0