Deltacms/module/form/view/index/index.php

105 lines
4.3 KiB
PHP
Raw Normal View History

2022-03-06 13:35:21 +01:00
<?php
// Lexique
2022-09-11 09:42:42 +02:00
$param = '';
include('./module/form/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_form.php');
2023-03-22 14:54:21 +01:00
// Flatpickr dans la langue d'administration
$lang_flatpickr = $text['form_view']['index'][2];
?><script>var lang_flatpickr = "<?php echo $lang_flatpickr; ?>";</script><?php
2022-09-11 09:42:42 +02:00
if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
2022-05-01 11:45:17 +02:00
<?php echo template::formOpenFile('formForm'); ?>
2022-11-05 09:31:32 +01:00
<div class="humanBot">
2022-01-31 09:10:49 +01:00
<?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,
2022-05-01 11:45:17 +02:00
'label' => $input['name'],
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'mail'])
2022-01-31 09:10:49 +01:00
]); ?>
<?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,
2022-05-01 11:45:17 +02:00
'label' => $input['name'],
2023-03-22 14:54:21 +01:00
'selected' => $values[$this->getData([ 'module', $this->getUrl(0), 'draft', 'select'])]
2022-01-31 09:10:49 +01:00
]); ?>
<?php elseif($input['type'] === $module::TYPE_TEXT): ?>
<?php echo template::text('formInput[' . $index . ']', [
'id' => 'formInput_' . $index,
2022-05-01 11:45:17 +02:00
'label' => $input['name'],
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'text'])
2022-01-31 09:10:49 +01:00
]); ?>
<?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?>
<?php echo template::textarea('formInput[' . $index . ']', [
'id' => 'formInput_' . $index,
2022-05-01 11:45:17 +02:00
'label' => $input['name'],
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'textarea'])
2022-01-31 09:10:49 +01:00
]); ?>
<?php elseif($input['type'] === $module::TYPE_DATETIME): ?>
<?php echo template::date('formInput[' . $index . ']', [
'id' => 'formInput_' . $index,
'label' => $input['name'],
2023-03-22 14:54:21 +01:00
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'datetime'])
2022-01-31 09:10:49 +01:00
]); ?>
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
2022-05-01 11:45:17 +02:00
<?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">
2022-09-02 08:44:18 +02:00
</div>
2022-01-31 09:10:49 +01:00
<?php elseif($input['type'] === $module::TYPE_LABEL): ?>
2022-05-01 11:45:17 +02:00
<p class='formLabel'> <?php echo $input['name']; ?> </p>
2022-01-31 09:10:49 +01:00
<?php endif; ?>
2022-09-02 08:44:18 +02:00
2022-01-31 09:10:49 +01:00
<?php endforeach; ?>
2022-11-05 09:31:32 +01:00
</div>
<?php if( $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
&& ( $_SESSION['humanBot']==='bot') || $this->getData(['config', 'connect', 'captchaBot'])===false ): ?>
2022-01-31 09:10:49 +01:00
<div class="row">
<div class="col12 textAlignCenter">
2022-11-05 09:31:32 +01:00
<?php echo template::captcha('formCaptcha', ''); ?>
2022-01-31 09:10:49 +01:00
</div>
</div>
<?php endif; ?>
2022-11-05 09:31:32 +01:00
<?php if( $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
&& $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot']) ): ?>
<div class="row formCheckBlue">
<?php echo template::text('formInputBlue', [
'label' => 'Input Blue',
'value' => ''
]); ?>
</div>
<br>
<div class="row formOuter">
<div class="formInner humanCheck">
<?php echo template::checkbox('formHumanCheck', true, $this->getData(['locale', 'captchaSimpleText']), [
'checked' => false,
'help' => $this->getData(['locale', 'captchaSimpleHelp'])
]); ?>
</div>
</div>
<br>
<?php endif; ?>
<div class="row textAlignCenter">
<div class="formInner humanBotClose">
2022-01-31 09:10:49 +01:00
<?php echo template::submit('formSubmit', [
2022-09-11 09:42:42 +02:00
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : $text['form_view']['index'][0],
2022-01-31 09:10:49 +01:00
'ico' => ''
]); ?>
</div>
</div>
<?php echo template::formClose(); ?>
<?php else: ?>
2022-09-11 09:42:42 +02:00
<?php echo template::speech($text['form_view']['index'][1]); ?>
2023-03-22 14:54:21 +01:00
<?php endif; ?>