1
0

ajout du nombre de votant, et correction bug de date

This commit is contained in:
Daniel Tartavel 2021-10-23 01:27:50 +02:00
parent 5f6807b0dd
commit 70261fcd71
3 changed files with 11 additions and 7 deletions

View File

@ -229,15 +229,19 @@ function listeAdherents()
function listeVotants($idVotation, $idVote, $listeAdherents) function listeVotants($idVotation, $idVote, $listeAdherents)
{ {
global $db; global $db;
$nv = 0;
$text = '';
$query = "SELECT DISTINCT idVotant FROM votes WHERE idVotation=" . $idVotation . ' AND idVote=' . $idVote; $query = "SELECT DISTINCT idVotant FROM votes WHERE idVotation=" . $idVotation . ' AND idVote=' . $idVote;
$result = $db->query($query); $result = $db->query($query);
print (EOLH . '<div id="listeVotants' . $idVote . '" style="display: none; line-height: 0.8;">');
while ($idVotants = $db->result->fetch_assoc()) while ($idVotants = $db->result->fetch_assoc())
{ {
$nv++;
print($listeAdherents[$idVotants['idVotant']] . EOLH); $text .= $listeAdherents[$idVotants['idVotant']] . EOLH;
} }
print('</div><button id="button' . $idVote . '" onclick="show(\'listeVotants\',\'' . $idVote . '\')">Voir la liste des votants</button>' . EOLH); print('Nombre de votants : ' . $nv . EOLH . '<div id="listeVotants' . $idVote . '" style="display: none; line-height: 0.8;">' . $text . '</div>');
print('<button id="button' . $idVote . '" onclick="show(\'listeVotants\',\'' . $idVote . '\')">Voir la liste des votants</button>' . EOLH);
} }
?> ?>

View File

@ -35,7 +35,7 @@ if ($dolibarr->result->num_rows == 0)
{ {
$dolibarr->close(); $dolibarr->close();
$db = new db(); $db = new db();
$query = 'SELECT *, UNIX_TIMESTAMP(dateDebut) as td, UNIX_TIMESTAMP( DATE_ADD(dateFin, INTERVAL 1 DAY)) as tf FROM liste_votations WHERE id=' . $db->protect($idVotation); $query = 'SELECT *, UNIX_TIMESTAMP(dateDebut) as td, UNIX_TIMESTAMP( DATE_ADD(dateFin, INTERVAL 1 DAY)) as tf, UNIX_TIMESTAMP( dateFin) as df FROM liste_votations WHERE id=' . $db->protect($idVotation);
$resultVotation = $db->query($query); $resultVotation = $db->query($query);
$votation = $db->result->fetch_array(); $votation = $db->result->fetch_array();
$now = date('Y-m-d'); $now = date('Y-m-d');
@ -84,7 +84,7 @@ if ($dolibarr->result->num_rows == 0)
} }
}else }else
{ {
print " Bonjour " . $votant['firstname'] . " " . $votant['lastname'] . ',</h4>' . EOLH . EOLH . "Le vote ne sera ouvert qu'à partir du " . formattedate('fr', $votation['td'] , "Europe/Paris") . " et jusqu'au " . formattedate('fr', $votation['tf'] , "Europe/Paris") . '.' . EOLH . "Si vous pensez que ceci est une erreur, veuillez prendre contact avec les responsables de l'association.</h4>"; print " Bonjour " . $votant['firstname'] . " " . $votant['lastname'] . ',</h4>' . EOLH . EOLH . "Le vote ne sera ouvert qu'à partir du " . formattedate('fr', $votation['td'] , "Europe/Paris") . " et jusqu'au " . formattedate('fr', $votation['df'] , "Europe/Paris") . '.' . EOLH . "Si vous pensez que ceci est une erreur, veuillez prendre contact avec les responsables de l'association.</h4>";
} }
} }
} }

View File

@ -46,7 +46,7 @@ if ( empty($idVotation))
}else }else
{ {
$now = date('Y-m-d'); $now = date('Y-m-d');
if ( time() < $votation['tf'] ) if ( time() > $votation['tf'] )
{ {
echo $votation["libelle"] . "</h4>"; echo $votation["libelle"] . "</h4>";
$listeAdherents = listeAdherents(); $listeAdherents = listeAdherents();