/upload/admin/controller/module/account.php

https://bitbucket.org/mjalajel/opencart · PHP · 99 lines · 74 code · 25 blank · 0 comment · 9 complexity · 29b351a827f5aeda62f96162effe5917 MD5 · raw file

  1. <?php
  2. class ControllerModuleAccount extends Controller {
  3. private $error = array();
  4. public function index() {
  5. $this->language->load('module/account');
  6. $this->document->setTitle($this->language->get('heading_title'));
  7. $this->load->model('setting/setting');
  8. if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
  9. $this->model_setting_setting->editSetting('account', $this->request->post);
  10. $this->session->data['success'] = $this->language->get('text_success');
  11. $this->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
  12. }
  13. $this->data['heading_title'] = $this->language->get('heading_title');
  14. $this->data['text_enabled'] = $this->language->get('text_enabled');
  15. $this->data['text_disabled'] = $this->language->get('text_disabled');
  16. $this->data['text_content_top'] = $this->language->get('text_content_top');
  17. $this->data['text_content_bottom'] = $this->language->get('text_content_bottom');
  18. $this->data['text_column_left'] = $this->language->get('text_column_left');
  19. $this->data['text_column_right'] = $this->language->get('text_column_right');
  20. $this->data['entry_layout'] = $this->language->get('entry_layout');
  21. $this->data['entry_position'] = $this->language->get('entry_position');
  22. $this->data['entry_status'] = $this->language->get('entry_status');
  23. $this->data['entry_sort_order'] = $this->language->get('entry_sort_order');
  24. $this->data['button_save'] = $this->language->get('button_save');
  25. $this->data['button_cancel'] = $this->language->get('button_cancel');
  26. $this->data['button_add_module'] = $this->language->get('button_add_module');
  27. $this->data['button_remove'] = $this->language->get('button_remove');
  28. if (isset($this->error['warning'])) {
  29. $this->data['error_warning'] = $this->error['warning'];
  30. } else {
  31. $this->data['error_warning'] = '';
  32. }
  33. $this->data['breadcrumbs'] = array();
  34. $this->data['breadcrumbs'][] = array(
  35. 'text' => $this->language->get('text_home'),
  36. 'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
  37. );
  38. $this->data['breadcrumbs'][] = array(
  39. 'text' => $this->language->get('text_module'),
  40. 'href' => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL')
  41. );
  42. $this->data['breadcrumbs'][] = array(
  43. 'text' => $this->language->get('heading_title'),
  44. 'href' => $this->url->link('module/account', 'token=' . $this->session->data['token'], 'SSL')
  45. );
  46. $this->data['action'] = $this->url->link('module/account', 'token=' . $this->session->data['token'], 'SSL');
  47. $this->data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
  48. $this->data['modules'] = array();
  49. if (isset($this->request->post['account_module'])) {
  50. $this->data['modules'] = $this->request->post['account_module'];
  51. } elseif ($this->config->get('account_module')) {
  52. $this->data['modules'] = $this->config->get('account_module');
  53. }
  54. $this->load->model('design/layout');
  55. $this->data['layouts'] = $this->model_design_layout->getLayouts();
  56. $this->template = 'module/account.tpl';
  57. $this->children = array(
  58. 'common/header',
  59. 'common/footer'
  60. );
  61. $this->response->setOutput($this->render());
  62. }
  63. protected function validate() {
  64. if (!$this->user->hasPermission('modify', 'module/account')) {
  65. $this->error['warning'] = $this->language->get('error_permission');
  66. }
  67. if (!$this->error) {
  68. return true;
  69. } else {
  70. return false;
  71. }
  72. }
  73. }
  74. ?>