1: | <?php
2: | namespace Opencart\Admin\Controller\Marketplace;
3: | /**
4: | * Class Extension
5: | *
6: | * @package Opencart\Admin\Controller\Marketplace
7: | */
8: | class Extension extends \Opencart\System\Engine\Controller {
9: | /**
10: | * Index
11: | *
12: | * @return void
13: | */
14: | public function index(): void {
15: | $this->load->language('marketplace/extension');
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('heading_title'),
28: | 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'])
29: | ];
30: |
31: | if (isset($this->request->get['type'])) {
32: | $data['type'] = $this->request->get['type'];
33: | } else {
34: | $data['type'] = '';
35: | }
36: |
37: | $data['categories'] = [];
38: |
39: | $this->load->model('setting/extension');
40: |
41: | $files = glob(DIR_APPLICATION . 'controller/extension/*.php');
42: |
43: | foreach ($files as $file) {
44: | $extension = basename($file, '.php');
45: |
46: | $this->load->language('extension/' . $extension, $extension);
47: |
48: | if ($this->user->hasPermission('access', 'extension/' . $extension)) {
49: | $data['categories'][] = [
50: | 'code' => $extension,
51: | 'text' => $this->language->get($extension . '_heading_title') . ' (' . count(glob(DIR_EXTENSION . '*/admin/controller/' . $extension . '/*.php')) . ')',
52: | 'href' => $this->url->link('extension/' . $extension, 'user_token=' . $this->session->data['user_token'])
53: | ];
54: | }
55: | }
56: |
57: | if (isset($this->request->get['type'])) {
58: | $data['extension'] = $this->load->controller('extension/' . basename($this->request->get['type']) . '.getList');
59: | } elseif ($data['categories']) {
60: | $data['extension'] = $this->load->controller('extension/' . $data['categories'][0]['code'] . '.getList');
61: | } else {
62: | $data['extension'] = '';
63: | }
64: |
65: | $data['user_token'] = $this->session->data['user_token'];
66: |
67: | $data['header'] = $this->load->controller('common/header');
68: | $data['column_left'] = $this->load->controller('common/column_left');
69: | $data['footer'] = $this->load->controller('common/footer');
70: |
71: | $this->response->setOutput($this->load->view('marketplace/extension', $data));
72: | }
73: | }
74: |

OpenCart API API documentation generated by ApiGen dev-master