<?php
class ControllerCommonHeaderMinimalist extends Controller
{
    protected function index()
    {
        $this->data['title'] = $this->document->getTitle();

        $this->load->type('tipocomum');
        $this->load->helper('ftr_geral');
        $this->load->dmodel('tool/image');
        $this->load->model('catalog/product');

        $server = $this->url->link('', '', 'SSL', false);

        if (isset($this->session->data['error']) && !empty($this->session->data['error'])) {
            $this->data['error'] = $this->session->data['error'];

            unset($this->session->data['error']);
        } else {
            $this->data['error'] = '';
        }

        $this->data['base'] = $server;
        $this->data['description'] = $this->document->getDescription();
        $this->data['keywords'] = $this->document->getKeywords();
        $this->data['links'] = $this->document->getLinks();
        $this->data['styles'] = $this->document->getStyles();
        $this->data['propertys'] = $this->document->getPropertys();
        $this->data['scripts'] = $this->document->getScripts();
        $this->data['types'] = $this->document->getTypes();
        $this->data['lang'] = $this->language->get('code');
        $this->data['direction'] = $this->language->get('direction');

        $this->data['name'] = $this->config->get('config_name');

        if ($this->config->get('config_icon') && file_exists(DIR_IMAGE . $this->config->get('config_icon'))) {
            $this->data['icon'] = $server . 'image/' . $this->config->get('config_icon');
        } else {
            $this->data['icon'] = '';
        }

        if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
            $logo_original = getimagesize(DIR_IMAGE . $this->config->get('config_logo'));
            $this->data['logo_original_width'] = $logo_original[0];
            $this->data['logo_original_height'] = $logo_original[1];
            $this->data['logo'] = $this->dmodel_tool_image->proportionatelyResize($this->config->get('config_logo'), 200, true);
        } else {
            $this->data['logo'] = '';
        }

        // Logo Responsivo
        $this->data['logo_responsivo'] =
            file_exists(DIR_IMAGE . $this->config->get('config_logo_responsivo')) ?
            $server . 'image/' . $this->config->get('config_logo_responsivo') :
            $server . 'image/' . $this->config->get('config_logo');

        $this->data['home'] = $this->url->link('common/home', '', 'NONSSL', 'false');

        $this->data['font_size'] = array(
            'title_page' => Type_TitlePage::getNickFromValue($this->config->get('wg24_page_h_font_size')),
            'title_product' => Type_TitleProduct::getNickFromValue($this->config->get('wg24_produt_h_font_size')),
            'title_aside' => Type_TitleAside::getNickFromValue($this->config->get('wg24_left_rig_h_font_size')),
        );

        $this->data['lab'] = $this->ftrgeralregistry->getScriptManifest('catalog/view/theme/vista/public/js/lab.js', true);

        $this->data['header_bg_color'] = $this->config->get('wg24_header_bg_color');
        $this->data['link_color'] = $this->config->get('wg24_l_linkc');
        $this->data['buttom_bg_color'] = $this->config->get('wg24_btn_1bg_col');
        $this->data['buttom_color'] = $this->config->get('wg24_btn_text_col');

        $this->children = array(
            'common/scripts_top',
        );

        $this->render('common/header_minimalist');
    }
}
