diff --git a/gestion/index2.php b/gestion/index2.php
new file mode 100644
index 0000000..17b1c9c
--- /dev/null
+++ b/gestion/index2.php
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
');
+$votationsList = queryVotationList();
+foreach($votationsList as $votation)
+{
+
+}
+print('
+
+
+ ');
+
+require_once './footer.html';
+?>
diff --git a/gestion/saisieCandidats.php b/gestion/saisieCandidats.php
index a1ca9ed..2632926 100644
--- a/gestion/saisieCandidats.php
+++ b/gestion/saisieCandidats.php
@@ -10,9 +10,11 @@ $db = new db();
$idVotation = getpost("idVotation");
$idVote = getpost("idVote");
$candidat = getpost("candidat");
+$idCandidat = getpost("idCandidat");
$libelle = getpost("libelle");
+$action = getpost("action");
-if (!empty($candidat))
+if (!empty($candidat) and $action != "modif")
{
$query = "INSERT INTO liste_candidats VALUES (0, " . $db->protect($idVotation) . ", " . $db->protect($idVote) . ",'" . $db->protect($libelle) . "', '". $db->protect($candidat) . "')";
$db->query($query);
@@ -34,6 +36,9 @@ if (!empty($candidat))
}elseif (empty($idVote))
{
choixVote($path, $idVotation);
+ }elseif ($action == "modif" and !empty($idCandidat))
+ {
+
}else
{
$votationName = $db->queryVotationName($idVotation);
@@ -63,4 +68,4 @@ if (!empty($candidat))
}
$db->close();
-?>;
+?>
diff --git a/gestion/saisieVotes.php b/gestion/saisieVotes.php
index ad1c352..0cc23ee 100644
--- a/gestion/saisieVotes.php
+++ b/gestion/saisieVotes.php
@@ -52,7 +52,7 @@ if (!empty($votes))
print("vote
méthode | ");
foreach ($votes as $value)
{
- print ("" . $value[1] . " | " . $value[5] . " |
" . EOL);
+ print ("" . $value["libelle"] . " | " . $value["methode"] . " |
" . EOL);
}
print("" . EOL);
echo EOLH . EOLH;
diff --git a/include/db.class.php b/include/db.class.php
index 5896971..7ba0484 100644
--- a/include/db.class.php
+++ b/include/db.class.php
@@ -113,12 +113,16 @@ class dbcore
}
}
- function queryVoteName($idVote)
+ function queryVotationList()
{
- $query = "SELECT libelle FROM liste_votes where id='" . $idVote . "'";
+ $query = "SELECT * FROM liste_votations";
$this->query($query);
- $voteLine = $this->result->fetch_assoc();
- return $voteLine["libelle"];
+ $votationLine = $this->result->fetch_all(MSQLI_ASSOC);
+ foreach ($votationLine as $line)
+ {
+ $votationList[$line["id"]] = $line;
+ }
+ return $votationList;
}
function queryVotationName($idVotation) :string
@@ -129,11 +133,31 @@ class dbcore
return $votationLine["libelle"];
}
+ function queryVoteList($idVotation)
+ {
+ $query = "SELECT * FROM liste_votes WHERE idVotation = " . idVotation;
+ $this->query($query);
+ $votes = $this->result->fetch_all(MSQLI_ASSOC);
+ foreach ($votes as $line)
+ {
+ $votesList[$line["id"]] = $line;
+ }
+ return $votesList;
+ }
+
+ function queryVoteName($idVote)
+ {
+ $query = "SELECT libelle FROM liste_votes WHERE id='" . $idVote . "'";
+ $this->query($query);
+ $voteLine = $this->result->fetch_assoc();
+ return $voteLine["libelle"];
+ }
+
function queryVotes($idVotation)
{
- $query = "SELECT * FROM liste_votes LEFT JOIN methods ON liste_votes.methode=methods.id WHERE idVotation='" . $idVotation . "'";
+ $query = "SELECT id, lv.libelle, ms.libelle as methode FROM liste_votes as lv LEFT JOIN methods as ms ON lv.methode=ms.id WHERE idVotation='" . $idVotation . "'";
$this->query($query);
- $votes = $this->result->fetch_all();
+ $votes = $this->result->fetch_all(MSQLI_ASSOC);
return $votes;
}
@@ -142,7 +166,11 @@ class dbcore
$query = "SELECT * FROM liste_candidats WHERE idVotation='" . $idVotation . "' AND idVote='" . $idVote . "'";
$this->query($query);
$candidats = $this->result->fetch_all(MYSQLI_ASSOC);
- return $candidats;
+ foreach ($candidats as $line)
+ {
+ $candidatsList[$line["id"]] = $line;
+ }
+ return $candidatsList;
}
}
diff --git a/include/fonctions.inc.php b/include/fonctions.inc.php
index 22c38a5..f864efb 100644
--- a/include/fonctions.inc.php
+++ b/include/fonctions.inc.php
@@ -264,4 +264,10 @@ function listeVotants($idVotation, $idVote, $listeAdherents)
$db->close();
}
+function printLine($path, $request, $libelle, $modif=true, $delete=false)
+{
+ print('