form option alignement + gabarit
This commit is contained in:
parent
30edec7ff7
commit
29ba48850c
@ -79,22 +79,26 @@ class form extends common {
|
|||||||
'100' => '100%'
|
'100' => '100%'
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $formOffset = [
|
public static $optionOffset = [
|
||||||
'none' => 'Aucune',
|
0 => 'Aucune',
|
||||||
'1' => 'Une colonne',
|
1 => 'Une colonne',
|
||||||
'2' => 'Deux colonnes',
|
2 => 'Deux colonnes'
|
||||||
'3' => 'Trois colonnes',
|
|
||||||
'4' => 'Quatre colonnes',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $formWidth = [
|
public static $optionWidth = [
|
||||||
'6' => 'Six colonne',
|
6 => 'Six colonnes',
|
||||||
'7' => 'Sept colonnes',
|
7 => 'Sept colonnes',
|
||||||
'8' => 'Huit colonnes',
|
8 => 'Huit colonnes',
|
||||||
'9' => 'Neuf colonnes',
|
9 => 'Neuf colonnes',
|
||||||
'10' => 'Dix colonnes',
|
10 => 'Dix colonnes',
|
||||||
'11' => 'Onze colonnes',
|
11 => 'Onze colonnes',
|
||||||
'12' => 'Douze colonnes',
|
12 => 'Douze colonnes',
|
||||||
|
];
|
||||||
|
|
||||||
|
public static $optionAlign = [
|
||||||
|
'' => 'A gauche',
|
||||||
|
'textAlignCenter' => 'Au centre',
|
||||||
|
'textAlignRight' => 'A droite'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -156,6 +160,12 @@ class form extends common {
|
|||||||
}
|
}
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if ($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
|
// Débordement
|
||||||
|
$width = $this->getInput('formOptionWidth');
|
||||||
|
if ($this->getInput('formOptionWidth',helper::FILTER_INT) + $this->getInput('formOptionOffset',helper::FILTER_INT) > 12 ) {
|
||||||
|
$width = (string) $this->getInput('formOptionWidth',helper::FILTER_INT) - $this->getInput('formOptionOffset',helper::FILTER_INT);
|
||||||
|
}
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'module',
|
'module',
|
||||||
@ -172,7 +182,10 @@ class form extends common {
|
|||||||
'replyto' => $this->getInput('formOptionMailReplyTo', helper::FILTER_BOOLEAN),
|
'replyto' => $this->getInput('formOptionMailReplyTo', helper::FILTER_BOOLEAN),
|
||||||
'signature' => $this->getInput('formOptionSignature'),
|
'signature' => $this->getInput('formOptionSignature'),
|
||||||
'logoUrl' => $this->getInput('formOptionLogo'),
|
'logoUrl' => $this->getInput('formOptionLogo'),
|
||||||
'logoWidth' => $this->getInput('formOptionLogoWidth')
|
'logoWidth' => $this->getInput('formOptionLogoWidth'),
|
||||||
|
'offset' =>$this->getInput('formOptionOffset'),
|
||||||
|
'width' =>$width,
|
||||||
|
'align' =>$this->getInput('formOptionAlign'),
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
// Génération des données vides
|
// Génération des données vides
|
||||||
@ -181,7 +194,7 @@ class form extends common {
|
|||||||
}
|
}
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'notification' => 'Modifications enregistrées',
|
'notification' => 'Modifications enregistrées' ,
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||||
'state' => true
|
'state' => true
|
||||||
]);
|
]);
|
||||||
|
@ -1,69 +1,75 @@
|
|||||||
<?php if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
|
<?php if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
|
||||||
<div class="col10 offset1">
|
<div class="row <?php echo $this->getData(['module', $this->getUrl(0), 'config', 'align']);?>">
|
||||||
<?php echo template::formOpen('formForm'); ?>
|
<div class="<?php
|
||||||
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
|
echo 'col' . $this->getData(['module', $this->getUrl(0), 'config', 'width']) . ' ';
|
||||||
<?php if($input['type'] === $module::TYPE_MAIL): ?>
|
echo $this->getData(['module', $this->getUrl(0), 'config', 'offset']) !== 0 ? 'offset' . $this->getData(['module', $this->getUrl(0), 'config', 'offset']) : '';
|
||||||
<?php echo template::mail('formInput[' . $index . ']', [
|
?>">
|
||||||
'id' => 'formInput_' . $index,
|
<?php echo template::formOpen('formForm'); ?>
|
||||||
'label' => $input['name']
|
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
|
||||||
]); ?>
|
<?php if($input['type'] === $module::TYPE_MAIL): ?>
|
||||||
<?php elseif($input['type'] === $module::TYPE_SELECT): ?>
|
<?php echo template::mail('formInput[' . $index . ']', [
|
||||||
<?php
|
'id' => 'formInput_' . $index,
|
||||||
$values = array_flip(explode(',', $input['values']));
|
'label' => $input['name']
|
||||||
foreach($values as $value => $key) {
|
]); ?>
|
||||||
$values[$value] = trim($value);
|
<?php elseif($input['type'] === $module::TYPE_SELECT): ?>
|
||||||
}
|
<?php
|
||||||
?>
|
$values = array_flip(explode(',', $input['values']));
|
||||||
<?php echo template::select('formInput[' . $index . ']', $values, [
|
foreach($values as $value => $key) {
|
||||||
'id' => 'formInput_' . $index,
|
$values[$value] = trim($value);
|
||||||
'label' => $input['name']
|
}
|
||||||
]); ?>
|
?>
|
||||||
<?php elseif($input['type'] === $module::TYPE_TEXT): ?>
|
<?php echo template::select('formInput[' . $index . ']', $values, [
|
||||||
<?php echo template::text('formInput[' . $index . ']', [
|
'id' => 'formInput_' . $index,
|
||||||
'id' => 'formInput_' . $index,
|
'label' => $input['name']
|
||||||
'label' => $input['name']
|
]); ?>
|
||||||
]); ?>
|
<?php elseif($input['type'] === $module::TYPE_TEXT): ?>
|
||||||
<?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?>
|
<?php echo template::text('formInput[' . $index . ']', [
|
||||||
<?php echo template::textarea('formInput[' . $index . ']', [
|
'id' => 'formInput_' . $index,
|
||||||
'id' => 'formInput_' . $index,
|
'label' => $input['name']
|
||||||
'label' => $input['name']
|
]); ?>
|
||||||
]); ?>
|
<?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?>
|
||||||
<?php elseif($input['type'] === $module::TYPE_DATETIME): ?>
|
<?php echo template::textarea('formInput[' . $index . ']', [
|
||||||
<?php echo template::date('formInput[' . $index . ']', [
|
'id' => 'formInput_' . $index,
|
||||||
'id' => 'formInput_' . $index,
|
'label' => $input['name']
|
||||||
'label' => $input['name'],
|
]); ?>
|
||||||
'vendor' => 'flatpickr'
|
<?php elseif($input['type'] === $module::TYPE_DATETIME): ?>
|
||||||
]); ?>
|
<?php echo template::date('formInput[' . $index . ']', [
|
||||||
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
|
'id' => 'formInput_' . $index,
|
||||||
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name']
|
'label' => $input['name'],
|
||||||
); ?>
|
'vendor' => 'flatpickr'
|
||||||
<?php elseif($input['type'] === $module::TYPE_LABEL): ?>
|
]); ?>
|
||||||
<h3 class='formLabel'>
|
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
|
||||||
<?php echo $input['name']; ?>
|
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name']
|
||||||
<hr class="formLabel">
|
); ?>
|
||||||
</h3>
|
<?php elseif($input['type'] === $module::TYPE_LABEL): ?>
|
||||||
|
<h3 class='formLabel'>
|
||||||
|
<?php echo $input['name']; ?>
|
||||||
|
<hr class="formLabel">
|
||||||
|
</h3>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col12 textAlignCenter">
|
||||||
|
<?php echo template::captcha('formCaptcha', [
|
||||||
|
'limit' => $this->getData(['config','connect', 'captchaStrong']),
|
||||||
|
'type' => $this->getData(['config','connect', 'captchaType'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12 textAlignCenter">
|
<div class="col2 offset10">
|
||||||
<?php echo template::captcha('formCaptcha', [
|
<?php echo template::submit('formSubmit', [
|
||||||
'limit' => $this->getData(['config','connect', 'captchaStrong']),
|
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer',
|
||||||
'type' => $this->getData(['config','connect', 'captchaType'])
|
'ico' => ''
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col2 offset10">
|
|
||||||
<?php echo template::submit('formSubmit', [
|
|
||||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer',
|
|
||||||
'ico' => ''
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo template::formClose(); ?>
|
</div>
|
||||||
|
<?php echo template::formClose(); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
|
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
@ -132,10 +132,24 @@
|
|||||||
<h4>Gabarit</h4>
|
<h4>Gabarit</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col6">
|
<div class="col6">
|
||||||
|
<?php echo template::select('formOptionAlign', $module::$optionAlign, [
|
||||||
|
'label' => 'Alignement du formulaire',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'align'])
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col6">
|
||||||
|
<?php echo template::select('formOptionOffset', $module::$optionOffset, [
|
||||||
|
'label' => 'Décalage à gauche',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'offset'])
|
||||||
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col6">
|
<div class="col6">
|
||||||
|
<?php echo template::select('formOptionWidth', $module::$optionWidth, [
|
||||||
|
'label' => 'Largeur',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'width'])
|
||||||
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user