handling.php (3709B)
1 <?php 2 class ControllerExtensionTotalHandling extends Controller { 3 private $error = array(); 4 5 public function index() { 6 $this->load->language('extension/total/handling'); 7 8 $this->document->setTitle($this->language->get('heading_title')); 9 10 $this->load->model('setting/setting'); 11 12 if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { 13 $this->model_setting_setting->editSetting('total_handling', $this->request->post); 14 15 $this->session->data['success'] = $this->language->get('text_success'); 16 17 $this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true)); 18 } 19 20 if (isset($this->error['warning'])) { 21 $data['error_warning'] = $this->error['warning']; 22 } else { 23 $data['error_warning'] = ''; 24 } 25 26 $data['breadcrumbs'] = array(); 27 28 $data['breadcrumbs'][] = array( 29 'text' => $this->language->get('text_home'), 30 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true) 31 ); 32 33 $data['breadcrumbs'][] = array( 34 'text' => $this->language->get('text_extension'), 35 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true) 36 ); 37 38 $data['breadcrumbs'][] = array( 39 'text' => $this->language->get('heading_title'), 40 'href' => $this->url->link('extension/total/handling', 'user_token=' . $this->session->data['user_token'], true) 41 ); 42 43 $data['action'] = $this->url->link('extension/total/handling', 'user_token=' . $this->session->data['user_token'], true); 44 45 $data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=total', true); 46 47 if (isset($this->request->post['total_handling_total'])) { 48 $data['total_handling_total'] = $this->request->post['total_handling_total']; 49 } else { 50 $data['total_handling_total'] = $this->config->get('total_handling_total'); 51 } 52 53 if (isset($this->request->post['total_handling_fee'])) { 54 $data['total_handling_fee'] = $this->request->post['total_handling_fee']; 55 } else { 56 $data['total_handling_fee'] = $this->config->get('total_handling_fee'); 57 } 58 59 if (isset($this->request->post['total_handling_tax_class_id'])) { 60 $data['total_handling_tax_class_id'] = $this->request->post['total_handling_tax_class_id']; 61 } else { 62 $data['total_handling_tax_class_id'] = $this->config->get('total_handling_tax_class_id'); 63 } 64 65 $this->load->model('localisation/tax_class'); 66 67 $data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses(); 68 69 if (isset($this->request->post['total_handling_status'])) { 70 $data['total_handling_status'] = $this->request->post['total_handling_status']; 71 } else { 72 $data['total_handling_status'] = $this->config->get('total_handling_status'); 73 } 74 75 if (isset($this->request->post['total_handling_sort_order'])) { 76 $data['total_handling_sort_order'] = $this->request->post['total_handling_sort_order']; 77 } else { 78 $data['total_handling_sort_order'] = $this->config->get('total_handling_sort_order'); 79 } 80 81 $data['header'] = $this->load->controller('common/header'); 82 $data['column_left'] = $this->load->controller('common/column_left'); 83 $data['footer'] = $this->load->controller('common/footer'); 84 85 $this->response->setOutput($this->load->view('extension/total/handling', $data)); 86 } 87 88 protected function validate() { 89 if (!$this->user->hasPermission('modify', 'extension/total/handling')) { 90 $this->error['warning'] = $this->language->get('error_permission'); 91 } 92 93 return !$this->error; 94 } 95 }