/admin/controller/module/welcome.php

https://github.com/smadi/arabian-land · PHP · 113 lines · 83 code · 30 blank · 0 comment · 9 complexity · a2e220b33f237242e17b8efa90f2d844 MD5 · raw file

  1. <?php
  2. class ControllerModuleWelcome extends Controller {
  3. private $error = array();
  4. public function index() {
  5. $this->load->language('module/welcome');
  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('welcome', $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_description'] = $this->language->get('entry_description');
  21. $this->data['entry_layout'] = $this->language->get('entry_layout');
  22. $this->data['entry_position'] = $this->language->get('entry_position');
  23. $this->data['entry_status'] = $this->language->get('entry_status');
  24. $this->data['entry_sort_order'] = $this->language->get('entry_sort_order');
  25. $this->data['button_save'] = $this->language->get('button_save');
  26. $this->data['button_cancel'] = $this->language->get('button_cancel');
  27. $this->data['button_add_module'] = $this->language->get('button_add_module');
  28. $this->data['button_remove'] = $this->language->get('button_remove');
  29. $this->data['tab_module'] = $this->language->get('tab_module');
  30. $this->data['token'] = $this->session->data['token'];
  31. if (isset($this->error['warning'])) {
  32. $this->data['error_warning'] = $this->error['warning'];
  33. } else {
  34. $this->data['error_warning'] = '';
  35. }
  36. $this->data['breadcrumbs'] = array();
  37. $this->data['breadcrumbs'][] = array(
  38. 'text' => $this->language->get('text_home'),
  39. 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
  40. 'separator' => false
  41. );
  42. $this->data['breadcrumbs'][] = array(
  43. 'text' => $this->language->get('text_module'),
  44. 'href' => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'),
  45. 'separator' => ' :: '
  46. );
  47. $this->data['breadcrumbs'][] = array(
  48. 'text' => $this->language->get('heading_title'),
  49. 'href' => $this->url->link('module/welcome', 'token=' . $this->session->data['token'], 'SSL'),
  50. 'separator' => ' :: '
  51. );
  52. $this->data['action'] = $this->url->link('module/welcome', 'token=' . $this->session->data['token'], 'SSL');
  53. $this->data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
  54. $this->data['modules'] = array();
  55. $this->data['modules'] = array();
  56. if (isset($this->request->post['welcome_module'])) {
  57. $this->data['modules'] = $this->request->post['welcome_module'];
  58. } elseif ($this->config->get('welcome_module')) {
  59. $this->data['modules'] = $this->config->get('welcome_module');
  60. }
  61. $this->load->model('design/layout');
  62. $this->data['layouts'] = $this->model_design_layout->getLayouts();
  63. $this->load->model('localisation/language');
  64. $this->data['languages'] = $this->model_localisation_language->getLanguages();
  65. $this->template = 'module/welcome.tpl';
  66. $this->children = array(
  67. 'common/header',
  68. 'common/footer',
  69. );
  70. $this->response->setOutput($this->render());
  71. }
  72. private function validate() {
  73. if (!$this->user->hasPermission('modify', 'module/welcome')) {
  74. $this->error['warning'] = $this->language->get('error_permission');
  75. }
  76. if (!$this->error) {
  77. return true;
  78. } else {
  79. return false;
  80. }
  81. }
  82. }
  83. ?>