1
0

added comment for candidats

This commit is contained in:
Daniel Tartavel 2022-09-26 11:39:41 +02:00
parent 6fdeb9d502
commit ae357e7e95
2 changed files with 15 additions and 5 deletions

View File

@ -10,10 +10,11 @@ $db = new db();
$idVotation = getpost("idVotation"); $idVotation = getpost("idVotation");
$idVote = getpost("idVote"); $idVote = getpost("idVote");
$candidat = getpost("candidat"); $candidat = getpost("candidat");
$libelle = getpost("libelle");
if (!empty($idCandidat)) if (!empty($idCandidat))
{ {
$query = "INSERT INTO liste_candidats VALUES (0, " . $idVotation . ", " . $idVote . ",'" . $candidat . "')"; $query = "INSERT INTO liste_candidats VALUES (0, " . $idVotation . ", " . $idVote . ",'" . $libelle . "', '". $candidat . "')";
$db->query($query); $db->query($query);
header("Location: " . $$base_url . "/" . $path , TRUE, 301); header("Location: " . $$base_url . "/" . $path , TRUE, 301);
return; return;
@ -38,11 +39,18 @@ if (!empty($idCandidat))
$votationName = $db->queryVotationName($idVotation); $votationName = $db->queryVotationName($idVotation);
$voteName = $db->queryVoteName($idVote); $voteName = $db->queryVoteName($idVote);
$candidatsList = $db->queryCandidatsList($idVotation, $idVote); $candidatsList = $db->queryCandidatsList($idVotation, $idVote);
print('<h3>Nouveau candidat pour le vote ' . $voteName . ' de la votation ' . $votationName . '</h3>');
print('Liste des candidats'); print('<h3>Nouveau candidat pour le vote "' . $voteName . '" de la votation "' . $votationName . '"</h3>');
foreach($candidatsList as $line) if (empty($candidatsList))
{ {
print($line["libelle"] . EOLH); print("Aucun candidats saisi pour l'instant" . EOLH);
}else
{
print('Liste des candidats');
foreach($candidatsList as $line)
{
print($line["libelle"] . EOLH);
}
} }
candidatsForm($path, $idVotation, $idVote); candidatsForm($path, $idVotation, $idVote);
} }

View File

@ -161,6 +161,8 @@ function candidatsForm($path, $idVotation, $idVote)
print('<input type="hidden" name="idVotation" value="' . $idVotation . '">'); print('<input type="hidden" name="idVotation" value="' . $idVotation . '">');
print('<input type="hidden" name="idVote" value="' . $idVote . '">'); print('<input type="hidden" name="idVote" value="' . $idVote . '">');
print('<label for="candidat">' . _("Candidat") .'</label><br><input type="text" id="candidat" name="candidat" value=""/>') . EOLH; print('<label for="candidat">' . _("Candidat") .'</label><br><input type="text" id="candidat" name="candidat" value=""/>') . EOLH;
print('<label for="libelle">' . _("Libellé") .'</label><br><input type="text" id="libelle" name="libelle" value=""/>') . EOLH;
print('<input type="submit" formaction="index.php" value="' . _("Annuler") . '"/>') . EOLH; print('<input type="submit" formaction="index.php" value="' . _("Annuler") . '"/>') . EOLH;
print('<input type="submit" value="' . _("Envoyer") . '"/>') . EOLH; print('<input type="submit" value="' . _("Envoyer") . '"/>') . EOLH;
} }