toutpratique/modules/cms_extrafields/controllers/admin/AdminExtraFieldsValueController.php
2015-08-21 10:59:28 +02:00

86 lines
2.3 KiB
PHP

<?php
require_once(dirname(__FILE__).'/../../cms_extrafields.php');
class AdminExtraFieldsValueController extends ModuleAdminController {
public function __construct()
{
$this->identifier = 'id_cmsps_extrafields_value';
$this->lang = true;
$this->table = 'cmsps_extrafields_value';
$this->className = 'CmsPsExtraFieldsValue';
$this->bootstrap = true;
$this->addRowAction('edit');
parent::__construct();
}
public function renderList()
{
$this->fields_list = array(
'id_cmsps_extrafields_value' => array(
'title' => 'ID',
'width' => 25,
'class' => 'text-center',
),
'value' => array(
'title' => $this->l('Name'),
),
'id_group' => array(
'title' => $this->l('Groupe'),
)
);
return parent::renderList();
}
public function renderForm()
{
$this->fields_form = array(
'multilang' => true,
'legend' => array(
'title' => $this->l('Tags CMS'),
),
'submit' => array(
'title' => $this->l('Save'),
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Name'),
'name' => 'value',
'lang' => true
),
array(
'type' => 'select',
'label' => $this->l('Groupe'),
'name' => 'id_group',
'options' => array(
'query' => $this->getGroupPossibility(),
'id' => 'id',
'name' => 'name'
)
),
),
);
return parent::renderForm();
}
public function getGroupPossibility() {
$groups = array();
$groups_list = CmsPsExtraFieldsGroup::getAll(Context::getContext()->language->id);
foreach ($groups_list as $key => $group) {
$groups[] = array(
'id' => $group->id,
'name' => $group->name
);
}
return $groups;
}
}