1: | <?php
2: | namespace Opencart\Admin\Controller\Extension\Opencart\Module;
3: | /**
4: | * Class Category
5: | *
6: | * @package Opencart\Admin\Controller\Extension\Opencart\Module
7: | */
8: | class Category extends \Opencart\System\Engine\Controller {
9: | /**
10: | * Index
11: | *
12: | * @return void
13: | */
14: | public function index(): void {
15: | $this->load->language('extension/opencart/module/category');
16: |
17: | $this->document->setTitle($this->language->get('heading_title'));
18: |
19: | $data['breadcrumbs'] = [];
20: |
21: | $data['breadcrumbs'][] = [
22: | 'text' => $this->language->get('text_home'),
23: | 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'])
24: | ];
25: |
26: | $data['breadcrumbs'][] = [
27: | 'text' => $this->language->get('text_extension'),
28: | 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module')
29: | ];
30: |
31: | $data['breadcrumbs'][] = [
32: | 'text' => $this->language->get('heading_title'),
33: | 'href' => $this->url->link('extension/opencart/module/category', 'user_token=' . $this->session->data['user_token'])
34: | ];
35: |
36: | $data['save'] = $this->url->link('extension/opencart/module/category.save', 'user_token=' . $this->session->data['user_token']);
37: | $data['back'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module');
38: |
39: | $data['module_category_status'] = $this->config->get('module_category_status');
40: |
41: | $data['header'] = $this->load->controller('common/header');
42: | $data['column_left'] = $this->load->controller('common/column_left');
43: | $data['footer'] = $this->load->controller('common/footer');
44: |
45: | $this->response->setOutput($this->load->view('extension/opencart/module/category', $data));
46: | }
47: |
48: | /**
49: | * Save
50: | *
51: | * @return void
52: | */
53: | public function save(): void {
54: | $this->load->language('extension/opencart/module/category');
55: |
56: | $json = [];
57: |
58: | if (!$this->user->hasPermission('modify', 'extension/opencart/module/category')) {
59: | $json['error']['warning'] = $this->language->get('error_permission');
60: | }
61: |
62: | if (!$json) {
63: | $this->load->model('setting/setting');
64: |
65: | $this->model_setting_setting->editSetting('module_category', $this->request->post);
66: |
67: | $json['success'] = $this->language->get('text_success');
68: | }
69: |
70: | $this->response->addHeader('Content-Type: application/json');
71: | $this->response->setOutput(json_encode($json));
72: | }
73: | }
74: |

OpenCart API API documentation generated by ApiGen dev-master