From bf8b71e4bf7b4b058453e451b858fc8f1c7cb150 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 20 Jan 2022 09:33:29 +0100 Subject: [PATCH] form option alignement + gabarit --- module/form/form.php | 45 +++++++---- module/form/view/index/index.php | 122 +++++++++++++++-------------- module/form/view/option/option.php | 18 ++++- 3 files changed, 109 insertions(+), 76 deletions(-) diff --git a/module/form/form.php b/module/form/form.php index e677542b..55730e8e 100644 --- a/module/form/form.php +++ b/module/form/form.php @@ -79,22 +79,26 @@ class form extends common { '100' => '100%' ]; - public static $formOffset = [ - 'none' => 'Aucune', - '1' => 'Une colonne', - '2' => 'Deux colonnes', - '3' => 'Trois colonnes', - '4' => 'Quatre colonnes', + public static $optionOffset = [ + 0 => 'Aucune', + 1 => 'Une colonne', + 2 => 'Deux colonnes' ]; - public static $formWidth = [ - '6' => 'Six colonne', - '7' => 'Sept colonnes', - '8' => 'Huit colonnes', - '9' => 'Neuf colonnes', - '10' => 'Dix colonnes', - '11' => 'Onze colonnes', - '12' => 'Douze colonnes', + public static $optionWidth = [ + 6 => 'Six colonnes', + 7 => 'Sept colonnes', + 8 => 'Huit colonnes', + 9 => 'Neuf colonnes', + 10 => 'Dix colonnes', + 11 => 'Onze 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 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 $this->setData([ 'module', @@ -172,7 +182,10 @@ class form extends common { 'replyto' => $this->getInput('formOptionMailReplyTo', helper::FILTER_BOOLEAN), 'signature' => $this->getInput('formOptionSignature'), '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 @@ -181,7 +194,7 @@ class form extends common { } // Valeurs en sortie $this->addOutput([ - 'notification' => 'Modifications enregistrées', + 'notification' => 'Modifications enregistrées' , 'redirect' => helper::baseUrl() . $this->getUrl(), 'state' => true ]); diff --git a/module/form/view/index/index.php b/module/form/view/index/index.php index 8d3b9a91..c2251225 100644 --- a/module/form/view/index/index.php +++ b/module/form/view/index/index.php @@ -1,69 +1,75 @@ getData(['module', $this->getUrl(0), 'input'])): ?> -
- - getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> - - 'formInput_' . $index, - 'label' => $input['name'] - ]); ?> - - $key) { - $values[$value] = trim($value); - } - ?> - 'formInput_' . $index, - 'label' => $input['name'] - ]); ?> - - 'formInput_' . $index, - 'label' => $input['name'] - ]); ?> - - 'formInput_' . $index, - 'label' => $input['name'] - ]); ?> - - 'formInput_' . $index, - 'label' => $input['name'], - 'vendor' => 'flatpickr' - ]); ?> - - - -

- -
-

+
+
+ + getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> + + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + $key) { + $values[$value] = trim($value); + } + ?> + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + 'formInput_' . $index, + 'label' => $input['name'], + 'vendor' => 'flatpickr' + ]); ?> + + + +

+ +
+

+ + + getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?> +
+
+ $this->getData(['config','connect', 'captchaStrong']), + 'type' => $this->getData(['config','connect', 'captchaType']) + ]); ?> +
+
- - getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
-
- $this->getData(['config','connect', 'captchaStrong']), - 'type' => $this->getData(['config','connect', 'captchaType']) +
+ $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer', + 'ico' => '' ]); ?>
- -
-
- $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer', - 'ico' => '' - ]); ?> -
- +
+ \ No newline at end of file diff --git a/module/form/view/option/option.php b/module/form/view/option/option.php index b9aa005c..f8635892 100644 --- a/module/form/view/option/option.php +++ b/module/form/view/option/option.php @@ -132,10 +132,24 @@

Gabarit

- + 'Alignement du formulaire', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'align']) + ]); ?> +
+
+
+
+ 'Décalage à gauche', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'offset']) + ]); ?>
- + 'Largeur', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'width']) + ]); ?>