Serveur preprod f0c0c48223 first push
2016-04-14 16:14:31 +02:00

91 lines
2.5 KiB
PHP

<?php
class AdminPrivateSalesStatsStatesController extends ModuleAdminController
{
public function __construct()
{
$this->table = 'privatesale_stats_states';
$this->className = 'PrivateSalesStatsStates';
$this->identifier = "id_privatesale_stats_states";
$this->addRowAction('update');
$this->addRowAction('delete');
parent::__construct();
$this->fields_list = array(
'id_privatesale_stats_states' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25
),
'name' => array(
'title' => $this->l('Name'),
'width' => 130,
)
);
}
public function setMedia()
{
parent::setMedia();
$this->addJS(_MODULE_DIR_.$this->module->name.'/js/admin.js');
$this->addCSS(_MODULE_DIR_.$this->module->name.'/css/admin.css', 'all');
}
public function display()
{
parent::display();
}
public function renderForm()
{
$this->fields_form = array(
'legend' => array(
'title' => $this->l('State'),
'image' => '../img/admin/contact.gif'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Name'),
'name' => 'name',
'size' => 50,
'required' => true
),
array(
'type' => 'select',
'label' => $this->l('States'),
'name' => 'order_states[]',
'multiple' => 'multiple',
'size' => 15,
'options' => array(
'query' => PrivateSalesStatsStates::getOrderStates(),
'id' => 'id_order_state',
'name' => 'name'
)
)
),
'submit' => array(
'title' => $this->l('Save'),
'class' => 'button',
'name' => 'submitEtape',
)
);
$object = $this->loadObject(true);
$this->fields_value['order_states[]'] = ( $object ? $object->states : array() );
return parent::renderForm();
}
public function copyFromPost(&$object, $table)
{
parent::copyFromPost($object, $table);
$object->states = Tools::getValue('order_states', array());
}
}