  |
18 | 18 | | $_content, |
| |
19 | 19 | | $_author_name, |
| |
20 | 20 | | $_author_www, |
  |
21 | | - | $_keys; |
| |
| 21 | + | $_keys, |
| |
| 22 | + | $_module_group; |
|
22 | 23 | | |
  |
23 | | - | function osC_Boxes() { |
| |
| 24 | + | function osC_Boxes($module_group) { |
| |
| 25 | + | $this->_module_group = $module_group; |
| |
| 26 | + | |
|
24 | 27 | | global $osC_Database, $osC_Template, $osC_Cache; |
| |
25 | 28 | | |
  |
26 | | - | if ($osC_Cache->read('templates_boxes_layout-' . $osC_Template->getTemplate() . '-' . $osC_Template->getGroup() . '-' . $osC_Template->getPageContentsFilename())) { |
| |
| 29 | + | if ($osC_Cache->read('templates_' . $this->_module_group . '_layout-' . $osC_Template->getTemplate() . '-' . $osC_Template->getGroup() . '-' . $osC_Template->getPageContentsFilename())) { |
|
27 | 30 | | $data = $osC_Cache->getCache(); |
| |
28 | 31 | | } else { |
| |
29 | 32 | | $data = array(); |
| |
30 | 33 | | |
  |
31 | | - | $Qspecific = $osC_Database->query('select b2p.boxes_group, b.code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b, :table_templates t where b2p.templates_id = :templates_id and b2p.page_specific = 1 and b2p.content_page in (:content_page) and b2p.templates_boxes_id = b.id and b2p.templates_id = t.id order by b2p.boxes_group, b2p.sort_order'); |
| |
| 34 | + | $Qspecific = $osC_Database->query('select b2p.boxes_group, b.code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b, :table_templates t where b2p.templates_id = :templates_id and b2p.page_specific = 1 and b2p.content_page in (:content_page) and b2p.templates_boxes_id = b.id and b.modules_group = :modules_group and b2p.templates_id = t.id order by b2p.boxes_group, b2p.sort_order'); |
|
32 | 35 | | $Qspecific->bindTable(':table_templates_boxes_to_pages', TABLE_TEMPLATES_BOXES_TO_PAGES); |
| |
33 | 36 | | $Qspecific->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); |
| |
34 | 37 | | $Qspecific->bindTable(':table_templates', TABLE_TEMPLATES); |
| |
35 | 38 | | $Qspecific->bindInt(':templates_id', 1); |
| |
36 | 39 | | $Qspecific->bindRaw(':content_page', '"*", "' . $osC_Template->getGroup() . '/*", "' . $osC_Template->getGroup() . '/' . substr($osC_Template->getPageContentsFilename(), 0, strrpos($osC_Template->getPageContentsFilename(), '.')) . '"'); |
  |
| 40 | + | $Qspecific->bindValue(':modules_group', $this->_module_group); |
|
37 | 41 | | $Qspecific->execute(); |
| |
38 | 42 | | |
| |
39 | 43 | | if ($Qspecific->numberOfRows()) { |
| |
40 | 44 | | while ($Qspecific->next()) { |
| |
41 | 45 | | $data[$Qspecific->value('boxes_group')][] = $Qspecific->value('code'); |
| |
42 | 46 | | } |
| |
43 | 47 | | } else { |
  |
44 | | - | $Qboxes = $osC_Database->query('select b2p.boxes_group, b2p.content_page, b.code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b, :table_templates t where b2p.templates_id = :templates_id and b2p.content_page in (:content_page) and b2p.templates_boxes_id = b.id and b2p.templates_id = t.id order by b2p.boxes_group, b2p.sort_order'); |
| |
| 48 | + | $Qboxes = $osC_Database->query('select b2p.boxes_group, b2p.content_page, b.code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b, :table_templates t where b2p.templates_id = :templates_id and b2p.content_page in (:content_page) and b2p.templates_boxes_id = b.id and b.modules_group = :modules_group and b2p.templates_id = t.id order by b2p.boxes_group, b2p.sort_order'); |
|
45 | 49 | | $Qboxes->bindTable(':table_templates_boxes_to_pages', TABLE_TEMPLATES_BOXES_TO_PAGES); |
| |
46 | 50 | | $Qboxes->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); |
| |
47 | 51 | | $Qboxes->bindTable(':table_templates', TABLE_TEMPLATES); |
| |
48 | 52 | | $Qboxes->bindInt(':templates_id', 1); |
| |
49 | 53 | | $Qboxes->bindRaw(':content_page', '"*", "' . $osC_Template->getGroup() . '/*", "' . $osC_Template->getGroup() . '/' . substr($osC_Template->getPageContentsFilename(), 0, strrpos($osC_Template->getPageContentsFilename(), '.')) . '"'); |
  |
| 54 | + | $Qboxes->bindValue(':modules_group', $this->_module_group); |
|
50 | 55 | | $Qboxes->execute(); |
| |
51 | 56 | | |
| |
52 | 57 | | while ($Qboxes->next()) { |
| |
|
|
 |
… |
|
112 | 117 | | |
| |
113 | 118 | | if (isset($this->_boxes[$group])) { |
| |
114 | 119 | | foreach ($this->_boxes[$group] as $box) { |
  |
115 | | - | if (file_exists('includes/boxes/' . $box . '.php')) { |
| |
116 | | - | $box_class = 'osC_Boxes_' . $box; |
| |
| 120 | + | if (file_exists('includes/modules/' . $this->_module_group . '/' . $box . '.php')) { |
| |
| 121 | + | $box_class = 'osC_' . ucfirst($this->_module_group) . '_' . $box; |
|
117 | 122 | | |
| |
118 | 123 | | if (class_exists($box_class) === false) { |
  |
119 | | - | include('includes/boxes/' . $box . '.php'); |
| |
| 124 | + | include('includes/modules/' . $this->_module_group . '/' . $box . '.php'); |
|
120 | 125 | | } |
| |
121 | 126 | | |
| |
122 | 127 | | $boxes[] = $box_class; |
| |
|
|
 |
… |
|
133 | 138 | | static $is_installed; |
| |
134 | 139 | | |
| |
135 | 140 | | if (isset($is_installed) === false) { |
  |
136 | | - | $Qcheck = $osC_Database->query('select id from :table_templates_boxes where code = :code'); |
| |
| 141 | + | $Qcheck = $osC_Database->query('select id from :table_templates_boxes where code = :code and modules_group = :modules_group'); |
|
137 | 142 | | $Qcheck->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); |
| |
138 | 143 | | $Qcheck->bindValue(':code', $this->_code); |
  |
| 144 | + | $Qcheck->bindValue(':modules_group', $this->_module_group); |
|
139 | 145 | | $Qcheck->execute(); |
| |
140 | 146 | | |
| |
141 | 147 | | $is_installed = ($Qcheck->numberOfRows()) ? true : false; |
| |
|
|
 |
… |
|
169 | 175 | | function remove() { |
| |
170 | 176 | | global $osC_Database; |
| |
171 | 177 | | |
  |
172 | | - | $Qbox = $osC_Database->query('select id from :table_templates_boxes where code = :code'); |
| |
| 178 | + | $Qbox = $osC_Database->query('select id from :table_templates_boxes where code = :code and modules_group = :modules_group'); |
|
173 | 179 | | $Qbox->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); |
| |
174 | 180 | | $Qbox->bindValue(':code', $this->_code); |
  |
| 181 | + | $Qbox->bindValue(':modules_group', $this->_module_group); |
|
175 | 182 | | $Qbox->execute(); |
| |
176 | 183 | | |
| |
177 | 184 | | $Qdel = $osC_Database->query('delete from :table_templates_boxes_to_pages where templates_boxes_id = :templates_boxes_id'); |
| |
178 | 185 | | $Qdel->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); |
| |
179 | 186 | | $Qdel->bindValue(':templates_boxes_id', $Qbox->valueInt('id')); |
| |
180 | 187 | | $Qdel->execute(); |
| |
181 | 188 | | |
  |
182 | | - | $Qdel = $osC_Database->query('delete from :table_templates_boxes where code = :code'); |
| |
| 189 | + | $Qdel = $osC_Database->query('delete from :table_templates_boxes where code = :code and modules_group = :modules_group'); |
|
183 | 190 | | $Qdel->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); |
| |
184 | 191 | | $Qdel->bindValue(':code', $this->_code); |
  |
| 192 | + | $Qdel->bindValue(':modules_group', $this->_module_group); |
  |
185 | 193 | | $Qdel->execute(); |
| |
186 | 194 | | |
| |
187 | 195 | | if ($this->hasKeys()) { |