Skip to content

Commit

Permalink
modules update
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel kerr committed Sep 24, 2014
1 parent 96c8270 commit f735ca3
Show file tree
Hide file tree
Showing 24 changed files with 186 additions and 150 deletions.
51 changes: 41 additions & 10 deletions upload/admin/controller/design/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,24 +358,55 @@ protected function getForm() {
$data['layout_modules'] = array();
}


$this->load->model('extension/extension');
$this->load->model('extension/module');

$data['modules'] = array();

$modules = $this->model_extension_module->getModules();
// Get a list of installed modules
$extensions = $this->model_extension_extension->getInstalled('module');

$i = 1;
foreach ($extensions as $code) {
if (!$this->config->has($code . '_module')) {
$this->load->language('module/' . $code);

$data['modules'][] = array(
'name' => $this->language->get('heading_title'),
'code' => $code,
'module' => ''
);
}
}

foreach ($modules as $module) {
$this->load->language('module/' . $module['code']);
// Add all the modules which have multiple settings for each module
foreach ($extensions as $code) {
if ($this->config->has($code . '_module')) {
$this->load->language('module/' . $code);

$data['modules'][] = array(
'module_id' => $module['module_id'],
'name' => $this->language->get('heading_title') . ' ' . $i++,
'code' => $module['code']
);
$i = 1;

$module_data = array();

$modules = $this->model_extension_module->getModules($code);

foreach ($modules as $module) {
$module_data[] = array(
'name' => $this->language->get('heading_title') . ' ' . $i++,
'code' => $code . '.' . $module['module_id']
);
}

if ($module_data) {
$data['modules'][] = array(
'name' => $this->language->get('heading_title'),
'code' => $code,
'module' => $module_data
);
}
}
}

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
Expand Down
7 changes: 0 additions & 7 deletions upload/admin/controller/module/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@ public function index() {
$this->document->setTitle($this->language->get('heading_title'));

$this->load->model('setting/setting');

$this->load->model('extension/module');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('account', $this->request->post);

$this->model_extension_module->editModule('account');

$this->session->data['success'] = $this->language->get('text_success');

$this->response->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
Expand Down Expand Up @@ -79,7 +75,4 @@ protected function validate() {

return !$this->error;
}



}
4 changes: 2 additions & 2 deletions upload/admin/controller/module/amazon_checkout_layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ class ControllerModuleAmazonCheckoutLayout extends Controller {
public function index() {
$this->language->load('module/amazon_checkout_layout');

$this->load->model('setting/setting');

$this->document->setTitle($this->language->get('heading_title'));

$this->load->model('setting/setting');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('amazon_checkout_layout', $this->request->post);
Expand Down
31 changes: 6 additions & 25 deletions upload/admin/controller/module/banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@ public function index() {
$this->document->setTitle($this->language->get('heading_title'));

$this->load->model('setting/setting');

$this->load->model('extension/module');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('banner', $this->request->post);

// Add positions for all the modules so they can be used with the layouts
$this->model_extension_module->deleteModule('banner');

foreach (array_keys($this->request->post['banner_module']) as $key) {
$this->model_extension_module->addModule('banner', $key);
}
// We need to add modules to a separate table
$this->model_extension_module->addModule('banner', $this->request->post['module']);

$this->session->data['success'] = $this->language->get('text_success');

Expand All @@ -36,8 +32,6 @@ public function index() {
$data['entry_dimension'] = $this->language->get('entry_dimension');
$data['entry_width'] = $this->language->get('entry_width');
$data['entry_height'] = $this->language->get('entry_height');
$data['entry_width'] = $this->language->get('entry_width');
$data['entry_height'] = $this->language->get('entry_height');
$data['entry_status'] = $this->language->get('entry_status');

$data['button_save'] = $this->language->get('button_save');
Expand Down Expand Up @@ -84,23 +78,10 @@ public function index() {
$data['banner_status'] = $this->config->get('banner_status');
}

if (isset($this->request->post['banner_module'])) {
$modules = $this->request->post['banner_module'];
} elseif ($this->config->get('banner_module')) {
$modules = $this->config->get('banner_module');
if (isset($this->request->post['module'])) {
$data['modules'] = $this->request->post['module'];
} else {
$modules = array();
}

$data['banner_modules'] = array();

foreach ($modules as $key => $module) {
$data['banner_modules'][] = array(
'key' => $key,
'banner_id' => $module['banner_id'],
'width' => $module['width'],
'height' => $module['height']
);
$data['modules'] = $this->extension_module->getModules('banner');
}

$this->load->model('design/banner');
Expand Down
15 changes: 9 additions & 6 deletions upload/admin/controller/module/bestseller.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public function index() {
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('bestseller', $this->request->post['bestseller_status']);

// We need to add modules to a table
$this->model_extension_module->addModule('bestseller', $this->request->post['module']);

$this->cache->delete('product');

$this->session->data['success'] = $this->language->get('text_success');
Expand Down Expand Up @@ -71,17 +74,17 @@ public function index() {

$data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');

if (isset($this->request->post['module'])) {
$data['modules'] = $this->request->post['module'];
} else {
$data['modules'] = $this->model_extension_module->getModulesByCode('bestseller');
}

if (isset($this->request->post['bestseller_status'])) {
$data['bestseller_status'] = $this->request->post['bestseller_status'];
} else {
$data['bestseller_status'] = $this->config->get('bestseller_status');
}

if (isset($this->request->post['module'])) {
$data['modules'] = $this->request->post['module'];
} else {
$data['modules'] = $this->extension_module->getModules('bestseller');
}

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
Expand Down
17 changes: 10 additions & 7 deletions upload/admin/controller/module/carousel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public function index() {

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('carousel', $this->request->post);

// We need to add modules to a table
$this->model_extension_module->addModule('bestseller', $this->request->post['module']);

$this->session->data['success'] = $this->language->get('text_success');

Expand Down Expand Up @@ -71,22 +74,22 @@ public function index() {

$data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');

if (isset($this->request->post['carousel_status'])) {
$data['carousel_status'] = $this->request->post['carousel_status'];
} else {
$data['carousel_status'] = $this->config->get('carousel_status');
}

if (isset($this->request->post['module'])) {
$data['modules'] = $this->request->post['module'];
} else {
$data['modules'] = $this->model_extension_module->getModulesByCode('carousel');
$data['modules'] = $this->extension_module->getModules('carousel');
}

$this->load->model('design/banner');

$data['banners'] = $this->model_design_banner->getBanners();

if (isset($this->request->post['carousel_status'])) {
$data['carousel_status'] = $this->request->post['carousel_status'];
} else {
$data['carousel_status'] = $this->config->get('carousel_status');
}

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
Expand Down
2 changes: 0 additions & 2 deletions upload/admin/controller/module/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ public function index() {

$this->load->model('setting/setting');

$this->load->model('extension/module');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('category', $this->request->post);

Expand Down
5 changes: 4 additions & 1 deletion upload/admin/controller/module/featured.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public function index() {

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('featured', $this->request->post);

// We need to add modules to a table
$this->model_extension_module->addModule('featured', $this->request->post['module']);

$this->session->data['success'] = $this->language->get('text_success');

Expand Down Expand Up @@ -110,7 +113,7 @@ public function index() {
if (isset($this->request->post['module'])) {
$data['modules'] = $this->request->post['module'];
} else {
$data['modules'] = $this->model_extension_module->getModulesByCode('featured');
$data['modules'] = $this->extension_module->getModules('featured');
}

$data['header'] = $this->load->controller('common/header');
Expand Down
8 changes: 4 additions & 4 deletions upload/admin/controller/module/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public function index() {

$data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');

if (isset($this->request->post['featured_status'])) {
$data['featured_status'] = $this->request->post['featured_status'];
if (isset($this->request->post['filter_status'])) {
$data['filter_status'] = $this->request->post['filter_status'];
} else {
$data['featured_status'] = $this->config->get('featured_status');
$data['filter_status'] = $this->config->get('filter_status');
}

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
Expand Down
2 changes: 0 additions & 2 deletions upload/admin/controller/module/google_hangouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ public function index() {

$this->load->model('setting/setting');

$this->load->model('extension/module');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('google_hangouts', $this->request->post);

Expand Down
20 changes: 9 additions & 11 deletions upload/admin/controller/module/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public function index() {
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('html', $this->request->post);

foreach ($this->request->post['html_module'] as $module) {
$this->model_setting_setting->addModule('html', $this->request->post);
}
$this->model_extension_module->addModule('html', $this->request->post['module']);

$this->session->data['success'] = $this->language->get('text_success');

Expand Down Expand Up @@ -66,23 +64,23 @@ public function index() {
$data['action'] = $this->url->link('module/html', 'token=' . $this->session->data['token'], 'SSL');

$data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');


if (isset($this->request->post['html_status'])) {
$data['html_status'] = $this->request->post['html_status'];
} else {
$data['html_status'] = $this->config->get('html_status');
}

if (isset($this->request->post['module'])) {
$data['modules'] = $this->request->post['module'];
} else {
$data['modules'] = $this->model_extension_module->getModulesByCode('html');
$data['modules'] = $this->extension_module->getModules('html');
}

$this->load->model('localisation/language');

$data['languages'] = $this->model_localisation_language->getLanguages();

if (isset($this->request->post['html_status'])) {
$data['html_status'] = $this->request->post['html_status'];
} else {
$data['html_status'] = $this->config->get('html_status');
}

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
Expand Down
2 changes: 0 additions & 2 deletions upload/admin/controller/module/information.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ public function index() {

$this->load->model('setting/setting');

$this->load->model('extension/module');

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('information', $this->request->post);

Expand Down
15 changes: 9 additions & 6 deletions upload/admin/controller/module/latest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public function index() {
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('latest', $this->request->post);

// We need to add modules to a table
$this->model_extension_module->addModule('latest', $this->request->post['module']);

$this->cache->delete('product');

$this->session->data['success'] = $this->language->get('text_success');
Expand Down Expand Up @@ -70,19 +73,19 @@ public function index() {
$data['action'] = $this->url->link('module/latest', 'token=' . $this->session->data['token'], 'SSL');

$data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');

if (isset($this->request->post['module'])) {
$data['modules'] = $this->request->post['module'];
} else {
$data['modules'] = $this->model_extension_module->getModulesByCode('latest');
}

if (isset($this->request->post['latest_status'])) {
$data['latest_status'] = $this->request->post['latest_status'];
} else {
$data['latest_status'] = $this->config->get('latest_status');
}

if (isset($this->request->post['module'])) {
$data['modules'] = $this->request->post['module'];
} else {
$data['modules'] = $this->model_extension_module->getModules('latest');
}

$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
Expand Down
Loading

0 comments on commit f735ca3

Please sign in to comment.