1: | <?php
2: | namespace Opencart\Admin\Controller\Report;
3: | /**
4: | * Class Report
5: | *
6: | * @package Opencart\Admin\Controller\Report
7: | */
8: | class Report extends \Opencart\System\Engine\Controller {
9: | /**
10: | * Index
11: | *
12: | * @return void
13: | */
14: | public function index(): void {
15: | $this->load->language('report/report');
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('report/report', 'user_token=' . $this->session->data['user_token'])
29: | ];
30: |
31: | if (isset($this->request->get['code'])) {
32: | $data['code'] = $this->request->get['code'];
33: | } else {
34: | $data['code'] = '';
35: | }
36: |
37: | // Reports
38: | $data['reports'] = [];
39: |
40: | $this->load->model('setting/extension');
41: |
42: | // Get a list of installed modules
43: | $results = $this->model_setting_extension->getExtensionsByType('report');
44: |
45: | // Add all the modules which have multiple settings for each module
46: | foreach ($results as $result) {
47: | if ($this->config->get('report_' . $result['code'] . '_status') && $this->user->hasPermission('access', 'extension/' . $result['extension'] . '/report/' . $result['code'])) {
48: | $this->load->language('extension/' . $result['extension'] . '/report/' . $result['code'], $result['code']);
49: |
50: | $data['reports'][] = [
51: | 'text' => $this->language->get($result['code'] . '_heading_title'),
52: | 'code' => $result['code'],
53: | 'sort_order' => $this->config->get('report_' . $result['code'] . '_sort_order'),
54: | 'href' => $this->url->link('extension/' . $result['extension'] . '/report/' . $result['code'] . '.report', 'user_token=' . $this->session->data['user_token'])
55: | ];
56: | }
57: | }
58: |
59: | $sort_order = [];
60: |
61: | foreach ($data['reports'] as $key => $value) {
62: | $sort_order[$key] = $value['sort_order'];
63: | }
64: |
65: | array_multisort($sort_order, SORT_ASC, $data['reports']);
66: |
67: | $data['user_token'] = $this->session->data['user_token'];
68: |
69: | $data['header'] = $this->load->controller('common/header');
70: | $data['column_left'] = $this->load->controller('common/column_left');
71: | $data['footer'] = $this->load->controller('common/footer');
72: |
73: | $this->response->setOutput($this->load->view('report/report', $data));
74: | }
75: | }
76: |

OpenCart API API documentation generated by ApiGen dev-master