divido_calculator.php (2672B)
1 <?php 2 class ControllerExtensionModuleDividoCalculator extends Controller { 3 private $error = array(); 4 5 public function index() { 6 $this->load->language('extension/module/divido_calculator'); 7 $this->load->model('setting/setting'); 8 9 $this->document->setTitle($this->language->get('heading_title')); 10 11 if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { 12 $this->model_setting_setting->editSetting('module_divido_calculator', $this->request->post); 13 $this->session->data['success'] = $this->language->get('text_success'); 14 $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true)); 15 } 16 17 if (isset($this->error['warning'])) { 18 $data['error_warning'] = $this->error['warning']; 19 } else { 20 $data['error_warning'] = ''; 21 } 22 23 $data['breadcrumbs'] = array(); 24 25 $data['breadcrumbs'][] = array( 26 'text' => $this->language->get('text_home'), 27 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) 28 ); 29 30 $data['breadcrumbs'][] = array( 31 'text' => $this->language->get('text_extension'), 32 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true) 33 ); 34 35 $data['breadcrumbs'][] = array( 36 'text' => $this->language->get('heading_title'), 37 'href' => $this->url->link('extension/module/divido_calculator', 'user_token=' . $this->session->data['user_token'], true) 38 ); 39 40 $data['action'] = $this->url->link('extension/module/divido_calculator', 'user_token=' . $this->session->data['user_token'], true); 41 42 $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true); 43 44 if (isset($this->request->post['module_divido_calculator_status'])) { 45 $data['module_divido_calculator_status'] = $this->request->post['module_divido_calculator_status']; 46 } else { 47 $data['module_divido_calculator_status'] = $this->config->get('module_divido_calculator_status'); 48 } 49 50 $data['header'] = $this->load->controller('common/header'); 51 $data['column_left'] = $this->load->controller('common/column_left'); 52 $data['footer'] = $this->load->controller('common/footer'); 53 54 $this->response->setOutput($this->load->view('extension/module/divido_calculator', $data)); 55 } 56 57 protected function validate() { 58 if (!$this->user->hasPermission('modify', 'extension/module/divido_calculator')) { 59 $this->error['warning'] = $this->language->get('error_permission'); 60 } 61 62 return !$this->error; 63 } 64 }