first commit
This commit is contained in:
79
gestionsite/envoiMailing.php
Normal file
79
gestionsite/envoiMailing.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
require_once '../session_init.php';
|
||||
require_once 'config.inc.php';
|
||||
require_once 'db.class.php';
|
||||
require_once 'entete.html';
|
||||
|
||||
$idVotation =$_GET["id"];
|
||||
|
||||
print('<br><br>
|
||||
<!-- lalis Grid Section -->
|
||||
|
||||
<section id="content">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h3>VOTE</h3>');
|
||||
|
||||
$db = new db();
|
||||
$dolibarr = new dbDolibarr();
|
||||
|
||||
if (empty($idVotation))
|
||||
{
|
||||
choixVotation('/gestionsite/envoiMailing.php') ;
|
||||
}else
|
||||
{
|
||||
//chargement des données de la votation
|
||||
$db->query("SELECT *, UNIX_TIMESTAMP( DATE_ADD(dateFin, INTERVAL 1 DAY)) as tf FROM liste_votations WHERE id=" . $idVotation);
|
||||
$votation = $db->result->fetch_array();
|
||||
|
||||
if(empty($_GET['status']))
|
||||
{
|
||||
print('<form method="get" action="envoiMailing.php">
|
||||
<input type="hidden" name="id" value="' . $idVotation . '">
|
||||
<pre><h4>Êtes-vous sûr de vouloir envoyer le Mailing pour la votation : ' . $votation['libelle'] .'</h4>
|
||||
</pre><br>
|
||||
<div>
|
||||
<input type="submit" name="status" value="Oui">
|
||||
<input type="submit" name="status" value="Non">
|
||||
<input type="submit" name="status" value="Test">
|
||||
</div>
|
||||
</form>
|
||||
');
|
||||
}elseif($_GET['status'] == 'Oui' OR $_GET['status'] == 'Test')
|
||||
{
|
||||
// message
|
||||
|
||||
//chargement de la liste des adhérents
|
||||
$dolibarr->query("SELECT login, firstname, lastname, email FROM llx_adherent");
|
||||
$adherents = $dolibarr->result->fetch_all(MYSQLI_ASSOC);
|
||||
$dolibarr->close();
|
||||
|
||||
$sujet = "[LALIS] Convocation à un vote";
|
||||
$textDebut = "Bonjour,\nL'association Lalis vous invite à un vote.\nMotif du vote : " . $votation['libelle'] . "\n\nPour voter, cliquez sur le lien suivant :\nhttps://lalis69.ddns.net:10443/vote.form.php?v=" . $idVotation . "&id=";
|
||||
$textFin = "\n\nNous vous rappelons que pour pouvoir voter, vous devez être à jour de cotisation à la date du vote.\nLes résultats seront visibles dès le " . formatteDate('fr', $votation['tf'], 'Europe/Paris') . " par le lien suivant : https://lalis69.ddns.net:10443/vote.resultat.php?id=" . $idVotation . "\n\nPour Lalis, Le Président, David Larochette.";
|
||||
foreach($adherents as $adherent)
|
||||
{
|
||||
$text = $textDebut . base64_encode($adherent['login']) . $textFin;
|
||||
print '<pre>' . $adherent['email'] . ' ' . $adherent['firstname'] . ' ' . $adherent['lastname'] . EOLH . nl2br($text) . '</pre>';
|
||||
if ( $_GET['status'] == 'Oui')
|
||||
{
|
||||
//envoiMail($adherent['email'], $sujet, $text, $html=false, $cc='', $bcc='');
|
||||
envoiMail('david@larochette.me', $sujet, $text, $html=false, $cc='', $bcc='');
|
||||
envoiMail('ric.libr4d@protonmail.com', $sujet, $text, $html=false, $cc='', $bcc='');
|
||||
}
|
||||
}
|
||||
}else
|
||||
{
|
||||
print("<pre><h4>Annulation de l'envoi du Mailing pour la votation : " . $votation['libelle'] . "</h4>
|
||||
</pre><br>");
|
||||
}
|
||||
|
||||
print(' </div>
|
||||
</div>
|
||||
</div>
|
||||
</section>');
|
||||
}
|
||||
require_once("footer.html");
|
||||
?>
|
Reference in New Issue
Block a user