2022-09-15 18:34:18 +02:00
|
|
|
<?php
|
|
|
|
require_once '../session_init.php';
|
|
|
|
require_once 'config.inc.php';
|
|
|
|
require_once 'db.class.php';
|
|
|
|
require_once 'entete.php';
|
|
|
|
require_once 'fonctions.inc.php';
|
|
|
|
|
2022-09-19 15:59:24 +02:00
|
|
|
$path = $_SERVER["PHP_SELF"];
|
2022-09-19 13:06:33 +02:00
|
|
|
$db = new db();
|
|
|
|
|
2022-09-19 15:59:24 +02:00
|
|
|
function queryVotationName($db, $idVotation) :string
|
|
|
|
{
|
|
|
|
$query = "SELECT libelle FROM liste_votations WHERE id='" . $idVotation . "'";
|
|
|
|
$db->query($query);
|
|
|
|
$votationLine = $db->result->fetch_assoc();
|
|
|
|
return $votationLine["libelle"];
|
|
|
|
}
|
2022-09-19 13:17:44 +02:00
|
|
|
|
2022-09-19 15:59:24 +02:00
|
|
|
$idVotation = getpost("id");
|
|
|
|
if (!empty($idVotation))
|
|
|
|
{
|
2022-09-21 14:01:45 +02:00
|
|
|
$_SESSION["idVotation"] = $idVotation;
|
2022-09-19 15:59:24 +02:00
|
|
|
$votationName = queryVotationName($db, $idVotation);
|
2022-09-21 14:01:45 +02:00
|
|
|
}elseif (array_key_exists("idVotation", $_SESSION))
|
2022-09-19 15:59:24 +02:00
|
|
|
{
|
2022-09-21 14:01:45 +02:00
|
|
|
if (!empty($_SESSION["idVotation"]))
|
2022-09-19 16:12:51 +02:00
|
|
|
{
|
2022-09-21 14:01:45 +02:00
|
|
|
$idVotation = $_SESSION["idVotation"];
|
2022-09-19 16:12:51 +02:00
|
|
|
$votationName = queryVotationName($db, $idVotation);
|
|
|
|
}
|
2022-09-19 15:59:24 +02:00
|
|
|
}
|
2022-09-19 13:17:44 +02:00
|
|
|
|
2022-09-15 18:34:18 +02:00
|
|
|
print('<br><br>
|
|
|
|
<!-- lalis Grid Section -->
|
|
|
|
<section id="content">
|
2022-09-19 10:28:44 +02:00
|
|
|
<div class="container">') . EOL;
|
2022-09-15 18:34:18 +02:00
|
|
|
print(' <div class="row">
|
|
|
|
<div class="col-lg-12 text-center">
|
2022-09-19 15:59:24 +02:00
|
|
|
<h3>Nouveau vote pour la votation');
|
2022-09-19 11:35:05 +02:00
|
|
|
|
2022-09-15 18:34:18 +02:00
|
|
|
if (empty($idVotation))
|
|
|
|
{
|
2022-09-19 12:59:40 +02:00
|
|
|
choixVotation($path, 0, false);
|
2022-09-19 11:06:53 +02:00
|
|
|
}else
|
|
|
|
{
|
2022-09-19 15:59:24 +02:00
|
|
|
print(": " . $votationName . '</h3>' . EOL);
|
2022-09-19 12:56:42 +02:00
|
|
|
$method = getpost("method");
|
|
|
|
$libelle = getpost("libelle");
|
|
|
|
if (empty($method) or empty($libelle))
|
|
|
|
{
|
|
|
|
votesForm($path);
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
$query = "INSERT INTO liste_votes ('libelle', 'method', 'id_votation') VALUES ('" . $libelle . "', '" . $method . "', '" . $idVotation . "')";
|
|
|
|
print($query);
|
|
|
|
//$db->query($query);
|
|
|
|
}
|
2022-09-19 11:06:53 +02:00
|
|
|
}
|
2022-09-19 13:06:33 +02:00
|
|
|
$db->close();
|
|
|
|
|
2022-09-15 21:29:43 +02:00
|
|
|
print(' </div>
|
|
|
|
</div>
|
2022-09-15 18:34:18 +02:00
|
|
|
</div>
|
|
|
|
</section>');
|
|
|
|
require_once("footer.html");
|
|
|
|
|
|
|
|
?>
|