|
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 ControllerDesignBanner extends \Divine\Engine\Core\Controller |
|
|
|
|
|
|
24
|
|
|
{ |
|
25
|
|
|
private $error = array(); |
|
26
|
|
|
|
|
27
|
|
|
public function index() |
|
|
|
|
|
|
28
|
|
|
{ |
|
29
|
|
|
$this->load->language('design/banner'); |
|
30
|
|
|
|
|
31
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
|
32
|
|
|
|
|
33
|
|
|
$this->load->model('design/banner'); |
|
34
|
|
|
|
|
35
|
|
|
$this->getList(); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function add() |
|
39
|
|
|
{ |
|
40
|
|
|
$this->load->language('design/banner'); |
|
41
|
|
|
|
|
42
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
|
43
|
|
|
|
|
44
|
|
|
$this->load->model('design/banner'); |
|
45
|
|
|
|
|
46
|
|
|
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) { |
|
47
|
|
|
$this->model_design_banner->addBanner($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('design/banner', 'token=' . $this->session->data['token'] . $url, true)); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
$this->getForm(); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function edit() |
|
72
|
|
|
{ |
|
73
|
|
|
$this->load->language('design/banner'); |
|
74
|
|
|
|
|
75
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
|
76
|
|
|
|
|
77
|
|
|
$this->load->model('design/banner'); |
|
78
|
|
|
|
|
79
|
|
|
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) { |
|
80
|
|
|
$this->model_design_banner->editBanner($this->request->get['banner_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('design/banner', 'token=' . $this->session->data['token'] . $url, true)); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
$this->getForm(); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function delete() |
|
105
|
|
|
{ |
|
106
|
|
|
$this->load->language('design/banner'); |
|
107
|
|
|
|
|
108
|
|
|
$this->document->setTitle($this->language->get('heading_title')); |
|
109
|
|
|
|
|
110
|
|
|
$this->load->model('design/banner'); |
|
111
|
|
|
|
|
112
|
|
|
if (isset($this->request->post['selected']) && $this->validateDelete()) { |
|
113
|
|
|
foreach ($this->request->post['selected'] as $banner_id) { |
|
114
|
|
|
$this->model_design_banner->deleteBanner($banner_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('design/banner', '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('design/banner', 'token=' . $this->session->data['token'] . $url, true) |
|
183
|
|
|
); |
|
184
|
|
|
|
|
185
|
|
|
$data['add'] = $this->url->link('design/banner/add', 'token=' . $this->session->data['token'] . $url, true); |
|
186
|
|
|
$data['delete'] = $this->url->link('design/banner/delete', 'token=' . $this->session->data['token'] . $url, true); |
|
187
|
|
|
|
|
188
|
|
|
$data['banners'] = 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
|
|
|
$banner_total = $this->model_design_banner->getTotalBanners(); |
|
198
|
|
|
|
|
199
|
|
|
$results = $this->model_design_banner->getBanners($filter_data); |
|
200
|
|
|
|
|
201
|
|
|
foreach ($results as $result) { |
|
202
|
|
|
$data['banners'][] = array( |
|
203
|
|
|
'banner_id' => $result['banner_id'], |
|
204
|
|
|
'name' => $result['name'], |
|
205
|
|
|
'status' => ($result['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled')), |
|
206
|
|
|
'edit' => $this->url->link('design/banner/edit', 'token=' . $this->session->data['token'] . '&banner_id=' . $result['banner_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_status'] = $this->language->get('column_status'); |
|
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('design/banner', 'token=' . $this->session->data['token'] . '&sort=name' . $url, true); |
|
257
|
|
|
$data['sort_status'] = $this->url->link('design/banner', 'token=' . $this->session->data['token'] . '&sort=status' . $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 = $banner_total; |
|
271
|
|
|
$pagination->page = $page; |
|
272
|
|
|
$pagination->limit = $this->config->get('config_limit_admin'); |
|
273
|
|
|
$pagination->url = $this->url->link('design/banner', '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'), ($banner_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($banner_total - $this->config->get('config_limit_admin'))) ? $banner_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $banner_total, ceil($banner_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('design/banner_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['banner_id']) ? $this->language->get('text_add') : $this->language->get('text_edit'); |
|
294
|
|
|
$data['text_enabled'] = $this->language->get('text_enabled'); |
|
295
|
|
|
$data['text_disabled'] = $this->language->get('text_disabled'); |
|
296
|
|
|
$data['text_default'] = $this->language->get('text_default'); |
|
297
|
|
|
|
|
298
|
|
|
$data['entry_name'] = $this->language->get('entry_name'); |
|
299
|
|
|
$data['entry_title'] = $this->language->get('entry_title'); |
|
300
|
|
|
$data['entry_link'] = $this->language->get('entry_link'); |
|
301
|
|
|
$data['entry_image'] = $this->language->get('entry_image'); |
|
302
|
|
|
$data['entry_status'] = $this->language->get('entry_status'); |
|
303
|
|
|
$data['entry_sort_order'] = $this->language->get('entry_sort_order'); |
|
304
|
|
|
|
|
305
|
|
|
$data['button_save'] = $this->language->get('button_save'); |
|
306
|
|
|
$data['button_cancel'] = $this->language->get('button_cancel'); |
|
307
|
|
|
$data['button_banner_add'] = $this->language->get('button_banner_add'); |
|
308
|
|
|
$data['button_remove'] = $this->language->get('button_remove'); |
|
309
|
|
|
|
|
310
|
|
|
if (isset($this->error['warning'])) { |
|
311
|
|
|
$data['error_warning'] = $this->error['warning']; |
|
312
|
|
|
} else { |
|
313
|
|
|
$data['error_warning'] = ''; |
|
314
|
|
|
} |
|
315
|
|
|
|
|
316
|
|
|
if (isset($this->error['name'])) { |
|
317
|
|
|
$data['error_name'] = $this->error['name']; |
|
318
|
|
|
} else { |
|
319
|
|
|
$data['error_name'] = ''; |
|
320
|
|
|
} |
|
321
|
|
|
|
|
322
|
|
|
if (isset($this->error['banner_image'])) { |
|
323
|
|
|
$data['error_banner_image'] = $this->error['banner_image']; |
|
324
|
|
|
} else { |
|
325
|
|
|
$data['error_banner_image'] = array(); |
|
326
|
|
|
} |
|
327
|
|
|
|
|
328
|
|
|
$url = ''; |
|
329
|
|
|
|
|
330
|
|
|
if (isset($this->request->get['sort'])) { |
|
331
|
|
|
$url .= '&sort=' . $this->request->get['sort']; |
|
332
|
|
|
} |
|
333
|
|
|
|
|
334
|
|
|
if (isset($this->request->get['order'])) { |
|
335
|
|
|
$url .= '&order=' . $this->request->get['order']; |
|
336
|
|
|
} |
|
337
|
|
|
|
|
338
|
|
|
if (isset($this->request->get['page'])) { |
|
339
|
|
|
$url .= '&page=' . $this->request->get['page']; |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
$data['breadcrumbs'] = array(); |
|
343
|
|
|
|
|
344
|
|
|
$data['breadcrumbs'][] = array( |
|
345
|
|
|
'text' => $this->language->get('text_home'), |
|
346
|
|
|
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true) |
|
347
|
|
|
); |
|
348
|
|
|
|
|
349
|
|
|
$data['breadcrumbs'][] = array( |
|
350
|
|
|
'text' => $this->language->get('heading_title'), |
|
351
|
|
|
'href' => $this->url->link('design/banner', 'token=' . $this->session->data['token'] . $url, true) |
|
352
|
|
|
); |
|
353
|
|
|
|
|
354
|
|
|
if (!isset($this->request->get['banner_id'])) { |
|
355
|
|
|
$data['action'] = $this->url->link('design/banner/add', 'token=' . $this->session->data['token'] . $url, true); |
|
356
|
|
|
} else { |
|
357
|
|
|
$data['action'] = $this->url->link('design/banner/edit', 'token=' . $this->session->data['token'] . '&banner_id=' . $this->request->get['banner_id'] . $url, true); |
|
358
|
|
|
} |
|
359
|
|
|
|
|
360
|
|
|
$data['cancel'] = $this->url->link('design/banner', 'token=' . $this->session->data['token'] . $url, true); |
|
361
|
|
|
|
|
362
|
|
|
if (isset($this->request->get['banner_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) { |
|
363
|
|
|
$banner_info = $this->model_design_banner->getBanner($this->request->get['banner_id']); |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
$data['token'] = $this->session->data['token']; |
|
367
|
|
|
|
|
368
|
|
|
if (isset($this->request->post['name'])) { |
|
369
|
|
|
$data['name'] = $this->request->post['name']; |
|
370
|
|
|
} elseif (!empty($banner_info)) { |
|
371
|
|
|
$data['name'] = $banner_info['name']; |
|
372
|
|
|
} else { |
|
373
|
|
|
$data['name'] = ''; |
|
374
|
|
|
} |
|
375
|
|
|
|
|
376
|
|
|
if (isset($this->request->post['status'])) { |
|
377
|
|
|
$data['status'] = $this->request->post['status']; |
|
378
|
|
|
} elseif (!empty($banner_info)) { |
|
379
|
|
|
$data['status'] = $banner_info['status']; |
|
380
|
|
|
} else { |
|
381
|
|
|
$data['status'] = true; |
|
382
|
|
|
} |
|
383
|
|
|
|
|
384
|
|
|
$this->load->model('localisation/language'); |
|
385
|
|
|
|
|
386
|
|
|
$data['languages'] = $this->model_localisation_language->getLanguages(); |
|
387
|
|
|
|
|
388
|
|
|
|
|
389
|
|
|
|
|
390
|
|
|
if (isset($this->request->post['banner_image'])) { |
|
391
|
|
|
$banner_images = $this->request->post['banner_image']; |
|
392
|
|
|
} elseif (isset($this->request->get['banner_id'])) { |
|
393
|
|
|
$banner_images = $this->model_design_banner->getBannerImages($this->request->get['banner_id']); |
|
394
|
|
|
} else { |
|
395
|
|
|
$banner_images = array(); |
|
396
|
|
|
} |
|
397
|
|
|
|
|
398
|
|
|
$data['banner_images'] = array(); |
|
399
|
|
|
|
|
400
|
|
|
foreach ($banner_images as $key => $value) { |
|
401
|
|
|
foreach ($value as $banner_image) { |
|
402
|
|
|
if (is_file($_SERVER['DOCUMENT_ROOT'] . '/public_html/assets/images/' . $banner_image['image'])) { |
|
403
|
|
|
$image = $banner_image['image']; |
|
404
|
|
|
$thumb = $banner_image['image']; |
|
405
|
|
|
} else { |
|
406
|
|
|
$image = ''; |
|
407
|
|
|
$thumb = 'no_image.png'; |
|
408
|
|
|
} |
|
409
|
|
|
|
|
410
|
|
|
$data['banner_images'][$key][] = array( |
|
411
|
|
|
'title' => $banner_image['title'], |
|
412
|
|
|
'link' => $banner_image['link'], |
|
413
|
|
|
'image' => $image, |
|
414
|
|
|
'thumb' => '/public_html/assets/images/' . $thumb, |
|
415
|
|
|
'sort_order' => $banner_image['sort_order'] |
|
416
|
|
|
); |
|
417
|
|
|
} |
|
418
|
|
|
} |
|
419
|
|
|
|
|
420
|
|
|
$data['placeholder'] = '/public_html/assets/images/no_image.png'; |
|
421
|
|
|
|
|
422
|
|
|
$data['header'] = $this->load->controller('common/header'); |
|
423
|
|
|
$data['column'] = $this->load->controller('common/column_left'); |
|
424
|
|
|
$data['footer'] = $this->load->controller('common/footer'); |
|
425
|
|
|
|
|
426
|
|
|
$this->response->setOutput($this->load->view('design/banner_form', $data)); |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
|
|
protected function validateForm() |
|
430
|
|
|
{ |
|
431
|
|
|
if (!$this->user->hasPermission('modify', 'design/banner')) { |
|
432
|
|
|
$this->error['warning'] = $this->language->get('error_permission'); |
|
433
|
|
|
} |
|
434
|
|
|
|
|
435
|
|
|
if ((\voku\helper\UTF8::strlen($this->request->post['name']) < 3) || (\voku\helper\UTF8::strlen($this->request->post['name']) > 64)) { |
|
436
|
|
|
$this->error['name'] = $this->language->get('error_name'); |
|
437
|
|
|
} |
|
438
|
|
|
|
|
439
|
|
|
if (isset($this->request->post['banner_image'])) { |
|
440
|
|
|
foreach ($this->request->post['banner_image'] as $language_id => $value) { |
|
441
|
|
|
foreach ($value as $banner_image_id => $banner_image) { |
|
442
|
|
|
if ((\voku\helper\UTF8::strlen($banner_image['title']) < 2) || (\voku\helper\UTF8::strlen($banner_image['title']) > 64)) { |
|
443
|
|
|
$this->error['banner_image'][$language_id][$banner_image_id] = $this->language->get('error_title'); |
|
444
|
|
|
} |
|
445
|
|
|
} |
|
446
|
|
|
} |
|
447
|
|
|
} |
|
448
|
|
|
|
|
449
|
|
|
return !$this->error; |
|
450
|
|
|
} |
|
451
|
|
|
|
|
452
|
|
|
protected function validateDelete() |
|
453
|
|
|
{ |
|
454
|
|
|
if (!$this->user->hasPermission('modify', 'design/banner')) { |
|
455
|
|
|
$this->error['warning'] = $this->language->get('error_permission'); |
|
456
|
|
|
} |
|
457
|
|
|
|
|
458
|
|
|
return !$this->error; |
|
459
|
|
|
} |
|
460
|
|
|
} |
|
461
|
|
|
|
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.