Browse Source

Logo dans le mail envoyé par form

10600
SylvainLelievre 1 month ago
parent
commit
01da51ac9b
  1. 15
      core/layout/mail.php
  2. 16
      module/form/form.php
  3. 49
      module/form/view/config/config.js.php
  4. 21
      module/form/view/config/config.php

15
core/layout/mail.php

@ -109,7 +109,18 @@
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="border-top: 1px solid #EBEEF2; padding: 20px; text-align: center; font-family: 'Open Sans', sans-serif; font-size: 12px; line-height: 17px; color: #212223;">
<a href="<?php echo helper::baseUrl(false); ?>" target="_blank"><?php echo $this->getData(['locale', 'title']); ?></a>
<a href="<?php echo helper::baseUrl(false); ?>" target="_blank">
<?php
if($this->getData(['module', $this->getUrl(0), 'config', 'signature' ]) === 'logo' && is_file( 'site/file/source/'. $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl' ]))){
$imageFile = helper::baseUrl(false).'site/file/source/'. $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl' ]) ;
$imageBase64 = base64_encode(file_get_contents($imageFile));
?><img src=" data:image/<?php echo pathinfo($imageFile, PATHINFO_EXTENSION); ?>;base64,<?php echo $imageBase64; ?>" border="0" width="<?php echo $this->getData(['module', $this->getUrl(0), 'config', 'logoWidth']) ?>%" >
<?php
}
else{
echo $this->getData(['locale', 'title']);
} ?>
</a>
</td>
</tr>
</table>
@ -124,4 +135,4 @@
</div>
</center>
</body>
</html>
</html>

16
module/form/form.php

@ -63,6 +63,17 @@ class form extends common {
public static $listUsers = [
];
public static $signature = [
'text' => 'Nom du site',
'logo' => 'Logo du site'
];
public static $logoWidth = [
'40' => '40%',
'60' => '60%',
'80' => '80%',
'100' => '100%'
];
/**
* Configuration
@ -90,7 +101,10 @@ class form extends common {
'mail' => $this->getInput('formConfigMail') ,
'pageId' => $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : '',
'subject' => $this->getInput('formConfigSubject'),
'replyto' => $this->getInput('formConfigMailReplyTo', helper::FILTER_BOOLEAN)
'replyto' => $this->getInput('formConfigMailReplyTo', helper::FILTER_BOOLEAN),
'signature' => $this->getInput('formConfigSignature'),
'logoUrl' => $this->getInput('formConfigLogo'),
'logoWidth' => $this->getInput('formConfigLogoWidth')
]
]);
// Génération des données vides

49
module/form/view/config/config.js.php

@ -133,13 +133,13 @@ $("#formConfigInputs")
case "label":
_this.parents(".formConfigInput").find("label[for*=formConfigRequired]").hide();
_this.parents(".formConfigInput").find(".formConfigLabelWrapper").slideDown();
_this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp();
_this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp();
break;
default:
_this.parents(".formConfigInput").find("label[for*=formConfigRequired]").show();
_this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp();
_this.parents(".formConfigInput").find(".formConfigLabelWrapper").slideUp();
}
_this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp();
_this.parents(".formConfigInput").find(".formConfigLabelWrapper").slideUp();
}
});
// Simule un changement de type au chargement de la page
$(".formConfigType").trigger("change");
@ -173,4 +173,43 @@ $("#formConfigPageIdToggle").on("change", function() {
$("#formConfigPageId").val("");
});
}
}).trigger("change");
}).trigger("change");
/**
* Paramètres par défaut au chargement
*/
$( document ).ready(function() {
/**
* Masquer ou afficher la sélection du logo
*/
if ($("#formConfigSignature").val() !== "text") {
$("#formConfigLogoWrapper").addClass("disabled");
$("#formConfigLogoWrapper").slideDown();
$("#formConfigLogoWidthWrapper").addClass("disabled");
$("#formConfigLogoWidthWrapper").slideDown();
} else {
$("#formConfigLogoWrapper").removeClass("disabled");
$("#formConfigLogoWrapper").slideUp();
$("#formConfigLogoWidthWrapper").removeClass("disabled");
$("#formConfigLogoWidthWrapper").slideUp();
}
});
/**
* Masquer ou afficher la sélection du logo
*/
var formConfigSignatureDOM = $("#formConfigSignature");
formConfigSignatureDOM.on("change", function() {
if ($(this).val() !== "text") {
$("#formConfigLogoWrapper").addClass("disabled");
$("#formConfigLogoWrapper").slideDown();
$("#formConfigLogoWidthWrapper").addClass("disabled");
$("#formConfigLogoWidthWrapper").slideDown();
} else {
$("#formConfigLogoWrapper").removeClass("disabled");
$("#formConfigLogoWrapper").slideUp();
$("#formConfigLogoWidthWrapper").removeClass("disabled");
$("#formConfigLogoWidthWrapper").slideUp();
}
});

21
module/form/view/config/config.php

@ -128,6 +128,27 @@
</div>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::select('formConfigSignature', $module::$signature, [
'label' => 'Sélectionner le type de signature',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'signature'])
]); ?>
</div>
<div class="col4">
<?php echo template::file('formConfigLogo', [
'help' => 'Sélectionnez le logo du site',
'label' => 'Logo',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('formConfigLogoWidth', $module::$logoWidth, [
'label' => 'Sélectionner la largeur du logo',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'logoWidth'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('formConfigPageIdToggle', true, 'Redirection après soumission du formulaire', [

Loading…
Cancel
Save