Create Form

This commit is contained in:
Michael RICOIS 2018-02-22 09:34:13 +01:00
parent dd21d98b9c
commit 9d615586ec
2 changed files with 112 additions and 8 deletions

View File

@ -207,7 +207,7 @@ class HelperList{
if ($all)
$html .= '<span style="margin: 0 5px;">' . $all_text . '</span>';
else
$html .= '<a style="margin: 0 5px;" class="button" href="' . $href . 'all' . '">' . $all_text . '</a>';
$html .= '<a style="margin: 0 5px;" class="button" href="' . $href . 'all' . '">' . $all_text . '</a>';
$html .= '</div>';
return $html;
}

View File

@ -10,6 +10,11 @@ class AdminSkinStatic extends AdminTab
protected $maxImageSize = NULL;
protected $maxFileSize = NULL;
/**
* @var HelperFormBootstrap
*/
protected $helperForm;
public function __construct()
{
$this->table = 'skinstatic';
@ -23,13 +28,40 @@ class AdminSkinStatic extends AdminTab
$this->maxFileSize = (Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1000000);
$this->fieldsDisplay = array(
'id_skinstatic' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Name'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'filter_key' => 'name', 'orderby' => false),
'a!active' => array('title' => $this->l('Active'), 'active' => 'status', 'filter_key' => 'a!active', 'align' => 'center', 'type' => 'bool', 'orderby' => false),
'start_at' => array('title' => $this->l('Start at'), 'widthColumn' => 100, 'width' => 140),
'end_at' => array('title' => $this->l('End at'), 'widthColumn' => 100, 'width' => 140),
'id_skinstatic' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25
),
'name' => array(
'title' => $this->l('Name'),
'width' => 200,
'align' => 'center',
'type' => 'string',
'filter_key' => 'name',
'orderby' => false
),
'a!active' => array(
'title' => $this->l('Active'),
'active' => 'status',
'filter_key' => 'a!active',
'align' => 'center',
'type' => 'bool',
'orderby' => false
),
'start_at' => array(
'title' => $this->l('Start at'),
'widthColumn' => 100,
'width' => 140
),
'end_at' => array(
'title' => $this->l('End at'),
'widthColumn' => 100, 'width' => 140
),
);
$this->helperForm = new HelperFormBootstrap();
parent::__construct();
}
@ -52,7 +84,79 @@ class AdminSkinStatic extends AdminTab
// Form
public function displayForm()
{
parent::displayForm();
echo "TEST";
$this->helperForm->_dateTimePicker = true;
$this->helperForm->_forms = array(
array(
'action' => $currentIndex.'&token='.Tools::getAdminTokenLite('AdminSkinStatic'),
'title' => $this->l('Nouveau Bandeau'),
'icon' => '<span class="glyphicon glyphicon-list"></span> ',
'class' => 'form-horizontal',
'id' => 'form-category',
'class_div' => 'col-md-12',
//'information' => 'Création catégorie principale',
'sections' => array(
array(
'inputs' => array(
array(
'type' => 'simpleText',
'label' => $this->l('Catégorie : '),
'label-class' => 'col-md-2',
'input-class' => 'col-md-6',
'name' => 'name',
),
array(
'type' => 'simpleDate',
'id' => 'start_at',
'name' => 'start_at',
'label' => $this->l('Start at'),
'label-class' => 'control-label col-md-2',
'after' => '<span class="glyphicon glyphicon-calendar"></span>',
'value' => '',
'required' => true,
),
array(
'type' => 'simpleDate',
'id' => 'end_at',
'name' => 'end_at',
'label' => $this->l('End at'),
'label-class' => 'control-label col-md-2',
'after' => '<span class="glyphicon glyphicon-calendar"></span>',
'value' => '',
'required' => true,
),
array(
'type' => 'uploadImage',
'label' => $this->l('Image : '),
'label-class' => 'col-md-2',
'input-class' => 'col-md-6',
'name' => 'image_thumb',
'id' => 'preview_thumb',
),
),
),
),
'actions' => array(
array(
'type' => 'submit',
'class' => 'btn-primary',
'name' => 'submitCategoryAdd',
'value' => $this->l('Ajouter')
)
),
'actions-class' => 'text-right',
),
);
$html = "";
$html .= $this->helperForm->renderStyle();
$html .= "\n";
$html .= $this->helperForm->renderScript();
$html .= "\n";
$html .= '<div class="row">'.$this->helperForm->renderForm(false, NULL, NULL, true).'</div>';
echo $html;
}
}