1
0

modifying index.php

This commit is contained in:
Daniel Tartavel 2022-09-29 11:32:23 +02:00
parent 135910b78f
commit 72e45ec987
5 changed files with 78 additions and 10 deletions

29
gestion/index2.php Normal file
View File

@ -0,0 +1,29 @@
<?php
require_once '../session_init.php';
require_once 'config.inc.php';
require_once 'entete.php';
print(' <br><br>
<!-- lalis Grid Section -->
<section id="content">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h3>Gestion du site</h3>
</div>
</div>
<div class="row">
<ul>');
$votationsList = queryVotationList();
foreach($votationsList as $votation)
{
}
print(' </ul>
</div>
</div>
</section>');
require_once './footer.html';
?>

View File

@ -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();
?>;
?>

View File

@ -52,7 +52,7 @@ if (!empty($votes))
print("<b>vote</b></td><td><b>méthode</b></td></tr>");
foreach ($votes as $value)
{
print ("<tr><td>" . $value[1] . "</td><td>" . $value[5] . "</td></tr>" . EOL);
print ("<tr><td>" . $value["libelle"] . "</td><td>" . $value["methode"] . "</td></tr>" . EOL);
}
print("</table>" . EOL);
echo EOLH . EOLH;

View File

@ -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;
}
}

View File

@ -264,4 +264,10 @@ function listeVotants($idVotation, $idVote, $listeAdherents)
$db->close();
}
function printLine($path, $request, $libelle, $modif=true, $delete=false)
{
print('<a href="' . $vote_url . $path . $request . '>' . $libelle . '</a>');
if ($modif) print('<a href=""');
}
?>