49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
if (!class_exists('CmsPsEdito')) {
|
|
require_once _PS_MODULE_DIR_.'cmsps/classes/CmsPsEdito.php';
|
|
}
|
|
|
|
class HomeEditoControllerCore extends FrontController
|
|
{
|
|
public $php_self = 'homeedito';
|
|
public $page;
|
|
|
|
const PER_PAGE = 20;
|
|
|
|
public function canonicalRedirection($canonical_url = '') {
|
|
parent::canonicalRedirection($this->context->link->getHomeEditoLink());
|
|
}
|
|
|
|
public function init() {
|
|
$this->page = Tools::getValue('page', 1);
|
|
parent::init();
|
|
}
|
|
|
|
public function initContent() {
|
|
parent::initContent();
|
|
|
|
$id_lang = Context::getContext()->language->id;
|
|
|
|
$total = CmsPsEdito::getAllEditos($id_lang, 9999999, 1, TRUE);
|
|
$editos = CmsPsEdito::getAllEditos($id_lang, self::PER_PAGE, $this->page, FALSE);
|
|
|
|
$nb_page = ceil($total / self::PER_PAGE);
|
|
if($this->page > $nb_page) {
|
|
$this->page = $nb_page;
|
|
}
|
|
$url_pagination = strtok($_SERVER['REQUEST_URI'], '?');
|
|
|
|
$this->context->smarty->assign(array(
|
|
// 'path' => Tools::getPath($this->postedito->id, '', FALSE, 'postedito'),
|
|
'editos' => $editos,
|
|
'url_pagination' => $url_pagination,
|
|
'nb_page' => $nb_page,
|
|
'total' => $total,
|
|
'limit' => count($editos),
|
|
'p' => $this->page,
|
|
));
|
|
|
|
$this->setTemplate(_PS_THEME_DIR_.'editos.tpl');
|
|
}
|
|
|
|
} |