1: <?php
2: namespace Opencart\Admin\Controller\Common;
3: /**
4: * Class Column Left
5: *
6: * @package Opencart\Admin\Controller\Common
7: */
8: class ColumnLeft extends \Opencart\System\Engine\Controller {
9: /**
10: * Index
11: *
12: * @return string
13: */
14: public function index(): string {
15: if (isset($this->request->get['user_token']) && isset($this->session->data['user_token']) && ((string)$this->request->get['user_token'] == $this->session->data['user_token'])) {
16: $this->load->language('common/column_left');
17:
18: // Create a 3 level menu array
19: // Level 2 cannot have children
20:
21: // Menu
22: $data['menus'][] = [
23: 'id' => 'menu-dashboard',
24: 'icon' => 'fas fa-home',
25: 'name' => $this->language->get('text_dashboard'),
26: 'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token']),
27: 'children' => []
28: ];
29:
30: // Catalog
31: $catalog = [];
32:
33: if ($this->user->hasPermission('access', 'catalog/category')) {
34: $catalog[] = [
35: 'name' => $this->language->get('text_category'),
36: 'href' => $this->url->link('catalog/category', 'user_token=' . $this->session->data['user_token']),
37: 'children' => []
38: ];
39: }
40:
41: if ($this->user->hasPermission('access', 'catalog/product')) {
42: $catalog[] = [
43: 'name' => $this->language->get('text_product'),
44: 'href' => $this->url->link('catalog/product', 'user_token=' . $this->session->data['user_token']),
45: 'children' => []
46: ];
47: }
48:
49: if ($this->user->hasPermission('access', 'catalog/subscription_plan')) {
50: $catalog[] = [
51: 'name' => $this->language->get('text_subscription_plan'),
52: 'href' => $this->url->link('catalog/subscription_plan', 'user_token=' . $this->session->data['user_token']),
53: 'children' => []
54: ];
55: }
56:
57: $filter = [];
58:
59: if ($this->user->hasPermission('access', 'catalog/filter')) {
60: $filter[] = [
61: 'name' => $this->language->get('text_filter'),
62: 'href' => $this->url->link('catalog/filter', 'user_token=' . $this->session->data['user_token']),
63: 'children' => []
64: ];
65: }
66:
67: if ($this->user->hasPermission('access', 'catalog/filter_group')) {
68: $filter[] = [
69: 'name' => $this->language->get('text_filter_group'),
70: 'href' => $this->url->link('catalog/filter_group', 'user_token=' . $this->session->data['user_token']),
71: 'children' => []
72: ];
73: }
74:
75: if ($filter) {
76: $catalog[] = [
77: 'name' => $this->language->get('text_filter'),
78: 'href' => '',
79: 'children' => $filter
80: ];
81: }
82:
83: // Attributes
84: $attribute = [];
85:
86: if ($this->user->hasPermission('access', 'catalog/attribute')) {
87: $attribute[] = [
88: 'name' => $this->language->get('text_attribute'),
89: 'href' => $this->url->link('catalog/attribute', 'user_token=' . $this->session->data['user_token']),
90: 'children' => []
91: ];
92: }
93:
94: if ($this->user->hasPermission('access', 'catalog/attribute_group')) {
95: $attribute[] = [
96: 'name' => $this->language->get('text_attribute_group'),
97: 'href' => $this->url->link('catalog/attribute_group', 'user_token=' . $this->session->data['user_token']),
98: 'children' => []
99: ];
100: }
101:
102: if ($attribute) {
103: $catalog[] = [
104: 'name' => $this->language->get('text_attribute'),
105: 'href' => '',
106: 'children' => $attribute
107: ];
108: }
109:
110: if ($this->user->hasPermission('access', 'catalog/option')) {
111: $catalog[] = [
112: 'name' => $this->language->get('text_option'),
113: 'href' => $this->url->link('catalog/option', 'user_token=' . $this->session->data['user_token']),
114: 'children' => []
115: ];
116: }
117:
118: if ($this->user->hasPermission('access', 'catalog/manufacturer')) {
119: $catalog[] = [
120: 'name' => $this->language->get('text_manufacturer'),
121: 'href' => $this->url->link('catalog/manufacturer', 'user_token=' . $this->session->data['user_token']),
122: 'children' => []
123: ];
124: }
125:
126: if ($this->user->hasPermission('access', 'catalog/download')) {
127: $catalog[] = [
128: 'name' => $this->language->get('text_download'),
129: 'href' => $this->url->link('catalog/download', 'user_token=' . $this->session->data['user_token']),
130: 'children' => []
131: ];
132: }
133:
134: if ($this->user->hasPermission('access', 'catalog/review')) {
135: $catalog[] = [
136: 'name' => $this->language->get('text_review'),
137: 'href' => $this->url->link('catalog/review', 'user_token=' . $this->session->data['user_token']),
138: 'children' => []
139: ];
140: }
141:
142: if ($this->user->hasPermission('access', 'catalog/information')) {
143: $catalog[] = [
144: 'name' => $this->language->get('text_information'),
145: 'href' => $this->url->link('catalog/information', 'user_token=' . $this->session->data['user_token']),
146: 'children' => []
147: ];
148: }
149:
150: if ($catalog) {
151: $data['menus'][] = [
152: 'id' => 'menu-catalog',
153: 'icon' => 'fa-solid fa-tag',
154: 'name' => $this->language->get('text_catalog'),
155: 'href' => '',
156: 'children' => $catalog
157: ];
158: }
159:
160: $cms = [];
161:
162: if ($this->user->hasPermission('access', 'cms/topic')) {
163: $cms[] = [
164: 'name' => $this->language->get('text_topic'),
165: 'href' => $this->url->link('cms/topic', 'user_token=' . $this->session->data['user_token']),
166: 'children' => []
167: ];
168: }
169:
170: if ($this->user->hasPermission('access', 'cms/article')) {
171: $cms[] = [
172: 'name' => $this->language->get('text_article'),
173: 'href' => $this->url->link('cms/article', 'user_token=' . $this->session->data['user_token']),
174: 'children' => []
175: ];
176: }
177:
178: if ($this->user->hasPermission('access', 'cms/comment')) {
179: $cms[] = [
180: 'name' => $this->language->get('text_comment'),
181: 'href' => $this->url->link('cms/comment', 'user_token=' . $this->session->data['user_token']),
182: 'children' => []
183: ];
184: }
185:
186: if ($this->user->hasPermission('access', 'cms/antispam')) {
187: $cms[] = [
188: 'name' => $this->language->get('text_antispam'),
189: 'href' => $this->url->link('cms/antispam', 'user_token=' . $this->session->data['user_token']),
190: 'children' => []
191: ];
192: }
193:
194: if ($cms) {
195: $data['menus'][] = [
196: 'id' => 'menu-cms',
197: 'icon' => 'fa-regular fa-newspaper',
198: 'name' => $this->language->get('text_cms'),
199: 'href' => '',
200: 'children' => $cms
201: ];
202: }
203:
204: // Extension
205: $marketplace = [];
206:
207: if ($this->user->hasPermission('access', 'marketplace/marketplace')) {
208: $marketplace[] = [
209: 'name' => $this->language->get('text_marketplace'),
210: 'href' => $this->url->link('marketplace/marketplace', 'user_token=' . $this->session->data['user_token']),
211: 'children' => []
212: ];
213: }
214:
215: if ($this->user->hasPermission('access', 'marketplace/installer')) {
216: $marketplace[] = [
217: 'name' => $this->language->get('text_installer'),
218: 'href' => $this->url->link('marketplace/installer', 'user_token=' . $this->session->data['user_token']),
219: 'children' => []
220: ];
221: }
222:
223: if ($this->user->hasPermission('access', 'marketplace/extension')) {
224: $marketplace[] = [
225: 'name' => $this->language->get('text_extension'),
226: 'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token']),
227: 'children' => []
228: ];
229: }
230:
231: if ($this->user->hasPermission('access', 'marketplace/modification')) {
232: $marketplace[] = [
233: 'name' => $this->language->get('text_modification'),
234: 'href' => $this->url->link('marketplace/modification', 'user_token=' . $this->session->data['user_token']),
235: 'children' => []
236: ];
237: }
238:
239: if ($this->user->hasPermission('access', 'marketplace/startup')) {
240: $marketplace[] = [
241: 'name' => $this->language->get('text_startup'),
242: 'href' => $this->url->link('marketplace/startup', 'user_token=' . $this->session->data['user_token']),
243: 'children' => []
244: ];
245: }
246:
247: if ($this->user->hasPermission('access', 'marketplace/event')) {
248: $marketplace[] = [
249: 'name' => $this->language->get('text_event'),
250: 'href' => $this->url->link('marketplace/event', 'user_token=' . $this->session->data['user_token']),
251: 'children' => []
252: ];
253: }
254:
255: if ($this->user->hasPermission('access', 'marketplace/cron')) {
256: $marketplace[] = [
257: 'name' => $this->language->get('text_cron'),
258: 'href' => $this->url->link('marketplace/cron', 'user_token=' . $this->session->data['user_token']),
259: 'children' => []
260: ];
261: }
262:
263: if ($marketplace) {
264: $data['menus'][] = [
265: 'id' => 'menu-extension',
266: 'icon' => 'fas fa-puzzle-piece',
267: 'name' => $this->language->get('text_extension'),
268: 'href' => '',
269: 'children' => $marketplace
270: ];
271: }
272:
273: // Design
274: $design = [];
275:
276: if ($this->user->hasPermission('access', 'design/layout')) {
277: $design[] = [
278: 'name' => $this->language->get('text_layout'),
279: 'href' => $this->url->link('design/layout', 'user_token=' . $this->session->data['user_token']),
280: 'children' => []
281: ];
282: }
283:
284: if ($this->user->hasPermission('access', 'design/theme')) {
285: $design[] = [
286: 'name' => $this->language->get('text_theme'),
287: 'href' => $this->url->link('design/theme', 'user_token=' . $this->session->data['user_token']),
288: 'children' => []
289: ];
290: }
291:
292: if ($this->user->hasPermission('access', 'design/translation')) {
293: $design[] = [
294: 'name' => $this->language->get('text_language_editor'),
295: 'href' => $this->url->link('design/translation', 'user_token=' . $this->session->data['user_token']),
296: 'children' => []
297: ];
298: }
299:
300: if ($this->user->hasPermission('access', 'design/banner')) {
301: $design[] = [
302: 'name' => $this->language->get('text_banner'),
303: 'href' => $this->url->link('design/banner', 'user_token=' . $this->session->data['user_token']),
304: 'children' => []
305: ];
306: }
307:
308: if ($this->user->hasPermission('access', 'design/seo_url')) {
309: $design[] = [
310: 'name' => $this->language->get('text_seo_url'),
311: 'href' => $this->url->link('design/seo_url', 'user_token=' . $this->session->data['user_token']),
312: 'children' => []
313: ];
314: }
315:
316: if ($design) {
317: $data['menus'][] = [
318: 'id' => 'menu-design',
319: 'icon' => 'fas fa-desktop',
320: 'name' => $this->language->get('text_design'),
321: 'href' => '',
322: 'children' => $design
323: ];
324: }
325:
326: // Sales
327: $sale = [];
328:
329: if ($this->user->hasPermission('access', 'sale/order')) {
330: $sale[] = [
331: 'name' => $this->language->get('text_order'),
332: 'href' => $this->url->link('sale/order', 'user_token=' . $this->session->data['user_token']),
333: 'children' => []
334: ];
335: }
336:
337: if ($this->user->hasPermission('access', 'sale/subscription')) {
338: $sale[] = [
339: 'name' => $this->language->get('text_subscription'),
340: 'href' => $this->url->link('sale/subscription', 'user_token=' . $this->session->data['user_token']),
341: 'children' => []
342: ];
343: }
344:
345: if ($this->user->hasPermission('access', 'sale/returns')) {
346: $sale[] = [
347: 'name' => $this->language->get('text_return'),
348: 'href' => $this->url->link('sale/returns', 'user_token=' . $this->session->data['user_token']),
349: 'children' => []
350: ];
351: }
352:
353: // Voucher
354: $voucher = [];
355:
356: if ($this->user->hasPermission('access', 'sale/voucher')) {
357: $voucher[] = [
358: 'name' => $this->language->get('text_voucher'),
359: 'href' => $this->url->link('sale/voucher', 'user_token=' . $this->session->data['user_token']),
360: 'children' => []
361: ];
362: }
363:
364: if ($this->user->hasPermission('access', 'sale/voucher_theme')) {
365: $voucher[] = [
366: 'name' => $this->language->get('text_voucher_theme'),
367: 'href' => $this->url->link('sale/voucher_theme', 'user_token=' . $this->session->data['user_token']),
368: 'children' => []
369: ];
370: }
371:
372: if ($voucher) {
373: $sale[] = [
374: 'name' => $this->language->get('text_voucher'),
375: 'href' => '',
376: 'children' => $voucher
377: ];
378: }
379:
380: if ($sale) {
381: $data['menus'][] = [
382: 'id' => 'menu-sale',
383: 'icon' => 'fas fa-shopping-cart',
384: 'name' => $this->language->get('text_sale'),
385: 'href' => '',
386: 'children' => $sale
387: ];
388: }
389:
390: // Customer
391: $customer = [];
392:
393: if ($this->user->hasPermission('access', 'customer/customer')) {
394: $customer[] = [
395: 'name' => $this->language->get('text_customer'),
396: 'href' => $this->url->link('customer/customer', 'user_token=' . $this->session->data['user_token']),
397: 'children' => []
398: ];
399: }
400:
401: if ($this->user->hasPermission('access', 'customer/customer_group')) {
402: $customer[] = [
403: 'name' => $this->language->get('text_customer_group'),
404: 'href' => $this->url->link('customer/customer_group', 'user_token=' . $this->session->data['user_token']),
405: 'children' => []
406: ];
407: }
408:
409: if ($this->user->hasPermission('access', 'customer/customer_approval')) {
410: $customer[] = [
411: 'name' => $this->language->get('text_customer_approval'),
412: 'href' => $this->url->link('customer/customer_approval', 'user_token=' . $this->session->data['user_token']),
413: 'children' => []
414: ];
415: }
416:
417: if ($this->user->hasPermission('access', 'customer/gdpr')) {
418: $customer[] = [
419: 'name' => $this->language->get('text_gdpr'),
420: 'href' => $this->url->link('customer/gdpr', 'user_token=' . $this->session->data['user_token']),
421: 'children' => []
422: ];
423: }
424:
425: if ($this->user->hasPermission('access', 'customer/custom_field')) {
426: $customer[] = [
427: 'name' => $this->language->get('text_custom_field'),
428: 'href' => $this->url->link('customer/custom_field', 'user_token=' . $this->session->data['user_token']),
429: 'children' => []
430: ];
431: }
432:
433: if ($customer) {
434: $data['menus'][] = [
435: 'id' => 'menu-customer',
436: 'icon' => 'fas fa-user',
437: 'name' => $this->language->get('text_customer'),
438: 'href' => '',
439: 'children' => $customer
440: ];
441: }
442:
443: // Marketing
444: $marketing = [];
445:
446: if ($this->user->hasPermission('access', 'marketing/affiliate')) {
447: $marketing[] = [
448: 'name' => $this->language->get('text_affiliate'),
449: 'href' => $this->url->link('marketing/affiliate', 'user_token=' . $this->session->data['user_token']),
450: 'children' => []
451: ];
452: }
453:
454: if ($this->user->hasPermission('access', 'marketing/marketing')) {
455: $marketing[] = [
456: 'name' => $this->language->get('text_marketing'),
457: 'href' => $this->url->link('marketing/marketing', 'user_token=' . $this->session->data['user_token']),
458: 'children' => []
459: ];
460: }
461:
462: if ($this->user->hasPermission('access', 'marketing/coupon')) {
463: $marketing[] = [
464: 'name' => $this->language->get('text_coupon'),
465: 'href' => $this->url->link('marketing/coupon', 'user_token=' . $this->session->data['user_token']),
466: 'children' => []
467: ];
468: }
469:
470: if ($this->user->hasPermission('access', 'marketing/contact')) {
471: $marketing[] = [
472: 'name' => $this->language->get('text_contact'),
473: 'href' => $this->url->link('marketing/contact', 'user_token=' . $this->session->data['user_token']),
474: 'children' => []
475: ];
476: }
477:
478: if ($marketing) {
479: $data['menus'][] = [
480: 'id' => 'menu-marketing',
481: 'icon' => 'fas fa-share-alt',
482: 'name' => $this->language->get('text_marketing'),
483: 'href' => '',
484: 'children' => $marketing
485: ];
486: }
487:
488: // Anti-Fraud
489: $fraud = [];
490:
491: $this->load->model('setting/extension');
492:
493: $results = $this->model_setting_extension->getExtensionsByType('fraud');
494:
495: foreach ($results as $result) {
496: if ($this->config->get('fraud_' . $result['code'] . '_status')) {
497: $this->load->language('extension/' . $result['extension'] . '/fraud/' . $result['code'], $result['code']);
498:
499: $fraud[] = [
500: 'name' => $this->language->get($result['code'] . '_heading_title'),
501: 'href' => $this->url->link('extension/' . $result['extension'] . '/fraud/' . $result['code'], 'user_token=' . $this->session->data['user_token']),
502: 'children' => []
503: ];
504: }
505: }
506:
507: if ($fraud) {
508: $data['menus'][] = [
509: 'id' => 'menu-fraud',
510: 'icon' => 'fas fa-share-alt',
511: 'name' => $this->language->get('text_antifraud'),
512: 'href' => '',
513: 'children' => $fraud
514: ];
515: }
516:
517: $marketing = [];
518:
519: if ($this->user->hasPermission('access', 'marketing/affiliate')) {
520: $marketing[] = [
521: 'name' => $this->language->get('text_affiliate'),
522: 'href' => $this->url->link('marketing/affiliate', 'user_token=' . $this->session->data['user_token']),
523: 'children' => []
524: ];
525: }
526:
527: // System
528: $system = [];
529:
530: if ($this->user->hasPermission('access', 'setting/setting')) {
531: $system[] = [
532: 'name' => $this->language->get('text_setting'),
533: 'href' => $this->url->link('setting/store', 'user_token=' . $this->session->data['user_token']),
534: 'children' => []
535: ];
536: }
537:
538: // Users
539: $user = [];
540:
541: if ($this->user->hasPermission('access', 'user/user')) {
542: $user[] = [
543: 'name' => $this->language->get('text_users'),
544: 'href' => $this->url->link('user/user', 'user_token=' . $this->session->data['user_token']),
545: 'children' => []
546: ];
547: }
548:
549: if ($this->user->hasPermission('access', 'user/user_permission')) {
550: $user[] = [
551: 'name' => $this->language->get('text_user_group'),
552: 'href' => $this->url->link('user/user_permission', 'user_token=' . $this->session->data['user_token']),
553: 'children' => []
554: ];
555: }
556:
557: if ($this->user->hasPermission('access', 'user/api')) {
558: $user[] = [
559: 'name' => $this->language->get('text_api'),
560: 'href' => $this->url->link('user/api', 'user_token=' . $this->session->data['user_token']),
561: 'children' => []
562: ];
563: }
564:
565: if ($user) {
566: $system[] = [
567: 'name' => $this->language->get('text_users'),
568: 'href' => '',
569: 'children' => $user
570: ];
571: }
572:
573: // Localisation
574: $localisation = [];
575:
576: if ($this->user->hasPermission('access', 'localisation/location')) {
577: $localisation[] = [
578: 'name' => $this->language->get('text_location'),
579: 'href' => $this->url->link('localisation/location', 'user_token=' . $this->session->data['user_token']),
580: 'children' => []
581: ];
582: }
583:
584: if ($this->user->hasPermission('access', 'localisation/language')) {
585: $localisation[] = [
586: 'name' => $this->language->get('text_language'),
587: 'href' => $this->url->link('localisation/language', 'user_token=' . $this->session->data['user_token']),
588: 'children' => []
589: ];
590: }
591:
592: if ($this->user->hasPermission('access', 'localisation/currency')) {
593: $localisation[] = [
594: 'name' => $this->language->get('text_currency'),
595: 'href' => $this->url->link('localisation/currency', 'user_token=' . $this->session->data['user_token']),
596: 'children' => []
597: ];
598: }
599:
600: if ($this->user->hasPermission('access', 'localisation/stock_status')) {
601: $localisation[] = [
602: 'name' => $this->language->get('text_stock_status'),
603: 'href' => $this->url->link('localisation/stock_status', 'user_token=' . $this->session->data['user_token']),
604: 'children' => []
605: ];
606: }
607:
608: if ($this->user->hasPermission('access', 'localisation/order_status')) {
609: $localisation[] = [
610: 'name' => $this->language->get('text_order_status'),
611: 'href' => $this->url->link('localisation/order_status', 'user_token=' . $this->session->data['user_token']),
612: 'children' => []
613: ];
614: }
615:
616: if ($this->user->hasPermission('access', 'localisation/subscription_status')) {
617: $localisation[] = [
618: 'name' => $this->language->get('text_subscription_status'),
619: 'href' => $this->url->link('localisation/subscription_status', 'user_token=' . $this->session->data['user_token']),
620: 'children' => []
621: ];
622: }
623:
624: // Returns
625: $returns = [];
626:
627: if ($this->user->hasPermission('access', 'localisation/return_status')) {
628: $returns[] = [
629: 'name' => $this->language->get('text_return_status'),
630: 'href' => $this->url->link('localisation/return_status', 'user_token=' . $this->session->data['user_token']),
631: 'children' => []
632: ];
633: }
634:
635: if ($this->user->hasPermission('access', 'localisation/return_action')) {
636: $returns[] = [
637: 'name' => $this->language->get('text_return_action'),
638: 'href' => $this->url->link('localisation/return_action', 'user_token=' . $this->session->data['user_token']),
639: 'children' => []
640: ];
641: }
642:
643: if ($this->user->hasPermission('access', 'localisation/return_reason')) {
644: $returns[] = [
645: 'name' => $this->language->get('text_return_reason'),
646: 'href' => $this->url->link('localisation/return_reason', 'user_token=' . $this->session->data['user_token']),
647: 'children' => []
648: ];
649: }
650:
651: if ($returns) {
652: $localisation[] = [
653: 'name' => $this->language->get('text_return'),
654: 'href' => '',
655: 'children' => $returns
656: ];
657: }
658:
659: if ($this->user->hasPermission('access', 'localisation/country')) {
660: $localisation[] = [
661: 'name' => $this->language->get('text_country'),
662: 'href' => $this->url->link('localisation/country', 'user_token=' . $this->session->data['user_token']),
663: 'children' => []
664: ];
665: }
666:
667: if ($this->user->hasPermission('access', 'localisation/zone')) {
668: $localisation[] = [
669: 'name' => $this->language->get('text_zone'),
670: 'href' => $this->url->link('localisation/zone', 'user_token=' . $this->session->data['user_token']),
671: 'children' => []
672: ];
673: }
674:
675: if ($this->user->hasPermission('access', 'localisation/geo_zone')) {
676: $localisation[] = [
677: 'name' => $this->language->get('text_geo_zone'),
678: 'href' => $this->url->link('localisation/geo_zone', 'user_token=' . $this->session->data['user_token']),
679: 'children' => []
680: ];
681: }
682:
683: // Tax
684: $tax = [];
685:
686: if ($this->user->hasPermission('access', 'localisation/tax_class')) {
687: $tax[] = [
688: 'name' => $this->language->get('text_tax_class'),
689: 'href' => $this->url->link('localisation/tax_class', 'user_token=' . $this->session->data['user_token']),
690: 'children' => []
691: ];
692: }
693:
694: if ($this->user->hasPermission('access', 'localisation/tax_rate')) {
695: $tax[] = [
696: 'name' => $this->language->get('text_tax_rate'),
697: 'href' => $this->url->link('localisation/tax_rate', 'user_token=' . $this->session->data['user_token']),
698: 'children' => []
699: ];
700: }
701:
702: if ($tax) {
703: $localisation[] = [
704: 'name' => $this->language->get('text_tax'),
705: 'href' => '',
706: 'children' => $tax
707: ];
708: }
709:
710: if ($this->user->hasPermission('access', 'localisation/length_class')) {
711: $localisation[] = [
712: 'name' => $this->language->get('text_length_class'),
713: 'href' => $this->url->link('localisation/length_class', 'user_token=' . $this->session->data['user_token']),
714: 'children' => []
715: ];
716: }
717:
718: if ($this->user->hasPermission('access', 'localisation/weight_class')) {
719: $localisation[] = [
720: 'name' => $this->language->get('text_weight_class'),
721: 'href' => $this->url->link('localisation/weight_class', 'user_token=' . $this->session->data['user_token']),
722: 'children' => []
723: ];
724: }
725:
726: if ($this->user->hasPermission('access', 'localisation/address_format')) {
727: $localisation[] = [
728: 'name' => $this->language->get('text_address_format'),
729: 'href' => $this->url->link('localisation/address_format', 'user_token=' . $this->session->data['user_token']),
730: 'children' => []
731: ];
732: }
733:
734: if ($localisation) {
735: $system[] = [
736: 'name' => $this->language->get('text_localisation'),
737: 'href' => '',
738: 'children' => $localisation
739: ];
740: }
741:
742: // Tools
743: $maintenance = [];
744:
745: if ($this->user->hasPermission('access', 'tool/upgrade')) {
746: $maintenance[] = [
747: 'name' => $this->language->get('text_upgrade'),
748: 'href' => $this->url->link('tool/upgrade', 'user_token=' . $this->session->data['user_token']),
749: 'children' => []
750: ];
751: }
752:
753: if ($this->user->hasPermission('access', 'tool/backup')) {
754: $maintenance[] = [
755: 'name' => $this->language->get('text_backup'),
756: 'href' => $this->url->link('tool/backup', 'user_token=' . $this->session->data['user_token']),
757: 'children' => []
758: ];
759: }
760:
761: if ($this->user->hasPermission('access', 'tool/upload')) {
762: $maintenance[] = [
763: 'name' => $this->language->get('text_upload'),
764: 'href' => $this->url->link('tool/upload', 'user_token=' . $this->session->data['user_token']),
765: 'children' => []
766: ];
767: }
768:
769: if ($this->user->hasPermission('access', 'tool/log')) {
770: $maintenance[] = [
771: 'name' => $this->language->get('text_log'),
772: 'href' => $this->url->link('tool/log', 'user_token=' . $this->session->data['user_token']),
773: 'children' => []
774: ];
775: }
776:
777: if ($maintenance) {
778: $system[] = [
779: 'name' => $this->language->get('text_maintenance'),
780: 'href' => '',
781: 'children' => $maintenance
782: ];
783: }
784:
785: if ($system) {
786: $data['menus'][] = [
787: 'id' => 'menu-system',
788: 'icon' => 'fas fa-cog',
789: 'name' => $this->language->get('text_system'),
790: 'href' => '',
791: 'children' => $system
792: ];
793: }
794:
795: $report = [];
796:
797: if ($this->user->hasPermission('access', 'report/report')) {
798: $report[] = [
799: 'name' => $this->language->get('text_reports'),
800: 'href' => $this->url->link('report/report', 'user_token=' . $this->session->data['user_token']),
801: 'children' => []
802: ];
803: }
804:
805: if ($this->user->hasPermission('access', 'report/online')) {
806: $report[] = [
807: 'name' => $this->language->get('text_online'),
808: 'href' => $this->url->link('report/online', 'user_token=' . $this->session->data['user_token']),
809: 'children' => []
810: ];
811: }
812:
813: if ($this->user->hasPermission('access', 'report/statistics')) {
814: $report[] = [
815: 'name' => $this->language->get('text_statistics'),
816: 'href' => $this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token']),
817: 'children' => []
818: ];
819: }
820:
821: if ($report) {
822: $data['menus'][] = [
823: 'id' => 'menu-report',
824: 'icon' => 'fas fa-chart-bar',
825: 'name' => $this->language->get('text_reports'),
826: 'href' => '',
827: 'children' => $report
828: ];
829: }
830:
831: // Stats
832: if ($this->user->hasPermission('access', 'report/statistics')) {
833: $this->load->model('sale/order');
834:
835: $order_total = (float)$this->model_sale_order->getTotalOrders();
836:
837: $this->load->model('report/statistics');
838:
839: $complete_total = (float)$this->model_report_statistics->getValue('order_complete');
840:
841: if ($complete_total && $order_total) {
842: $data['complete_status'] = round(($complete_total / $order_total) * 100);
843: } else {
844: $data['complete_status'] = 0;
845: }
846:
847: $processing_total = (float)$this->model_report_statistics->getValue('order_processing');
848:
849: if ($processing_total && $order_total) {
850: $data['processing_status'] = round(($processing_total / $order_total) * 100);
851: } else {
852: $data['processing_status'] = 0;
853: }
854:
855: $other_total = (float)$this->model_report_statistics->getValue('order_other');
856:
857: if ($other_total && $order_total) {
858: $data['other_status'] = round(($other_total / $order_total) * 100);
859: } else {
860: $data['other_status'] = 0;
861: }
862:
863: $data['statistics_status'] = true;
864: } else {
865: $data['statistics_status'] = false;
866: }
867:
868: return $this->load->view('common/column_left', $data);
869: } else {
870: return '';
871: }
872: }
873: }
874: