ZwiiCMS/module/form/view/index/index.php

69 lines
2.6 KiB
PHP
Raw Normal View History

2018-04-02 08:29:19 +02:00
<?php if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
2022-01-18 16:55:48 +01:00
<div class="col10 offset1">
2018-04-02 08:29:19 +02:00
<?php echo template::formOpen('formForm'); ?>
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
<?php if($input['type'] === $module::TYPE_MAIL): ?>
<?php echo template::mail('formInput[' . $index . ']', [
'id' => 'formInput_' . $index,
'label' => $input['name']
]); ?>
<?php elseif($input['type'] === $module::TYPE_SELECT): ?>
<?php
$values = array_flip(explode(',', $input['values']));
foreach($values as $value => $key) {
$values[$value] = trim($value);
}
?>
<?php echo template::select('formInput[' . $index . ']', $values, [
'id' => 'formInput_' . $index,
'label' => $input['name']
]); ?>
<?php elseif($input['type'] === $module::TYPE_TEXT): ?>
<?php echo template::text('formInput[' . $index . ']', [
'id' => 'formInput_' . $index,
'label' => $input['name']
]); ?>
<?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?>
<?php echo template::textarea('formInput[' . $index . ']', [
'id' => 'formInput_' . $index,
'label' => $input['name']
]); ?>
2018-11-28 12:44:32 +01:00
<?php elseif($input['type'] === $module::TYPE_DATETIME): ?>
<?php echo template::date('formInput[' . $index . ']', [
'id' => 'formInput_' . $index,
'label' => $input['name'],
'vendor' => 'flatpickr'
2019-01-23 13:07:28 +01:00
]); ?>
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name']
2020-08-11 18:10:53 +02:00
); ?>
2019-11-26 19:22:30 +01:00
<?php elseif($input['type'] === $module::TYPE_LABEL): ?>
<h3 class='formLabel'>
<?php echo $input['name']; ?>
<hr class="formLabel">
</h3>
2018-04-02 08:29:19 +02:00
<?php endif; ?>
<?php endforeach; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
2018-04-02 08:29:19 +02:00
<div class="row">
2020-11-04 20:34:07 +01:00
<div class="col12 textAlignCenter">
2020-10-11 19:29:33 +02:00
<?php echo template::captcha('formCaptcha', [
2021-11-12 18:22:06 +01:00
'limit' => $this->getData(['config','connect', 'captchaStrong']),
'type' => $this->getData(['config','connect', 'captchaType'])
2020-10-11 19:29:33 +02:00
]); ?>
2018-04-02 08:29:19 +02:00
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col2 offset10">
2018-04-02 08:29:19 +02:00
<?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>
2022-01-18 16:55:48 +01:00
</div>
2018-04-02 08:29:19 +02:00
<?php echo template::formClose(); ?>
<?php else: ?>
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
<?php endif; ?>