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 ControllerCommonColumn extends \Divine\Engine\Core\Controller |
|
|
|
|
24
|
|
|
{ |
25
|
|
|
public function index() |
|
|
|
|
26
|
|
|
{ |
27
|
|
|
$this->load->model('design/layout'); |
28
|
|
|
|
29
|
|
|
if (isset($this->request->get['route'])) { |
30
|
|
|
$route = (string)$this->request->get['route']; |
31
|
|
|
} else { |
32
|
|
|
$route = 'common/home'; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
$layout_id = 0; |
36
|
|
|
|
37
|
|
|
if ($route == 'product/manufacturer/info' && isset($this->request->get['manufacturer_id'])) { |
38
|
|
|
$this->load->model('catalog/manufacturer'); |
39
|
|
|
|
40
|
|
|
$layout_id = $this->model_catalog_manufacturer->getManufacturerLayoutId($this->request->get['manufacturer_id']); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
if ($route == 'product/category' && isset($this->request->get['path'])) { |
44
|
|
|
$this->load->model('catalog/category'); |
45
|
|
|
|
46
|
|
|
$path = explode('_', (string)$this->request->get['path']); |
47
|
|
|
|
48
|
|
|
$layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path)); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
if ($route == 'product/product' && isset($this->request->get['product_id'])) { |
52
|
|
|
$this->load->model('catalog/product'); |
53
|
|
|
|
54
|
|
|
$layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
if ($route == 'information/information' && isset($this->request->get['information_id'])) { |
58
|
|
|
$this->load->model('catalog/information'); |
59
|
|
|
|
60
|
|
|
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
if ($route == 'blog/category' && isset($this->request->get['blog_category_id'])) { |
64
|
|
|
$this->load->model('blog/category'); |
65
|
|
|
|
66
|
|
|
$path = explode('_', (string)$this->request->get['blog_category_id']); |
67
|
|
|
$layout_id = $this->model_blog_category->getCategoryLayoutId(end($path)); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
if ($route == 'blog/article' && isset($this->request->get['article_id'])) { |
71
|
|
|
$this->load->model('blog/article'); |
72
|
|
|
|
73
|
|
|
$layout_id = $this->model_blog_article->getArticleLayoutId($this->request->get['article_id']); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
if (!$layout_id) { |
77
|
|
|
$layout_id = $this->model_design_layout->getLayout($route); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
if (!$layout_id) { |
81
|
|
|
$layout_id = $this->config->get('config_layout_id'); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
$this->load->model('extension/module'); |
85
|
|
|
|
86
|
|
|
$data['modules'] = array(); |
|
|
|
|
87
|
|
|
|
88
|
|
|
$modules = $this->model_design_layout->getLayoutModules($layout_id, 'column'); |
89
|
|
|
|
90
|
|
|
foreach ($modules as $module) { |
91
|
|
|
$part = explode('.', $module['code']); |
92
|
|
|
|
93
|
|
|
if (isset($part[0]) && $this->config->get($part[0] . '_status')) { |
94
|
|
|
$module_data = $this->load->controller('extension/module/' . $part[0]); |
95
|
|
|
|
96
|
|
|
if ($module_data) { |
97
|
|
|
$data['modules'][] = $module_data; |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
if (isset($part[1])) { |
102
|
|
|
$setting_info = $this->model_extension_module->getModule($part[1]); |
103
|
|
|
|
104
|
|
|
if ($setting_info && $setting_info['status']) { |
105
|
|
|
$output = $this->load->controller('extension/module/' . $part[0], $setting_info); |
106
|
|
|
|
107
|
|
|
if ($output) { |
108
|
|
|
$data['modules'][] = $output; |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
return $this->load->view('common/column', $data); |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|
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.