53 lines
2.3 KiB
PHP
Raw Normal View History

2017-07-06 17:41:10 +02:00
<?php
class CmsController extends CmsControllerCore
{
public function initContent()
{
FrontController::initContent();
$parent_cat = new CMSCategory(1, $this->context->language->id);
$this->context->smarty->assign('id_current_lang', $this->context->language->id);
$this->context->smarty->assign('home_title', $parent_cat->name);
$this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID'));
if (isset($this->cms->id_cms_category) && $this->cms->id_cms_category)
$path = Tools::getFullPath($this->cms->id_cms_category, $this->cms->meta_title, 'CMS');
elseif (isset($this->cms_category->meta_title))
$path = Tools::getFullPath(1, $this->cms_category->meta_title, 'CMS');
2017-07-27 16:34:51 +02:00
/*matrices */
$this->cms->matrices = !empty($this->cms->matrices) ? array_filter(unserialize(base64_decode($this->cms->matrices))) : false;
/* / matrices */
2017-07-06 17:41:10 +02:00
if ($this->assignCase == 1)
{
$this->context->smarty->assign(array(
2017-07-27 16:34:51 +02:00
/* matrices */
'id_lang' => $this->context->language->id,
/* / matrices */
2017-07-06 17:41:10 +02:00
'cms' => $this->cms,
'cms_categories' => CMSCategory::getRecurseCategory($this->context->language->id),
'cms_pages' => CMS::getCMSPages($this->context->language->id, (int)$this->cms->id_cms_category, true, (int)$this->context->shop->id),
'content_only' => (int)Tools::getValue('content_only'),
'path' => $path,
'body_classes' => array($this->php_self.'-'.$this->cms->id, $this->php_self.'-'.$this->cms->link_rewrite)
));
if ($this->cms->indexation == 0)
$this->context->smarty->assign('nobots', true);
}
elseif ($this->assignCase == 2)
{
$this->context->smarty->assign(array(
'category' => $this->cms_category, //for backward compatibility
'cms_category' => $this->cms_category,
'sub_category' => $this->cms_category->getSubCategories($this->context->language->id),
'cms_pages' => CMS::getCMSPages($this->context->language->id, (int)$this->cms_category->id, true, (int)$this->context->shop->id),
'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '',
'body_classes' => array($this->php_self.'-'.$this->cms_category->id, $this->php_self.'-'.$this->cms_category->link_rewrite)
));
}
$this->setTemplate(_PS_THEME_DIR_.'cms.tpl');
}
}