95 lines
3.6 KiB
PHP
95 lines
3.6 KiB
PHP
<?php
|
|
// Lexique
|
|
$text = [];
|
|
$val = $this->getData(['config', 'i18n', 'langAdmin']);
|
|
switch ($val) {
|
|
case 'fr' :
|
|
$text[0] = 'Envoyer';
|
|
$text[1] = 'Le formulaire ne contient aucun champ.';
|
|
break;
|
|
case 'en' :
|
|
$text[0] = 'Send';
|
|
$text[1] = 'The form contains no fields';
|
|
break;
|
|
}
|
|
?>
|
|
<?php if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
|
|
<?php echo template::formOpenFile('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'],
|
|
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'mail'])
|
|
]); ?>
|
|
<?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'],
|
|
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'select'])
|
|
]); ?>
|
|
<?php elseif($input['type'] === $module::TYPE_TEXT): ?>
|
|
<?php echo template::text('formInput[' . $index . ']', [
|
|
'id' => 'formInput_' . $index,
|
|
'label' => $input['name'],
|
|
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'text'])
|
|
]); ?>
|
|
<?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?>
|
|
<?php echo template::textarea('formInput[' . $index . ']', [
|
|
'id' => 'formInput_' . $index,
|
|
'label' => $input['name'],
|
|
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'textarea'])
|
|
]); ?>
|
|
<?php elseif($input['type'] === $module::TYPE_DATETIME): ?>
|
|
<?php echo template::date('formInput[' . $index . ']', [
|
|
'id' => 'formInput_' . $index,
|
|
'label' => $input['name'],
|
|
'vendor' => 'flatpickr',
|
|
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'datetime'])
|
|
]); ?>
|
|
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
|
|
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name'], [
|
|
'checked' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'checkbox'])
|
|
]); ?>
|
|
|
|
|
|
|
|
<?php elseif($input['type'] === $module::TYPE_FILE): ?>
|
|
<label class='formLabel'> <?php echo $input['name']; ?> </label>
|
|
<div class="formInputFile">
|
|
<input type="hidden" name="MAX_FILE_SIZE" value="5000000">
|
|
<input type="file" name="fileToUpload" id="fileToUpload">
|
|
<input type="button" id="formFileReset" value="X">
|
|
</div><br>
|
|
<?php elseif($input['type'] === $module::TYPE_LABEL): ?>
|
|
<p class='formLabel'> <?php echo $input['name']; ?> </p>
|
|
<?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; ?>
|
|
<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']) : $text[0],
|
|
'ico' => ''
|
|
]); ?>
|
|
</div>
|
|
</div>
|
|
<?php echo template::formClose(); ?>
|
|
<?php else: ?>
|
|
<?php echo template::speech($text[1]); ?>
|
|
<?php endif; ?>
|