modifying index.php
This commit is contained in:
parent
135910b78f
commit
72e45ec987
29
gestion/index2.php
Normal file
29
gestion/index2.php
Normal 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';
|
||||||
|
?>
|
@ -10,9 +10,11 @@ $db = new db();
|
|||||||
$idVotation = getpost("idVotation");
|
$idVotation = getpost("idVotation");
|
||||||
$idVote = getpost("idVote");
|
$idVote = getpost("idVote");
|
||||||
$candidat = getpost("candidat");
|
$candidat = getpost("candidat");
|
||||||
|
$idCandidat = getpost("idCandidat");
|
||||||
$libelle = getpost("libelle");
|
$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) . "')";
|
$query = "INSERT INTO liste_candidats VALUES (0, " . $db->protect($idVotation) . ", " . $db->protect($idVote) . ",'" . $db->protect($libelle) . "', '". $db->protect($candidat) . "')";
|
||||||
$db->query($query);
|
$db->query($query);
|
||||||
@ -34,6 +36,9 @@ if (!empty($candidat))
|
|||||||
}elseif (empty($idVote))
|
}elseif (empty($idVote))
|
||||||
{
|
{
|
||||||
choixVote($path, $idVotation);
|
choixVote($path, $idVotation);
|
||||||
|
}elseif ($action == "modif" and !empty($idCandidat))
|
||||||
|
{
|
||||||
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
$votationName = $db->queryVotationName($idVotation);
|
$votationName = $db->queryVotationName($idVotation);
|
||||||
@ -63,4 +68,4 @@ if (!empty($candidat))
|
|||||||
}
|
}
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
?>;
|
?>
|
||||||
|
@ -52,7 +52,7 @@ if (!empty($votes))
|
|||||||
print("<b>vote</b></td><td><b>méthode</b></td></tr>");
|
print("<b>vote</b></td><td><b>méthode</b></td></tr>");
|
||||||
foreach ($votes as $value)
|
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);
|
print("</table>" . EOL);
|
||||||
echo EOLH . EOLH;
|
echo EOLH . EOLH;
|
||||||
|
@ -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);
|
$this->query($query);
|
||||||
$voteLine = $this->result->fetch_assoc();
|
$votationLine = $this->result->fetch_all(MSQLI_ASSOC);
|
||||||
return $voteLine["libelle"];
|
foreach ($votationLine as $line)
|
||||||
|
{
|
||||||
|
$votationList[$line["id"]] = $line;
|
||||||
|
}
|
||||||
|
return $votationList;
|
||||||
}
|
}
|
||||||
|
|
||||||
function queryVotationName($idVotation) :string
|
function queryVotationName($idVotation) :string
|
||||||
@ -129,11 +133,31 @@ class dbcore
|
|||||||
return $votationLine["libelle"];
|
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)
|
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);
|
$this->query($query);
|
||||||
$votes = $this->result->fetch_all();
|
$votes = $this->result->fetch_all(MSQLI_ASSOC);
|
||||||
return $votes;
|
return $votes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +166,11 @@ class dbcore
|
|||||||
$query = "SELECT * FROM liste_candidats WHERE idVotation='" . $idVotation . "' AND idVote='" . $idVote . "'";
|
$query = "SELECT * FROM liste_candidats WHERE idVotation='" . $idVotation . "' AND idVote='" . $idVote . "'";
|
||||||
$this->query($query);
|
$this->query($query);
|
||||||
$candidats = $this->result->fetch_all(MYSQLI_ASSOC);
|
$candidats = $this->result->fetch_all(MYSQLI_ASSOC);
|
||||||
return $candidats;
|
foreach ($candidats as $line)
|
||||||
|
{
|
||||||
|
$candidatsList[$line["id"]] = $line;
|
||||||
|
}
|
||||||
|
return $candidatsList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,4 +264,10 @@ function listeVotants($idVotation, $idVote, $listeAdherents)
|
|||||||
$db->close();
|
$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=""');
|
||||||
|
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user