1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
panel.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\Grid\Panel;
4
5use Bitrix\Main\Filter\Filter;
6use Bitrix\Main\Grid\GridRequest;
7use Bitrix\Main\Grid\GridResponse;
8use Bitrix\Main\Grid\Panel\Action\DataProvider;
9use Bitrix\Main\Grid\Panel\Action\Action;
10use Bitrix\Main\Grid\Panel\Action\GroupAction;
11use Bitrix\Main\Grid\UI\Response\GridResponseFactory;
12
13class 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
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}
if(!Loader::includeModule('messageservice')) $provider
Определения callback_ednaruimhpx.php:21
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
getControls()
Определения panel.php:74
getActionById(string $id)
Определения panel.php:61
__construct(DataProvider ... $providers)
Определения panel.php:31
processRequest(GridRequest $request, ?Filter $filter)
Определения panel.php:97
getActions()
Определения panel.php:43
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$filter
Определения iblock_catalog_list.php:54
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
$action
Определения file_dialog.php:21