\n";
$display = FALSE;
}
if ($display && isset ($_GET["election_id"]) && is_numeric ($_GET["election_id"]))
$election_id = $_GET["election_id"];
else {
$election_id = -1;
$error .= "Please choose an election/referendum on this list.
\n";
$display = FALSE;
}
if ($display && $election_id >= 0) {
$election = elec_get_election ($handle, $election_id);
if ($election === FALSE) {
$error .= "The specified election/referendum does not exist.
\n";
$display = FALSE;
} else if (!elec_election_has_ended ($election)) {
$error .= "The voting period for the specified ".elec_election_get_type ($election)." starts on ".$election["voting_start"]." (UTC) and ends on ".$election["voting_end"]." (UTC). It is not possible to see the results now.
\n";
$display = FALSE;
}
}
if (isset ($election) && $election !== FALSE) {
echo "Detailed votes for the ".$election["name"]."
\n";
}
if ($display) {
$anon_tokens = elec_get_anon_tokens_for_election ($handle, $election_id);
if ($anon_tokens === FALSE) {
$error .= "Can not get the anonymous tokens for this ".elec_election_get_type ($election).".\n";
$display = FALSE;
}
}
if ($display) {
$choices = elec_choices_get ($handle, $election_id);
if ($choices === FALSE) {
$error .= "The ".elec_election_get_type ($election)." is not properly set up.\n";
$display = FALSE;
}
}
if ($display) {
$choices_name = array ();
foreach ($choices as $choice) {
$choices_name[$choice["id"]] = $choice["choice"];
}
echo "Please look at the automatic results to have a summary of the votes.
\n";
echo "Please note that these results are automatically calculated and are thus not the official results.
\n";
echo "".$election["question"]."
\n";
echo "\nAnonymous token | Vote(s) |
\n";
$color = TRUE;
foreach ($anon_tokens as $anon_token) {
$votes = elec_get_votes_for_anon_token ($handle, $anon_token["id"]);
if ($color)
$class = "colorA";
else
$class = "colorB";
echo "\n";
echo "".$anon_token["anon_token"]." | \n";
echo "";
if ($votes === FALSE) {
echo "Can not access votes for this anonymous token.";
$error .= "Can not get votes for anonymous token ".$anon_token["anon_token"]." \n";
} else if (count ($votes) == 0) {
echo "This member chose to vote for none of the possible choices.";
} else {
foreach ($votes as $vote) {
if (array_key_exists ($vote, $choices_name))
echo "".$choices_name[$vote]." \n";
else {
echo "Unknown value (".$vote.") \n";
$error .= "There was an unkown vote for anonymous token ".$anon_token["anon_token"].": ".$vote." \n";
}
}
}
echo " | \n";
echo "
\n";
$color = !$color;
}
echo "
\n";
}
if (isset ($error) && $error != "") {
echo "".$error."
\n";;
echo "If you don't understand the error, you should probably contact the Membership and Elections Committee, which can be reached at elections@gnome.org.
\n";
}
if (isset ($handle))
elec_sql_close ($handle);
?>