Beispiel #1
0
function person_voting_record($member, $extra_info) {
	?> <a name="votingrecord"></a> <?php
	//$this->block_start(array('id'=>'votingrecord', 'title'=>'Voting record (from PublicWhip)'));
	print '<h2>Voting record (from PublicWhip)</h2>';
	$displayed_stuff = 0;

	if ($member['party']=='Speaker' || $member['party']=='Deputy Speaker') {
		if ($member['party']=='Speaker') $art = 'the'; else $art = 'a';
		echo "<p>As $art $member[party], $member[full_name] cannot vote (except to break a tie).</p>";
	}

    # ID, display string, MP only
    $policies = array(
	    array(996, "a <strong>transparent Parliament</strong>"),
		array(811, "a <strong>smoking ban</strong>", true),
		array(1051, "introducing <strong>ID cards</strong>"),
		array(363, "introducing <strong>foundation hospitals</strong>"),
		array(1052, "university <strong>tuition fees</strong>"),
		array(1053, "Labour's <strong title='Including voting to maintain them'>anti-terrorism laws</strong>", true),
		array(1049, "the <strong>Iraq war</strong>"),
		array(984, "replacing <strong>Trident</strong>"),
		array(1050, "the <strong>hunting ban</strong>"),
		array(826, "equal <strong>gay rights</strong>"),
		array(1030, "laws to <strong>stop climate change</strong>"),
		array(1074, "greater <strong>autonomy for schools</strong>"),
		array(1071, "allowing ministers to <strong>intervene in inquests</strong>"),
		array(1079, "removing <strong>hereditary peers</strong> from the House of Lords"),
        array(1087, "a <strong>stricter asylum system</strong>"),
        array(1065, "more <strong>EU integration</strong>"),
        array(1110, "increasing the <strong>rate of VAT</strong>"),
        array(1084, "a more <a href='http://en.wikipedia.org/wiki/Proportional_representation'>proportional system</a> for electing MPs"),
        array(1124, "automatic enrolment in occupational pensions"),
        # Unfinished
		# array(856, "the <strong>changes to parliamentary scrutiny in the <a href=\"http://en.wikipedia.org/wiki/Legislative_and_Regulatory_Reform_Bill\">Legislative and Regulatory Reform Bill</a></strong>"),
		# array(1080, "government budgets and associated measures"),
		# array(1077, "equal extradition terms with the US"),
    );
    shuffle($policies);

    $joined = array(
        1079 => array(837, "a <strong>wholly elected</strong> House of Lords"),
        1049 => array(975, "an <strong>investigation</strong> into the Iraq war"),
        1052 => array(1132, 'raising England&rsquo;s undergraduate tuition fee cap to &pound;9,000 per year'),
        1124 => array(1109, "encouraging occupational pensions"),
    );

	$got_dream = '';
    foreach ($policies as $policy) {
        if (isset($policy[2]) && $policy[2] && !in_array(1, $member['houses']))
            continue;
	    $got_dream .= display_dream_comparison($extra_info, $member, $policy[0], $policy[1]);
        if (isset($joined[$policy[0]])) {
		    $policy = $joined[$policy[0]];
	        $got_dream .= display_dream_comparison($extra_info, $member, $policy[0], $policy[1]);
        }
    }

	if ($got_dream) {
		$displayed_stuff = 1;
        if (in_array(1, $member['houses']) && $member['entered_house'][1]['date'] > '2001-06-07') {
            $since = '';
        } else {
            $since = ' since 2001';
        }
?>

<p id="howvoted">How <?=$member['full_name']?> voted on key issues<?=$since?>:</p>
<ul id="dreamcomparisons">
<?=$got_dream ?>
</ul>
<p class="italic">
<small>Read about <a href="<?=WEBPATH ?>help/#votingrecord">how the voting record is decided</a>.</small>
</p>

<?
    }

	// Links to full record at Guardian and Public Whip	
	$record = array();
	if (isset($extra_info['guardian_howtheyvoted'])) {
		$record[] = '<a href="' . $extra_info['guardian_howtheyvoted'] . '" title="At The Guardian">well-known issues</a> <small>(from the Guardian)</small>';
	}
	if ((isset($extra_info['public_whip_division_attendance']) && $extra_info['public_whip_division_attendance'] != 'n/a')
      || (isset($extra_info['Lpublic_whip_division_attendance']) && $extra_info['Lpublic_whip_division_attendance'] != 'n/a')) {
		$record[] = '<a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' . $member['member_id'] . '&amp;showall=yes#divisions" title="At Public Whip">their full record</a>';
	}

	if (count($record) > 0) {
		$displayed_stuff = 1;
		?>
		<p>More on <?php echo implode(' &amp; ', $record); ?></p>
<?php
	}
        
	// Rebellion rate
	if (isset($extra_info['public_whip_rebellions']) && $extra_info['public_whip_rebellions'] != 'n/a') {	
		$displayed_stuff = 1;
?>					<ul>
						<li><a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/<?=$member['member_id'] ?>#divisions" title="See more details at Public Whip">
                        <strong><?php echo htmlentities(ucfirst($extra_info['public_whip_rebel_description'])); ?> rebels</strong></a> against their party<?php
		if (isset($extra_info['public_whip_rebelrank'])) {
			if ($member['house_disp'] == 2) {
				echo '';
			} elseif ($extra_info['public_whip_data_date'] == 'complete') {
				echo " in their last parliament";
			} else {
			    echo " in this parliament";
			}
			/* &#8212; ";
			if (isset($extra_info['public_whip_rebelrank_joint']))
				print 'joint ';
			echo make_ranking($extra_info['public_whip_rebelrank']);
			echo " most rebellious of ";
			echo $extra_info['public_whip_rebelrank_outof'];
			echo ($member['house']=='House of Commons') ? " MPs" : ' Lords';
			*/
		}
		?>.
		</li>
	</ul><?php
	}

	if (!$displayed_stuff) {
		print '<p>No data to display yet.</p>';
	}
}
Beispiel #2
0
        continue;
    }
    $output[$key] = $value;
}
$pw = '<ul>';
display_dream_comparison(996, "a <strong>transparent Parliament</strong>");
display_dream_comparison(811, "introducing a <strong>smoking ban</strong>");
display_dream_comparison(230, "introducing <strong>ID cards</strong>", true);
display_dream_comparison(363, "introducing <strong>foundation hospitals</strong>");
display_dream_comparison(367, "introducing <strong>student top-up fees</strong>", true);
display_dream_comparison(258, "Labour's <strong>anti-terrorism laws</strong>", true);
display_dream_comparison(219, "the <strong>Iraq war</strong>", true);
display_dream_comparison(975, "investigating the <strong>Iraq war</strong>");
display_dream_comparison(984, "replacing <strong>Trident</strong>");
display_dream_comparison(358, "the <strong>hunting ban</strong>", true);
display_dream_comparison(826, "equal <strong>gay rights</strong>");
function display_dream_comparison($id, $text, $inverse = false)
{
    global $pw, $output;
    if (!array_key_exists($id, $output)) {
        return;
    }
    $score = $output[$id];
    if ($score == -1) {
        $pw .= '<li>Has never voted on';
    } else {
        if ($inverse) {
            $score = 1 - $score;
        }
        $pw .= '<li>Voted <strong>' . score_to_strongly($score) . '</strong>';
    }
Beispiel #3
0
    function display_member($member, $extra_info)
    {
        global $THEUSER, $DATA, $this_page;
        # If current Senator show their name as "Senator John Smith". Current Representative show their name as "John Smith MP"
        $title = $member['current_member'][2] ? 'Senator ' : '';
        $title .= ucfirst($member['full_name']);
        # Show current titles first
        foreach ($member['houses'] as $house) {
            if ($member['current_member'][$house]) {
                $title .= ' ';
                if ($house == 1) {
                    $title .= 'MP';
                }
            }
        }
        # Show former membership
        foreach ($member['houses'] as $house) {
            if (!$member['current_member'][$house]) {
                $title .= ', former ';
                if ($house == 1) {
                    $title .= 'Representative';
                }
                if ($house == 2) {
                    $title .= 'Senator';
                }
            }
        }
        if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
            $title = '<a href="' . WEBPATH . $rssurl . '"><img src="' . WEBPATH . 'images/rss.gif" alt="RSS feed" border="0" align="right"></a> ' . $title;
        }
        print '<p class="printonly">This data was produced by OpenAustralia from a variety of sources.</p>';
        $this->block_start(array('id' => 'mp', 'title' => $title));
        list($image, $sz) = find_rep_image($member['person_id']);
        if ($image) {
            echo '<img class="portrait" alt="Photo of ', $member['full_name'], '" src="', $image, '"';
            if ($sz == 'S') {
                echo ' height="118"';
            }
            echo '>';
        } else {
            // Prompt for photo
            echo '<div class="textportrait"><br>We\'re missing a photo!<br><br><a href="mailto:contact@openaustralia.org">Email us one</a> <small>(that you have copyright of)</small><br><br></div>';
        }
        echo '<ul class="hilites">';
        $desc = '';
        foreach ($member['houses'] as $house) {
            $party = $member['left_house'][$house]['party'];
            $desc .= '<li><strong>';
            if (!$member['current_member'][$house]) {
                $desc .= 'Former ';
            }
            $desc .= htmlentities($party);
            if ($party == 'Speaker' || $party == 'Deputy-Speaker' || $party == 'President' || $party == 'Deputy-President') {
                $desc .= ', and ';
                # XXX: Will go horribly wrong if something odd happens
                $last = end($member['other_parties']);
                $desc .= $last['from'] . ' ';
            }
            $desc .= ' ';
            if ($house == 1) {
                $desc .= 'Representative';
            }
            if ($house == 2) {
                $desc .= 'Senator';
            }
            if ($house == 3) {
                $desc .= 'MLA';
            }
            if ($house == 4) {
                $desc .= 'MSP';
            }
            $desc .= ' for ' . $member['left_house'][$house]['constituency'];
            $desc .= '</strong></li>';
        }
        print $desc;
        if ($member['other_parties'] && $member['party'] != 'Speaker' && $member['party'] != 'Deputy-Speaker' && $member['party'] != 'President' && $member['party'] != 'Deputy-President') {
            print "<li>Changed party ";
            foreach ($member['other_parties'] as $r) {
                $out[] = 'from ' . $r['from'] . ' on ' . format_date($r['date'], SHORTDATEFORMAT);
            }
            print join('; ', $out);
            print '</li>';
        }
        // Ministerial position
        if (array_key_exists('office', $extra_info)) {
            $mins = array();
            foreach ($extra_info['office'] as $row) {
                if ($row['to_date'] == '9999-12-31' && $row['source'] != 'chgpages/selctee') {
                    $m = prettify_office($row['position'], $row['dept']);
                    $m .= ' (since ' . format_date($row['from_date'], SHORTDATEFORMAT) . ')';
                    $mins[] = $m;
                }
            }
            if ($mins) {
                print '<li>' . join('<br>', $mins) . '</li>';
            }
        }
        if (isset($member['left_house'][1]) && isset($member['entered_house'][2])) {
            print '<li><strong>Entered the Senate ';
            if (strlen($member['entered_house'][2]['date_pretty']) == 4) {
                print 'in ';
            } else {
                print 'on ';
            }
            print $member['entered_house'][2]['date_pretty'] . '</strong>';
            print '</strong>';
            if ($member['entered_house'][2]['reason']) {
                print ' &mdash; ' . $member['entered_house'][2]['reason'];
            }
            print '</li>';
            if (!$member['current_member'][1]) {
                print '<li><strong>Previously Representative for ';
                print $member['left_house'][1]['constituency'] . ' until ';
                print $member['left_house'][1]['date_pretty'] . '</strong>';
                if ($member['left_house'][1]['reason']) {
                    print ' &mdash; ' . $member['left_house'][1]['reason'];
                }
                print '</li>';
            }
        } elseif (isset($member['entered_house'][2]['date'])) {
            print '<li><strong>Became a Senator ';
            if (strlen($member['entered_house'][2]['date_pretty']) == 4) {
                print 'in ';
            } else {
                print 'on ';
            }
            print $member['entered_house'][2]['date_pretty'] . '</strong>';
            if ($member['entered_house'][2]['reason']) {
                print ' &mdash; ' . $member['entered_house'][2]['reason'];
            }
            print '</li>';
        } elseif (in_array(1, $member['houses']) && !$member['current_member'][1]) {
            print '<li><strong>Left House of Representatives on ' . $member['left_house'][1]['date_pretty'] . '</strong>';
            if ($member['left_house'][1]['reason']) {
                print ' &mdash; ' . $member['left_house'][1]['reason'];
            }
            print '</li>';
        }
        if (isset($member['entered_house'][1]['date'])) {
            print '<li><strong>Entered House of Representatives on ';
            print $member['entered_house'][1]['date_pretty'] . '</strong>';
            if ($member['entered_house'][1]['reason']) {
                print ' &mdash; ' . $member['entered_house'][1]['reason'];
            }
            print '</li>';
        }
        if (isset($extra_info['lordbio'])) {
            echo '<li><strong>Positions held:</strong> ', $extra_info['lordbio'], ' <small>(from <a href="', $extra_info['lordbio_from'], '">Number 10 press release</a>)</small></li>';
        }
        if (in_array(2, $member['houses']) && !$member['current_member'][2]) {
            print '<li><strong>Left Senate on ' . $member['left_house'][2]['date_pretty'] . '</strong>';
            if ($member['left_house'][2]['reason']) {
                print ' &mdash; ' . $member['left_house'][2]['reason'];
            }
            print '</li>';
        }
        if (isset($member['entered_house'][3]['date'])) {
            print '<li><strong>Entered the Assembly on ';
            print $member['entered_house'][3]['date_pretty'] . '</strong>';
            if ($member['entered_house'][3]['reason']) {
                print ' &mdash; ' . $member['entered_house'][3]['reason'];
            }
            print '</li>';
        }
        if (in_array(3, $member['houses']) && !$member['current_member'][3]) {
            print '<li><strong>Left the Assembly on ' . $member['left_house'][3]['date_pretty'] . '</strong>';
            if ($member['left_house'][3]['reason']) {
                print ' &mdash; ' . $member['left_house'][3]['reason'];
            }
            print '</li>';
        }
        if (isset($member['entered_house'][4]['date'])) {
            print '<li><strong>Entered the Scottish Parliament on ';
            print $member['entered_house'][4]['date_pretty'] . '</strong>';
            if ($member['entered_house'][4]['reason']) {
                print ' &mdash; ' . $member['entered_house'][4]['reason'];
            }
            print '</li>';
        }
        if (in_array(4, $member['houses']) && !$member['current_member'][4]) {
            print '<li><strong>Left the Scottish Parliament on ' . $member['left_house'][4]['date_pretty'] . '</strong>';
            if ($member['left_house'][4]['reason']) {
                print ' &mdash; ' . $member['left_house'][4]['reason'];
            }
            print '</li>';
        }
        if (isset($extra_info['majority_in_seat'])) {
            ?>
						<li><strong>Majority:</strong> 
						<?php 
            echo number_format($extra_info['majority_in_seat']);
            ?>
 votes. <?php 
            if (isset($extra_info['swing_to_lose_seat_today'])) {
                /*
                if (isset($extra_info['swing_to_lose_seat_today_quintile'])) {
                	$q = $extra_info['swing_to_lose_seat_today_quintile'];
                	if ($q == 0) {
                		print 'Very safe seat';
                	} elseif ($q == 1) {
                		print 'Safe seat';
                	} elseif ($q == 2) {
                		print '';
                	} elseif ($q == 3) {
                		print 'Unsafe seat';
                	} elseif ($q == 4) {
                		print 'Very unsafe seat';
                	} else {
                		print '[Impossible quintile!]';
                	}
                }
                */
                print ' &mdash; ' . make_ranking($extra_info['swing_to_lose_seat_today_rank']);
                ?>
 out of <?php 
                echo $extra_info['swing_to_lose_seat_today_rank_outof'];
                ?>
 MPs.
<?php 
            }
            ?>
</li>
<?php 
        }
        if ($member['party'] == 'Sinn Fein' && in_array(1, $member['houses'])) {
            print '<li>Sinn F&eacute;in MPs do not take their seats in Parliament</li>';
        }
        if ($member['the_users_mp'] == true) {
        } elseif ($member['current_member'][1]) {
        } elseif ($member['current_member'][3]) {
            ?>
						<li><a href="http://www.writetothem.com/"><strong>Send a message to your MLA</strong></a> <small>(via WriteToThem.com)</small></li>
<?php 
        } elseif ($member['current_member'][2]) {
        }
        # If they're currently an MLA, a Lord or a non-Sinn Fein MP
        if ($member['current_member'][0] || $member['current_member'][2] || $member['current_member'][3] || $member['current_member'][1] && $member['party'] != 'Sinn Fein') {
            if (!isset($_SERVER['DEVICE_TYPE']) || $_SERVER['DEVICE_TYPE'] != "mobile") {
                print '<li><a href="' . WEBPATH . 'alert/?only=1&amp;pid=' . $member['person_id'] . '"><strong>Email me whenever ' . $member['full_name'] . ' speaks</strong></a> (no more than once per day)</li>';
            }
        }
        ?>
						</ul>
						
						
						<ul class="jumpers">
<?php 
        if (defined('DISPLAY_VOTING_DATA') && DISPLAY_VOTING_DATA) {
            ?>
						<li><a href="#votingrecord">Voting record</a></li>
<?php 
        }
        ?>
						<li><a href="#numbers">Numbers</a></li>
<?php 
        if ($member['current_member'][1] || $member['current_member'][2]) {
            ?>
						<li><a href="#register">Register of Interests</a></li>
<?php 
        }
        if (isset($extra_info['expenses2004_col1']) || isset($extra_info['expenses2006_col1']) || isset($extra_info['expenses2007_col1'])) {
            ?>
 						<li><a href="#expenses">Expenses</a></li>
<?php 
        }
        if (isset($extra_info['edm_ais_url'])) {
            ?>
						<li><a href="<?php 
            echo $extra_info['edm_ais_url'];
            ?>
">Early Day Motions signed by this MP</a> <small>(From edm.ais.co.uk)</small></li>
<?php 
        }
        ?>
						</ul>
<?php 
        $this->block_end();
        if (defined('DISPLAY_VOTING_DATA') && DISPLAY_VOTING_DATA) {
            // Voting Record.
            ?>
 <a name="votingrecord"></a> <?php 
            $this->block_start(array('id' => 'votingrecord', 'title' => 'Voting record (from <a href="https://theyvoteforyou.org.au/">They Vote For You</a>)'));
            $displayed_stuff = 0;
            function display_dream_comparison($extra_info, $member, $dreamid, $desc, $inverse, $search)
            {
                if (isset($extra_info["public_whip_dreammp{$dreamid}_distance"])) {
                    if ($extra_info["public_whip_dreammp{$dreamid}_both_voted"] == 0) {
                        $dmpdesc = 'Has <strong>never voted</strong> on';
                    } else {
                        $dmpscore = floatval($extra_info["public_whip_dreammp{$dreamid}_distance"]);
                        print "<!-- distance {$dreamid}: {$dmpscore} -->";
                        if ($inverse) {
                            $dmpscore = 1.0 - $dmpscore;
                        }
                        $dmpdesc = 'Voted <strong>' . score_to_strongly($dmpscore) . '</strong>';
                        // How many votes Dream MP and MP both voted (and didn't abstain) in
                        // $extra_info["public_whip_dreammp${dreamid}_both_voted"];
                    }
                    $search_link = WEBPATH . "search/?s=" . urlencode($search) . "&pid=" . $member['person_id'] . "&pop=1";
                    ?>
					<li>
					<?php 
                    echo $dmpdesc;
                    ?>
				<?php 
                    echo $desc;
                    ?>
.
	<small class="unneededprintlinks">
	<a href="<?php 
                    echo PUBLICWHIP_HOST;
                    ?>
/mp.php?mpid=<?php 
                    echo $member['member_id'];
                    ?>
&amp;dmp=<?php 
                    echo $dreamid;
                    ?>
">votes</a>
	</small>

					</li>
	<?php 
                    return true;
                }
                return false;
            }
            ?>

		<p id="howvoted">How <?php 
            echo $member['full_name'];
            ?>
 voted on key issues since 2006:</p>
		<ul id="dreamcomparisons">
		<?php 
            $got_dream = false;
            $got_dream |= display_dream_comparison($extra_info, $member, 1, "same sex marriage", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 2, "tobacco plain packaging", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 3, "a carbon price", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 4, "increasing scrutiny of asylum seeker management", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 5, "government administered paid parental leave", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 6, "increasing trade unions' powers in the workplace", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 7, "the Carbon Pollution Reduction Scheme", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 8, "implementing refugee and protection conventions", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 9, "increasing competition in bulk wheat export", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 10, "recognising local government in the Constitution", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 11, "temporary protection visas", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 12, "voluntary student union fees", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 13, "increasing or removing the debt limit", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 14, "a minerals resource rent tax ", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 15, "increasing protection of Australia's fresh water", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 16, "regional processing of asylum seekers", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 17, "increasing marine conservation", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 18, "unconventional gas mining", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 19, "restricting foreign ownership", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 20, "increasing investment in renewable energy", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 21, "privatising government assets", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 22, "stem cell research", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 23, "more scrutiny of intelligence services & police", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 24, "increasing Aboriginal land rights", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 25, "increasing funding for university education", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 26, "decreasing the private health insurance rebate", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 27, "increasing the price of subsidised medicine", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 28, "increasing the age pension", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 29, "extending government benefits to same-sex couples", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 30, "increasing protection of Aboriginal heritage sites", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 31, "increasing availability of abortion drugs", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 32, "live animal exports", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 33, "carbon farming", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 34, "decreasing availability of welfare payments", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 35, "re-approving/ re-registering agvet chemicals", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 36, "the Intervention in the Northern Territory", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 37, "an emissions reduction fund", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 38, "increasing funding for road infrastructure", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 39, "increasing restrictions on gambling", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 40, "increasing beef import standards", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 41, "increasing fishing restrictions", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 42, "encouraging Australian-based industry", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 43, "uranium export", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 44, "increasing surveillance powers", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 45, "increasing consumer protections", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 46, "increasing public access to government data", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 47, "an NBN (using fibre to the premises)", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 50, "a federal inquiry into Queensland government administration", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 51, "offshore processing of asylum seekers", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 53, "increasing freedom of political communication", false, "");
            $got_dream |= display_dream_comparison($extra_info, $member, 56, "decreasing ABC and SBS funding", false, "");
            if (!$got_dream) {
                print "<li>" . $member['full_name'] . " has not voted enough in this parliament to have any scores.</li>";
            }
            print '</ul>';
            ?>
	<p class="italic">
	<small>Read about <a href="<?php 
            echo WEBPATH;
            ?>
help/#votingrecord">how the voting record is decided</a>.</small>
	</p>

	<?php 
            // Links to full record at Guardian and Public Whip
            $record = array();
            if (isset($extra_info['guardian_howtheyvoted'])) {
                $record[] = '<a href="' . $extra_info['guardian_howtheyvoted'] . '" title="At The Guardian">well-known issues</a> <small>(from the Guardian)</small>';
            }
            if (isset($extra_info['public_whip_division_attendance']) && $extra_info['public_whip_division_attendance'] != 'n/a') {
                $record[] = '<a href="' . PUBLICWHIP_HOST . '/mp.php?id=uk.org.publicwhip/member/' . $member['member_id'] . '" title="At They Vote For You">their full record</a>';
            }
            if (count($record) > 0) {
                $displayed_stuff = 1;
                ?>
				<p>More on <?php 
                echo implode(' &amp; ', $record);
                ?>
</p>
	<?php 
            }
            // Rebellion rate
            if (isset($extra_info['public_whip_rebellions']) && $extra_info['public_whip_rebellions'] != 'n/a') {
                $displayed_stuff = 1;
                ?>
					<ul>
								<li><a href="<?php 
                echo PUBLICWHIP_HOST;
                ?>
/mp.php?id=uk.org.publicwhip/member/<?php 
                echo $member['member_id'];
                ?>
#divisions" title="See more details at Public Whip">
	                        <strong><?php 
                echo htmlentities(ucfirst($extra_info['public_whip_rebel_description']));
                ?>
 rebels</strong></a> against their party<?php 
                if (isset($extra_info['public_whip_rebelrank'])) {
                    echo " in this parliament";
                    /* &#8212; ";
                    			if (isset($extra_info['public_whip_rebelrank_joint']))
                    				print 'joint ';
                    			echo make_ranking($extra_info['public_whip_rebelrank']);
                    			echo " most rebellious of ";
                    			echo $extra_info['public_whip_rebelrank_outof'];
                    			echo ($member['house']=='House of Commons') ? " MPs" : ' Lords';
                    			*/
                }
                ?>
.
				</li>
			</ul><?php 
            }
            if (!$displayed_stuff) {
                print '<p>No data to display yet.</p>';
            }
            $this->block_end();
        }
        // End DISPLAY_VOTING_DATA feature flag
        // Topics of interest only for MPs at the moment
        // if (in_array(1, $member['houses'])) {
        // Disable topics of interest
        if (0) {
            ?>
	<a name="topics"></a>
		<?php 
            $this->block_start(array('id' => 'topics', 'title' => 'Committees and topics of interest'));
            $topics_block_empty = true;
            // Select committee membership
            if (array_key_exists('office', $extra_info)) {
                $mins = array();
                foreach ($extra_info['office'] as $row) {
                    if ($row['to_date'] == '9999-12-31' && $row['source'] == 'chgpages/selctee') {
                        $m = prettify_office($row['position'], $row['dept']);
                        if ($row['from_date'] != '2004-05-28') {
                            $m .= ' <small>(since ' . format_date($row['from_date'], SHORTDATEFORMAT) . ')</small>';
                        }
                        $mins[] = $m;
                    }
                }
                if ($mins) {
                    print "<h5>Select Committee membership</h5>";
                    print "<ul>";
                    foreach ($mins as $min) {
                        print '<li>' . $min . '</li>';
                    }
                    print "</ul>";
                    $topics_block_empty = false;
                }
            }
            $wrans_dept = false;
            $wrans_dept_1 = null;
            $wrans_dept_2 = null;
            if (isset($extra_info['wrans_departments'])) {
                $wrans_dept = true;
                $wrans_dept_1 = "<li><strong>Departments:</strong> " . $extra_info['wrans_departments'] . "</p>";
            }
            if (isset($extra_info['wrans_subjects'])) {
                $wrans_dept = true;
                $wrans_dept_2 = "<li><strong>Subjects (based on headings added by Hansard):</strong> " . $extra_info['wrans_subjects'] . "</p>";
            }
            if ($wrans_dept) {
                print "<p><strong>Asks most questions about</strong></p>";
                print "<ul>";
                if ($wrans_dept_1) {
                    print $wrans_dept_1;
                }
                if ($wrans_dept_2) {
                    print $wrans_dept_2;
                }
                print "</ul>";
                $topics_block_empty = false;
                $WRANSURL = new URL('search');
                $WRANSURL->insert(array('pid' => $member['person_id'], 's' => 'section:wrans', 'pop' => 1));
                ?>
							<p><small>(based on <a href="<?php 
                echo $WRANSURL->generate();
                ?>
">written questions asked by <?php 
                echo $member['full_name'];
                ?>
</a> and answered by departments)</small></p><?php 
            }
            # Public Bill Committees
            if (count($extra_info['pbc'])) {
                $topics_block_empty = false;
                print '<h5>Public Bill Committees <small>(sittings attended)</small></h5> <ul>';
                foreach ($extra_info['pbc'] as $bill_id => $arr) {
                    print '<li>';
                    if ($arr['chairman']) {
                        print 'Chairman, ';
                    }
                    print '<a href="/pbc/' . $arr['session'] . '/' . urlencode($arr['title']) . '">' . $arr['title'] . ' Committee</a> <small>(' . $arr['attending'] . ' out of ' . $arr['outof'] . ')</small>';
                }
                print '</ul>';
            }
            if ($topics_block_empty) {
                print "<p><em>This MP is not currently on any select <!-- or public bill --> committee\nand has had no written questions answered for which we know the department or subject.</em></p>";
            }
            $this->block_end();
        }
        if (!in_array(1, $member['houses']) || $member['party'] != 'Sinn Fein') {
            ?>
		<a name="hansard"></a> <?php 
            $title = 'Most recent appearances in parliament';
            if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
                $title = '<a href="' . WEBPATH . $rssurl . '"><img src="' . WEBPATH . 'images/rss.gif" alt="RSS feed" border="0" align="right"></a> ' . $title;
            }
            $this->block_start(array('id' => 'hansard', 'title' => $title));
            // This is really far from ideal - I don't really want $PAGE to know
            // anything about HANSARDLIST / DEBATELIST / WRANSLIST.
            // But doing this any other way is going to be a lot more work for little
            // benefit unfortunately.
            twfy_debug_timestamp();
            $HANSARDLIST = new HANSARDLIST();
            $searchstring = "speaker:{$member['person_id']}";
            global $SEARCHENGINE;
            $SEARCHENGINE = new SEARCHENGINE($searchstring);
            $args = array('s' => $searchstring, 'p' => 1, 'num' => 3, 'pop' => 1, 'o' => 'd');
            $HANSARDLIST->display('search_min', $args);
            twfy_debug_timestamp();
            $MOREURL = new URL('search');
            $MOREURL->insert(array('pid' => $member['person_id'], 'pop' => 1));
            ?>
	<p id="moreappear"><a href="<?php 
            echo $MOREURL->generate();
            ?>
#n4">More of <?php 
            echo ucfirst($member['full_name']);
            ?>
's recent appearances</a></p>

<?php 
            if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
                // If we set an RSS feed for this page.
                $HELPURL = new URL('help');
                ?>
					<p class="unneededprintlinks"><a href="<?php 
                echo WEBPATH . $rssurl;
                ?>
" title="XML version of this person's recent appearances">RSS feed</a> (<a href="<?php 
                echo $HELPURL->generate();
                ?>
#rss" title="An explanation of what RSS feeds are for">?</a>)</p>
<?php 
            }
            $this->block_end();
        }
        # End Sinn Fein
        ?>
 <a name="numbers"></a> <?php 
        $this->block_start(array('id' => 'numbers', 'title' => 'Numbers'));
        $displayed_stuff = 0;
        ?>
		<p><em>Please note that numbers do not measure quality. 
		Also, <?php 
        if ($member['house_disp'] == 1) {
            echo "Representatives";
        } else {
            echo "Senators";
        }
        ?>
 may do other things not currently covered
		by this site.</em> (<a href="<?php 
        echo WEBPATH;
        ?>
help/#numbers">More about this</a>)</p>
<ul>
<?php 
        $since_text = 'in the last year';
        #if ($member['entered_house'] > '2005-05-05')
        #	$since_text = 'since joining Parliament';
        $MOREURL = new URL('search');
        $MOREURL->insert(array('pid' => $member['person_id'], 'pop' => 1));
        if ($member['party'] != 'Sinn Fein') {
            $displayed_stuff |= display_stats_line('debate_sectionsspoken_inlastyear', 'Has spoken in <a href="' . $MOREURL->generate() . '">', 'debate', '</a> ' . $since_text, '', $extra_info);
            $MOREURL->insert(array('pid' => $member['person_id'], 's' => 'section:wrans', 'pop' => 1));
            // We assume that if they've answered a question, they're a minister
            $minister = false;
            $Lminister = false;
            if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) {
                $minister = true;
            }
            if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) {
                $Lminister = true;
            }
            #		$displayed_stuff |= display_stats_line('wrans_asked_inlastyear', 'Has received answers to <a href="' . $MOREURL->generate() . '">', 'written question', '</a> ' . $since_text, '', $extra_info, $minister, $Lminister);
        }
        if (isset($extra_info['select_committees'])) {
            print "<li>Is a member of <strong>{$extra_info['select_committees']}</strong> select committee";
            if ($extra_info['select_committees'] > 1) {
                print "s";
            }
            if (isset($extra_info['select_committees_chair'])) {
                print " ({$extra_info['select_committees_chair']} as chair)";
            }
            print '.</li>';
        }
        #		$wtt_displayed = display_writetothem_numbers(2006, $extra_info);
        #		$displayed_stuff |= $wtt_displayed;
        #		if (!$wtt_displayed)
        # 			$displayed_stuff |= display_writetothem_numbers(2005, $extra_info);
        $after_stuff = ' <small>(From Public Whip)</small>';
        if ($member['party'] == 'Scottish National Party') {
            $after_stuff .= '<br><em>Note SNP MPs do not vote on legislation not affecting Scotland.</em>';
        }
        if ($member['party'] != 'Sinn Fein') {
            #			$displayed_stuff |= display_stats_line('public_whip_division_attendance', 'Has voted in <a href=" . PUBLICWHIP_HOST . "/mp.php?id=uk.org.publicwhip/member/' . $member['member_id'] . '&amp;showall=yes#divisions" title="See more details at Public Whip">', 'of vote', '</a> in parliament', $after_stuff, $extra_info);
            $displayed_stuff |= display_stats_line('comments_on_speeches', 'People have made <a href="' . WEBPATH . 'comments/recent/?pid=' . $member['person_id'] . '">', 'comment', "</a> on this Representative's speeches", '', $extra_info);
            $displayed_stuff |= display_stats_line('reading_age', 'This Representative\'s speeches are understandable to an average ', '', ' year old, going by the <a href="http://en.wikipedia.org/wiki/Flesch-Kincaid_Readability_Test">Flesch-Kincaid Grade Level</a> score', '', $extra_info);
        }
        if (isset($extra_info['number_of_alerts'])) {
            $displayed_stuff = 1;
            ?>
		<li><strong><?php 
            echo htmlentities($extra_info['number_of_alerts']);
            ?>
</strong> <?php 
            echo $extra_info['number_of_alerts'] == 1 ? 'person is' : 'people are';
            ?>
 tracking whenever <?php 
            if ($member['house_disp'] == 1) {
                print 'this Representative';
            } elseif ($member['house_disp'] == 2) {
                print 'this Senator';
            } elseif ($member['house_disp'] == 3) {
                print 'this MLA';
            } elseif ($member['house_disp'] == 4) {
                print 'this MSP';
            } elseif ($member['house_disp'] == 0) {
                print $member['full_name'];
            }
            ?>
 speaks<?php 
            if ($member['current_member'][0] || $member['current_member'][2] || $member['current_member'][3] || $member['current_member'][1] && $member['party'] != 'Sinn Fein') {
                if (!isset($_SERVER['DEVICE_TYPE']) || $_SERVER['DEVICE_TYPE'] != "mobile") {
                    print ' &mdash; <a href="' . WEBPATH . 'alert/?only=1&amp;pid=' . $member['person_id'] . '">email me whenever ' . $member['full_name'] . ' speaks</a>';
                }
            }
            print '.</li>';
        }
        if ($member['party'] != 'Sinn Fein') {
            $displayed_stuff |= display_stats_line('three_word_alliterations', 'Has used three-word alliterative phrases (e.g. "she sells seashells") ', 'time', ' in debates', ' <small>(<a href="' . WEBPATH . 'help/#numbers">Why is this here?</a>)</small>', $extra_info);
            if (isset($extra_info['three_word_alliteration_content'])) {
                print "\n<!-- " . $extra_info['three_word_alliteration_content'] . " -->\n";
            }
        }
        #		$displayed_stuff |= display_stats_line('ending_with_a_preposition', "Has ended a sentence with 'with' ", 'time', ' in debates', '', $extra_info);
        #		$displayed_stuff |= display_stats_line('only_asked_why', "Has made a speech consisting solely of 'Why?' ", 'time', ' in debates', '', $extra_info);
        ?>
						</ul>
<?php 
        if (!$displayed_stuff) {
            print '<p>No data to display yet.</p>';
        }
        $this->block_end();
        if ($member['current_member'][1] || $member['current_member'][2]) {
            ?>
				
<a name="register"></a>
<?php 
            $this->block_start(array('id' => 'register', 'title' => 'Register of Interests <small>(<a href="' . WEBPATH . 'help/#regmem">What\'s this?</a>)</small>'));
            $regpath = REGMEMPDFPATH . 'register_interests_' . $member['person_id'] . '.pdf';
            if (isset($extra_info['aph_interests_url'])) {
                echo '<p><a href="' . $extra_info['aph_interests_url'] . '">' . $member['full_name'] . '\'s latest interest statement from Australian Parliament House<img alt="PDF" src="/images/pdficon_small.gif"></a>';
                if (isset($extra_info['aph_interests_last_updated'])) {
                    echo '<small>Last updated: ';
                    echo format_date($extra_info['aph_interests_last_updated'], SHORTDATEFORMAT);
                    echo '</small>';
                }
                echo '</p>';
            }
            if (is_file(BASEDIR . $regpath)) {
                echo '<p><a href="' . WEBPATH . $regpath . '">Our last scan of ' . $member['full_name'] . '\'s interest statement</a><img alt="PDF" src="/images/pdficon_small.gif"><small>(<a href="' . WEBPATH . 'help/#regmem-links">Possibly outdated</a>)</small></p>';
            }
            if (!isset($extra_info['aph_interests_url']) && !is_file(BASEDIR . $regpath)) {
                echo 'Scan of ' . $member['full_name'] . '\'s entry is not yet available';
            }
            if (isset($extra_info['register_member_interests_date'])) {
                echo '<p class="italic">';
                echo 'Register last updated: ';
                echo format_date($extra_info['register_member_interests_date'], SHORTDATEFORMAT);
                echo '. ';
                echo '</p>';
            }
            //print '<p><strong><a href="' . WEBPATH . 'regmem/?p='.$member['person_id'].'">View the history of this MP\'s entries in the Register</a></strong></p>';
            $this->block_end();
        }
        if (isset($extra_info['expenses2004_col1']) || isset($extra_info['expenses2006_col1']) || isset($extra_info['expenses2007_col1'])) {
            ?>
<a name="expenses"></a>
<?php 
            $title = 'Expenses';
            $this->block_start(array('id' => 'expenses', 'title' => $title));
            print '<p class="italic">Figures in brackets are ranks. Parliament\'s <a href="http://www.parliament.uk/site_information/allowances.cfm">explanatory notes</a>.</p>';
            print '<table class="people"><tr><th>Type</th><th>2006/07';
            if (isset($extra_info['expenses2007_col1_rank_outof'])) {
                print ' (ranking out of ' . $extra_info['expenses2007_col1_rank_outof'] . ')';
            }
            print '</th><th>2005/06';
            if (isset($extra_info['expenses2006_col1_rank_outof'])) {
                # TODO: Needs to be more complicated, because of General Election
                print ' (ranking out of ' . $extra_info['expenses2006_col1_rank_outof'] . ')';
            }
            print '</th><th>2004/05';
            if (isset($extra_info['expenses2005_col1_rank_outof'])) {
                print ' (ranking out of ' . $extra_info['expenses2005_col1_rank_outof'] . ')';
            }
            print '</th><th>2003/04';
            if (isset($extra_info['expenses2004_col1_rank_outof'])) {
                print ' (ranking out of&nbsp;' . $extra_info['expenses2004_col1_rank_outof'] . ')';
            }
            print '</th><th>2002/03';
            if (isset($extra_info['expenses2003_col1_rank_outof'])) {
                print ' (ranking out of&nbsp;' . $extra_info['expenses2003_col1_rank_outof'] . ')';
            }
            print '</th><th>2001/02';
            if (isset($extra_info['expenses2002_col1_rank_outof'])) {
                print ' (ranking out of&nbsp;' . $extra_info['expenses2002_col1_rank_outof'] . ')';
            }
            print '</th></tr>';
            print '<tr><td class="row-1">Additional Costs Allowance</td>';
            $this->expenses_printout('col1', $extra_info, 1);
            print '</tr><tr><td class="row-2">London Supplement</td>';
            $this->expenses_printout('col2', $extra_info, 2);
            print '</tr><tr><td class="row-1">Incidental Expenses Provision</td>';
            $this->expenses_printout('col3', $extra_info, 1);
            print '</tr><tr><td class="row-2">Staffing Allowance</td>';
            $this->expenses_printout('col4', $extra_info, 2);
            print '</tr><tr><td class="row-1">Members\' Travel</td>';
            $this->expenses_printout('col5', $extra_info, 1);
            print '</tr><tr><td class="row-2">Members\' Staff Travel</td>';
            $this->expenses_printout('col6', $extra_info, 2);
            print '</tr><tr><td class="row-1">Centrally Purchased Stationery</td>';
            $this->expenses_printout('col7', $extra_info, 1);
            print '</tr><tr><td class="row-2">Stationery: Associated Postage Costs</td>';
            $this->expenses_printout('col7a', $extra_info, 2);
            print '</tr><tr><td class="row-1">Centrally Provided Computer Equipment</td>';
            $this->expenses_printout('col8', $extra_info, 1);
            print '</tr><tr><td class="row-2">Other Costs</td>';
            $this->expenses_printout('col9', $extra_info, 2);
            print '</tr><tr><th style="text-align: right">Total</th>';
            $this->expenses_printout('total', $extra_info, 1);
            print '</tr></table>';
            if (isset($extra_info['expenses2007_col5a'])) {
                print '<p><a name="travel2007"></a><sup>*</sup> <small>';
                foreach (array('a' => 'Car', 'b' => '3rd party', 'c' => 'Rail', 'd' => 'Air', 'e' => 'Other', 'f' => 'European') as $let => $desc) {
                    if ($extra_info['expenses2007_col5' . $let] > 0) {
                        print $desc . ' &pound;' . number_format(str_replace(',', '', $extra_info['expenses2007_col5' . $let]));
                        if (isset($extra_info['expenses2007_col5' . $let . '_rank'])) {
                            print ' (' . make_ranking($extra_info['expenses2007_col5' . $let . '_rank']) . ')';
                        }
                        print '. ';
                    }
                }
                print '</small></p>';
            }
            $this->block_end();
        }
    }
Beispiel #4
0
    function display_member($member, $extra_info)
    {
        global $THEUSER, $DATA, $this_page;
        # If current Senator show their name as "Senator John Smith". Current Representative show their name as "John Smith MP"
        $title = $member['current_member'][2] ? 'Senator ' : '';
        $title .= ucfirst($member['full_name']);
        # Show current titles first
        foreach ($member['houses'] as $house) {
            if ($member['current_member'][$house]) {
                $title .= ' ';
                if ($house == 1) {
                    $title .= 'MP';
                }
            }
        }
        # Show former membership
        foreach ($member['houses'] as $house) {
            if (!$member['current_member'][$house]) {
                $title .= ', former ';
                if ($house == 1) {
                    $title .= 'Representative';
                }
                if ($house == 2) {
                    $title .= 'Senator';
                }
            }
        }
        /*		if (isset($extra_info["public_whip_dreammp996_distance"])) {
        			$dmpscore = floatval($extra_info["public_whip_dreammp996_distance"]);
        			$strongly_foi = "voted " . score_to_strongly(1.0 - $dmpscore);
        		}
        		if ($extra_info["public_whip_dreammp996_both_voted"] == 0) {
        			$strongly_foi = "has never voted on";
        		}
        		$this->block_start(array('id'=>'black', 'title'=>"Freedom of Information and Parliament"));
        		print "<p>There is currently a Bill before Parliament which will make Parliament
        			exempt from Freedom of Information requests. This Bill will remove
        			your legal right to see some of the information on this page, notably
        			expenses, replacing it with a weaker promise that could be retracted
        			later.</p>
        
        			<p>Even if this bill is amended to exclude expenses, exemption from the
        			Freedom of Information Act may prevent OpenAustralia from adding
        			useful information of new sorts in the future. The Bill is not backed
        			or opposed by a specific party, and OpenAustralia remains strictly
        			neutral on all issues that do not affect our ability to serve the
        			public.</p>
        
        			<p><a href=\"somewhere\">Join the Campaign to keep Parliament transparent
        			(external)</a>.</p>";
        
        		print 'For your information, '.$title.' MP <a href="http://www.publicwhip.org.uk/mp.php?mpid='.$member['member_id'].'&amp;dmp=996">'.$strongly_foi.'</a> this Bill.';
        		$this->block_end();
        */
        if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
            $title = '<a href="' . WEBPATH . $rssurl . '"><img src="' . WEBPATH . 'images/rss.gif" alt="RSS feed" border="0" align="right"></a> ' . $title;
        }
        print '<p class="printonly">This data was produced by OpenAustralia from a variety of sources.</p>';
        $this->block_start(array('id' => 'mp', 'title' => $title));
        list($image, $sz) = find_rep_image($member['person_id']);
        if ($image) {
            echo '<img class="portrait" alt="Photo of ', $member['full_name'], '" src="', $image, '"';
            if ($sz == 'S') {
                echo ' height="118"';
            }
            echo '>';
        } else {
            // Prompt for photo
            echo '<div class="textportrait"><br>We\'re missing a photo!<br><br><a href="mailto:contact@openaustralia.org">Email us one</a> <small>(that you have copyright of)</small><br><br></div>';
        }
        echo '<ul class="hilites">';
        $desc = '';
        foreach ($member['houses'] as $house) {
            $party = $member['left_house'][$house]['party'];
            $desc .= '<li><strong>';
            if (!$member['current_member'][$house]) {
                $desc .= 'Former ';
            }
            $desc .= htmlentities($party);
            if ($party == 'Speaker' || $party == 'Deputy-Speaker' || $party == 'President' || $party == 'Deputy-President') {
                $desc .= ', and ';
                # XXX: Will go horribly wrong if something odd happens
                if ($party == 'Deputy-Speaker') {
                    $last = end($member['other_parties']);
                    $desc .= $last['from'] . ' ';
                }
            }
            $desc .= ' ';
            if ($house == 1) {
                $desc .= 'Representative';
            }
            if ($house == 2) {
                $desc .= 'Senator';
            }
            if ($house == 3) {
                $desc .= 'MLA';
            }
            if ($house == 4) {
                $desc .= 'MSP';
            }
            $desc .= ' for ' . $member['left_house'][$house]['constituency'];
            $desc .= '</strong></li>';
        }
        print $desc;
        if ($member['other_parties'] && $member['party'] != 'Speaker' && $member['party'] != 'Deputy-Speaker' && $member['party'] != 'President' && $member['party'] != 'Deputy-President') {
            print "<li>Changed party ";
            foreach ($member['other_parties'] as $r) {
                $out[] = 'from ' . $r['from'] . ' on ' . format_date($r['date'], SHORTDATEFORMAT);
            }
            print join('; ', $out);
            print '</li>';
        }
        // Ministerial position
        if (array_key_exists('office', $extra_info)) {
            $mins = array();
            foreach ($extra_info['office'] as $row) {
                if ($row['to_date'] == '9999-12-31' && $row['source'] != 'chgpages/selctee') {
                    $m = prettify_office($row['position'], $row['dept']);
                    $m .= ' (since ' . format_date($row['from_date'], SHORTDATEFORMAT) . ')';
                    $mins[] = $m;
                }
            }
            if ($mins) {
                print '<li>' . join('<br>', $mins) . '</li>';
            }
        }
        if (isset($member['left_house'][1]) && isset($member['entered_house'][2])) {
            print '<li><strong>Entered the Senate ';
            if (strlen($member['entered_house'][2]['date_pretty']) == 4) {
                print 'in ';
            } else {
                print 'on ';
            }
            print $member['entered_house'][2]['date_pretty'] . '</strong>';
            print '</strong>';
            if ($member['entered_house'][2]['reason']) {
                print ' &mdash; ' . $member['entered_house'][2]['reason'];
            }
            print '</li>';
            if (!$member['current_member'][1]) {
                print '<li><strong>Previously Representative for ';
                print $member['left_house'][1]['constituency'] . ' until ';
                print $member['left_house'][1]['date_pretty'] . '</strong>';
                if ($member['left_house'][1]['reason']) {
                    print ' &mdash; ' . $member['left_house'][1]['reason'];
                }
                print '</li>';
            }
        } elseif (isset($member['entered_house'][2]['date'])) {
            print '<li><strong>Became a Senator ';
            if (strlen($member['entered_house'][2]['date_pretty']) == 4) {
                print 'in ';
            } else {
                print 'on ';
            }
            print $member['entered_house'][2]['date_pretty'] . '</strong>';
            if ($member['entered_house'][2]['reason']) {
                print ' &mdash; ' . $member['entered_house'][2]['reason'];
            }
            print '</li>';
        } elseif (in_array(1, $member['houses']) && !$member['current_member'][1]) {
            print '<li><strong>Left House of Representatives on ' . $member['left_house'][1]['date_pretty'] . '</strong>';
            if ($member['left_house'][1]['reason']) {
                print ' &mdash; ' . $member['left_house'][1]['reason'];
            }
            print '</li>';
        }
        if (isset($member['entered_house'][1]['date'])) {
            print '<li><strong>Entered House of Representatives on ';
            print $member['entered_house'][1]['date_pretty'] . '</strong>';
            if ($member['entered_house'][1]['reason']) {
                print ' &mdash; ' . $member['entered_house'][1]['reason'];
            }
            print '</li>';
        }
        if (isset($extra_info['lordbio'])) {
            echo '<li><strong>Positions held:</strong> ', $extra_info['lordbio'], ' <small>(from <a href="', $extra_info['lordbio_from'], '">Number 10 press release</a>)</small></li>';
        }
        if (in_array(2, $member['houses']) && !$member['current_member'][2]) {
            print '<li><strong>Left Senate on ' . $member['left_house'][2]['date_pretty'] . '</strong>';
            if ($member['left_house'][2]['reason']) {
                print ' &mdash; ' . $member['left_house'][2]['reason'];
            }
            print '</li>';
        }
        if (isset($member['entered_house'][3]['date'])) {
            print '<li><strong>Entered the Assembly on ';
            print $member['entered_house'][3]['date_pretty'] . '</strong>';
            if ($member['entered_house'][3]['reason']) {
                print ' &mdash; ' . $member['entered_house'][3]['reason'];
            }
            print '</li>';
        }
        if (in_array(3, $member['houses']) && !$member['current_member'][3]) {
            print '<li><strong>Left the Assembly on ' . $member['left_house'][3]['date_pretty'] . '</strong>';
            if ($member['left_house'][3]['reason']) {
                print ' &mdash; ' . $member['left_house'][3]['reason'];
            }
            print '</li>';
        }
        if (isset($member['entered_house'][4]['date'])) {
            print '<li><strong>Entered the Scottish Parliament on ';
            print $member['entered_house'][4]['date_pretty'] . '</strong>';
            if ($member['entered_house'][4]['reason']) {
                print ' &mdash; ' . $member['entered_house'][4]['reason'];
            }
            print '</li>';
        }
        if (in_array(4, $member['houses']) && !$member['current_member'][4]) {
            print '<li><strong>Left the Scottish Parliament on ' . $member['left_house'][4]['date_pretty'] . '</strong>';
            if ($member['left_house'][4]['reason']) {
                print ' &mdash; ' . $member['left_house'][4]['reason'];
            }
            print '</li>';
        }
        if (isset($extra_info['majority_in_seat'])) {
            ?>
						<li><strong>Majority:</strong> 
						<?php 
            echo number_format($extra_info['majority_in_seat']);
            ?>
 votes. <?php 
            if (isset($extra_info['swing_to_lose_seat_today'])) {
                /*
                if (isset($extra_info['swing_to_lose_seat_today_quintile'])) {
                	$q = $extra_info['swing_to_lose_seat_today_quintile'];
                	if ($q == 0) {
                		print 'Very safe seat';
                	} elseif ($q == 1) {
                		print 'Safe seat';
                	} elseif ($q == 2) {
                		print '';
                	} elseif ($q == 3) {
                		print 'Unsafe seat';
                	} elseif ($q == 4) {
                		print 'Very unsafe seat';
                	} else {
                		print '[Impossible quintile!]';
                	}
                }
                */
                print ' &mdash; ' . make_ranking($extra_info['swing_to_lose_seat_today_rank']);
                ?>
 out of <?php 
                echo $extra_info['swing_to_lose_seat_today_rank_outof'];
                ?>
 MPs.
<?php 
            }
            ?>
</li>
<?php 
        }
        if ($member['party'] == 'Sinn Fein' && in_array(1, $member['houses'])) {
            print '<li>Sinn F&eacute;in MPs do not take their seats in Parliament</li>';
        }
        if ($member['the_users_mp'] == true) {
        } elseif ($member['current_member'][1]) {
        } elseif ($member['current_member'][3]) {
            ?>
						<li><a href="http://www.writetothem.com/"><strong>Send a message to your MLA</strong></a> <small>(via WriteToThem.com)</small></li>
<?php 
        } elseif ($member['current_member'][2]) {
        }
        # If they're currently an MLA, a Lord or a non-Sinn Fein MP
        if ($member['current_member'][0] || $member['current_member'][2] || $member['current_member'][3] || $member['current_member'][1] && $member['party'] != 'Sinn Fein') {
            print '<li><a href="' . WEBPATH . 'alert/?only=1&amp;pid=' . $member['person_id'] . '"><strong>Email me whenever ' . $member['full_name'] . ' speaks</strong></a> (no more than once per day)</li>';
        }
        ?>
						</ul>
						
						
						<ul class="jumpers">
<?php 
        if (!in_array(1, $member['houses']) || $member['party'] == 'Sinn Fein') {
            ?>
						<li><a href="#hansard">Recent appearances</a></li>
<?php 
        }
        ?>
						<li><a href="#numbers">Numbers</a></li>
<?php 
        if (isset($extra_info['register_member_interests_html'])) {
            ?>
						<li><a href="#register">Register of Members' Interests</a></li>
<?php 
        }
        if (isset($extra_info['expenses2004_col1']) || isset($extra_info['expenses2006_col1']) || isset($extra_info['expenses2007_col1'])) {
            ?>
 						<li><a href="#expenses">Expenses</a></li>
<?php 
        }
        if (isset($extra_info['edm_ais_url'])) {
            ?>
						<li><a href="<?php 
            echo $extra_info['edm_ais_url'];
            ?>
">Early Day Motions signed by this MP</a> <small>(From edm.ais.co.uk)</small></li>
<?php 
        }
        ?>
						</ul>
<?php 
        $this->block_end();
        # Big don't-print for SF MPs
        if (0) {
            // Voting Record.
            ?>
 <a name="votingrecord"></a> <?php 
            $this->block_start(array('id' => 'votingrecord', 'title' => 'Voting record (from PublicWhip)'));
            $displayed_stuff = 0;
            function display_dream_comparison($extra_info, $member, $dreamid, $desc, $inverse, $search)
            {
                if (isset($extra_info["public_whip_dreammp{$dreamid}_distance"])) {
                    if ($extra_info["public_whip_dreammp{$dreamid}_both_voted"] == 0) {
                        $dmpdesc = 'Has <strong>never voted</strong> on';
                    } else {
                        $dmpscore = floatval($extra_info["public_whip_dreammp{$dreamid}_distance"]);
                        print "<!-- distance {$dreamid}: {$dmpscore} -->";
                        if ($inverse) {
                            $dmpscore = 1.0 - $dmpscore;
                        }
                        $dmpdesc = 'Voted <strong>' . score_to_strongly($dmpscore) . '</strong>';
                        // How many votes Dream MP and MP both voted (and didn't abstain) in
                        // $extra_info["public_whip_dreammp${dreamid}_both_voted"];
                    }
                    $search_link = WEBPATH . "search/?s=" . urlencode($search) . "&pid=" . $member['person_id'] . "&pop=1";
                    ?>
				<li>
				<?php 
                    echo $dmpdesc;
                    ?>
			<?php 
                    echo $desc;
                    ?>
. 
<small class="unneededprintlinks"> 
<a href="http://www.publicwhip.org.uk/mp.php?mpid=<?php 
                    echo $member['member_id'];
                    ?>
&amp;dmp=<?php 
                    echo $dreamid;
                    ?>
">votes</a>,
<a href="<?php 
                    echo $search_link;
                    ?>
">speeches</a>
</small>

				</li>
<?php 
                    return true;
                }
                return false;
            }
            if (isset($extra_info["public_whip_dreammp230_distance"]) || isset($extra_info["public_whip_dreammp996_distance"])) {
                # XXX
                $displayed_stuff = 1;
                ?>


	<p id="howvoted">How <?php 
                echo $member['full_name'];
                ?>
 voted on key issues since 2001:</p>
	<ul id="dreamcomparisons">
	<?php 
                $got_dream = false;
                $got_dream |= display_dream_comparison($extra_info, $member, 996, "a <strong>transparent Parliament</strong>", false, '"freedom of information"');
                $got_dream |= display_dream_comparison($extra_info, $member, 811, "introducing a <strong>smoking ban</strong>", false, "smoking");
                #$got_dream |= display_dream_comparison($extra_info, $member, 856, "the <strong>changes to parliamentary scrutiny in the <a href=\"http://en.wikipedia.org/wiki/Legislative_and_Regulatory_Reform_Bill\">Legislative and Regulatory Reform Bill</a></strong>", false, "legislative and regulatory reform bill");
                $got_dream |= display_dream_comparison($extra_info, $member, 230, "introducing <strong>ID cards</strong>", true, "id cards");
                $got_dream |= display_dream_comparison($extra_info, $member, 363, "introducing <strong>foundation hospitals</strong>", false, "foundation hospital");
                $got_dream |= display_dream_comparison($extra_info, $member, 367, "introducing <strong>student top-up fees</strong>", true, "top-up fees");
                $got_dream |= display_dream_comparison($extra_info, $member, 258, "Labour's <strong>anti-terrorism laws</strong>", true, "terrorism");
                $got_dream |= display_dream_comparison($extra_info, $member, 219, "the <strong>Iraq war</strong>", true, "iraq");
                $got_dream |= display_dream_comparison($extra_info, $member, 975, "investigating the <strong>Iraq war</strong>", false, "iraq");
                $got_dream |= display_dream_comparison($extra_info, $member, 984, "replacing <strong>Trident</strong>", false, "trident");
                $got_dream |= display_dream_comparison($extra_info, $member, 358, "the <strong>hunting ban</strong>", true, "hunting");
                $got_dream |= display_dream_comparison($extra_info, $member, 826, "equal <strong>gay rights</strong>", false, "gay");
                if (!$got_dream) {
                    print "<li>" . $member['full_name'] . " has not voted enough in this parliament to have any scores.</li>";
                }
                print '</ul>';
                ?>
<p class="italic">
<small>Read about <a href="<?php 
                echo WEBPATH;
                ?>
help/#votingrecord">how the voting record is decided</a>.</small>
</p>

<?php 
            }
            ?>

<?php 
            // Links to full record at Guardian and Public Whip
            $record = array();
            if (isset($extra_info['guardian_howtheyvoted'])) {
                $record[] = '<a href="' . $extra_info['guardian_howtheyvoted'] . '" title="At The Guardian">well-known issues</a> <small>(from the Guardian)</small>';
            }
            if (isset($extra_info['public_whip_division_attendance']) && $extra_info['public_whip_division_attendance'] != 'n/a') {
                $record[] = '<a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' . $member['member_id'] . '&amp;showall=yes#divisions" title="At Public Whip">their full record</a>';
            }
            if (count($record) > 0) {
                $displayed_stuff = 1;
                ?>
			<p>More on <?php 
                echo implode(' &amp; ', $record);
                ?>
</p>
<?php 
            }
            // Rebellion rate
            if (isset($extra_info['public_whip_rebellions']) && $extra_info['public_whip_rebellions'] != 'n/a') {
                $displayed_stuff = 1;
                ?>
					<ul>
							<li><a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/<?php 
                echo $member['member_id'];
                ?>
#divisions" title="See more details at Public Whip">
                        <strong><?php 
                echo htmlentities(ucfirst($extra_info['public_whip_rebel_description']));
                ?>
 rebels</strong></a> against their party<?php 
                if (isset($extra_info['public_whip_rebelrank'])) {
                    echo " in this parliament";
                    /* &#8212; ";
                    			if (isset($extra_info['public_whip_rebelrank_joint']))
                    				print 'joint ';
                    			echo make_ranking($extra_info['public_whip_rebelrank']);
                    			echo " most rebellious of ";
                    			echo $extra_info['public_whip_rebelrank_outof'];
                    			echo ($member['house']=='House of Commons') ? " MPs" : ' Lords';
                    			*/
                }
                ?>
.
			</li>
		</ul><?php 
            }
            if (!$displayed_stuff) {
                print '<p>No data to display yet.</p>';
            }
            $this->block_end();
            # Topics of interest only for MPs at the moment
            if (in_array(1, $member['houses'])) {
                ?>
	<a name="topics"></a>
		<?php 
                $this->block_start(array('id' => 'topics', 'title' => 'Committees and topics of interest'));
                $topics_block_empty = true;
                // Select committee membership
                if (array_key_exists('office', $extra_info)) {
                    $mins = array();
                    foreach ($extra_info['office'] as $row) {
                        if ($row['to_date'] == '9999-12-31' && $row['source'] == 'chgpages/selctee') {
                            $m = prettify_office($row['position'], $row['dept']);
                            if ($row['from_date'] != '2004-05-28') {
                                $m .= ' <small>(since ' . format_date($row['from_date'], SHORTDATEFORMAT) . ')</small>';
                            }
                            $mins[] = $m;
                        }
                    }
                    if ($mins) {
                        print "<h5>Select Committee membership</h5>";
                        print "<ul>";
                        foreach ($mins as $min) {
                            print '<li>' . $min . '</li>';
                        }
                        print "</ul>";
                        $topics_block_empty = false;
                    }
                }
                $wrans_dept = false;
                $wrans_dept_1 = null;
                $wrans_dept_2 = null;
                if (isset($extra_info['wrans_departments'])) {
                    $wrans_dept = true;
                    $wrans_dept_1 = "<li><strong>Departments:</strong> " . $extra_info['wrans_departments'] . "</p>";
                }
                if (isset($extra_info['wrans_subjects'])) {
                    $wrans_dept = true;
                    $wrans_dept_2 = "<li><strong>Subjects (based on headings added by Hansard):</strong> " . $extra_info['wrans_subjects'] . "</p>";
                }
                if ($wrans_dept) {
                    print "<p><strong>Asks most questions about</strong></p>";
                    print "<ul>";
                    if ($wrans_dept_1) {
                        print $wrans_dept_1;
                    }
                    if ($wrans_dept_2) {
                        print $wrans_dept_2;
                    }
                    print "</ul>";
                    $topics_block_empty = false;
                    $WRANSURL = new URL('search');
                    $WRANSURL->insert(array('pid' => $member['person_id'], 's' => 'section:wrans', 'pop' => 1));
                    ?>
							<p><small>(based on <a href="<?php 
                    echo $WRANSURL->generate();
                    ?>
">written questions asked by <?php 
                    echo $member['full_name'];
                    ?>
</a> and answered by departments)</small></p><?php 
                }
                # Public Bill Committees
                if (count($extra_info['pbc'])) {
                    $topics_block_empty = false;
                    print '<h5>Public Bill Committees <small>(sittings attended)</small></h5> <ul>';
                    foreach ($extra_info['pbc'] as $bill_id => $arr) {
                        print '<li>';
                        if ($arr['chairman']) {
                            print 'Chairman, ';
                        }
                        print '<a href="/pbc/' . $arr['session'] . '/' . urlencode($arr['title']) . '">' . $arr['title'] . ' Committee</a> <small>(' . $arr['attending'] . ' out of ' . $arr['outof'] . ')</small>';
                    }
                    print '</ul>';
                }
                if ($topics_block_empty) {
                    print "<p><em>This MP is not currently on any select <!-- or public bill --> committee\nand has had no written questions answered for which we know the department or subject.</em></p>";
                }
                $this->block_end();
            }
        }
        if (!in_array(1, $member['houses']) || $member['party'] != 'Sinn Fein') {
            ?>
		<a name="hansard"></a> <?php 
            $title = 'Most recent appearances in parliament';
            if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
                $title = '<a href="' . WEBPATH . $rssurl . '"><img src="' . WEBPATH . 'images/rss.gif" alt="RSS feed" border="0" align="right"></a> ' . $title;
            }
            $this->block_start(array('id' => 'hansard', 'title' => $title));
            // This is really far from ideal - I don't really want $PAGE to know
            // anything about HANSARDLIST / DEBATELIST / WRANSLIST.
            // But doing this any other way is going to be a lot more work for little
            // benefit unfortunately.
            twfy_debug_timestamp();
            $HANSARDLIST = new HANSARDLIST();
            $searchstring = "speaker:{$member['person_id']}";
            global $SEARCHENGINE;
            $SEARCHENGINE = new SEARCHENGINE($searchstring);
            $args = array('s' => $searchstring, 'p' => 1, 'num' => 3, 'pop' => 1, 'o' => 'd');
            $HANSARDLIST->display('search_min', $args);
            twfy_debug_timestamp();
            $MOREURL = new URL('search');
            $MOREURL->insert(array('pid' => $member['person_id'], 'pop' => 1));
            ?>
	<p id="moreappear"><a href="<?php 
            echo $MOREURL->generate();
            ?>
#n4">More of <?php 
            echo ucfirst($member['full_name']);
            ?>
's recent appearances</a></p>

<?php 
            if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
                // If we set an RSS feed for this page.
                $HELPURL = new URL('help');
                ?>
					<p class="unneededprintlinks"><a href="<?php 
                echo WEBPATH . $rssurl;
                ?>
" title="XML version of this person's recent appearances">RSS feed</a> (<a href="<?php 
                echo $HELPURL->generate();
                ?>
#rss" title="An explanation of what RSS feeds are for">?</a>)</p>
<?php 
            }
            $this->block_end();
        }
        # End Sinn Fein
        ?>
 <a name="numbers"></a> <?php 
        $this->block_start(array('id' => 'numbers', 'title' => 'Numbers'));
        $displayed_stuff = 0;
        ?>
		<p><em>Please note that numbers do not measure quality. 
		Also, <?php 
        if ($member['house_disp'] == 1) {
            echo "Representatives";
        } else {
            echo "Senators";
        }
        ?>
 may do other things not currently covered
		by this site.</em> (<a href="<?php 
        echo WEBPATH;
        ?>
help/#numbers">More about this</a>)</p>
<ul>
<?php 
        $since_text = 'in the last year';
        #if ($member['entered_house'] > '2005-05-05')
        #	$since_text = 'since joining Parliament';
        $MOREURL = new URL('search');
        $MOREURL->insert(array('pid' => $member['person_id'], 'pop' => 1));
        if ($member['party'] != 'Sinn Fein') {
            $displayed_stuff |= display_stats_line('debate_sectionsspoken_inlastyear', 'Has spoken in <a href="' . $MOREURL->generate() . '">', 'debate', '</a> ' . $since_text, '', $extra_info);
            $MOREURL->insert(array('pid' => $member['person_id'], 's' => 'section:wrans', 'pop' => 1));
            // We assume that if they've answered a question, they're a minister
            $minister = false;
            $Lminister = false;
            if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) {
                $minister = true;
            }
            if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) {
                $Lminister = true;
            }
            #		$displayed_stuff |= display_stats_line('wrans_asked_inlastyear', 'Has received answers to <a href="' . $MOREURL->generate() . '">', 'written question', '</a> ' . $since_text, '', $extra_info, $minister, $Lminister);
        }
        if (isset($extra_info['select_committees'])) {
            print "<li>Is a member of <strong>{$extra_info['select_committees']}</strong> select committee";
            if ($extra_info['select_committees'] > 1) {
                print "s";
            }
            if (isset($extra_info['select_committees_chair'])) {
                print " ({$extra_info['select_committees_chair']} as chair)";
            }
            print '.</li>';
        }
        #		$wtt_displayed = display_writetothem_numbers(2006, $extra_info);
        #		$displayed_stuff |= $wtt_displayed;
        #		if (!$wtt_displayed)
        # 			$displayed_stuff |= display_writetothem_numbers(2005, $extra_info);
        $after_stuff = ' <small>(From Public Whip)</small>';
        if ($member['party'] == 'Scottish National Party') {
            $after_stuff .= '<br><em>Note SNP MPs do not vote on legislation not affecting Scotland.</em>';
        }
        if ($member['party'] != 'Sinn Fein') {
            #			$displayed_stuff |= display_stats_line('public_whip_division_attendance', 'Has voted in <a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' . $member['member_id'] . '&amp;showall=yes#divisions" title="See more details at Public Whip">', 'of vote', '</a> in parliament', $after_stuff, $extra_info);
            $displayed_stuff |= display_stats_line('comments_on_speeches', 'People have made <a href="' . WEBPATH . 'comments/recent/?pid=' . $member['person_id'] . '">', 'comment', "</a> on this Representative's speeches", '', $extra_info);
            $displayed_stuff |= display_stats_line('reading_age', 'This Representative\'s speeches are understandable to an average ', '', ' year old, going by the <a href="http://en.wikipedia.org/wiki/Flesch-Kincaid_Readability_Test">Flesch-Kincaid Grade Level</a> score', '', $extra_info);
        }
        if (isset($extra_info['number_of_alerts'])) {
            $displayed_stuff = 1;
            ?>
		<li><strong><?php 
            echo htmlentities($extra_info['number_of_alerts']);
            ?>
</strong> <?php 
            echo $extra_info['number_of_alerts'] == 1 ? 'person is' : 'people are';
            ?>
 tracking whenever <?php 
            if ($member['house_disp'] == 1) {
                print 'this Representative';
            } elseif ($member['house_disp'] == 2) {
                print 'this Senator';
            } elseif ($member['house_disp'] == 3) {
                print 'this MLA';
            } elseif ($member['house_disp'] == 4) {
                print 'this MSP';
            } elseif ($member['house_disp'] == 0) {
                print $member['full_name'];
            }
            ?>
 speaks<?php 
            if ($member['current_member'][0] || $member['current_member'][2] || $member['current_member'][3] || $member['current_member'][1] && $member['party'] != 'Sinn Fein') {
                print ' &mdash; <a href="' . WEBPATH . 'alert/?only=1&amp;pid=' . $member['person_id'] . '">email me whenever ' . $member['full_name'] . ' speaks</a>';
            }
            print '.</li>';
        }
        if ($member['party'] != 'Sinn Fein') {
            $displayed_stuff |= display_stats_line('three_word_alliterations', 'Has used three-word alliterative phrases (e.g. "she sells seashells") ', 'time', ' in debates', ' <small>(<a href="' . WEBPATH . 'help/#numbers">Why is this here?</a>)</small>', $extra_info);
            if (isset($extra_info['three_word_alliteration_content'])) {
                print "\n<!-- " . $extra_info['three_word_alliteration_content'] . " -->\n";
            }
        }
        #		$displayed_stuff |= display_stats_line('ending_with_a_preposition', "Has ended a sentence with 'with' ", 'time', ' in debates', '', $extra_info);
        #		$displayed_stuff |= display_stats_line('only_asked_why', "Has made a speech consisting solely of 'Why?' ", 'time', ' in debates', '', $extra_info);
        ?>
						</ul>
<?php 
        if (!$displayed_stuff) {
            print '<p>No data to display yet.</p>';
        }
        $this->block_end();
        if (isset($extra_info['register_member_interests_html'])) {
            ?>
				
<a name="register"></a>
<?php 
            $this->block_start(array('id' => 'register', 'title' => "Register of Members' Interests"));
            if ($extra_info['register_member_interests_html'] != '') {
                echo $extra_info['register_member_interests_html'];
            } else {
                echo "\t\t\t\t<p>Nil</p>\n";
            }
            echo '<p class="italic">';
            if (isset($extra_info['register_member_interests_date'])) {
                echo 'Register last updated: ';
                echo format_date($extra_info['register_member_interests_date'], SHORTDATEFORMAT);
                echo '. ';
            }
            echo '<a href="http://www.publications.parliament.uk/pa/cm/cmregmem/061106/memi01.htm">More about the Register</a>';
            echo '</p>';
            print '<p><strong><a href="' . WEBPATH . 'regmem/?p=' . $member['person_id'] . '">View the history of this MP\'s entries in the Register</a></strong></p>';
            $this->block_end();
        }
        if (isset($extra_info['expenses2004_col1']) || isset($extra_info['expenses2006_col1']) || isset($extra_info['expenses2007_col1'])) {
            ?>
<a name="expenses"></a>
<?php 
            $title = 'Expenses';
            $this->block_start(array('id' => 'expenses', 'title' => $title));
            print '<p class="italic">Figures in brackets are ranks. Parliament\'s <a href="http://www.parliament.uk/site_information/allowances.cfm">explanatory notes</a>.</p>';
            print '<table class="people"><tr><th>Type</th><th>2006/07';
            if (isset($extra_info['expenses2007_col1_rank_outof'])) {
                print ' (ranking out of ' . $extra_info['expenses2007_col1_rank_outof'] . ')';
            }
            print '</th><th>2005/06';
            if (isset($extra_info['expenses2006_col1_rank_outof'])) {
                # TODO: Needs to be more complicated, because of General Election
                print ' (ranking out of ' . $extra_info['expenses2006_col1_rank_outof'] . ')';
            }
            print '</th><th>2004/05';
            if (isset($extra_info['expenses2005_col1_rank_outof'])) {
                print ' (ranking out of ' . $extra_info['expenses2005_col1_rank_outof'] . ')';
            }
            print '</th><th>2003/04';
            if (isset($extra_info['expenses2004_col1_rank_outof'])) {
                print ' (ranking out of&nbsp;' . $extra_info['expenses2004_col1_rank_outof'] . ')';
            }
            print '</th><th>2002/03';
            if (isset($extra_info['expenses2003_col1_rank_outof'])) {
                print ' (ranking out of&nbsp;' . $extra_info['expenses2003_col1_rank_outof'] . ')';
            }
            print '</th><th>2001/02';
            if (isset($extra_info['expenses2002_col1_rank_outof'])) {
                print ' (ranking out of&nbsp;' . $extra_info['expenses2002_col1_rank_outof'] . ')';
            }
            print '</th></tr>';
            print '<tr><td class="row-1">Additional Costs Allowance</td>';
            $this->expenses_printout('col1', $extra_info, 1);
            print '</tr><tr><td class="row-2">London Supplement</td>';
            $this->expenses_printout('col2', $extra_info, 2);
            print '</tr><tr><td class="row-1">Incidental Expenses Provision</td>';
            $this->expenses_printout('col3', $extra_info, 1);
            print '</tr><tr><td class="row-2">Staffing Allowance</td>';
            $this->expenses_printout('col4', $extra_info, 2);
            print '</tr><tr><td class="row-1">Members\' Travel</td>';
            $this->expenses_printout('col5', $extra_info, 1);
            print '</tr><tr><td class="row-2">Members\' Staff Travel</td>';
            $this->expenses_printout('col6', $extra_info, 2);
            print '</tr><tr><td class="row-1">Centrally Purchased Stationery</td>';
            $this->expenses_printout('col7', $extra_info, 1);
            print '</tr><tr><td class="row-2">Stationery: Associated Postage Costs</td>';
            $this->expenses_printout('col7a', $extra_info, 2);
            print '</tr><tr><td class="row-1">Centrally Provided Computer Equipment</td>';
            $this->expenses_printout('col8', $extra_info, 1);
            print '</tr><tr><td class="row-2">Other Costs</td>';
            $this->expenses_printout('col9', $extra_info, 2);
            print '</tr><tr><th style="text-align: right">Total</th>';
            $this->expenses_printout('total', $extra_info, 1);
            print '</tr></table>';
            if (isset($extra_info['expenses2007_col5a'])) {
                print '<p><a name="travel2007"></a><sup>*</sup> <small>';
                foreach (array('a' => 'Car', 'b' => '3rd party', 'c' => 'Rail', 'd' => 'Air', 'e' => 'Other', 'f' => 'European') as $let => $desc) {
                    if ($extra_info['expenses2007_col5' . $let] > 0) {
                        print $desc . ' &pound;' . number_format(str_replace(',', '', $extra_info['expenses2007_col5' . $let]));
                        if (isset($extra_info['expenses2007_col5' . $let . '_rank'])) {
                            print ' (' . make_ranking($extra_info['expenses2007_col5' . $let . '_rank']) . ')';
                        }
                        print '. ';
                    }
                }
                print '</small></p>';
            }
            $this->block_end();
        }
    }
Beispiel #5
0
function person_voting_record($member, $extra_info)
{
    ?>
 <a name="votingrecord"></a> <?php 
    //$this->block_start(array('id'=>'votingrecord', 'title'=>'Voting record (from PublicWhip)'));
    print '<h4>Voting record (from PublicWhip)</h4>';
    $displayed_stuff = 0;
    if ($member['party'] == 'Speaker' || $member['party'] == 'Deputy Speaker') {
        if ($member['party'] == 'Speaker') {
            $art = 'the';
        } else {
            $art = 'a';
        }
        echo "<p>As {$art} {$member['party']}, {$member['full_name']} cannot vote (except to break a tie).</p>";
    }
    if (isset($extra_info["public_whip_dreammp230_distance"]) || isset($extra_info["public_whip_dreammp996_distance"])) {
        # XXX
        $displayed_stuff = 1;
        ?>

<p id="howvoted">How <?php 
        echo $member['full_name'];
        ?>
 voted on key issues since 2001:</p>
<ul id="dreamcomparisons">
<?php 
        # ID, display string, MP only
        $policies = array(array(996, "a <strong>transparent Parliament</strong>"), array(811, "introducing a <strong>smoking ban</strong>", true), array(1051, "introducing <strong>ID cards</strong>"), array(363, "introducing <strong>foundation hospitals</strong>"), array(1052, "introducing <strong>student top-up fees</strong>"), array(1053, "Labour's <strong>anti-terrorism laws</strong>", true), array(1049, "the <strong>Iraq war</strong>"), array(984, "replacing <strong>Trident</strong>"), array(1050, "the <strong>hunting ban</strong>"), array(826, "equal <strong>gay rights</strong>"), array(1030, "laws to <strong>stop climate change</strong>"), array(1074, "greater <strong>autonomy for schools</strong>"), array(1071, "allowing ministers to <strong>intervene in inquests</strong>"), array(1079, "removing <strong>hereditary peers</strong> from the House of Lords"));
        shuffle($policies);
        $joined = array(1079 => array(837, "a <strong>wholly elected</strong> House of Lords"), 1049 => array(975, "an <strong>investigation</strong> into the Iraq war"));
        $got_dream = false;
        foreach ($policies as $policy) {
            if (isset($policy[2]) && $policy[2] && !in_array(1, $member['houses'])) {
                continue;
            }
            $got_dream |= display_dream_comparison($extra_info, $member, $policy[0], $policy[1]);
            if (isset($joined[$policy[0]])) {
                $policy = $joined[$policy[0]];
                $got_dream |= display_dream_comparison($extra_info, $member, $policy[0], $policy[1]);
            }
        }
        if (!$got_dream) {
            print "<li>" . $member['full_name'] . " has not voted enough in this parliament to have any scores.</li>";
        }
        print '</ul>';
        ?>
<p class="italic">
<small>Read about <a href="<?php 
        echo WEBPATH;
        ?>
help/#votingrecord">how the voting record is decided</a>.</small>
</p>

<?php 
    }
    // Links to full record at Guardian and Public Whip
    $record = array();
    if (isset($extra_info['guardian_howtheyvoted'])) {
        $record[] = '<a href="' . $extra_info['guardian_howtheyvoted'] . '" title="At The Guardian">well-known issues</a> <small>(from the Guardian)</small>';
    }
    if (isset($extra_info['public_whip_division_attendance']) && $extra_info['public_whip_division_attendance'] != 'n/a') {
        $record[] = '<a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' . $member['member_id'] . '&amp;showall=yes#divisions" title="At Public Whip">their full record</a>';
    }
    if (count($record) > 0) {
        $displayed_stuff = 1;
        ?>
		<p>More on <?php 
        echo implode(' &amp; ', $record);
        ?>
</p>
<?php 
    }
    // Rebellion rate
    if (isset($extra_info['public_whip_rebellions']) && $extra_info['public_whip_rebellions'] != 'n/a') {
        $displayed_stuff = 1;
        ?>
					<ul>
						<li><a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/<?php 
        echo $member['member_id'];
        ?>
#divisions" title="See more details at Public Whip">
                        <strong><?php 
        echo htmlentities(ucfirst($extra_info['public_whip_rebel_description']));
        ?>
 rebels</strong></a> against their party<?php 
        if (isset($extra_info['public_whip_rebelrank'])) {
            echo " in this parliament";
            /* &#8212; ";
            			if (isset($extra_info['public_whip_rebelrank_joint']))
            				print 'joint ';
            			echo make_ranking($extra_info['public_whip_rebelrank']);
            			echo " most rebellious of ";
            			echo $extra_info['public_whip_rebelrank_outof'];
            			echo ($member['house']=='House of Commons') ? " MPs" : ' Lords';
            			*/
        }
        ?>
.
		</li>
	</ul><?php 
    }
    if (!$displayed_stuff) {
        print '<p>No data to display yet.</p>';
    }
}
Beispiel #6
0
    function display_member($member, $extra_info)
    {
        global $THEUSER, $DATA, $this_page;
        #$title = ucfirst($member['full_name']);
        /*		if (isset($extra_info["public_whip_dreammp996_distance"])) {
        			$dmpscore = floatval($extra_info["public_whip_dreammp996_distance"]);
        			$strongly_foi = "voted " . score_to_strongly(1.0 - $dmpscore);
        		}
        		if ($extra_info["public_whip_dreammp996_both_voted"] == 0) {
        			$strongly_foi = "has never voted on";
        		}
        		$this->block_start(array('id'=>'black', 'title'=>"Freedom of Information and Parliament"));
        		print "<p>There is currently a Bill before Parliament which will make Parliament
        			exempt from Freedom of Information requests. This Bill will remove
        			your legal right to see some of the information on this page, notably
        			expenses, replacing it with a weaker promise that could be retracted
        			later.</p>
        
        			<p>Even if this bill is amended to exclude expenses, exemption from the
        			Freedom of Information Act may prevent TheyWorkForYou from adding
        			useful information of new sorts in the future. The Bill is not backed
        			or opposed by a specific party, and TheyWorkForYou remains strictly
        			neutral on all issues that do not affect our ability to serve the
        			public.</p>
        
        			<p><a href=\"somewhere\">Join the Campaign to keep Parliament transparent
        			(external)</a>.</p>";
        
        		print 'For your information, '.$title.' MP <a href="http://www.publicwhip.org.uk/mp.php?mpid='.$member['member_id'].'&amp;dmp=996">'.$strongly_foi.'</a> this Bill.';
        		$this->block_end();
        */
        if (isset($extra_info["is_speaker_candidate"]) && $extra_info["is_speaker_candidate"] == 1 && isset($extra_info["speaker_candidate_contacted_on"]) || isset($extra_info['speaker_candidate_response']) && $extra_info['speaker_candidate_response']) {
            $just_response = false;
            if ($extra_info['is_speaker_candidate'] == 0) {
                $just_response = true;
            }
            // days since originally contacted
            $contact_date_string = $extra_info["speaker_candidate_contacted_on"];
            $contact_date_midnight = strtotime($contact_date_string);
            $days_since_contact = floor((time() - $contact_date_midnight) / 86400);
            if ($days_since_contact == 1) {
                $days_since_string = $days_since_contact . ' day ago';
            } elseif ($days_since_contact > 1) {
                $days_since_string = $days_since_contact . ' days ago';
            } else {
                $days_since_string = 'today';
            }
            $reply_time = "*unknown*";
            if (isset($extra_info["speaker_candidate_replied_on"])) {
                $reply_date_string = $extra_info["speaker_candidate_replied_on"];
                $reply_date_midnight = strtotime($reply_date_string);
                $days_for_reply = floor(($reply_date_midnight - $contact_date_midnight) / 86400);
                if ($days_for_reply == 0) {
                    $reply_time = "in less than 24 hours";
                } elseif ($days_for_reply == 1) {
                    $reply_time = "in 1 day";
                } else {
                    $reply_time = "in {$days_for_reply} days";
                }
            }
            if ($just_response) {
                $spk_cand_title = $member['full_name'] . ' endorses our Speaker principles';
            } else {
                if (isset($extra_info["speaker_candidate_elected"]) && $extra_info["speaker_candidate_elected"] == 1) {
                    $spk_cand_title = 'LATEST: ' . $member['full_name'] . ' elected Speaker. Here\'s what he endorsed:';
                } else {
                    $spk_cand_title = 'IMPORTANT: ' . $member['full_name'] . ' was a Candidate for Speaker.';
                }
            }
            $this->block_start(array('id' => 'campaign_block', 'title' => $spk_cand_title));
            if (!isset($extra_info["speaker_candidate_response"])) {
                print "\n                You can help make sure that all the candidates understand that they\n                must be a strong, Internet-savvy proponents of a better, more\n                accountable era of democracy.";
            }
            print "</p>\n\n            <p>mySociety asked likely candidates for the post of Speaker to endorse the\n            following principles.";
            print "<p><strong>The three principles are:</strong></p>\n\n            <ol>\n\n               <li> Voters have the right to know in <strong>detail about the money</strong> that is spent to\n            support MPs and run Parliament, and in similar detail how the decisions to\n            spend that money are settled upon. </li>\n\n               <li> Bills being considered must be published online in a much better way than\n            they are now, as the <strong>Free Our Bills</strong> campaign has been suggesting for some time. </li>\n\n               <li> The Internet is not a threat to a renewal in our democracy, it is one of\n            its best hopes. Parliament should appoint a senior officer with direct working\n            experience of the <strong>power of the Internet</strong> who reports directly to the Speaker,\n            and who will help Parliament adapt to a new era of transparency and\n            effectiveness. </li>\n\n            </ol>";
            if (isset($extra_info["speaker_candidate_response"]) && $extra_info["speaker_candidate_response"]) {
                print "</p><p><strong><big>Update: " . $member['full_name'] . " MP replied {$reply_time}. " . $extra_info["speaker_candidate_response_summary"] . " Here's the reply in full: </big></strong></p>";
                print "<blockquote><div id='speaker_candidate_response'>";
                print $extra_info["speaker_candidate_response"];
                print "</div></blockquote>";
            } else {
                print "<p> We contacted " . $member['full_name'] . " MP to ask for an endorsement " . $days_since_string . ". ";
                print "They have not yet replied.</p>";
            }
            $this->block_end();
        }
        $is_lord = false;
        foreach ($member['houses'] as $house) {
            if ($house == 2) {
                $is_lord = true;
            }
            continue;
            if (!$member['current_member'][$house]) {
                $title .= ', former';
            }
            if ($house == 1) {
                $title .= ' MP';
            }
            if ($house == 3) {
                $title .= ' MLA';
            }
            if ($house == 4) {
                $title .= ' MSP';
            }
        }
        #if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
        #	$title = '<a href="' . WEBPATH . $rssurl . '"><img src="' . WEBPATH . 'images/rss.gif" alt="RSS feed" border="0" align="right"></a> ' . $title;
        #}
        print '<p class="printonly">This data was produced by TheyWorkForYou from a variety of sources.</p>';
        //get the correct image (with special case for lords)
        if ($is_lord) {
            list($image, $sz) = find_rep_image($member['person_id'], false, 'lord');
        } else {
            list($image, $sz) = find_rep_image($member['person_id'], false, true);
        }
        //show image
        echo '<p class="person">';
        echo '<img class="portrait" alt="Photo of ', $member['full_name'], '" src="', $image, '"';
        if ($sz == 'S') {
            echo ' height="118"';
        }
        echo '></p>';
        //work out person's description
        $desc = '';
        $last_item = end($member['houses']);
        foreach ($member['houses'] as $house) {
            if ($house == 0) {
                $desc .= '<li><strong>Acceded on ';
                $desc .= $member['entered_house'][0]['date_pretty'];
                $desc .= '</strong></li>';
                $desc .= '<li><strong>Coronated on 2 June 1953</strong></li>';
                continue;
            }
            $party = $member['left_house'][$house]['party'];
            if ($house == 1 && isset($member['entered_house'][2])) {
                continue;
            }
            # Same info is printed further down
            if (!$member['current_member'][$house]) {
                $desc .= 'Former ';
            }
            $party_br = '';
            if (preg_match('#^(.*?)\\s*\\((.*?)\\)$#', $party, $m)) {
                $party_br = $m[2];
                $party = $m[1];
            }
            if ($party != 'unknown') {
                $desc .= htmlentities($party);
            }
            if ($party == 'Speaker' || $party == 'Deputy Speaker') {
                $desc .= ', and ';
                # XXX: Will go horribly wrong if something odd happens
                if ($party == 'Deputy Speaker') {
                    $last = end($member['other_parties']);
                    $desc .= $last['from'] . ' ';
                }
            }
            if ($house == 1 || $house == 3 || $house == 4) {
                $desc .= ' ';
                if ($house == 1) {
                    $desc .= 'MP';
                }
                if ($house == 3) {
                    $desc .= 'MLA';
                }
                if ($house == 4) {
                    $desc .= 'MSP';
                }
                if ($party_br) {
                    $desc .= " ({$party_br})";
                }
                $desc .= ' for ' . $member['left_house'][$house]['constituency'];
            }
            if ($house == 2 && $party != 'Bishop') {
                $desc .= ' Peer';
            }
            if ($house != $last_item) {
                $desc .= ', ';
            }
        }
        //headings
        echo '<h2>' . $member['full_name'] . '</h2>';
        echo '<h3>' . $desc . '</h3>';
        //History
        echo '<ul class="hilites">';
        if ($member['other_constituencies']) {
            print "<li>Also represented " . join('; ', array_keys($member['other_constituencies']));
            print '</li>';
        }
        if ($member['other_parties'] && $member['party'] != 'Speaker' && $member['party'] != 'Deputy Speaker') {
            print "<li>Changed party ";
            foreach ($member['other_parties'] as $r) {
                $out[] = 'from ' . $r['from'] . ' on ' . format_date($r['date'], SHORTDATEFORMAT);
            }
            print join('; ', $out);
            print '</li>';
        }
        // Ministerial position
        if (array_key_exists('office', $extra_info)) {
            $mins = array();
            foreach ($extra_info['office'] as $row) {
                if ($row['to_date'] == '9999-12-31' && $row['source'] != 'chgpages/selctee') {
                    $m = prettify_office($row['position'], $row['dept']);
                    $m .= ' (since ' . format_date($row['from_date'], SHORTDATEFORMAT) . ')';
                    $mins[] = $m;
                }
            }
            if ($mins) {
                print '<li>' . join('<br>', $mins) . '</li>';
            }
        }
        echo '<br class="clear">';
        //if dummy image, show message asking for a photo
        if (!exists_rep_image($member['person_id'])) {
            // For MPs, prompt for photo
            echo '<p class="missingphoto">';
            if ($member['current_member_anywhere']) {
                echo 'Help, we\'re missing a photo of ' . $member['full_name'] . '! If you are ' . $member['full_name'] . ', or have a photo of them (that you have copyright of) <a href="mailto:team@theyworkforyou.com">please email it to us</a>.';
            } else {
                echo 'Help, we\'re missing a photo of ' . $member['full_name'] . '! If have a photo of them (that you have copyright of), or can locate a copyright free photo of them <a href="mailto:team@theyworkforyou.com">please email it to us</a>.';
            }
            echo '</p>';
        }
        if (isset($member['left_house'][1]) && isset($member['entered_house'][2])) {
            print '<li><strong>Entered the House of Lords ';
            if (strlen($member['entered_house'][2]['date_pretty']) == 4) {
                print 'in ';
            } else {
                print 'on ';
            }
            print $member['entered_house'][2]['date_pretty'] . '</strong>';
            print '</strong>';
            if ($member['entered_house'][2]['reason']) {
                print ' &mdash; ' . $member['entered_house'][2]['reason'];
            }
            print '</li>';
            print '<li><strong>Previously MP for ';
            print $member['left_house'][1]['constituency'] . ' until ';
            print $member['left_house'][1]['date_pretty'] . '</strong>';
            if ($member['left_house'][1]['reason']) {
                print ' &mdash; ' . $member['left_house'][1]['reason'];
            }
            print '</li>';
        } elseif (isset($member['entered_house'][2]['date'])) {
            print '<li><strong>Became a Lord ';
            if (strlen($member['entered_house'][2]['date_pretty']) == 4) {
                print 'in ';
            } else {
                print 'on ';
            }
            print $member['entered_house'][2]['date_pretty'] . '</strong>';
            if ($member['entered_house'][2]['reason']) {
                print ' &mdash; ' . $member['entered_house'][2]['reason'];
            }
            print '</li>';
        }
        if (in_array(2, $member['houses']) && !$member['current_member'][2]) {
            print '<li><strong>Left Parliament on ' . $member['left_house'][2]['date_pretty'] . '</strong>';
            if ($member['left_house'][2]['reason']) {
                print ' &mdash; ' . $member['left_house'][2]['reason'];
            }
            print '</li>';
        }
        if (isset($extra_info['lordbio'])) {
            echo '<li><strong>Positions held at time of appointment:</strong> ', $extra_info['lordbio'], ' <small>(from <a href="', $extra_info['lordbio_from'], '">Number 10 press release</a>)</small></li>';
        }
        if (isset($member['entered_house'][1]['date'])) {
            print '<li><strong>Entered Parliament on ';
            print $member['entered_house'][1]['date_pretty'] . '</strong>';
            if ($member['entered_house'][1]['reason']) {
                print ' &mdash; ' . $member['entered_house'][1]['reason'];
            }
            print '</li>';
        }
        if (in_array(1, $member['houses']) && !$member['current_member'][1] && !isset($member['entered_house'][2])) {
            print '<li><strong>Left Parliament ';
            if (strlen($member['left_house'][1]['date_pretty']) == 4) {
                print 'in ';
            } else {
                print 'on ';
            }
            echo $member['left_house'][1]['date_pretty'] . '</strong>';
            if ($member['left_house'][1]['reason']) {
                print ' &mdash; ' . $member['left_house'][1]['reason'];
            }
            print '</li>';
        }
        if (isset($member['entered_house'][3]['date'])) {
            print '<li><strong>Entered the Assembly on ';
            print $member['entered_house'][3]['date_pretty'] . '</strong>';
            if ($member['entered_house'][3]['reason']) {
                print ' &mdash; ' . $member['entered_house'][3]['reason'];
            }
            print '</li>';
        }
        if (in_array(3, $member['houses']) && !$member['current_member'][3]) {
            print '<li><strong>Left the Assembly on ' . $member['left_house'][3]['date_pretty'] . '</strong>';
            if ($member['left_house'][3]['reason']) {
                print ' &mdash; ' . $member['left_house'][3]['reason'];
            }
            print '</li>';
        }
        if (isset($member['entered_house'][4]['date'])) {
            print '<li><strong>Entered the Scottish Parliament on ';
            print $member['entered_house'][4]['date_pretty'] . '</strong>';
            if ($member['entered_house'][4]['reason']) {
                print ' &mdash; ' . $member['entered_house'][4]['reason'];
            }
            print '</li>';
        }
        if (in_array(4, $member['houses']) && !$member['current_member'][4]) {
            print '<li><strong>Left the Scottish Parliament on ' . $member['left_house'][4]['date_pretty'] . '</strong>';
            if ($member['left_house'][4]['reason']) {
                print ' &mdash; ' . $member['left_house'][4]['reason'];
            }
            print '</li>';
        }
        if (isset($extra_info['majority_in_seat'])) {
            ?>
						<li><strong>Majority:</strong> 
						<?php 
            echo number_format($extra_info['majority_in_seat']);
            ?>
 votes. <?php 
            if (isset($extra_info['swing_to_lose_seat_today'])) {
                /*
                if (isset($extra_info['swing_to_lose_seat_today_quintile'])) {
                	$q = $extra_info['swing_to_lose_seat_today_quintile'];
                	if ($q == 0) {
                		print 'Very safe seat';
                	} elseif ($q == 1) {
                		print 'Safe seat';
                	} elseif ($q == 2) {
                		print '';
                	} elseif ($q == 3) {
                		print 'Unsafe seat';
                	} elseif ($q == 4) {
                		print 'Very unsafe seat';
                	} else {
                		print '[Impossible quintile!]';
                	}
                }
                */
                print ' &mdash; ' . make_ranking($extra_info['swing_to_lose_seat_today_rank']);
                ?>
 out of <?php 
                echo $extra_info['swing_to_lose_seat_today_rank_outof'];
                ?>
 MPs.
<?php 
            }
            ?>
</li>
<?php 
        }
        if ($member['party'] == 'Sinn Fein' && in_array(1, $member['houses'])) {
            print '<li>Sinn F&eacute;in MPs do not take their seats in Parliament</li>';
        }
        print "</ul>";
        print '<br class="clear"/>';
        print "<ul class=\"hilites\">";
        if ($member['the_users_mp'] == true) {
            $pc = $THEUSER->postcode();
            ?>
						<li><a href="http://www.writetothem.com/?a=WMC&amp;pc=<?php 
            echo htmlentities(urlencode($pc));
            ?>
"><strong>Send a message to <?php 
            echo $member['full_name'];
            ?>
</strong></a> (only use this for <em>your</em> MP) <small>(via WriteToThem.com)</small></li>
						<li><a href="http://www.hearfromyourmp.com/?pc=<?php 
            echo htmlentities(urlencode($pc));
            ?>
"><strong>Get messages from your MP</strong></a> <small>(via HearFromYourMP)</small></strong></a></li>
<?php 
        } elseif ($member['current_member'][1]) {
            ?>
						<li><a href="http://www.writetothem.com/"><strong>Send a message to your MP</strong></a> <small>(via WriteToThem.com)</small></li>
						<li><a href="http://www.hearfromyourmp.com/"><strong>Sign up to <em>HearFromYourMP</em></strong></a> to get messages from your MP</li>
<?php 
        } elseif ($member['current_member'][3]) {
            ?>
						<li><a href="http://www.writetothem.com/"><strong>Send a message to your MLA</strong></a> <small>(via WriteToThem.com)</small></li>
<?php 
        } elseif ($member['current_member'][4]) {
            ?>
						<li><a href="http://www.writetothem.com/"><strong>Send a message to your MSP</strong></a> <small>(via WriteToThem.com)</small></li>
<?php 
        } elseif ($member['current_member'][2]) {
            ?>
						<li><a href="http://www.writetothem.com/?person=uk.org.publicwhip/person/<?php 
            echo $member['person_id'];
            ?>
"><strong>Send a message to <?php 
            echo $member['full_name'];
            ?>
</strong></a> <small>(via WriteToThem.com)</small></li>
<?php 
        }
        # If they're currently an MLA, a Lord or a non-Sinn Fein MP
        if ($member['current_member'][0] || $member['current_member'][2] || $member['current_member'][3] || $member['current_member'][1] && $member['party'] != 'Sinn Fein' || $member['current_member'][4]) {
            print '<li><a href="' . WEBPATH . 'alert/?only=1&amp;pid=' . $member['person_id'] . '"><strong>Email me whenever ' . $member['full_name'] . ' speaks</strong></a> (no more than once per day)</li>';
        }
        # Video
        if ($member['current_member'][1] && $member['party'] != 'Sinn Fein') {
            echo '<li>Help us add video by <a href="/video/next.php?action=random&amp;pid=' . $member['person_id'] . '"><strong>matching a speech by ' . $member['full_name'] . '</strong></a>';
        }
        ?>
						</ul>
						
						
						<ul class="jumpers hilites">
<?php 
        if (in_array(1, $member['houses']) && $member['party'] != 'Sinn Fein' || in_array(2, $member['houses'])) {
            echo '<li><a href="#votingrecord">Voting record</a></li>';
            if ($member['current_member'][1]) {
                echo '<li><a href="#topics">Committees and topics of interest</a></li>';
            }
        }
        if (!in_array(1, $member['houses']) || $member['party'] != 'Sinn Fein' || in_array(3, $member['houses'])) {
            echo '<li><a href="#hansard">Most recent appearances</a></li>';
        }
        echo '<li><a href="#numbers">Numerology</a></li>';
        if (isset($extra_info['register_member_interests_html'])) {
            echo '<li><a href="#register">Register of Members&rsquo; Interests</a></li>';
        }
        if (isset($extra_info['expenses2004_col1']) || isset($extra_info['expenses2006_col1']) || isset($extra_info['expenses2007_col1']) || isset($extra_info['expenses2008_col1'])) {
            echo '<li><a href="#expenses">Expenses</a></li>';
        }
        if (isset($extra_info['edm_ais_url'])) {
            ?>
						<li><a href="<?php 
            echo $extra_info['edm_ais_url'];
            ?>
">Early Day Motions signed by this MP</a> <small>(From edmi.parliament.uk)</small></li>
<?php 
        }
        ?>
						</ul>
<?php 
        # Big don't-print for SF MPs
        $chairmens_panel = false;
        if (in_array(1, $member['houses']) && $member['party'] != 'Sinn Fein' || in_array(2, $member['houses'])) {
            // Voting Record.
            ?>
 <a name="votingrecord"></a> <?php 
            //$this->block_start(array('id'=>'votingrecord', 'title'=>'Voting record (from PublicWhip)'));
            print '<h4>Voting record (from PublicWhip)</h4>';
            $displayed_stuff = 0;
            function display_dream_comparison($extra_info, $member, $dreamid, $desc, $inverse, $search)
            {
                if (isset($extra_info["public_whip_dreammp{$dreamid}_distance"])) {
                    if ($extra_info["public_whip_dreammp{$dreamid}_both_voted"] == 0) {
                        $dmpdesc = 'Has <strong>never voted</strong> on';
                    } else {
                        $dmpscore = floatval($extra_info["public_whip_dreammp{$dreamid}_distance"]);
                        print "<!-- distance {$dreamid}: {$dmpscore} -->";
                        if ($inverse) {
                            $dmpscore = 1.0 - $dmpscore;
                        }
                        $english = score_to_strongly($dmpscore);
                        if ($extra_info["public_whip_dreammp{$dreamid}_both_voted"] == 1) {
                            $english = preg_replace('#(very )?(strongly|moderately) #', '', $english);
                        }
                        $dmpdesc = 'Voted <strong>' . $english . '</strong>';
                        // How many votes Dream MP and MP both voted (and didn't abstain) in
                        // $extra_info["public_whip_dreammp${dreamid}_both_voted"];
                    }
                    $search_link = WEBPATH . "search/?s=" . urlencode($search) . "&pid=" . $member['person_id'] . "&pop=1";
                    ?>
				<li>
				<?php 
                    echo $dmpdesc;
                    ?>
			<?php 
                    echo $desc;
                    ?>
. 
<small class="unneededprintlinks"> 
<a href="http://www.publicwhip.org.uk/mp.php?mpid=<?php 
                    echo $member['member_id'];
                    ?>
&amp;dmp=<?php 
                    echo $dreamid;
                    ?>
">votes</a>,
<a href="<?php 
                    echo $search_link;
                    ?>
">speeches</a>
</small>

				</li>
<?php 
                    return true;
                }
                return false;
            }
            if ($member['party'] == 'Speaker' || $member['party'] == 'Deputy Speaker') {
                if ($member['party'] == 'Speaker') {
                    $art = 'the';
                } else {
                    $art = 'a';
                }
                echo "<p>As {$art} {$member['party']}, {$member['full_name']} cannot vote (except to break a tie).</p>";
            }
            if (isset($extra_info["public_whip_dreammp230_distance"]) || isset($extra_info["public_whip_dreammp996_distance"])) {
                # XXX
                $displayed_stuff = 1;
                ?>


	<p id="howvoted">How <?php 
                echo $member['full_name'];
                ?>
 voted on key issues since 2001:</p>
	<ul id="dreamcomparisons">
	<?php 
                $got_dream = false;
                $got_dream |= display_dream_comparison($extra_info, $member, 996, "a <strong>transparent Parliament</strong>", false, '"freedom of information"');
                if (in_array(1, $member['houses'])) {
                    $got_dream |= display_dream_comparison($extra_info, $member, 811, "introducing a <strong>smoking ban</strong>", false, "smoking");
                }
                #$got_dream |= display_dream_comparison($extra_info, $member, 856, "the <strong>changes to parliamentary scrutiny in the <a href=\"http://en.wikipedia.org/wiki/Legislative_and_Regulatory_Reform_Bill\">Legislative and Regulatory Reform Bill</a></strong>", false, "legislative and regulatory reform bill");
                $got_dream |= display_dream_comparison($extra_info, $member, 1051, "introducing <strong>ID cards</strong>", false, "id cards");
                $got_dream |= display_dream_comparison($extra_info, $member, 363, "introducing <strong>foundation hospitals</strong>", false, "foundation hospital");
                $got_dream |= display_dream_comparison($extra_info, $member, 1052, "introducing <strong>student top-up fees</strong>", false, "top-up fees");
                if (in_array(1, $member['houses'])) {
                    $got_dream |= display_dream_comparison($extra_info, $member, 1053, "Labour's <strong>anti-terrorism laws</strong>", false, "terrorism");
                }
                $got_dream |= display_dream_comparison($extra_info, $member, 1049, "the <strong>Iraq war</strong>", false, "iraq");
                $got_dream |= display_dream_comparison($extra_info, $member, 975, "an <strong>investigation</strong> into the Iraq war", false, "iraq");
                $got_dream |= display_dream_comparison($extra_info, $member, 984, "replacing <strong>Trident</strong>", false, "trident");
                $got_dream |= display_dream_comparison($extra_info, $member, 1050, "the <strong>hunting ban</strong>", false, "hunting");
                $got_dream |= display_dream_comparison($extra_info, $member, 826, "equal <strong>gay rights</strong>", false, "gay");
                $got_dream |= display_dream_comparison($extra_info, $member, 1030, "laws to <strong>stop climate change</strong>", false, "climate change");
                if (!$got_dream) {
                    print "<li>" . $member['full_name'] . " has not voted enough in this parliament to have any scores.</li>";
                }
                print '</ul>';
                ?>
<p class="italic">
<small>Read about <a href="<?php 
                echo WEBPATH;
                ?>
help/#votingrecord">how the voting record is decided</a>.</small>
</p>

<?php 
            }
            ?>

<?php 
            // Links to full record at Guardian and Public Whip
            $record = array();
            if (isset($extra_info['guardian_howtheyvoted'])) {
                $record[] = '<a href="' . $extra_info['guardian_howtheyvoted'] . '" title="At The Guardian">well-known issues</a> <small>(from the Guardian)</small>';
            }
            if (isset($extra_info['public_whip_division_attendance']) && $extra_info['public_whip_division_attendance'] != 'n/a') {
                $record[] = '<a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' . $member['member_id'] . '&amp;showall=yes#divisions" title="At Public Whip">their full record</a>';
            }
            if (count($record) > 0) {
                $displayed_stuff = 1;
                ?>
			<p>More on <?php 
                echo implode(' &amp; ', $record);
                ?>
</p>
<?php 
            }
            // Rebellion rate
            if (isset($extra_info['public_whip_rebellions']) && $extra_info['public_whip_rebellions'] != 'n/a') {
                $displayed_stuff = 1;
                ?>
					<ul>
							<li><a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/<?php 
                echo $member['member_id'];
                ?>
#divisions" title="See more details at Public Whip">
                        <strong><?php 
                echo htmlentities(ucfirst($extra_info['public_whip_rebel_description']));
                ?>
 rebels</strong></a> against their party<?php 
                if (isset($extra_info['public_whip_rebelrank'])) {
                    echo " in this parliament";
                    /* &#8212; ";
                    			if (isset($extra_info['public_whip_rebelrank_joint']))
                    				print 'joint ';
                    			echo make_ranking($extra_info['public_whip_rebelrank']);
                    			echo " most rebellious of ";
                    			echo $extra_info['public_whip_rebelrank_outof'];
                    			echo ($member['house']=='House of Commons') ? " MPs" : ' Lords';
                    			*/
                }
                ?>
.
			</li>
		</ul><?php 
            }
            if (!$displayed_stuff) {
                print '<p>No data to display yet.</p>';
            }
            # Topics of interest only for MPs at the moment
            if ($member['current_member'][1]) {
                # in_array(1, $member['houses'])
                ?>
	<a name="topics"></a>
    <h4>Committees and topics of interest</h4>
		<?php 
                $topics_block_empty = true;
                // Select committee membership
                if (array_key_exists('office', $extra_info)) {
                    $mins = array();
                    foreach ($extra_info['office'] as $row) {
                        if ($row['to_date'] == '9999-12-31' && $row['source'] == 'chgpages/selctee') {
                            $m = prettify_office($row['position'], $row['dept']);
                            if ($row['from_date'] != '2004-05-28') {
                                $m .= ' <small>(since ' . format_date($row['from_date'], SHORTDATEFORMAT) . ')</small>';
                            }
                            $mins[] = $m;
                            if ($row['dept'] == "Chairmen's Panel Committee") {
                                $chairmens_panel = true;
                            }
                        }
                    }
                    if ($mins) {
                        print "<h5>Select Committee membership</h5>";
                        print "<ul>";
                        foreach ($mins as $min) {
                            print '<li>' . $min . '</li>';
                        }
                        print "</ul>";
                        $topics_block_empty = false;
                    }
                }
                $wrans_dept = false;
                $wrans_dept_1 = null;
                $wrans_dept_2 = null;
                if (isset($extra_info['wrans_departments'])) {
                    $wrans_dept = true;
                    $wrans_dept_1 = "<li><strong>Departments:</strong> " . $extra_info['wrans_departments'] . "</p>";
                }
                if (isset($extra_info['wrans_subjects'])) {
                    $wrans_dept = true;
                    $wrans_dept_2 = "<li><strong>Subjects (based on headings added by Hansard):</strong> " . $extra_info['wrans_subjects'] . "</p>";
                }
                if ($wrans_dept) {
                    print "<p><strong>Asks most questions about</strong></p>";
                    print "<ul>";
                    if ($wrans_dept_1) {
                        print $wrans_dept_1;
                    }
                    if ($wrans_dept_2) {
                        print $wrans_dept_2;
                    }
                    print "</ul>";
                    $topics_block_empty = false;
                    $WRANSURL = new URL('search');
                    $WRANSURL->insert(array('pid' => $member['person_id'], 's' => 'section:wrans', 'pop' => 1));
                    ?>
							<p><small>(based on <a href="<?php 
                    echo $WRANSURL->generate();
                    ?>
">written questions asked by <?php 
                    echo $member['full_name'];
                    ?>
</a> and answered by departments)</small></p><?php 
                }
                # Public Bill Committees
                if (count($extra_info['pbc'])) {
                    $topics_block_empty = false;
                    print '<h5>Public Bill Committees <small>(sittings attended)</small></h5>';
                    if ($member['party'] == 'Scottish National Party') {
                        echo '<p><em>SNP MPs only attend sittings where the legislation pertains to Scotland.</em></p>';
                    }
                    echo '<ul>';
                    foreach ($extra_info['pbc'] as $bill_id => $arr) {
                        print '<li>';
                        if ($arr['chairman']) {
                            print 'Chairman, ';
                        }
                        print '<a href="/pbc/' . $arr['session'] . '/' . urlencode($arr['title']) . '">' . $arr['title'] . ' Committee</a> <small>(' . $arr['attending'] . ' out of ' . $arr['outof'] . ')</small>';
                    }
                    print '</ul>';
                }
                if ($topics_block_empty) {
                    print "<p><em>This MP is not currently on any select or public bill committee\nand has had no written questions answered for which we know the department or subject.</em></p>";
                }
            }
        }
        if (!in_array(1, $member['houses']) || $member['party'] != 'Sinn Fein' || in_array(3, $member['houses'])) {
            ?>
		<a name="hansard"></a> <?php 
            $title = 'Most recent appearances';
            if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
                $title = '<a href="' . WEBPATH . $rssurl . '"><img src="' . WEBPATH . 'images/rss.gif" alt="RSS feed" border="0" align="right"></a> ' . $title;
            }
            print "<h4>{$title}</h4>";
            //$this->block_start(array('id'=>'hansard', 'title'=>$title));
            // This is really far from ideal - I don't really want $PAGE to know
            // anything about HANSARDLIST / DEBATELIST / WRANSLIST.
            // But doing this any other way is going to be a lot more work for little
            // benefit unfortunately.
            twfy_debug_timestamp();
            $HANSARDLIST = new HANSARDLIST();
            $searchstring = "speaker:{$member['person_id']}";
            global $SEARCHENGINE;
            $SEARCHENGINE = new SEARCHENGINE($searchstring);
            $args = array('s' => $searchstring, 'p' => 1, 'num' => 3, 'pop' => 1, 'o' => 'd');
            $HANSARDLIST->display('search_min', $args);
            twfy_debug_timestamp();
            $MOREURL = new URL('search');
            $MOREURL->insert(array('pid' => $member['person_id'], 'pop' => 1));
            ?>
	<p id="moreappear"><a href="<?php 
            echo $MOREURL->generate();
            ?>
#n4">More of <?php 
            echo ucfirst($member['full_name']);
            ?>
's recent appearances</a></p>

<?php 
            if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
                // If we set an RSS feed for this page.
                $HELPURL = new URL('help');
                ?>
					<p class="unneededprintlinks"><a href="<?php 
                echo WEBPATH . $rssurl;
                ?>
" title="XML version of this person's recent appearances">RSS feed</a> (<a href="<?php 
                echo $HELPURL->generate();
                ?>
#rss" title="An explanation of what RSS feeds are for">?</a>)</p>
<?php 
            }
            //	$this->block_end();
        }
        # End Sinn Fein
        ?>
 <a name="numbers"></a> <?php 
        //$this->block_start(array('id'=>'numbers', 'title'=>'Numerology'));
        print "<h4>Numerology</h4>";
        $displayed_stuff = 0;
        ?>
		<p><em>Please note that numbers do not measure quality. 
		Also, representatives may do other things not currently covered
		by this site.</em> (<a href="<?php 
        echo WEBPATH;
        ?>
help/#numbers">More about this</a>)</p>
<ul>
<?php 
        $since_text = 'in the last year';
        #if ($member['entered_house'] > '2005-05-05')
        #	$since_text = 'since joining Parliament';
        $MOREURL = new URL('search');
        $section = 'section:debates section:whall section:lords section:ni';
        $MOREURL->insert(array('pid' => $member['person_id'], 's' => $section, 'pop' => 1));
        if ($member['party'] != 'Sinn Fein') {
            $displayed_stuff |= display_stats_line('debate_sectionsspoken_inlastyear', 'Has spoken in <a href="' . $MOREURL->generate() . '">', 'debate', '</a> ' . $since_text, '', $extra_info);
            $MOREURL->insert(array('pid' => $member['person_id'], 's' => 'section:wrans', 'pop' => 1));
            // We assume that if they've answered a question, they're a minister
            $minister = 0;
            $Lminister = false;
            if (isset($extra_info['wrans_answered_inlastyear']) && $extra_info['wrans_answered_inlastyear'] > 0 && $extra_info['wrans_asked_inlastyear'] == 0) {
                $minister = 1;
            }
            if (isset($extra_info['Lwrans_answered_inlastyear']) && $extra_info['Lwrans_answered_inlastyear'] > 0 && $extra_info['Lwrans_asked_inlastyear'] == 0) {
                $Lminister = true;
            }
            if ($member['party'] == 'Speaker' || $member['party'] == 'Deputy Speaker') {
                $minister = 2;
            }
            $displayed_stuff |= display_stats_line('wrans_asked_inlastyear', 'Has received answers to <a href="' . $MOREURL->generate() . '">', 'written question', '</a> ' . $since_text, '', $extra_info, $minister, $Lminister);
        }
        if (isset($extra_info['select_committees'])) {
            print "<li>Is a member of <strong>{$extra_info['select_committees']}</strong> select committee";
            if ($extra_info['select_committees'] != 1) {
                print "s";
            }
            if (isset($extra_info['select_committees_chair'])) {
                print " ({$extra_info['select_committees_chair']} as chair)";
            }
            print '.</li>';
        }
        $wtt_displayed = display_writetothem_numbers(2008, $extra_info);
        $displayed_stuff |= $wtt_displayed;
        if (!$wtt_displayed) {
            $wtt_displayed = display_writetothem_numbers(2007, $extra_info);
            $displayed_stuff |= $wtt_displayed;
            if (!$wtt_displayed) {
                $wtt_displayed = display_writetothem_numbers(2006, $extra_info);
                $displayed_stuff |= $wtt_displayed;
                if (!$wtt_displayed) {
                    $displayed_stuff |= display_writetothem_numbers(2005, $extra_info);
                }
            }
        }
        $after_stuff = ' <small>(From Public Whip)</small>';
        if ($member['party'] == 'Scottish National Party') {
            $after_stuff .= '<br><em>Note SNP MPs do not vote on legislation not affecting Scotland.</em>';
        } elseif ($member['party'] == 'Speaker' || $member['party'] == 'Deputy Speaker') {
            $after_stuff .= '<br><em>Speakers and deputy speakers cannot vote except to break a tie.</em>';
        }
        if ($member['party'] != 'Sinn Fein') {
            $displayed_stuff |= display_stats_line('public_whip_division_attendance', 'Has voted in <a href="http://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/' . $member['member_id'] . '&amp;showall=yes#divisions" title="See more details at Public Whip">', 'of vote', '</a> in parliament with this affiliation', $after_stuff, $extra_info);
            if ($chairmens_panel) {
                print '<br><em>Members of the Chairmen\'s Panel act for the Speaker when chairing things such as Public Bill Committees, and as such do not vote on Bills they are involved in chairing.</em>';
            }
            $displayed_stuff |= display_stats_line('comments_on_speeches', 'People have made <a href="' . WEBPATH . 'comments/recent/?pid=' . $member['person_id'] . '">', 'annotation', "</a> on this MP&rsquo;s speeches", '', $extra_info);
            $displayed_stuff |= display_stats_line('reading_age', 'This MP\'s speeches, in Hansard, are readable by an average ', '', ' year old, going by the <a href="http://en.wikipedia.org/wiki/Flesch-Kincaid_Readability_Test">Flesch-Kincaid Grade Level</a> score', '', $extra_info);
        }
        if (isset($extra_info['number_of_alerts'])) {
            $displayed_stuff = 1;
            ?>
		<li><strong><?php 
            echo htmlentities($extra_info['number_of_alerts']);
            ?>
</strong> <?php 
            echo $extra_info['number_of_alerts'] == 1 ? 'person is' : 'people are';
            ?>
 tracking whenever <?php 
            if ($member['house_disp'] == 1) {
                print 'this MP';
            } elseif ($member['house_disp'] == 2) {
                print 'this peer';
            } elseif ($member['house_disp'] == 3) {
                print 'this MLA';
            } elseif ($member['house_disp'] == 4) {
                print 'this MSP';
            } elseif ($member['house_disp'] == 0) {
                print $member['full_name'];
            }
            ?>
 speaks<?php 
            if ($member['current_member'][0] || $member['current_member'][2] || $member['current_member'][3] || $member['current_member'][1] && $member['party'] != 'Sinn Fein' || $member['current_member'][4]) {
                print ' &mdash; <a href="' . WEBPATH . 'alert/?only=1&amp;pid=' . $member['person_id'] . '">email me whenever ' . $member['full_name'] . ' speaks</a>';
            }
            print '.</li>';
        }
        if ($member['party'] != 'Sinn Fein') {
            $displayed_stuff |= display_stats_line('three_word_alliterations', 'Has used three-word alliterative phrases (e.g. "she sells seashells") ', 'time', ' in debates', ' <small>(<a href="' . WEBPATH . 'help/#numbers">Why is this here?</a>)</small>', $extra_info);
            if (isset($extra_info['three_word_alliteration_content'])) {
                print "\n<!-- " . $extra_info['three_word_alliteration_content'] . " -->\n";
            }
        }
        #		$displayed_stuff |= display_stats_line('ending_with_a_preposition', "Has ended a sentence with 'with' ", 'time', ' in debates', '', $extra_info);
        #		$displayed_stuff |= display_stats_line('only_asked_why', "Has made a speech consisting solely of 'Why?' ", 'time', ' in debates', '', $extra_info);
        ?>
						</ul>
<?php 
        if (!$displayed_stuff) {
            print '<p>No data to display yet.</p>';
        }
        //$this->block_end();
        if (isset($extra_info['register_member_interests_html'])) {
            ?>
				
<a name="register"></a>
<?php 
            print "<h4>Register of Members' Interests</h4>";
            if ($extra_info['register_member_interests_html'] != '') {
                echo $extra_info['register_member_interests_html'];
            } else {
                echo "\t\t\t\t<p>Nil</p>\n";
            }
            echo '<p class="italic">';
            if (isset($extra_info['register_member_interests_date'])) {
                echo 'Register last updated: ';
                echo format_date($extra_info['register_member_interests_date'], SHORTDATEFORMAT);
                echo '. ';
            }
            echo '<a href="http://www.publications.parliament.uk/pa/cm/cmregmem/061106/memi01.htm">More about the Register</a>';
            echo '</p>';
            print '<p><strong><a href="' . WEBPATH . 'regmem/?p=' . $member['person_id'] . '">View the history of this MP\'s entries in the Register</a></strong></p>';
        }
        if (isset($extra_info['expenses2004_col1']) || isset($extra_info['expenses2006_col1']) || isset($extra_info['expenses2007_col1']) || isset($extra_info['expenses2008_col1'])) {
            include_once INCLUDESPATH . 'easyparliament/expenses.php';
            ?>
<a name="expenses"></a>
<?php 
            $title = 'Expenses';
            print "<h4>" . $title . "</h4>";
            echo expenses_display_table($extra_info);
        }
    }