1: | <?php
2: | namespace Opencart\Catalog\Controller\Extension\Opencart\Module;
3: | /**
4: | * Class Banner
5: | *
6: | * @package Opencart\Catalog\Controller\Extension\Opencart\Module
7: | */
8: | class Banner extends \Opencart\System\Engine\Controller {
9: | /**
10: | * Index
11: | *
12: | * @param array<string, mixed> $setting
13: | *
14: | * @return string
15: | */
16: | public function index(array $setting): string {
17: | static $module = 0;
18: |
19: | $this->load->model('design/banner');
20: | $this->load->model('tool/image');
21: |
22: | $data['banners'] = [];
23: |
24: | $results = $this->model_design_banner->getBanner($setting['banner_id']);
25: |
26: | foreach ($results as $result) {
27: | if (is_file(DIR_IMAGE . html_entity_decode($result['image'], ENT_QUOTES, 'UTF-8'))) {
28: | $data['banners'][] = [
29: | 'title' => $result['title'],
30: | 'link' => $result['link'],
31: | 'image' => $this->model_tool_image->resize(html_entity_decode($result['image'], ENT_QUOTES, 'UTF-8'), $setting['width'], $setting['height'])
32: | ];
33: | }
34: | }
35: |
36: | if ($data['banners']) {
37: | $data['module'] = $module++;
38: |
39: | $data['effect'] = $setting['effect'];
40: | $data['controls'] = $setting['controls'];
41: | $data['indicators'] = $setting['indicators'];
42: | $data['items'] = $setting['items'];
43: | $data['interval'] = $setting['interval'];
44: | $data['width'] = $setting['width'];
45: | $data['height'] = $setting['height'];
46: |
47: | return $this->load->view('extension/opencart/module/banner', $data);
48: | } else {
49: | return '';
50: | }
51: | }
52: | }
53: |

OpenCart API API documentation generated by ApiGen dev-master