Logo dans le mail envoyé par form

This commit is contained in:
SylvainLelievre 2021-05-03 09:02:58 +02:00
parent 479a546679
commit 01da51ac9b
4 changed files with 93 additions and 8 deletions

View File

@ -109,7 +109,18 @@
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%"> <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr> <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;"> <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> </td>
</tr> </tr>
</table> </table>

View File

@ -63,6 +63,17 @@ class form extends common {
public static $listUsers = [ 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 * Configuration
@ -90,7 +101,10 @@ class form extends common {
'mail' => $this->getInput('formConfigMail') , 'mail' => $this->getInput('formConfigMail') ,
'pageId' => $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : '', 'pageId' => $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : '',
'subject' => $this->getInput('formConfigSubject'), '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 // Génération des données vides

View File

@ -174,3 +174,42 @@ $("#formConfigPageIdToggle").on("change", function() {
}); });
} }
}).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();
}
});

View File

@ -128,6 +128,27 @@
</div> </div>
</div> </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="row">
<div class="col6"> <div class="col6">
<?php echo template::checkbox('formConfigPageIdToggle', true, 'Redirection après soumission du formulaire', [ <?php echo template::checkbox('formConfigPageIdToggle', true, 'Redirection après soumission du formulaire', [