105 lines
3.1 KiB
PHP
105 lines
3.1 KiB
PHP
<?php
|
|
|
|
require_once(dirname(__FILE__).'/../../blockadshooks.php');
|
|
|
|
class AdminAdsController extends ModuleAdminController {
|
|
|
|
public function __construct()
|
|
{
|
|
$this->identifier = 'id_block_ads';
|
|
$this->lang = true;
|
|
$this->table = 'ads';
|
|
$this->className = 'BlockAds';
|
|
$this->bootstrap = true;
|
|
|
|
$this->addRowAction('view');
|
|
$this->addRowAction('edit');
|
|
|
|
parent::__construct();
|
|
}
|
|
|
|
public function renderList()
|
|
{
|
|
$this->fields_list = array(
|
|
'id_block_ads' => array(
|
|
'title' => 'ID',
|
|
'width' => 25,
|
|
'class' => 'text-center',
|
|
),
|
|
'label' => array(
|
|
'title' => $this->l('Label'),
|
|
),
|
|
'hook_name' => array(
|
|
'title' => $this->l('Hook'),
|
|
)
|
|
);
|
|
|
|
return parent::renderList();
|
|
}
|
|
|
|
public function renderForm()
|
|
{
|
|
$this->fields_form = array(
|
|
'multilang' => true,
|
|
'tinymce' => true,
|
|
'legend' => array(
|
|
'title' => $this->l('Ads'),
|
|
),
|
|
'submit' => array(
|
|
'title' => $this->l('Save'),
|
|
),
|
|
'input' => array(
|
|
array(
|
|
'type' => 'text',
|
|
'label' => $this->l('Label'),
|
|
'name' => 'label',
|
|
),
|
|
array(
|
|
'type' => 'text',
|
|
'label' => $this->l('Nom du hook'),
|
|
'name' => 'hook_name',
|
|
'disabled' => Validate::isLoadedObject($this->object)
|
|
),
|
|
array(
|
|
'type' => 'text',
|
|
'label' => $this->l('Width'),
|
|
'name' => 'width',
|
|
),
|
|
array(
|
|
'type' => 'text',
|
|
'label' => $this->l('Height'),
|
|
'name' => 'height',
|
|
),
|
|
array(
|
|
'type' => 'textarea',
|
|
'label' => $this->l('Contenu par défaut de l emplacement'),
|
|
'name' => 'content',
|
|
'lang' => true
|
|
),
|
|
|
|
)
|
|
);
|
|
|
|
|
|
return parent::renderForm();
|
|
}
|
|
|
|
public function renderView()
|
|
{
|
|
require(_PS_MODULE_DIR_.'blockadshooks/controllers/admin/AdminAdsPublication.php');
|
|
$controller = new AdminAdsPublicationController();
|
|
$controller->listByAds(array($this->object->id));
|
|
$controller->toolbar_title = $this->l('Liste des publicités');
|
|
$controller->toolbar_btn['new'] = array(
|
|
'href' => Context::getContext()->link->getAdminLink('AdminAdsPublication', true).'&id_default_ads='.$this->object->id.'&addads_publication',
|
|
'desc' => $this->l('Add new')
|
|
);
|
|
|
|
$this->context->smarty->assign(array(
|
|
'ads' => $this->object,
|
|
'publications_list' => $controller->renderList()
|
|
));
|
|
|
|
return parent::renderView();
|
|
}
|
|
} |