Example #1
0
function WriteCandidateIssueTd($candidate, $issue)
{
    $distance = $candidate["issuedistances"][$issue["name"]];
    print "\t<td id=\"" . $candidate["candidate_id"] . '-' . $issue["dream_id"] . '">';
    if ($candidate["matchid"]) {
        $acont = "href=\"http://www.publicwhip.org.uk/mp.php?dmp=" . $issue["dream_id"] . '&amp;' . $candidate["matchid"] . '"' . " onmouseover=\"Tip('Show comparison with MP or party')\"";
    } else {
        $acont = "href=\"http://www.publicwhip.org.uk/policy.php?id=" . $issue["dream_id"] . '&display=motions"';
    }
    if ($candidate["votetype"] == "incumbent") {
        $vsubject = "Your MP";
    } else {
        if ($candidate["votetype"] == "party") {
            $vsubject = $candidate["party"] . " MPs";
        } else {
            if ($candidate["votetype"] == "dream" && $distance != -1) {
                $vsubject = "Party would have";
            } else {
                $vsubject = Null;
            }
        }
    }
    if ($vsubject) {
        print "{$vsubject} <a {$acont} target=\"_blank\">voted</a> ";
    }
    print DistanceToWord($distance) . "</td>\n";
}
function WriteIssueRow($issue, $candidates)
{
    #print "<th>".$issue["name"]."</th>\n";
    $issuelink = "http://www.publicwhip.org.uk/policy.php?id=" . $issue["dream_id"];
    #print "<th class=\"issue\"><a href=\"$issuelink\">".$issue["name"]."</a></th>\n";
    #print "<th> </th>\n";
    print "\n<tr class=\"issuerow-top\" >\n";
    foreach ($candidates as $candidate) {
        if ($candidate["votetype"] == "incumbent") {
            $vsubject = "Your MP";
        } else {
            if ($candidate["votetype"] == "party") {
                $vsubject = $candidate["party"];
            } else {
                if ($candidate["votetype"] == "dream" && $distance != -1) {
                    $vsubject = "Party would have";
                } else {
                    if ($candidate["votetype"] == "leftoffice") {
                        $vsubject = $candidate["name"];
                    } else {
                        $vsubject = Null;
                    }
                }
            }
        }
        print "<td class=\"" . $candidate["party_code"] . "\">{$vsubject}</td>";
        //WriteCandidateIssueTd($candidate, $issue);
    }
    print "</tr>\n";
    print "\n<tr class=\"issuerow-middle\" id=\"" . $issue["dream_id"] . "-row\">\n";
    foreach ($candidates as $candidate) {
        WriteCandidateIssueTd($candidate, $issue);
    }
    print "</tr>\n";
    print "\n<tr class=\"issuerow-bottom\">\n";
    foreach ($candidates as $candidate) {
        print "<td>" . DistanceToWord($candidate["issuedistances"][$issue["name"]]) . "</td>\n";
    }
    print "</tr>\n";
}