Ejemplo n.º 1
0
require_once "tableoth.inc";
require_once "dream.inc";
require_once "tablepeop.inc";
require_once "wiki.inc";
# the main mp list
# against a dreammp, another mp, or the party
$voter2attr = get_dreammpid_attr_decode($db, "");
if ($voter2attr != null) {
    $voter2type = "dreammp";
    $voter2 = $voter2attr['dreammpid'];
}
# decode the parameters.
# first is the two voting objects which get compared together.
# First is an mp (arranged by person or by constituency)
# Second is another mp (by person), a dream mp, or a/the party
$voter1attr = get_mpid_attr_decode($db, $db2, "", $voter2type == "dreammp" ? $voter2attr : null);
if ($voter1attr == null) {
    print "<p>No MP or Lord found. If you entered a postcode, please make\n        sure it is correct.  Or you can <a href=\"/mps.php\">browse\n        all MPs</a> or <a href=\"/mps.php?house=lords\">browse all Lords</a>.";
    exit;
}
$voter1type = "mp";
# shorthand to get at the designated MP for this class of MP holders
# (multiple sets of properties, usually overlapping, hold for each MP if they've had more than one term)
$mpprop = $voter1attr["mpprop"];
# case now is we know the two voting actors,
# (and whether the first is a constituency or a person)
# select a mode for what is displayed
# code for the 0th mp def, if it is there.
$voter1link = "mp.php?";
$voter1link .= $mpprop['mpanchor'];
$referrer = $_SERVER["HTTP_REFERER"];
Ejemplo n.º 2
0
print "<title>The Public Whip - Forty-Two Days</title>\n";
print "<link href=\"publicwhip.css\" type=\"text/css\" rel=\"stylesheet\"/>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n";
print "<style type=\"text/css\">\n";
print "\nbody { width:800px; margin-left:auto; margin-right:auto; text-align:center; }\nh1#th1 { background:#003300; padding:0; margin:0 }\nh4#th4a { color: #399611; margin-top: 10px; font-size: 35px; margin-bottom: 5px; text-align: center }\nh4#th4b { color: #304030; margin-top: 7px; width: 650px; font-size: 20px; margin-bottom: 5px; font-style: italic; }\nh2 { color: #102010; margin-top: 4em; border-left: 10px #5050ff solid; padding-left: 10px; border-top: thin blue solid}\ninput { color: #303070 }\ndiv#content { text-align: left; width: 800px; }\ndiv#Zopform {  border: thin black solid; padding: 20px }\ndiv.quessec { text-align: left; border: thin black solid; width: 600px; margin-left: auto; margin-right: auto; padding: 10px; margin-top:10px; background-color: #beffbe;}\ndiv.oprad { margin-top:10px; padding:5px; font-size:120%; margin-left: 20px; }\ndiv#checkmpbutton { font-size: 200%; text-align:center; margin:20px;}\ndiv#footer { background-color:black; color:white;  border: thin black solid;  margin-top: 2em; }\ntable.votetab td { border: thin black solid; background-color: #e0e0e0; }\ntable.votetab { margin-left:auto; margin-right:auto }\ndiv#yourfav p { text-align: left; padding-left: 10px; background-color:#beffbe; width:80%; margin-left:auto; margin-right:auto; padding:10px; }\ndiv#foiparl { text-align: left; background-color:#fed9d8; width:80%; margin-left:auto; margin-right:auto; padding:5px; margin-bottom: 20px; border: thick red dotted; }\ntr.agree td { background-color:#90ff90; }\ntr.disagree td { background-color:#ff9090; }\n.agpe { background-color:#b0ffb0; }\ndiv.dethist { text-align: left; height:200px; margin-top:1em; overflow:auto; border: thin blue solid; background-color:#c9d9ff;}\ndiv.dethist li { margin-top:20px }\ntable.bars { border: thin black solid; margin-left: auto; margin-right:auto; }\ntr.bars td { padding-top: 20px; vertical-align:bottom; padding-left:50px; padding-right:50px; margin-left: auto; margin-right:auto; }\ntr.bars div { width:50px; vertical-align:bottom; text-align:center; margin-left: auto; margin-right:auto;}:\n";
print "</style>\n";
print "</head>\n";
print "<body class=\"fortytwodays\">\n";
#print "<script type=\"text/javascript\" src=\"quiz/election2008.js\"></script>\n";
print "<a href=\"/\"><h1 id=\"th1\"><a href=\"/\"><img src=\"/thepublicwhip.gif\" ></h1></a>\n";
print "<h4 id=\"th4a\">The Forty-two Days Question</h4>\n";
#print "<h1>The Public Whip - Forty-two days</h1>\n";
#print "<h4 id=\"th4\">The candidate calculator for <i>$constituency</i></h4>\n";
#print "<p></p>\n\n";
if (is_postcode($_GET["mppc"]) or $_GET["mpc"]) {
    $mpval = get_mpid_attr_decode($db, $db2, "");
}
$vterdet = db_scrub($_GET["vterdet"]);
$vpubemknow = db_scrub($_GET["vpubemknow"]);
$vpubemagg = db_scrub($_GET["vpubemagg"]);
$vpubem = "{$vpubemknow}-{$vpubemagg}";
$vrand = db_scrub($_GET["vrand"]);
if ($vrand) {
    $vrand = (int) $vrand;
} else {
    $vrand = rand(10, 10000000);
}
$vdash = mysql_real_escape_string(db_scrub($_GET["dash"]));
# used to tell if /by-election or /byelection was used
$vformfilled = ($vterdet and $vpubemknow and $vpubemagg);
$referrer = $_SERVER["HTTP_REFERER"];
Ejemplo n.º 3
0
$original_motion = $divattr["original_motion"];
$debate_url = $divattr["debate_url"];
$source_gid = $divattr["source_gid"];
$debate_gid = $divattr["debate_gid"];
$div_no = html_scrub($divattr["division_number"]);
$this_anchor = $divattr["divhref"];
$house = $divattr["house"];
$clock_time = $divattr["clock_time"];
$clock_time = preg_replace("/:00\$/", "", $clock_time);
$clock_time = preg_replace("/^0/", "", $clock_time);
$colour_scheme = $house;
$showhits = preg_match("/.*?house=z/", $referrer);
# designated voter on this division
$votertype = "";
$voter = "";
$voterattr = get_mpid_attr_decode($db, $db2, "", null);
if ($voterattr != null) {
    $votertype = "mp";
    $voter = $voterattr['mpprop'];
    # brutally find which of the set did the vote
    foreach ($voterattr['mpprops'] as $lkey => $mpprop) {
        $query = "SELECT vote FROM pw_vote WHERE division_id = ? AND mp_id = ? LIMIT 1";
        $row = $pwpdo->get_single_row($query, array($divattr["division_id"], $mpprop['mpid']));
        if ($row) {
            $voter = $mpprop;
            $vote = $row["vote"];
            break;
        }
    }
} else {
    $voterattr = get_dreammpid_attr_decode($db, "");
Ejemplo n.º 4
0
<?php

require_once "common.inc";
# $Id: mpplot.php,v 1.1 2006/02/17 11:47:07 frabcus Exp $
# Draw thumbsketch histogram of how many MPs are each distance away
# from the Dream MP.
# The Public Whip, Copyright (C) 2003 Francis Irving and Julian Todd
# This is free software, and you are welcome to redistribute it under
# certain conditions.  However, it comes with ABSOLUTELY NO WARRANTY.
# For details see the file LICENSE.html in the top level of the source.
require_once "db.inc";
require_once "decodeids.inc";
$db = new DB();
$db2 = new DB();
$voter1attr = get_mpid_attr_decode($db, $db2, "");
$person = db_scrub($voter1attr['mpprop']['person']);
// Calculate number of MPs with distance to Dream MP in each of
// $divisions blocked off ranges (between 0.0 and 1.0).
$query = "select division_date, vote, whip_guess\n            from pw_vote\n            left join pw_division on pw_division.division_id = pw_vote.division_id \n            left join pw_mp on pw_mp.mp_id = pw_vote.mp_id\n            left join pw_cache_whip on pw_cache_whip.division_id = pw_division.division_id and pw_mp.party = pw_cache_whip.party\n            where pw_mp.person = {$person}\n            order by division_date";
$db->query($query);
#$divisions = 10;
#$data = array();
#for ($i = 0; $i < $divisions; $i++) {
#    $data[$i] = 0;
#}
$data = array();
while ($row = $db->fetch_row_assoc()) {
    $vote = str_replace("tell", "", $row['vote']);
    $whip = $row['whip_guess'];
    if ($vote != "aye" && $vote != "no" && $vote != "both") {
        trigger_error("Unknown vote type '{$vote}'", E_USER_ERROR);