Try to create form

This commit is contained in:
Michael RICOIS 2018-02-22 15:30:56 +01:00
parent 71e3ab5317
commit 3f2072a20f

View File

@ -20,6 +20,9 @@ class AdminSkinStatic extends AdminTab
$this->table = 'skinstatic';
$this->className = 'Skinstatic';
$this->lang = true;
parent::__construct();
$this->view = true;
$this->edit = true;
$this->delete = true;
@ -56,13 +59,12 @@ class AdminSkinStatic extends AdminTab
),
'end_at' => array(
'title' => $this->l('End at'),
'widthColumn' => 100, 'width' => 140
'widthColumn' => 100,
'width' => 140
),
);
$this->helperForm = new HelperFormBootstrap();
parent::__construct();
}
public function postProcess()
@ -84,7 +86,13 @@ class AdminSkinStatic extends AdminTab
// Form
public function displayForm()
{
global $currentIndex, $cookie;
parent::displayForm();
$this->helperForm->_dateTime = true;
$this->helperForm->_dateTimePicker = true;
$this->helperForm->_inputSwitch = true;
$this->helperForm->_inputMask = true;
$this->helperForm->_forms = array(
array(
@ -92,71 +100,110 @@ class AdminSkinStatic extends AdminTab
'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(
array(
'type' => 'simpleText',
'label' => $this->l('Catégorie : '),
'label' => $this->l('Name: '),
'label-class' => 'col-md-2',
'input-class' => 'col-md-6',
'name' => 'name',
'value' => '',
'required' => true,
),
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 : '),
'type' => 'switch',
'label' => $this->l('Active: '),
'label-class' => 'col-md-2',
'input-class' => 'col-md-6',
'name' => 'image_thumb',
'id' => 'preview_thumb',
'name' => 'active',
),
array(
'type' => 'simpleDate',
'id' => 'start_at',
'name' => 'start_at',
'label' => $this->l('Start at: '),
'label-class' => 'control-label col-md-2',
'input-class' => 'col-md-6',
'after' => '<span class="glyphicon glyphicon-calendar"></span>',
'value' => date('Y-m-d H:i:s'),
'required' => true,
),
array(
'type' => 'simpleDate',
'id' => 'end_at',
'name' => 'end_at',
'label' => $this->l('End at: '),
'label-class' => 'control-label col-md-2',
'input-class' => 'col-md-6',
'after' => '<span class="glyphicon glyphicon-calendar"></span>',
'value' => date('Y-m-d H:i:s'),
'required' => true,
),
array(
'type' => 'text',
'label' => $this->l('Left Link: '),
'label-class' => 'col-md-2',
'input-class' => 'col-md-6',
'name' => 'link_left',
'value' => '',
'required' => true,
'help' => $this->l("Don't add the domain http://".Configuration::get('PS_SHOP_DOMAIN')),
),
array(
'type' => 'text',
'label' => $this->l('Right Link: '),
'label-class' => 'col-md-2',
'input-class' => 'col-md-6',
'name' => 'link_right',
'value' => '',
'required' => true,
'help' => $this->l("Don't add the domain http://".Configuration::get('PS_SHOP_DOMAIN')),
),
array(
'type' => 'uploadImage',
'lang' => true,
'label' => $this->l('Image: '),
'name' => 'image',
'name_img' => 'image',
'id' => 'image',
'help' => $this->l('Size: '),
'languages' => $this->_languages,
'label-class' => 'control-label col-md-2',
'input-class' => 'col-md-6',
'id_langs' => 'image¤image',
'link_flag_img' => '../img/l/',
'url_imgs' => '',
'url_to_check' => '',
'required' => true,
),
),
),
),
'actions' => array(
array(
'type' => 'submit',
'class' => 'btn-primary',
'name' => 'submitCategoryAdd',
'value' => $this->l('Ajouter')
)
),
'actions-class' => 'text-right',
'actions' => array(
array(
'type' => 'submit',
'class' => 'btn-primary',
'name' => 'submitSkinAdd',
'value' => $this->l('Ajouter')
)
),
'actions-class' => 'text-right',
),
);
$html = "";
$html .= $this->helperForm->renderStyle();
$html .= "\n";
$html .= '<div class="row">';
$html .= $this->helperForm->renderForm(false, null, null, true);
$html .= '</div>';
$html .= "\n";
$html .= $this->helperForm->renderScript();
$html .= "\n";
$html .= '<div class="row">'.$this->helperForm->renderForm(false, NULL, NULL, true).'</div>';
echo $html;
}
}