|
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 ModelDesignCustomMenu extends \Divine\Engine\Core\Model |
|
|
|
|
|
|
24
|
|
|
{ |
|
25
|
|
|
public function getcustommenus() |
|
|
|
|
|
|
26
|
|
|
{ |
|
27
|
|
|
$data = array(); |
|
28
|
|
|
|
|
29
|
|
|
$sql = " |
|
30
|
|
|
SELECT * |
|
31
|
|
|
FROM `custommenu` m |
|
32
|
|
|
LEFT JOIN custommenu_description md ON (m.custommenu_id = md.custommenu_id) |
|
33
|
|
|
WHERE md.language_id = '" . (int)$this->config->get('config_language_id') . "' |
|
34
|
|
|
ORDER BY m.sort_order |
|
35
|
|
|
"; |
|
36
|
|
|
|
|
37
|
|
|
$query = $this->db->query($sql); |
|
38
|
|
|
|
|
39
|
|
|
if ($query->rows) { |
|
40
|
|
|
foreach ($query->rows as $custommenu) { |
|
41
|
|
|
$data[$custommenu['custommenu_id']] = $custommenu; |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
return $data; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function getChildcustommenus() |
|
49
|
|
|
{ |
|
50
|
|
|
$data = array(); |
|
51
|
|
|
|
|
52
|
|
|
$sql = " |
|
53
|
|
|
SELECT * |
|
54
|
|
|
FROM `custommenu_child` mc |
|
55
|
|
|
LEFT JOIN custommenu_child_description mcd ON (mc.custommenu_child_id = mcd.custommenu_child_id) |
|
56
|
|
|
WHERE mcd.language_id = '" . (int)$this->config->get('config_language_id') . "' |
|
57
|
|
|
ORDER BY mc.sort_order |
|
58
|
|
|
"; |
|
59
|
|
|
|
|
60
|
|
|
$query = $this->db->query($sql); |
|
61
|
|
|
|
|
62
|
|
|
if ($query->rows) { |
|
63
|
|
|
foreach ($query->rows as $custommenu_child) { |
|
64
|
|
|
$data[$custommenu_child['custommenu_child_id']] = $custommenu_child; |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
return $data; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function add($data, $languages) |
|
72
|
|
|
{ |
|
73
|
|
|
$this->db->query(" |
|
74
|
|
|
INSERT INTO custommenu |
|
75
|
|
|
SET sort_order= '1', |
|
76
|
|
|
columns = '1', |
|
77
|
|
|
custommenu_type = '" . $this->db->escape($data['type']) . "', |
|
78
|
|
|
status = '1' |
|
79
|
|
|
"); |
|
80
|
|
|
|
|
81
|
|
|
$custommenu_id = $this->db->getLastId(); |
|
82
|
|
|
|
|
83
|
|
|
if ($data['type'] == 'custom') { |
|
84
|
|
|
$link = $data['link']; |
|
85
|
|
|
|
|
86
|
|
|
$data['custommenu_desc'] = array(); |
|
87
|
|
|
|
|
88
|
|
|
foreach ($languages as $language) { |
|
89
|
|
|
$data['custommenu_desc'][] = array('name' => $data['name'], 'language_id' => $language['language_id']); |
|
90
|
|
|
} |
|
91
|
|
|
} else { |
|
92
|
|
|
$link = (int)$data['id']; |
|
93
|
|
|
|
|
94
|
|
|
if ($data['type'] == 'information') { |
|
95
|
|
|
$fields = 'title AS name, '.$data['type'].'_id, language_id'; |
|
96
|
|
|
} else { |
|
97
|
|
|
$fields = 'name, '.$data['type'].'_id, language_id'; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
if ($data['type'] != 'manufacturer') { |
|
101
|
|
|
$query = $this->db->query(" |
|
|
|
|
|
|
102
|
|
|
SELECT " . $fields . " F |
|
|
|
|
|
|
103
|
|
|
ROM " . $data['type'] . "_description |
|
|
|
|
|
|
104
|
|
|
WHERE ". $data['type'] ."_id = '" . (int)$data['id'] . "' |
|
105
|
|
|
"); |
|
106
|
|
|
|
|
107
|
|
|
$data['custommenu_desc'] = $query->rows; |
|
108
|
|
|
} else { |
|
109
|
|
|
$fields = 'name, '.$data['type'].'_id '; |
|
110
|
|
|
|
|
111
|
|
|
$query = $this->db->query(" |
|
|
|
|
|
|
112
|
|
|
SELECT " . $fields . " |
|
|
|
|
|
|
113
|
|
|
FROM " . $data['type'] . " |
|
|
|
|
|
|
114
|
|
|
WHERE ". $data['type'] ."_id = '" . (int)$data['id'] . "' |
|
115
|
|
|
"); |
|
116
|
|
|
$result = array(); |
|
117
|
|
|
|
|
118
|
|
|
foreach ($languages as $language) { |
|
119
|
|
|
$result[] = array('name' => $query->row['name'], 'manufacturer_id' => $query->row['manufacturer_id'], 'language_id' => $language['language_id']); |
|
120
|
|
|
}; |
|
121
|
|
|
|
|
122
|
|
|
$data['custommenu_desc'] = $result; |
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
foreach ($data['custommenu_desc'] as $desc) { |
|
127
|
|
|
$this->db->query(" |
|
128
|
|
|
INSERT INTO custommenu_description |
|
129
|
|
|
SET custommenu_id = '" . (int)$custommenu_id . "', |
|
130
|
|
|
language_id = '" . (int)$desc['language_id'] . "', |
|
131
|
|
|
name = '" . $this->db->escape($desc['name']) . "', |
|
132
|
|
|
link = '" . $link . "' |
|
133
|
|
|
"); |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
$custommenu = array( |
|
137
|
|
|
'name' =>$data['custommenu_desc'][0]['name'], |
|
138
|
|
|
'custommenu_type' =>$data['type'], |
|
139
|
|
|
'custommenu_id' => $custommenu_id |
|
140
|
|
|
); |
|
141
|
|
|
|
|
142
|
|
|
return $custommenu; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
public function save($data) |
|
146
|
|
|
{ |
|
147
|
|
|
foreach ($data['custommenu-item-typecustommenu'] as $key => $value) { |
|
148
|
|
|
$_custommenu_id = explode('-', $key); |
|
149
|
|
|
} |
|
150
|
|
|
$custommenu_id = $_custommenu_id[1]; |
|
|
|
|
|
|
151
|
|
|
|
|
152
|
|
|
$this->db->query(" |
|
153
|
|
|
UPDATE `custommenu` |
|
154
|
|
|
SET columns = '" . (int)$data['custommenu_columns'] . "' |
|
155
|
|
|
WHERE custommenu_id = '" . (int)$custommenu_id . "' |
|
156
|
|
|
"); |
|
157
|
|
|
|
|
158
|
|
|
$this->db->query(" |
|
159
|
|
|
DELETE |
|
160
|
|
|
FROM custommenu_description |
|
161
|
|
|
WHERE custommenu_id = '" . (int)$custommenu_id . "' |
|
162
|
|
|
"); |
|
163
|
|
|
|
|
164
|
|
|
foreach ($data['custommenu_name'] as $language_id => $value) { |
|
165
|
|
|
$this->db->query(" |
|
166
|
|
|
INSERT INTO custommenu_description |
|
167
|
|
|
SET custommenu_id = '" . (int)$custommenu_id . "', |
|
168
|
|
|
language_id = '" . (int)$language_id . "', |
|
169
|
|
|
name = '" . $this->db->escape($value) . "', |
|
170
|
|
|
link = '" . $this->db->escape($data['custommenu_link'][$language_id]) . "' |
|
171
|
|
|
"); |
|
172
|
|
|
} |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
public function saveChild($data) |
|
176
|
|
|
{ |
|
177
|
|
|
foreach ($data['custommenu-item-typecustommenu'] as $key => $value) { |
|
178
|
|
|
$_custommenu_id = explode('-', $key); |
|
179
|
|
|
} |
|
180
|
|
|
$custommenu_child_id = $_custommenu_id[1]; |
|
|
|
|
|
|
181
|
|
|
|
|
182
|
|
|
$query = $this->db->query(" |
|
183
|
|
|
SELECT * |
|
184
|
|
|
FROM custommenu_child |
|
185
|
|
|
WHERE custommenu_child_id = '" . (int)$custommenu_child_id . "' |
|
186
|
|
|
"); |
|
187
|
|
|
|
|
188
|
|
|
$custommenu_id = $query->row['custommenu_id']; |
|
189
|
|
|
|
|
190
|
|
|
$this->db->query(" |
|
191
|
|
|
DELETE |
|
192
|
|
|
FROM custommenu_child_description |
|
193
|
|
|
WHERE custommenu_child_id = '" . (int)$custommenu_child_id . "' |
|
194
|
|
|
"); |
|
195
|
|
|
|
|
196
|
|
|
foreach ($data['custommenu_child_name'] as $language_id => $value) { |
|
197
|
|
|
$this->db->query(" |
|
198
|
|
|
INSERT INTO custommenu_child_description |
|
199
|
|
|
SET custommenu_id = '" . (int)$custommenu_id . "', |
|
200
|
|
|
custommenu_child_id = '" . (int)$custommenu_child_id . "', |
|
201
|
|
|
language_id = '" . (int)$language_id . "', |
|
202
|
|
|
name = '" . $this->db->escape($value) . "', |
|
203
|
|
|
link = '" . $this->db->escape($data['custommenu_child_link'][$language_id]) . "' |
|
204
|
|
|
"); |
|
205
|
|
|
} |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
public function deletecustommenu($custommenu_id) |
|
209
|
|
|
{ |
|
210
|
|
|
$this->db->query(" |
|
211
|
|
|
DELETE |
|
212
|
|
|
FROM `custommenu` |
|
213
|
|
|
WHERE custommenu_id = '" . (int)$custommenu_id . "' |
|
214
|
|
|
"); |
|
215
|
|
|
$this->db->query(" |
|
216
|
|
|
DELETE |
|
217
|
|
|
FROM `custommenu_description` |
|
218
|
|
|
WHERE custommenu_id = '" . (int)$custommenu_id . "' |
|
219
|
|
|
"); |
|
220
|
|
|
|
|
221
|
|
|
$query = $this->db->query(" |
|
|
|
|
|
|
222
|
|
|
SELECT * |
|
223
|
|
|
FROM custommenu_child |
|
224
|
|
|
WHERE custommenu_id = '" . (int)$custommenu_id . "' |
|
225
|
|
|
"); |
|
226
|
|
|
|
|
227
|
|
|
$this->db->query(" |
|
228
|
|
|
DELETE |
|
229
|
|
|
FROM `custommenu_child` |
|
230
|
|
|
WHERE custommenu_id = '" . (int)$custommenu_id . "' |
|
231
|
|
|
"); |
|
232
|
|
|
$this->db->query(" |
|
233
|
|
|
DELETE |
|
234
|
|
|
FROM `custommenu_child_description` |
|
235
|
|
|
WHERE custommenu_id = '" . (int)$custommenu_id . "' |
|
236
|
|
|
"); |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
public function deleteChildcustommenu($custommenu_child_id) |
|
240
|
|
|
{ |
|
241
|
|
|
$this->db->query(" |
|
242
|
|
|
DELETE |
|
243
|
|
|
FROM `custommenu_child` |
|
244
|
|
|
WHERE custommenu_child_id = '" . (int)$custommenu_child_id . "' |
|
245
|
|
|
"); |
|
246
|
|
|
$this->db->query(" |
|
247
|
|
|
DELETE |
|
248
|
|
|
FROM `custommenu_child_description` |
|
249
|
|
|
WHERE custommenu_child_id = '" . (int)$custommenu_child_id . "' |
|
250
|
|
|
"); |
|
251
|
|
|
} |
|
252
|
|
|
|
|
253
|
|
|
public function getcustommenuDesc() |
|
254
|
|
|
{ |
|
255
|
|
|
$data = array(); |
|
256
|
|
|
|
|
257
|
|
|
$link = array(); |
|
258
|
|
|
|
|
259
|
|
|
$query = $this->db->query(" |
|
|
|
|
|
|
260
|
|
|
SELECT * FROM custommenu_description AS md |
|
261
|
|
|
LEFT JOIN custommenu m ON (m.custommenu_id = md.custommenu_id) |
|
262
|
|
|
"); |
|
263
|
|
|
|
|
264
|
|
|
foreach ($query->rows as $result) { |
|
265
|
|
|
// Quick fix for multilanguage |
|
266
|
|
|
// Check if link exists to set for later usage |
|
267
|
|
|
if (!empty($result['link'])) { |
|
268
|
|
|
$link[$result['custommenu_id']] = $result['link']; |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
// Try to get the link from previous set if not already exists |
|
272
|
|
|
if (empty($result['link']) and !empty($link[$result['custommenu_id']])) { |
|
273
|
|
|
$result['link'] = $link[$result['custommenu_id']]; |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
$data[$result['custommenu_id']][$result['language_id']] = $result; |
|
277
|
|
|
} |
|
278
|
|
|
|
|
279
|
|
|
return $data; |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
public function getcustommenuChildDesc() |
|
283
|
|
|
{ |
|
284
|
|
|
$data = array(); |
|
285
|
|
|
|
|
286
|
|
|
$link = array(); |
|
287
|
|
|
|
|
288
|
|
|
$query = $this->db->query(" |
|
|
|
|
|
|
289
|
|
|
SELECT * |
|
290
|
|
|
FROM custommenu_child_description AS md |
|
291
|
|
|
LEFT JOIN custommenu_child m ON (m.custommenu_child_id = md.custommenu_child_id) |
|
292
|
|
|
"); |
|
293
|
|
|
|
|
294
|
|
|
foreach ($query->rows as $result) { |
|
295
|
|
|
// Quick fix for multilanguage |
|
296
|
|
|
// Check if link exists to set for later usage |
|
297
|
|
|
if (!empty($result['link'])) { |
|
298
|
|
|
$link[$result['custommenu_child_id']] = $result['link']; |
|
299
|
|
|
} |
|
300
|
|
|
|
|
301
|
|
|
// Try to get the link from previous set if not already exists |
|
302
|
|
|
if (empty($result['link']) and !empty($link[$result['custommenu_child_id']])) { |
|
303
|
|
|
$result['link'] = $link[$result['custommenu_child_id']]; |
|
304
|
|
|
} |
|
305
|
|
|
|
|
306
|
|
|
$data[$result['custommenu_child_id']][$result['language_id']] = $result; |
|
307
|
|
|
} |
|
308
|
|
|
|
|
309
|
|
|
return $data; |
|
310
|
|
|
} |
|
311
|
|
|
|
|
312
|
|
|
public function enablecustommenu($custommenu_id) |
|
313
|
|
|
{ |
|
314
|
|
|
$this->db->query(" |
|
315
|
|
|
UPDATE `custommenu` |
|
316
|
|
|
SET status = '1' |
|
317
|
|
|
WHERE custommenu_id = '" . (int)$custommenu_id . "' |
|
318
|
|
|
"); |
|
319
|
|
|
} |
|
320
|
|
|
|
|
321
|
|
|
public function enableChildcustommenu($custommenu_child_id) |
|
322
|
|
|
{ |
|
323
|
|
|
$this->db->query(" |
|
324
|
|
|
UPDATE `custommenu_child` |
|
325
|
|
|
SET status = '1' |
|
326
|
|
|
WHERE custommenu_child_id = '" . (int)$custommenu_child_id . "' |
|
327
|
|
|
"); |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
|
|
public function disablecustommenu($custommenu_id) |
|
331
|
|
|
{ |
|
332
|
|
|
$this->db->query(" |
|
333
|
|
|
UPDATE `custommenu` |
|
334
|
|
|
SET status = '0' |
|
335
|
|
|
WHERE custommenu_id = '" . (int)$custommenu_id . "' |
|
336
|
|
|
"); |
|
337
|
|
|
} |
|
338
|
|
|
|
|
339
|
|
|
public function disableChildcustommenu($custommenu_child_id) |
|
340
|
|
|
{ |
|
341
|
|
|
$this->db->query(" |
|
342
|
|
|
UPDATE `custommenu_child` |
|
343
|
|
|
SET status = '0' |
|
344
|
|
|
WHERE custommenu_child_id = '" . (int)$custommenu_child_id . "' |
|
345
|
|
|
"); |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
public function changecustommenuPosition($data) |
|
349
|
|
|
{ |
|
350
|
|
|
$custommenuOrder = 1; |
|
351
|
|
|
$custommenuSubOrder = 1; |
|
352
|
|
|
|
|
353
|
|
|
foreach ($data['custommenu-item-db-id'] as $key => $value) { |
|
354
|
|
|
$custommenuType = explode('-', $key); |
|
355
|
|
|
|
|
356
|
|
|
$subcustommenu = 0; |
|
357
|
|
|
|
|
358
|
|
|
if (($custommenuType[0] == 'Childcustommenu') && $data['custommenu-item-parent-id'][$key] == 0) { |
|
359
|
|
|
$insertData = $this->db->query(" |
|
360
|
|
|
SELECT * |
|
361
|
|
|
FROM `custommenu_child` |
|
362
|
|
|
WHERE custommenu_child_id = '" . $custommenuType[1] . "' |
|
363
|
|
|
"); |
|
364
|
|
|
$insertDataDesc = $this->db->query(" |
|
365
|
|
|
SELECT * |
|
366
|
|
|
FROM `custommenu_child_description` |
|
367
|
|
|
WHERE custommenu_child_id = '" . $custommenuType[1] . "' |
|
368
|
|
|
"); |
|
369
|
|
|
|
|
370
|
|
|
$this->db->query(" |
|
371
|
|
|
INSERT INTO `custommenu` |
|
372
|
|
|
SET sort_order = '" . (int)$insertData->row['sort_order'] . "', |
|
373
|
|
|
columns = '1', |
|
374
|
|
|
custommenu_type = '" . $insertData->row['custommenu_type'] . "', |
|
375
|
|
|
status = '1' |
|
376
|
|
|
"); |
|
377
|
|
|
|
|
378
|
|
|
$custommenu_id = $this->db->getLastId(); |
|
379
|
|
|
|
|
380
|
|
|
foreach ($insertDataDesc->rows as $dataDesc) { |
|
381
|
|
|
$this->db->query(" |
|
382
|
|
|
INSERT INTO custommenu_description |
|
383
|
|
|
SET custommenu_id = '" . (int)$custommenu_id . "', |
|
384
|
|
|
language_id = '" . (int)$dataDesc['language_id'] . "', |
|
385
|
|
|
name = '" . $this->db->escape($dataDesc['name']) . "', |
|
386
|
|
|
link = '" . $this->db->escape($dataDesc['link']) . "' |
|
387
|
|
|
"); |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
|
|
$this->db->query(" |
|
391
|
|
|
DELETE |
|
392
|
|
|
FROM `custommenu_child` |
|
393
|
|
|
WHERE custommenu_child_id = '" . $custommenuType[1] . "' |
|
394
|
|
|
"); |
|
395
|
|
|
$this->db->query(" |
|
396
|
|
|
DELETE |
|
397
|
|
|
FROM `custommenu_child_description` |
|
398
|
|
|
WHERE custommenu_child_id = '" . $custommenuType[1] . "' |
|
399
|
|
|
"); |
|
400
|
|
|
|
|
401
|
|
|
$custommenuType[0] = 'Maincustommenu'; |
|
402
|
|
|
$custommenuType[1] = $custommenu_id; |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
if (($custommenuType[0] == 'Maincustommenu') && $data['custommenu-item-parent-id'][$key] <> 0) { |
|
406
|
|
|
$insertData = $this->db->query(" |
|
407
|
|
|
SELECT * |
|
408
|
|
|
FROM `custommenu` |
|
409
|
|
|
WHERE custommenu_id = '" . $custommenuType[1] . "' |
|
410
|
|
|
"); |
|
411
|
|
|
$insertDataDesc = $this->db->query(" |
|
412
|
|
|
SELECT * |
|
413
|
|
|
FROM `custommenu_description` |
|
414
|
|
|
WHERE custommenu_id = '" . $custommenuType[1] . "' |
|
415
|
|
|
"); |
|
416
|
|
|
|
|
417
|
|
|
$this->db->query(" |
|
418
|
|
|
INSERT INTO custommenu_child |
|
419
|
|
|
SET custommenu_id = '" . $data['custommenu-item-parent-id'][$key] ."', s |
|
420
|
|
|
ort_order = '" . (int)$insertData->row['sort_order'] . "', |
|
421
|
|
|
custommenu_type = '" . $insertData->row['custommenu_type'] . "', |
|
422
|
|
|
status = '1' |
|
423
|
|
|
"); |
|
424
|
|
|
|
|
425
|
|
|
$custommenu_child_id = $this->db->getLastId(); |
|
426
|
|
|
|
|
427
|
|
|
foreach ($insertDataDesc->rows as $dataDesc) { |
|
428
|
|
|
$this->db->query(" |
|
429
|
|
|
INSERT INTO custommenu_child_description |
|
430
|
|
|
SET custommenu_id = '" . $data['custommenu-item-parent-id'][$key] . "', |
|
431
|
|
|
custommenu_child_id = '" . (int)$custommenu_child_id . "', |
|
432
|
|
|
language_id = '" . (int)$dataDesc['language_id'] . "', |
|
433
|
|
|
name = '" . $this->db->escape($dataDesc['name']) . "', |
|
434
|
|
|
link = '" . $this->db->escape($dataDesc['link']) . "' |
|
435
|
|
|
"); |
|
436
|
|
|
} |
|
437
|
|
|
|
|
438
|
|
|
$this->db->query(" |
|
439
|
|
|
DELETE |
|
440
|
|
|
FROM `custommenu` |
|
441
|
|
|
WHERE custommenu_id = '" . $custommenuType[1] . "' |
|
442
|
|
|
"); |
|
443
|
|
|
$this->db->query(" |
|
444
|
|
|
DELETE |
|
445
|
|
|
FROM `custommenu_description` |
|
446
|
|
|
WHERE custommenu_id = '" . $custommenuType[1] . "' |
|
447
|
|
|
"); |
|
448
|
|
|
|
|
449
|
|
|
$custommenuType[1] = $custommenu_child_id; |
|
450
|
|
|
|
|
451
|
|
|
$subcustommenu = '1'; |
|
452
|
|
|
} |
|
453
|
|
|
|
|
454
|
|
|
if ($custommenuType[0] == 'Maincustommenu' && empty($subcustommenu)) { |
|
455
|
|
|
$this->db->query(" |
|
456
|
|
|
UPDATE `custommenu` |
|
457
|
|
|
SET sort_order = '" . (int)$custommenuOrder . "' |
|
458
|
|
|
WHERE custommenu_id = '" . $custommenuType[1] . "' |
|
459
|
|
|
"); |
|
460
|
|
|
$custommenuOrder++; |
|
461
|
|
|
$custommenuSubOrder = 1; |
|
462
|
|
|
} else { |
|
463
|
|
|
$this->db->query(" |
|
464
|
|
|
UPDATE `custommenu_child` |
|
465
|
|
|
SET sort_order = '" . (int)$custommenuSubOrder . "', |
|
466
|
|
|
custommenu_id = '" . $data['custommenu-item-parent-id'][$key] . "' |
|
467
|
|
|
WHERE custommenu_child_id = '" . $custommenuType[1] . "' |
|
468
|
|
|
"); |
|
469
|
|
|
$this->db->query(" |
|
470
|
|
|
UPDATE `custommenu_child_description` |
|
471
|
|
|
SET custommenu_id = '" . $data['custommenu-item-parent-id'][$key] . "' |
|
472
|
|
|
WHERE custommenu_child_id = '" . $custommenuType[1] . "' |
|
473
|
|
|
"); |
|
474
|
|
|
$custommenuSubOrder++; |
|
475
|
|
|
} |
|
476
|
|
|
} |
|
477
|
|
|
} |
|
478
|
|
|
} |
|
479
|
|
|
|
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.