<?php
class ControllerExtensionModuleService extends Controller {
	public function index() {

	    $this->load->language('extension/module/service');
        $this->load->model('catalog/category');
        $this->load->model('tool/image');

        $data['heading_title'] = $this->language->get('heading_title');
        $data['text_more'] = $this->language->get('text_more');

        $results = $this->model_catalog_category->getThreeInfo();

        $data['categories'] = array();

        if($results) {
            foreach ($results as $result) {

                if ($result['image']) {
                    $image = $this->model_tool_image->resize($result['image'], $this->config->get($this->config->get('config_theme') . '_image_related_width'), $this->config->get($this->config->get('config_theme') . '_image_related_height'));
                } else {
                    $image = $this->model_tool_image->resize('placeholder.png', $this->config->get($this->config->get('config_theme') . '_image_related_width'), $this->config->get($this->config->get('config_theme') . '_image_related_height'));
                }

                $data['categories'][] = array(
                    'title'            => $result['title'],
                    'description'      => mb_substr(strip_tags(html_entity_decode($result['description'])), 0, 160) . '...',
                    'short_description'=> mb_substr(strip_tags(html_entity_decode($result['short_description'])), 0, 160) . '...',
                    'image'            => $image,
                    'href'             => $this->url->link('information/information', '&information_id='.$result['information_id'])
                );
            }
        }

		return $this->load->view('extension/module/service', $data);
	}
}
