From 7a78d7b4d54e284e28910bdca412adb61e9e8171 Mon Sep 17 00:00:00 2001 From: clem Date: Wed, 19 Aug 2020 14:45:37 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20des=20exemples=20de=20fonctions=20appel?= =?UTF-8?q?=C3=A9es=20par=20le=20CVT=20de=20gamumail.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- formulaires/gamumail.php | 2 +- gamumail_fonctions.php | 66 ++++++++++++++++++++++++++++++++++++ inclure/gamumail_config.html | 7 ++-- 3 files changed, 71 insertions(+), 4 deletions(-) diff --git a/formulaires/gamumail.php b/formulaires/gamumail.php index b8b2c14..6c8e98f 100644 --- a/formulaires/gamumail.php +++ b/formulaires/gamumail.php @@ -184,7 +184,7 @@ function formulaires_gamumail_traiter_dist($slug, $auteur = 0, $Tclient = [], $T $html_footer = ''; if(find_in_path('gamumail/html_footer.html')){ $html_footer = recuperer_fond('gamumail/html_footer', $options); - }elseif (find_in_path($slug . '_html_footer.html')) { + } elseif (find_in_path($slug . '_html_footer.html')) { $html_footer = recuperer_fond('gamumail/'.$slug . '_html_footer', $options); } diff --git a/gamumail_fonctions.php b/gamumail_fonctions.php index 76b6837..9e58989 100644 --- a/gamumail_fonctions.php +++ b/gamumail_fonctions.php @@ -16,3 +16,69 @@ if (!defined('_ECRIRE_INC_VERSION')) { function gamumail_TabClient($objet, $id_objet, $champ){ return compact('objet', 'id_objet', 'champ'); } + + +/** + * modèles pour surcharge des fonctions du CVT gamumail + * chacune de ces fonctions a un équivalent spécifique pour chaque slug + * avec un nom de la forme gamumail_$slug_charger(), gamumail_$slug_verifier()... + **/ + +/** + * fonction appelée en fin de gamumail_charger() + * + * $valeurs = array( + * "slug" => $slug, + * 'sujet' => $gamuMail['sujet'], + * 'texte' => $gamuMail['texte'], + * 'pour' => implode(',', $Tmails), + * 'cc' => lire_config('gamumail/mail_cc'), + * 'cci' => lire_config('gamumail/mail_cci'), + * 'TFichierpdfs' => $TFichierPdf, + * 'Tpdfs_ok' => [], + * 'Tid_doc' => [], + * 'options' => $options + * ); + * + * @return array $valeurs + * + **/ +function gamumail_charger_dist($valeurs, $options, $slug, $auteur, $Tclient, $Tpdf, $redirect) { + + return $valeurs; +} + +/** + * fonction appelée en fin de gamumail_verifier_dist() + * + * @return array $erreurs + * + **/ +function gamumail_verifier_dist($erreurs, $options, $slug, $auteur, $Tclient, $Tpdf, $redirect) { + + return $erreurs; +} + +/** + * fonctions appelée en fin de gamumail_traiter_dist() + * + * @param string $slug modele du mail a charger + * @param int|string $auteur id_auteur ou email du destinataire + * @param array $Tclient [] ['objet' => 'app_client', 'id_objet' => 3, 'champ' => 'email'] ou ['objet' => 'app_client', 'id_objet' => 3, 'champ' => 'email'] + * @param array $Tpdf [] ['fichier' => 'pdf_facture', 'nom' => 'facture_123', 'contexte' => ['id_app_facture' => 3]] ou ['fichier' => 'pdf_facture', 'nom' => 'facture_123', 'contexte' => ['id_app_facture' => 3]] + * @param string $redirect + * @param array $options + * + * @return array $corps du message => $corps['html'] et $corps['texte'] + * + **/ +function gamumail_traiter_dist($corps, $options, $slug, $auteur, $Tclient, $Tpdf, $redirect) { + + $html = $corps['html']; + $html = str_replace('@@truc_a_remplacer@@', 'le machin qui remplace', $html); + $texte = facteur_mail_html2text($html); + $corps['html'] = $html; + $corps['texte'] = $texte; + + return $corps; +} diff --git a/inclure/gamumail_config.html b/inclure/gamumail_config.html index c9c8579..34612fe 100644 --- a/inclure/gamumail_config.html +++ b/inclure/gamumail_config.html @@ -8,9 +8,6 @@ margin: 10px auto; padding: 10px; border-radius: 4px; - .crayon { - background-color: #fff; - } } .un-pdf { border: 1px solid black; @@ -52,6 +49,10 @@ font-size: inherit; line-height: 1; } + .markItUp .markItUpHeader ul a em { + width: 2rem; + height: 2rem; + }