1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* Divine CMS - Open source CMS for widespread use. |
4
|
|
|
Copyright (c) 2019 Mykola Burakov ([email protected]) |
5
|
|
|
|
6
|
|
|
See SOURCE.txt for other and additional information. |
7
|
|
|
|
8
|
|
|
This file is part of Divine CMS. |
9
|
|
|
|
10
|
|
|
This program is free software: you can redistribute it and/or modify |
11
|
|
|
it under the terms of the GNU General Public License as published by |
12
|
|
|
the Free Software Foundation, either version 3 of the License, or |
13
|
|
|
(at your option) any later version. |
14
|
|
|
|
15
|
|
|
This program is distributed in the hope that it will be useful, |
16
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18
|
|
|
GNU General Public License for more details. |
19
|
|
|
|
20
|
|
|
You should have received a copy of the GNU General Public License |
21
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
22
|
|
|
|
23
|
|
|
class ControllerLocalisationLocation extends \Divine\Engine\Core\Controller |
|
|
|
|
24
|
|
|
{ |
25
|
|
|
private $error = array(); |
26
|
|
|
|
27
|
|
|
public function index() |
|
|
|
|
28
|
|
|
{ |
29
|
|
|
$this->load->language('localisation/location'); |
30
|
|
|
|
31
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
32
|
|
|
|
33
|
|
|
$this->load->model('localisation/location'); |
34
|
|
|
|
35
|
|
|
$this->getList(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function add() |
39
|
|
|
{ |
40
|
|
|
$this->load->language('localisation/location'); |
41
|
|
|
|
42
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
43
|
|
|
|
44
|
|
|
$this->load->model('localisation/location'); |
45
|
|
|
|
46
|
|
|
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) { |
47
|
|
|
$this->model_localisation_location->addLocation($this->request->post); |
48
|
|
|
|
49
|
|
|
$this->session->data['success'] = $this->language->get('text_success'); |
50
|
|
|
|
51
|
|
|
$url = ''; |
52
|
|
|
|
53
|
|
|
if (isset($this->request->get['sort'])) { |
54
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
if (isset($this->request->get['order'])) { |
58
|
|
|
$url .= '&order=' . $this->request->get['order']; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
if (isset($this->request->get['page'])) { |
62
|
|
|
$url .= '&page=' . $this->request->get['page']; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
$this->response->redirect($this->url->link('localisation/location', 'token=' . $this->session->data['token'] . $url, true)); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
$this->getForm(); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function edit() |
72
|
|
|
{ |
73
|
|
|
$this->load->language('localisation/location'); |
74
|
|
|
|
75
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
76
|
|
|
|
77
|
|
|
$this->load->model('localisation/location'); |
78
|
|
|
|
79
|
|
|
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) { |
80
|
|
|
$this->model_localisation_location->editLocation($this->request->get['location_id'], $this->request->post); |
81
|
|
|
|
82
|
|
|
$this->session->data['success'] = $this->language->get('text_success'); |
83
|
|
|
|
84
|
|
|
$url = ''; |
85
|
|
|
|
86
|
|
|
if (isset($this->request->get['sort'])) { |
87
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
if (isset($this->request->get['order'])) { |
91
|
|
|
$url .= '&order=' . $this->request->get['order']; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
if (isset($this->request->get['page'])) { |
95
|
|
|
$url .= '&page=' . $this->request->get['page']; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
$this->response->redirect($this->url->link('localisation/location', 'token=' . $this->session->data['token'] . $url, true)); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
$this->getForm(); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function delete() |
105
|
|
|
{ |
106
|
|
|
$this->load->language('localisation/location'); |
107
|
|
|
|
108
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
109
|
|
|
|
110
|
|
|
$this->load->model('localisation/location'); |
111
|
|
|
|
112
|
|
|
if (isset($this->request->post['selected']) && $this->validateDelete()) { |
113
|
|
|
foreach ($this->request->post['selected'] as $location_id) { |
114
|
|
|
$this->model_localisation_location->deleteLocation($location_id); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
$this->session->data['success'] = $this->language->get('text_success'); |
118
|
|
|
|
119
|
|
|
$url = ''; |
120
|
|
|
|
121
|
|
|
if (isset($this->request->get['sort'])) { |
122
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
if (isset($this->request->get['order'])) { |
126
|
|
|
$url .= '&order=' . $this->request->get['order']; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
if (isset($this->request->get['page'])) { |
130
|
|
|
$url .= '&page=' . $this->request->get['page']; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
$this->response->redirect($this->url->link('localisation/location', 'token=' . $this->session->data['token'] . $url, true)); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
$this->getList(); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
protected function getList() |
140
|
|
|
{ |
141
|
|
|
if (isset($this->request->get['sort'])) { |
142
|
|
|
$sort = $this->request->get['sort']; |
143
|
|
|
} else { |
144
|
|
|
$sort = 'name'; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
if (isset($this->request->get['order'])) { |
148
|
|
|
$order = $this->request->get['order']; |
149
|
|
|
} else { |
150
|
|
|
$order = 'ASC'; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
if (isset($this->request->get['page'])) { |
154
|
|
|
$page = $this->request->get['page']; |
155
|
|
|
} else { |
156
|
|
|
$page = 1; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
$url = ''; |
160
|
|
|
|
161
|
|
|
if (isset($this->request->get['sort'])) { |
162
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
if (isset($this->request->get['order'])) { |
166
|
|
|
$url .= '&order=' . $this->request->get['order']; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
if (isset($this->request->get['page'])) { |
170
|
|
|
$url .= '&page=' . $this->request->get['page']; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
$data['breadcrumbs'] = array(); |
|
|
|
|
174
|
|
|
|
175
|
|
|
$data['breadcrumbs'][] = array( |
176
|
|
|
'text' => $this->language->get('text_home'), |
177
|
|
|
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true) |
178
|
|
|
); |
179
|
|
|
|
180
|
|
|
$data['breadcrumbs'][] = array( |
181
|
|
|
'text' => $this->language->get('heading_title'), |
182
|
|
|
'href' => $this->url->link('localisation/location', 'token=' . $this->session->data['token'] . $url, true) |
183
|
|
|
); |
184
|
|
|
|
185
|
|
|
$data['add'] = $this->url->link('localisation/location/add', 'token=' . $this->session->data['token'] . $url, true); |
186
|
|
|
$data['delete'] = $this->url->link('localisation/location/delete', 'token=' . $this->session->data['token'] . $url, true); |
187
|
|
|
|
188
|
|
|
$data['location'] = array(); |
189
|
|
|
|
190
|
|
|
$filter_data = array( |
191
|
|
|
'sort' => $sort, |
192
|
|
|
'order' => $order, |
193
|
|
|
'start' => ($page - 1) * $this->config->get('config_limit_admin'), |
194
|
|
|
'limit' => $this->config->get('config_limit_admin') |
195
|
|
|
); |
196
|
|
|
|
197
|
|
|
$location_total = $this->model_localisation_location->getTotalLocations(); |
198
|
|
|
|
199
|
|
|
$results = $this->model_localisation_location->getLocations($filter_data); |
200
|
|
|
|
201
|
|
|
foreach ($results as $result) { |
202
|
|
|
$data['location'][] = array( |
203
|
|
|
'location_id' => $result['location_id'], |
204
|
|
|
'name' => $result['name'], |
205
|
|
|
'address' => $result['address'], |
206
|
|
|
'edit' => $this->url->link('localisation/location/edit', 'token=' . $this->session->data['token'] . '&location_id=' . $result['location_id'] . $url, true) |
207
|
|
|
); |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
$data['heading_title'] = $this->language->get('heading_title'); |
211
|
|
|
|
212
|
|
|
$data['text_list'] = $this->language->get('text_list'); |
213
|
|
|
$data['text_no_results'] = $this->language->get('text_no_results'); |
214
|
|
|
$data['text_confirm'] = $this->language->get('text_confirm'); |
215
|
|
|
|
216
|
|
|
$data['column_name'] = $this->language->get('column_name'); |
217
|
|
|
$data['column_address'] = $this->language->get('column_address'); |
218
|
|
|
$data['column_action'] = $this->language->get('column_action'); |
219
|
|
|
|
220
|
|
|
$data['button_add'] = $this->language->get('button_add'); |
221
|
|
|
$data['button_edit'] = $this->language->get('button_edit'); |
222
|
|
|
$data['button_delete'] = $this->language->get('button_delete'); |
223
|
|
|
|
224
|
|
|
if (isset($this->error['warning'])) { |
225
|
|
|
$data['error_warning'] = $this->error['warning']; |
226
|
|
|
} else { |
227
|
|
|
$data['error_warning'] = ''; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
if (isset($this->session->data['success'])) { |
231
|
|
|
$data['success'] = $this->session->data['success']; |
232
|
|
|
|
233
|
|
|
unset($this->session->data['success']); |
234
|
|
|
} else { |
235
|
|
|
$data['success'] = ''; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
if (isset($this->request->post['selected'])) { |
239
|
|
|
$data['selected'] = (array)$this->request->post['selected']; |
240
|
|
|
} else { |
241
|
|
|
$data['selected'] = array(); |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
$url = ''; |
245
|
|
|
|
246
|
|
|
if ($order == 'ASC') { |
247
|
|
|
$url .= '&order=DESC'; |
248
|
|
|
} else { |
249
|
|
|
$url .= '&order=ASC'; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
if (isset($this->request->get['page'])) { |
253
|
|
|
$url .= '&page=' . $this->request->get['page']; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
$data['sort_name'] = $this->url->link('localisation/location', 'token=' . $this->session->data['token'] . '&sort=name' . $url, true); |
257
|
|
|
$data['sort_address'] = $this->url->link('localisation/location', 'token=' . $this->session->data['token'] . '&sort=address' . $url, true); |
258
|
|
|
|
259
|
|
|
$url = ''; |
260
|
|
|
|
261
|
|
|
if (isset($this->request->get['sort'])) { |
262
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
if (isset($this->request->get['order'])) { |
266
|
|
|
$url .= '&order=' . $this->request->get['order']; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
$pagination = new \Divine\Engine\Library\Pagination(); |
270
|
|
|
$pagination->total = $location_total; |
271
|
|
|
$pagination->page = $page; |
272
|
|
|
$pagination->limit = $this->config->get('config_limit_admin'); |
273
|
|
|
$pagination->url = $this->url->link('localisation/location', 'token=' . $this->session->data['token'] . $url . '&page={page}', true); |
274
|
|
|
|
275
|
|
|
$data['pagination'] = $pagination->render(); |
276
|
|
|
|
277
|
|
|
$data['results'] = sprintf($this->language->get('text_pagination'), ($location_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($location_total - $this->config->get('config_limit_admin'))) ? $location_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $location_total, ceil($location_total / $this->config->get('config_limit_admin'))); |
278
|
|
|
|
279
|
|
|
$data['sort'] = $sort; |
280
|
|
|
$data['order'] = $order; |
281
|
|
|
|
282
|
|
|
$data['header'] = $this->load->controller('common/header'); |
283
|
|
|
$data['column'] = $this->load->controller('common/column_left'); |
284
|
|
|
$data['footer'] = $this->load->controller('common/footer'); |
285
|
|
|
|
286
|
|
|
$this->response->setOutput($this->load->view('localisation/location_list', $data)); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
protected function getForm() |
290
|
|
|
{ |
291
|
|
|
$data['heading_title'] = $this->language->get('heading_title'); |
|
|
|
|
292
|
|
|
|
293
|
|
|
$data['text_form'] = !isset($this->request->get['location_id']) ? $this->language->get('text_add') : $this->language->get('text_edit'); |
294
|
|
|
$data['text_select'] = $this->language->get('text_select'); |
295
|
|
|
$data['text_none'] = $this->language->get('text_none'); |
296
|
|
|
$data['text_default'] = $this->language->get('text_default'); |
297
|
|
|
$data['text_geocode'] = $this->language->get('text_geocode'); |
298
|
|
|
|
299
|
|
|
$data['entry_name'] = $this->language->get('entry_name'); |
300
|
|
|
$data['entry_address'] = $this->language->get('entry_address'); |
301
|
|
|
$data['entry_geocode'] = $this->language->get('entry_geocode'); |
302
|
|
|
$data['entry_telephone'] = $this->language->get('entry_telephone'); |
303
|
|
|
$data['entry_fax'] = $this->language->get('entry_fax'); |
304
|
|
|
$data['entry_image'] = $this->language->get('entry_image'); |
305
|
|
|
$data['entry_open'] = $this->language->get('entry_open'); |
306
|
|
|
$data['entry_comment'] = $this->language->get('entry_comment'); |
307
|
|
|
|
308
|
|
|
$data['help_geocode'] = $this->language->get('help_geocode'); |
309
|
|
|
$data['help_open'] = $this->language->get('help_open'); |
310
|
|
|
$data['help_comment'] = $this->language->get('help_comment'); |
311
|
|
|
|
312
|
|
|
$data['button_save'] = $this->language->get('button_save'); |
313
|
|
|
$data['button_cancel'] = $this->language->get('button_cancel'); |
314
|
|
|
|
315
|
|
|
if (isset($this->error['warning'])) { |
316
|
|
|
$data['error_warning'] = $this->error['warning']; |
317
|
|
|
} else { |
318
|
|
|
$data['error_warning'] = ''; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
if (isset($this->error['name'])) { |
322
|
|
|
$data['error_name'] = $this->error['name']; |
323
|
|
|
} else { |
324
|
|
|
$data['error_name'] = ''; |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
if (isset($this->error['address'])) { |
328
|
|
|
$data['error_address'] = $this->error['address']; |
329
|
|
|
} else { |
330
|
|
|
$data['error_address'] = ''; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
if (isset($this->error['telephone'])) { |
334
|
|
|
$data['error_telephone'] = $this->error['telephone']; |
335
|
|
|
} else { |
336
|
|
|
$data['error_telephone'] = ''; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
$url = ''; |
340
|
|
|
|
341
|
|
|
if (isset($this->request->get['sort'])) { |
342
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
if (isset($this->request->get['order'])) { |
346
|
|
|
$url .= '&order=' . $this->request->get['order']; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
if (isset($this->request->get['page'])) { |
350
|
|
|
$url .= '&page=' . $this->request->get['page']; |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
$data['breadcrumbs'] = array(); |
354
|
|
|
|
355
|
|
|
$data['breadcrumbs'][] = array( |
356
|
|
|
'text' => $this->language->get('text_home'), |
357
|
|
|
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true) |
358
|
|
|
); |
359
|
|
|
|
360
|
|
|
$data['breadcrumbs'][] = array( |
361
|
|
|
'text' => $this->language->get('heading_title'), |
362
|
|
|
'href' => $this->url->link('localisation/location', 'token=' . $this->session->data['token'] . $url, true) |
363
|
|
|
); |
364
|
|
|
|
365
|
|
|
if (!isset($this->request->get['location_id'])) { |
366
|
|
|
$data['action'] = $this->url->link('localisation/location/add', 'token=' . $this->session->data['token'] . $url, true); |
367
|
|
|
} else { |
368
|
|
|
$data['action'] = $this->url->link('localisation/location/edit', 'token=' . $this->session->data['token'] . '&location_id=' . $this->request->get['location_id'] . $url, true); |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
$data['cancel'] = $this->url->link('localisation/location', 'token=' . $this->session->data['token'] . $url, true); |
372
|
|
|
|
373
|
|
|
if (isset($this->request->get['location_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { |
374
|
|
|
$location_info = $this->model_localisation_location->getLocation($this->request->get['location_id']); |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
$data['token'] = $this->session->data['token']; |
378
|
|
|
|
379
|
|
|
if (isset($this->request->post['name'])) { |
380
|
|
|
$data['name'] = $this->request->post['name']; |
381
|
|
|
} elseif (!empty($location_info)) { |
382
|
|
|
$data['name'] = $location_info['name']; |
383
|
|
|
} else { |
384
|
|
|
$data['name'] = ''; |
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
if (isset($this->request->post['address'])) { |
388
|
|
|
$data['address'] = $this->request->post['address']; |
389
|
|
|
} elseif (!empty($location_info)) { |
390
|
|
|
$data['address'] = $location_info['address']; |
391
|
|
|
} else { |
392
|
|
|
$data['address'] = ''; |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
if (isset($this->request->post['geocode'])) { |
396
|
|
|
$data['geocode'] = $this->request->post['geocode']; |
397
|
|
|
} elseif (!empty($location_info)) { |
398
|
|
|
$data['geocode'] = $location_info['geocode']; |
399
|
|
|
} else { |
400
|
|
|
$data['geocode'] = ''; |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
if (isset($this->request->post['telephone'])) { |
404
|
|
|
$data['telephone'] = $this->request->post['telephone']; |
405
|
|
|
} elseif (!empty($location_info)) { |
406
|
|
|
$data['telephone'] = $location_info['telephone']; |
407
|
|
|
} else { |
408
|
|
|
$data['telephone'] = ''; |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
if (isset($this->request->post['fax'])) { |
412
|
|
|
$data['fax'] = $this->request->post['fax']; |
413
|
|
|
} elseif (!empty($location_info)) { |
414
|
|
|
$data['fax'] = $location_info['fax']; |
415
|
|
|
} else { |
416
|
|
|
$data['fax'] = ''; |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
if (isset($this->request->post['image'])) { |
420
|
|
|
$data['image'] = $this->request->post['image']; |
421
|
|
|
} elseif (!empty($location_info)) { |
422
|
|
|
$data['image'] = $location_info['image']; |
423
|
|
|
} else { |
424
|
|
|
$data['image'] = ''; |
425
|
|
|
} |
426
|
|
|
|
427
|
|
|
|
428
|
|
|
|
429
|
|
|
if (isset($this->request->post['image']) && is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $this->request->post['image'])) { |
430
|
|
|
$data['thumb'] = '/public_html/assets/images/' . $this->request->post['image']; |
431
|
|
|
} elseif (!empty($location_info) && is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $location_info['image'])) { |
432
|
|
|
$data['thumb'] = '/public_html/assets/images/' . $location_info['image']; |
433
|
|
|
} else { |
434
|
|
|
$data['thumb'] = '/public_html/assets/images/no_image.png'; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
$data['placeholder'] = '/public_html/assets/images/no_image.png'; |
438
|
|
|
|
439
|
|
|
if (isset($this->request->post['open'])) { |
440
|
|
|
$data['open'] = $this->request->post['open']; |
441
|
|
|
} elseif (!empty($location_info)) { |
442
|
|
|
$data['open'] = $location_info['open']; |
443
|
|
|
} else { |
444
|
|
|
$data['open'] = ''; |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
if (isset($this->request->post['comment'])) { |
448
|
|
|
$data['comment'] = $this->request->post['comment']; |
449
|
|
|
} elseif (!empty($location_info)) { |
450
|
|
|
$data['comment'] = $location_info['comment']; |
451
|
|
|
} else { |
452
|
|
|
$data['comment'] = ''; |
453
|
|
|
} |
454
|
|
|
|
455
|
|
|
$data['header'] = $this->load->controller('common/header'); |
456
|
|
|
$data['column'] = $this->load->controller('common/column_left'); |
457
|
|
|
$data['footer'] = $this->load->controller('common/footer'); |
458
|
|
|
|
459
|
|
|
$this->response->setOutput($this->load->view('localisation/location_form', $data)); |
460
|
|
|
} |
461
|
|
|
|
462
|
|
|
protected function validateForm() |
463
|
|
|
{ |
464
|
|
|
if (!$this->user->hasPermission('modify', 'localisation/location')) { |
465
|
|
|
$this->error['warning'] = $this->language->get('error_permission'); |
466
|
|
|
} |
467
|
|
|
|
468
|
|
|
if ((\voku\helper\UTF8::strlen($this->request->post['name']) < 3) || (\voku\helper\UTF8::strlen($this->request->post['name']) > 32)) { |
469
|
|
|
$this->error['name'] = $this->language->get('error_name'); |
470
|
|
|
} |
471
|
|
|
|
472
|
|
|
if ((\voku\helper\UTF8::strlen($this->request->post['address']) < 3) || (\voku\helper\UTF8::strlen($this->request->post['address']) > 128)) { |
473
|
|
|
$this->error['address'] = $this->language->get('error_address'); |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
if ((\voku\helper\UTF8::strlen($this->request->post['telephone']) < 3) || (\voku\helper\UTF8::strlen($this->request->post['telephone']) > 32)) { |
477
|
|
|
$this->error['telephone'] = $this->language->get('error_telephone'); |
478
|
|
|
} |
479
|
|
|
|
480
|
|
|
return !$this->error; |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
protected function validateDelete() |
484
|
|
|
{ |
485
|
|
|
if (!$this->user->hasPermission('modify', 'localisation/location')) { |
486
|
|
|
$this->error['warning'] = $this->language->get('error_permission'); |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
return !$this->error; |
490
|
|
|
} |
491
|
|
|
} |
492
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.