2015-08-12 14:10:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require(dirname(__FILE__).'/../../blockadshooks.php');
|
|
|
|
|
|
|
|
class AdminAdsPublicationController extends ModuleAdminController {
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->identifier = 'id_publication';
|
|
|
|
$this->lang = true;
|
|
|
|
$this->table = 'ads_publication';
|
|
|
|
$this->className = 'Publication';
|
|
|
|
$this->bootstrap = true;
|
|
|
|
|
|
|
|
$this->addRowAction('edit');
|
|
|
|
$this->_group .= ' GROUP BY app.id_publication';
|
|
|
|
$this->_select .= ' GROUP_CONCAT(app.page_name) as page_list';
|
|
|
|
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'ads_publication_page` app ON (app.`id_publication` = a.`id_publication`)';
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderList()
|
|
|
|
{
|
|
|
|
$this->fields_list = array(
|
|
|
|
'id_publication' => array(
|
|
|
|
'title' => 'ID',
|
|
|
|
'width' => 25,
|
|
|
|
'class' => 'text-center',
|
|
|
|
),
|
|
|
|
'date_from' => array(
|
|
|
|
'title' => $this->l('Date début'),
|
|
|
|
),
|
|
|
|
'date_to' => array(
|
|
|
|
'title' => $this->l('Date fin'),
|
|
|
|
),
|
|
|
|
'page_list' => array(
|
|
|
|
'title' => 'list des pages'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
return parent::renderList();
|
|
|
|
}
|
|
|
|
|
2015-08-12 16:12:56 +02:00
|
|
|
public function postProcess()
|
|
|
|
{
|
|
|
|
parent::postProcess();
|
|
|
|
|
|
|
|
if(Tools::isSubmit('submitAddads_publication'))
|
|
|
|
{
|
|
|
|
d($_POST);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2015-08-12 14:10:25 +02:00
|
|
|
public function renderForm()
|
|
|
|
{
|
|
|
|
$pages = Publication::getAllPages();
|
|
|
|
foreach($pages as &$page)
|
|
|
|
{
|
|
|
|
$page = array(
|
|
|
|
'id' => $page,
|
|
|
|
'name' => Publication::getPageNameTranslated($page)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->fields_form = array(
|
|
|
|
'multilang' => true,
|
|
|
|
'tinymce' => true,
|
|
|
|
'legend' => array(
|
|
|
|
'title' => $this->l('Ads'),
|
|
|
|
),
|
|
|
|
'submit' => array(
|
|
|
|
'title' => $this->l('Save'),
|
|
|
|
),
|
|
|
|
'input' => array(
|
|
|
|
|
|
|
|
array(
|
2015-08-12 16:12:56 +02:00
|
|
|
'type' => 'relation_posts_cms',
|
|
|
|
'name' => 'input-posts-cms',
|
|
|
|
'label' => $this->l('Sélectionner des articles'),
|
|
|
|
'id' => 'posts-cms',
|
|
|
|
'query' => $this->object->getInfos('postcms')
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'type' => 'relation_posts_edito',
|
|
|
|
'name' => 'input-posts-edito',
|
|
|
|
'label' => $this->l('Sélectionner des éditos'),
|
|
|
|
'id' => 'posts-edito',
|
|
|
|
'query' => $this->object->getInfos('postedito')
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'type' => 'relation_category_cms',
|
|
|
|
'name' => 'input-category-cms',
|
|
|
|
'label' => $this->l("Sélectionner les catégories d'article"),
|
|
|
|
'id' => 'category-cms',
|
|
|
|
'query' => $this->object->getInfos('categorycms')
|
2015-08-12 14:10:25 +02:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'type' => 'textarea',
|
|
|
|
'label' => $this->l('Contenu de la publicité'),
|
|
|
|
'name' => 'content',
|
|
|
|
'lang' => true
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'type' => 'select',
|
|
|
|
'multiple' => true,
|
|
|
|
'label' => $this->l('Liste des pages'),
|
2015-08-12 16:12:56 +02:00
|
|
|
'name' => 'pages',
|
2015-08-12 14:10:25 +02:00
|
|
|
'options' => array(
|
|
|
|
'query' => $pages,
|
|
|
|
'id' => 'id',
|
|
|
|
'name' => 'name'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
array(
|
2015-08-12 16:12:56 +02:00
|
|
|
'type' => 'date',
|
2015-08-12 14:10:25 +02:00
|
|
|
'label' => $this->l('Date de début'),
|
|
|
|
'name' => 'date_from',
|
|
|
|
),
|
|
|
|
array(
|
2015-08-12 16:12:56 +02:00
|
|
|
'type' => 'date',
|
2015-08-12 14:10:25 +02:00
|
|
|
'label' => $this->l('Date de fin'),
|
|
|
|
'name' => 'date_to',
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
return parent::renderForm();
|
|
|
|
}
|
|
|
|
}
|