<?php

//use PrestaShop\PrestaShop\Core\Product\Search\Pagination;
include_once _PS_MODULE_DIR_.'chcreateur/classes/chcreapost.php';


class ChcreateurArchiveModuleFrontController extends ModuleFrontController
{

	public function __construct()
	{
	    parent::__construct();
	    $this->controller_type = 'modulefront';
		$this->page_name = $this->module->name.'-archive';
	}

	public function init()
	{
		parent::init();
	}

	public function setMedia($isNewTheme = false)
	{
		parent::setMedia();
		$this->context->controller->addJS(chcrea_js_dir.'chslider.js');
	}

	public function initContent()
	{
		parent::initContent();

		$id_lang = (int)Context::getContext()->language->id;

		$chcreavars = [];
		$chcreavars['name'] = configuration::get('CHCREATEUR_TITLE');
		$chcreavars['description'] = configuration::get('CHCREATEUR_DESCRIPTION');
		
		$this->context->smarty->assign('chvars', $chcreavars);
		$this->context->smarty->assign('chposts', Chcreapost::getAllSelections());

		$this->setTemplate('module:chcreateur/views/templates/front/archive.tpl');
	}

	public function getBreadcrumbLinks()
    {
        $breadcrumb = parent::getBreadcrumbLinks();
        $breadcrumb['links'][] = [
            'title' => Configuration::get(strtoupper($this->module->name).'_TITLE'),
            'url' => '/'.Configuration::get('CHCREATEUR_URL'),
        ];

        return $breadcrumb;
    }


}

