1
0

ajout saisie de la liste des votes

This commit is contained in:
2022-09-15 18:34:18 +02:00
parent 0cefd8f9a0
commit b3790d3425
3 changed files with 93 additions and 6 deletions

View File

@ -30,7 +30,7 @@ function getpost( $var )
return $_POST[$var];
}else
{
return false;
return null;
}
}
@ -44,9 +44,10 @@ function mb_ucfirst($str)
return $char . $str;
}
function choixVotation($path, $methode=2) //2 = toutes les votations 1 = votations en cours 0 = votations cloturées
function choixVotation($path, $methode = 2, $confirm = true) //2 = toutes les votations 1 = votations en cours 0 = votations cloturées
{
global $db, $base_url, $action;
$query = "SELECT * FROM liste_votations";
if ($methode != 2)
{
@ -64,7 +65,7 @@ function choixVotation($path, $methode=2) //2 = toutes les votations 1 = votat
}
$redirect .= '">';
echo $redirect;
//echo $redirect;
header( 'Location: ' . $base_url . '/gestionsite/modifVotation.php?id=' . $votations["0"]["id"]) . $redirect;
}
print ('<form method="get" action="' . $path . '">');
@ -74,6 +75,8 @@ function choixVotation($path, $methode=2) //2 = toutes les votations 1 = votat
{
print '<input type="radio" name="id" value="' . $value["id"] . '"> ' . $value["titre"] . '&nbsp;:' . $value["libelle"] . '<br>';
}
// TODO confirmation du choix par javascript si $confirm = true
print '</pre><br>
<div>
<input type="submit" value="Envoyer">
@ -93,6 +96,43 @@ function votationForm($path, $titre="", $libelle="", $dateDebut="", $DateFin="",
print('<input type="submit" value="' . _("Envoyer") . '">') . EOLH;
}
function votesForm($path, $libelle = "", $method = 0)
{
$db = new db();
$query = "SELECT *m FROM methods"; // clotûre
$db->query($query);
$methods = $db->result::fetch_all(MYSQLI_ASSOC);
if (!(array_key_exists($method, $methods)))
{
print(_("L'ID de la méthode demandée n'est pas bonne " . __file__ . __LINE__));
log_error(_("L'ID de la méthode demandée n'est pas bonne " . __file__ . __LINE__), true, true);
}
//TODO vérification du formulaire en javascript
print('<form method="get" action="' . $path . '">');
print('<label for="libelle">' . _("Libellé du vote") .'</label><br><input type="text" id="libelle" name="libelle" value="'. $libelle . '">') . EOLH;
print('<label for="method">' . _("Méthode de vote") . '</label><br>
<input type="select" id="method" name="method" value="'. $method . '">') . EOLH;
if ($method == 0)
{
print('<option value ="">' . _("Choisissez une option") . '<option>');
}
foreach ($methods as $id => $value)
{
if ($id == $value)
{
print('<option value ="' . $id . '" selected>' . $value . '<option>');
}else
{
print('<option value ="' . $id . '">' . $value . '<option>');
}
}
print('<input type="submit" formaction="index.php" value="' . _("Annuler") . '">') . EOLH;
print('<input type="submit" value="' . _("Envoyer") . '">') . EOLH;
}
function envoiMail($destinataire, $sujet, $text, $html=false, $cc='', $bcc='')
{