Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
storedataprovider.php
1<?php
2
4
8
10{
11 public function getSettings()
12 {
13 // TODO: Implement getSettings() method.
14 }
15
16 public function prepareFields()
17 {
18 $fields = [
19 'ID' => $this->createField('ID', [
20 "name" => "ID",
21 "type" => "number",
22 "default" => true
23 ]),
24 'SITE_ID' => $this->createField('SITE_ID', [
25 "name" => Loc::getMessage("STORE_SITE_ID"),
26 "type" => "list",
27 'partial' => true,
28 ]),
29 'ACTIVE' => $this->createField('ACTIVE', [
30 "name" => Loc::getMessage("STORE_ACTIVE"),
31 "type" => "list",
32 'partial' => true,
33 ]),
34 'IS_DEFAULT' => $this->createField('IS_DEFAULT', [
35 "name" => Loc::getMessage("IS_DEFAULT"),
36 "type" => "list",
37 'partial' => true,
38 ]),
39 'TITLE' => $this->createField('TITLE', [
40 "name" => Loc::getMessage("TITLE"),
41 'partial' => true,
42 ]),
43 'CODE' => $this->createField('CODE', [
44 "name" => Loc::getMessage("STORE_CODE"),
45 ]),
46 'XML_ID' => $this->createField('XML_ID', [
47 "name" => Loc::getMessage("STORE_XML_ID"),
48 ]),
49 'ISSUING_CENTER' => $this->createField('ISSUING_CENTER', [
50 "name" => Loc::getMessage("ISSUING_CENTER"),
51 "type" => "list",
52 'partial' => true,
53 ]),
54 'SHIPPING_CENTER' => $this->createField('SHIPPING_CENTER', [
55 "name" => Loc::getMessage("SHIPPING_CENTER"),
56 "type" => "list",
57 'partial' => true,
58 ]),
59 'ADDRESS' => $this->createField('ADDRESS', [
60 "name" => Loc::getMessage("ADDRESS"),
61 'partial' => true,
62 ]),
63 'PHONE' => $this->createField('PHONE', [
64 "name" => Loc::getMessage("PHONE"),
65 'partial' => true,
66 ]),
67 'EMAIL' => $this->createField('EMAIL', [
68 "id" => "",
69 "name" => "E-mail",
70 'partial' => true,
71 ]),
72 ];
73
74 if (!$this->allowedShippingCenterField())
75 {
76 unset($fields['SHIPPING_CENTER']);
77 }
78
79 return $fields;
80 }
81
82 protected function getFieldName($fieldID)
83 {
84 return Loc::getMessage("STORE_{$fieldID}_NAME");
85 }
86
87 public function prepareFieldData($fieldID)
88 {
89 $checkboxFields = ['ACTIVE', 'ISSUING_CENTER', 'IS_DEFAULT'];
90 if ($this->allowedShippingCenterField())
91 {
92 $checkboxFields[] = 'SHIPPING_CENTER';
93 }
94 if (in_array($fieldID, $checkboxFields))
95 {
96 return [
97 'items' => [
98 "Y" => Loc::getMessage('MAIN_YES'),
99 "N" => Loc::getMessage('MAIN_NO'),
100 ]
101 ];
102 }
103
104 if ($fieldID === 'SITE_ID')
105 {
106 $listSite = [];
107 $sitesQueryObject = \CSite::getList("sort", "asc", ["ACTIVE" => "Y"]);
108 while ($site = $sitesQueryObject->fetch())
109 {
110 $listSite[$site["LID"]] = $site["NAME"]." [".$site["LID"]."]";
111 }
112
113 return ['items' => $listSite];
114 }
115 }
116
117 public function getGridColumns()
118 {
119 $columns = [];
120 $columns[] = [
121 "id" => "ID",
122 "name" => "ID",
123 "sort" => "ID",
124 "default" => true
125 ];
126 $columns[] = [
127 "id" => "SORT",
128 "name" => Loc::getMessage("CSTORE_SORT"),
129 "sort" => "SORT",
130 "default" => true
131 ];
132 $columns[] = [
133 "id" => "TITLE",
134 "name" => Loc::getMessage("TITLE"),
135 "sort" => "TITLE",
136 "default" => true,
137 'width' => 175,
138 ];
139 $columns[] = [
140 "id" => "ACTIVE",
141 "name" => Loc::getMessage("STORE_ACTIVE"),
142 "sort" => "ACTIVE",
143 "default" => true
144 ];
145 $columns[] = [
146 "id" => "IS_DEFAULT",
147 "name" => Loc::getMessage("IS_DEFAULT"),
148 "sort" => "IS_DEFAULT",
149 "default" => true
150 ];
151 $columns[] = [
152 "id" => "ADDRESS",
153 "name" => Loc::getMessage("ADDRESS"),
154 "sort" => "",
155 "default" => true
156 ];
157 $columns[] = [
158 "id" => "IMAGE_ID",
159 "name" => Loc::getMessage("STORE_IMAGE"),
160 "sort" => "",
161 "default" => false
162 ];
163 $columns[] = [
164 "id" => "DESCRIPTION",
165 "name" => Loc::getMessage("DESCRIPTION"),
166 "sort" => "",
167 "default" => true
168 ];
169 $columns[] = [
170 "id" => "GPS_N",
171 "name" => Loc::getMessage("GPS_N"),
172 "sort" => "GPS_N",
173 "default" => false
174 ];
175 $columns[] = [
176 "id" => "GPS_S",
177 "name" => Loc::getMessage("GPS_S"),
178 "sort" => "GPS_S",
179 "default" => false
180 ];
181 $columns[] = [
182 "id" => "PHONE",
183 "name" => Loc::getMessage("PHONE"),
184 "sort" => "",
185 "default" => true
186 ];
187 $columns[] = [
188 "id" => "SCHEDULE",
189 "name" => Loc::getMessage("SCHEDULE"),
190 "sort" => "",
191 "default" => true
192 ];
193 $columns[] = [
194 "id" => "DATE_MODIFY",
195 "name" => Loc::getMessage("DATE_MODIFY"),
196 "sort" => "DATE_MODIFY",
197 "default" => true
198 ];
199 $columns[] = [
200 "id" => "MODIFIED_BY",
201 "name" => Loc::getMessage("MODIFIED_BY"),
202 "sort" => "MODIFIED_BY",
203 "default" => true
204 ];
205 $columns[] = [
206 "id" => "DATE_CREATE",
207 "name" => Loc::getMessage("DATE_CREATE"),
208 "sort" => "DATE_CREATE",
209 "default" => false
210 ];
211 $columns[] = [
212 "id" => "USER_ID",
213 "name" => Loc::getMessage("USER_ID"),
214 "sort" => "USER_ID",
215 "default" => false
216 ];
217 $columns[] = [
218 "id" => "EMAIL",
219 "name" => "E-mail",
220 "sort" => "EMAIL",
221 "default" => false
222 ];
223 $columns[] = [
224 "id" => "ISSUING_CENTER",
225 "name" => Loc::getMessage("ISSUING_CENTER"),
226 "sort" => "ISSUING_CENTER",
227 "default" => false
228 ];
229 if ($this->allowedShippingCenterField())
230 {
231 $columns[] = [
232 "id" => "SHIPPING_CENTER",
233 "name" => Loc::getMessage("SHIPPING_CENTER"),
234 "sort" => "SHIPPING_CENTER",
235 "default" => false
236 ];
237 }
238 $columns[] = [
239 "id" => "SITE_ID",
240 "name" => Loc::getMessage("STORE_SITE_ID"),
241 "sort" => "SITE_ID",
242 "default" => true
243 ];
244 $columns[] = [
245 "id" => "CODE",
246 "name" => Loc::getMessage("STORE_CODE"),
247 "sort" => "CODE",
248 "default" => false
249 ];
250 $columns[] = [
251 "id" => "XML_ID",
252 "name" => Loc::getMessage("STORE_XML_ID"),
253 "sort" => "XML_ID",
254 "default" => false
255 ];
256
257 return $columns;
258 }
259
260 protected function allowedShippingCenterField(): bool
261 {
262 return \CCatalogStoreControlUtil::isAllowShowShippingCenter();
263 }
264}
createField($fieldID, array $params=null)
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29