示例#1
0
		foreach ($member['other_parties'] as $r) {
			$out[] = 'from ' . $r['from'] . ' on ' . format_date($r['date'], SHORTDATEFORMAT);
		}
		print join('; ', $out);
		print '</li>';
	}

	// Ministerial positions
	if (array_key_exists('office', $extra_info)) {
		person_offices($extra_info);
	}

echo '</ul>';

//if dummy image, show message asking for a photo
if (!exists_rep_image($member['person_id'])) {
	person_ask_for_picture($member);
}

echo '<ul class="hilites clear">';
	person_enter_leave_facts($member, $extra_info);
	person_majority($extra_info);
	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">';

person_user_actions($member);
person_internal_links($member, $extra_info);
示例#2
0
文件: page.php 项目: palfrey/twfy
    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);
        }
    }