Form 3.4 bug div en trop

This commit is contained in:
Fred Tempez 2023-01-27 08:26:34 +01:00
parent 4cc1c59abe
commit c266d916ac
3 changed files with 24 additions and 22 deletions

View File

@ -1,3 +1,5 @@
# Version 3.4
- Bug de présentation, une div en trop.
# Version 3.3 # Version 3.3
- Multilinguisme - Multilinguisme
# Version 3.2 # Version 3.2

View File

@ -16,7 +16,7 @@
class form extends common { class form extends common {
const VERSION = '3.3'; const VERSION = '3.4';
const REALNAME = 'Formulaire'; const REALNAME = 'Formulaire';
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json) const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)

View File

@ -1,20 +1,19 @@
<?php if($this->getData(['module', $this->getUrl(0), 'input'])): ?> <?php if ($this->getData(['module', $this->getUrl(0), 'input'])): ?>
<div class="row <?php echo $this->getData(['module', $this->getUrl(0), 'config', 'align']);?>"> <div class="row <?php echo $this->getData(['module', $this->getUrl(0), 'config', 'align']); ?>">
<div class="<?php <div class="<?php
echo 'col' . $this->getData(['module', $this->getUrl(0), 'config', 'width']) . ' '; echo 'col' . $this->getData(['module', $this->getUrl(0), 'config', 'width']) . ' ';
echo $this->getData(['module', $this->getUrl(0), 'config', 'offset']) !== 0 ? 'offset' . $this->getData(['module', $this->getUrl(0), 'config', 'offset']) : ''; echo $this->getData(['module', $this->getUrl(0), 'config', 'offset']) !== 0 ? 'offset' . $this->getData(['module', $this->getUrl(0), 'config', 'offset']) : '';
?>"> ?>">
<?php echo template::formOpen('formForm'); ?> <?php echo template::formOpen('formForm'); ?>
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> <?php foreach ($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
<?php if($input['type'] === $module::TYPE_MAIL): ?> <?php if ($input['type'] === $module::TYPE_MAIL): ?>
<?php echo template::mail('formInput[' . $index . ']', [ <?php echo template::mail('formInput[' . $index . ']', [
'id' => 'formInput_' . $index, 'id' => 'formInput_' . $index,
'label' => $input['name'] 'label' => $input['name']
]); ?> ]); ?>
<?php elseif($input['type'] === $module::TYPE_SELECT): ?> <?php elseif ($input['type'] === $module::TYPE_SELECT): ?>
<?php <?php
$values = array_flip(explode(',', $input['values'])); $values = array_flip(explode(',', $input['values'])); foreach ($values as $value => $key) {
foreach($values as $value => $key) {
$values[$value] = trim($value); $values[$value] = trim($value);
} }
?> ?>
@ -22,38 +21,40 @@
'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_TEXT): ?>
<?php echo template::text('formInput[' . $index . ']', [ <?php echo template::text('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_TEXTAREA): ?>
<?php echo template::textarea('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_DATETIME): ?> <?php elseif ($input['type'] === $module::TYPE_DATETIME): ?>
<?php echo template::date('formInput[' . $index . ']', [ <?php echo template::date('formInput[' . $index . ']', [
'id' => 'formInput_' . $index, 'id' => 'formInput_' . $index,
'label' => $input['name'], 'label' => $input['name'],
'vendor' => 'flatpickr' 'vendor' => 'flatpickr'
]); ?> ]); ?>
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?> <?php elseif ($input['type'] === $module::TYPE_CHECKBOX): ?>
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name'] <?php echo template::checkbox(
'formInput[' . $index . ']',
true, $input['name']
); ?> ); ?>
<?php elseif($input['type'] === $module::TYPE_LABEL): ?> <?php elseif ($input['type'] === $module::TYPE_LABEL): ?>
<h3 class='formLabel'> <h3 class='formLabel'>
<?php echo $input['name']; ?> <?php echo $input['name']; ?>
<hr class="formLabel"> <hr class="formLabel">
</h3> </h3>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?> <?php if ($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
<div class="row"> <div class="row">
<div class="col12 textAlignCenter"> <div class="col12 textAlignCenter">
<?php echo template::captcha('formCaptcha', [ <?php echo template::captcha('formCaptcha', [
'limit' => $this->getData(['config','connect', 'captchaStrong']), 'limit' => $this->getData(['config', 'connect', 'captchaStrong']),
'type' => $this->getData(['config','connect', 'captchaType']) 'type' => $this->getData(['config', 'connect', 'captchaType'])
]); ?> ]); ?>
</div> </div>
</div> </div>
@ -68,8 +69,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> <?php echo template::formClose(); ?>
<?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; ?>