added saisie votes et candidats
This commit is contained in:
@ -113,20 +113,44 @@ class dbcore
|
||||
}
|
||||
}
|
||||
|
||||
function queryVotationName($db, $idVotation) :string
|
||||
function queryVoteName($idVote)
|
||||
{
|
||||
$query = "SELECT libelle FROM liste_votes where id='" . $idVote . "'";
|
||||
$this->query($query);
|
||||
$voteLine = $this->result->fetch_assoc();
|
||||
return $voteLine["libelle"];
|
||||
}
|
||||
|
||||
function queryVotationName($idVotation) :string
|
||||
{
|
||||
$query = "SELECT libelle FROM liste_votations WHERE id='" . $idVotation . "'";
|
||||
$db->query($query);
|
||||
$votationLine = $db->result->fetch_assoc();
|
||||
$this->query($query);
|
||||
$votationLine = $this->result->fetch_assoc();
|
||||
return $votationLine["libelle"];
|
||||
}
|
||||
|
||||
function queryVotes($db, $idVotation)
|
||||
function queryVotes($idVotation)
|
||||
{
|
||||
$query = "SELECT * FROM liste_votes LEFT JOIN methods ON liste_votes.methode=methods.id WHERE idVotation='" . $idVotation . "'";
|
||||
$db->query($query);
|
||||
$votes = $db->result->fetch_all();
|
||||
$this->query($query);
|
||||
$votes = $this->result->fetch_all();
|
||||
return $votes;
|
||||
}
|
||||
|
||||
function queryCandidatsList($idVotation, $idVote)
|
||||
{
|
||||
$query = "SELECT * FROM liste_candidats WHERE idVotation='" . $idVotation . "' AND idVote='" . $idVote . "'";
|
||||
$this->query($query);
|
||||
$candidats = $this->result->fetch_all();
|
||||
return $candidats;
|
||||
}
|
||||
}
|
||||
|
||||
function queryCandidatName($idCandidat)
|
||||
{
|
||||
$query = "SELECT libelle FROM liste_candidats where id='" . $idCandidat . "'";
|
||||
$this->query($query);
|
||||
$line = $this->result->fetch_assoc();
|
||||
return $line["candidat"];
|
||||
}
|
||||
?>
|
||||
|
@ -44,6 +44,32 @@ function mb_ucfirst($str)
|
||||
return $char . $str;
|
||||
}
|
||||
|
||||
function choixVote($path, $idVotation, $confirm=false)
|
||||
{
|
||||
global $base_url, $action;
|
||||
|
||||
$db = new db();
|
||||
$query = "SELECT * FROM liste_votes WHERE idVotation=" . $idVotation;
|
||||
$result = $db->query($query);
|
||||
$votes = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||
print ('<form method="get" action="' . $path . '">');
|
||||
print "<pre>";
|
||||
print '<input type="hidden" name="idVotation" value="' . $idVotation . '"/>';
|
||||
foreach($votes as $key => $value )
|
||||
{
|
||||
print '<input type="radio" name="idVote" value="' . $value["id"] . '"/> ' . $value["candidat"] . '<br>';
|
||||
}
|
||||
// TODO confirmation du choix par javascript si $confirm = true
|
||||
|
||||
print '</pre><br>
|
||||
<div>
|
||||
<input type="submit" value="Envoyer"/>
|
||||
<input type="submit" formaction="index.php" value="' . _("Annuler") . '"/>
|
||||
</div>
|
||||
</form>';
|
||||
$db->close();
|
||||
}
|
||||
|
||||
function choixVotation($path, $methode = 2, $confirm = true) //2 = toutes les votations 0 = votations en cours 1 = votations cloturées
|
||||
{
|
||||
global $base_url, $action;
|
||||
@ -57,18 +83,6 @@ function choixVotation($path, $methode = 2, $confirm = true) //2 = toutes les v
|
||||
$result = $db->query($query);
|
||||
$votations = $db->result->fetch_all(MYSQLI_ASSOC);
|
||||
|
||||
/*if ($db->result->num_rows == 1)
|
||||
{
|
||||
$redirect = '<META HTTP-EQUIV=Refresh CONTENT="0; URL=' . $base_url . $path . '?id=' . $votations["0"]["id"];
|
||||
if( !empty($action))
|
||||
{
|
||||
$redirect .= '&action=' . $action;
|
||||
}
|
||||
$redirect .= '">';
|
||||
|
||||
//echo $redirect;
|
||||
header( 'Location: ' . $base_url . '/gestionsite/modifVotation.php?id=' . $votations["0"]["id"]) . $redirect;
|
||||
}*/
|
||||
print ('<form method="get" action="' . $path . '">');
|
||||
print "<pre>";
|
||||
print '<input type="hidden" name="action" value="' . $action . '"/>';
|
||||
|
Reference in New Issue
Block a user