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