1: | <?php
|
2: | namespace Opencart\Admin\Controller\Extension\Opencart\Theme;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Basic extends \Opencart\System\Engine\Controller {
|
9: | |
10: | |
11: | |
12: | |
13: |
|
14: | public function index(): void {
|
15: | $this->load->language('extension/opencart/theme/basic');
|
16: |
|
17: | $this->document->setTitle($this->language->get('heading_title'));
|
18: |
|
19: | if (isset($this->request->get['store_id'])) {
|
20: | $store_id = (int)$this->request->get['store_id'];
|
21: | } else {
|
22: | $store_id = 0;
|
23: | }
|
24: |
|
25: | $data['breadcrumbs'] = [];
|
26: |
|
27: | $data['breadcrumbs'][] = [
|
28: | 'text' => $this->language->get('text_home'),
|
29: | 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'])
|
30: | ];
|
31: |
|
32: | $data['breadcrumbs'][] = [
|
33: | 'text' => $this->language->get('text_extension'),
|
34: | 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=theme')
|
35: | ];
|
36: |
|
37: | $data['breadcrumbs'][] = [
|
38: | 'text' => $this->language->get('heading_title'),
|
39: | 'href' => $this->url->link('extension/opencart/theme/basic', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $store_id)
|
40: | ];
|
41: |
|
42: | $data['save'] = $this->url->link('extension/opencart/theme/basic.save', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $store_id);
|
43: | $data['back'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=theme');
|
44: |
|
45: | if (isset($this->request->get['store_id'])) {
|
46: | $this->load->model('setting/setting');
|
47: |
|
48: | $setting_info = $this->model_setting_setting->getSetting('theme_basic', $this->request->get['store_id']);
|
49: | }
|
50: |
|
51: | if (isset($setting_info['theme_basic_status'])) {
|
52: | $data['theme_basic_status'] = $setting_info['theme_basic_status'];
|
53: | } else {
|
54: | $data['theme_basic_status'] = '';
|
55: | }
|
56: |
|
57: | $data['header'] = $this->load->controller('common/header');
|
58: | $data['column_left'] = $this->load->controller('common/column_left');
|
59: | $data['footer'] = $this->load->controller('common/footer');
|
60: |
|
61: | $this->response->setOutput($this->load->view('extension/opencart/theme/basic', $data));
|
62: | }
|
63: |
|
64: | |
65: | |
66: | |
67: | |
68: |
|
69: | public function save(): void {
|
70: | $this->load->language('extension/opencart/theme/basic');
|
71: |
|
72: | if (isset($this->request->get['store_id'])) {
|
73: | $store_id = (int)$this->request->get['store_id'];
|
74: | } else {
|
75: | $store_id = 0;
|
76: | }
|
77: |
|
78: | $json = [];
|
79: |
|
80: | if (!$this->user->hasPermission('modify', 'extension/opencart/theme/basic')) {
|
81: | $json['error'] = $this->language->get('error_permission');
|
82: | }
|
83: |
|
84: | if (!$json) {
|
85: | $this->load->model('setting/setting');
|
86: |
|
87: | $this->model_setting_setting->editSetting('theme_basic', $this->request->post, $store_id);
|
88: |
|
89: | $json['success'] = $this->language->get('text_success');
|
90: | }
|
91: |
|
92: | $this->response->addHeader('Content-Type: application/json');
|
93: | $this->response->setOutput(json_encode($json));
|
94: | }
|
95: | }
|
96: | |