本文整理汇总了PHP中prettify_office函数的典型用法代码示例。如果您正苦于以下问题:PHP prettify_office函数的具体用法?PHP prettify_office怎么用?PHP prettify_office使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prettify_office函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search_by_usage
function search_by_usage($search, $house = 0)
{
$data = array();
$SEARCHENGINE = new SEARCHENGINE($search);
$data['pagetitle'] = $SEARCHENGINE->query_description_short();
$SEARCHENGINE = new SEARCHENGINE($search . ' groupby:speech');
$count = $SEARCHENGINE->run_count(0, 5000, 'date');
if ($count <= 0) {
$data['error'] = 'No results';
return $data;
}
$SEARCHENGINE->run_search(0, 5000, 'date');
$gids = $SEARCHENGINE->get_gids();
if (count($gids) <= 0) {
$data['error'] = 'No results';
return $data;
}
if (count($gids) == 5000) {
$data['limit_reached'] = true;
}
# Fetch all the speakers of the results, count them up and get min/max date usage
$speaker_count = array();
$gids = join('","', $gids);
$db = new ParlDB();
$q = $db->query('SELECT gid,person_id,hdate FROM hansard WHERE gid IN ("' . $gids . '")');
for ($n = 0; $n < $q->rows(); $n++) {
$gid = $q->field($n, 'gid');
$person_id = $q->field($n, 'person_id');
$hdate = $q->field($n, 'hdate');
if (!isset($speaker_count[$person_id])) {
$speaker_count[$person_id] = 0;
$maxdate[$person_id] = '1001-01-01';
$mindate[$person_id] = '9999-12-31';
}
$speaker_count[$person_id]++;
if ($hdate < $mindate[$person_id]) {
$mindate[$person_id] = $hdate;
}
if ($hdate > $maxdate[$person_id]) {
$maxdate[$person_id] = $hdate;
}
}
# Fetch details of all the speakers
$speakers = array();
$pids = array();
if (count($speaker_count)) {
$person_ids = join(',', array_keys($speaker_count));
$q = $db->query('SELECT member_id, member.person_id, title, given_name, family_name, lordofname,
constituency, house, party,
moffice_id, dept, position, from_date, to_date, left_house
FROM member LEFT JOIN moffice ON member.person_id = moffice.person
JOIN person_names pn ON member.person_id = pn.person_id AND pn.type="name" AND pn.start_date <= left_house AND left_house <= pn.end_date
WHERE member.person_id IN (' . $person_ids . ')
' . ($house ? " AND house={$house}" : '') . '
ORDER BY left_house DESC');
for ($n = 0; $n < $q->rows(); $n++) {
$mid = $q->field($n, 'member_id');
if (!isset($pids[$mid])) {
$title = $q->field($n, 'title');
$first = $q->field($n, 'given_name');
$last = $q->field($n, 'family_name');
$lordofname = $q->field($n, 'lordofname');
$house = $q->field($n, 'house');
$party = $q->field($n, 'party');
$full_name = ucfirst(member_full_name($house, $title, $first, $last, $lordofname));
$pid = $q->field($n, 'person_id');
$pids[$mid] = $pid;
$speakers[$pid]['house'] = $house;
$speakers[$pid]['left'] = $q->field($n, 'left_house');
}
$dept = $q->field($n, 'dept');
$posn = $q->field($n, 'position');
$moffice_id = $q->field($n, 'moffice_id');
if ($dept && $q->field($n, 'to_date') == '9999-12-31') {
$speakers[$pid]['office'][$moffice_id] = prettify_office($posn, $dept);
}
if (!isset($speakers[$pid]['name'])) {
$speakers[$pid]['name'] = $full_name . ($house == 1 ? ' MP' : '');
$speakers[$pid]['party'] = $party;
}
}
}
if (isset($speaker_count[0])) {
$speakers[0] = array('party' => '', 'name' => 'Headings, procedural text, etc.', 'house' => 0, 'count' => 0);
}
$party_count = array();
$ok = 0;
foreach ($speakers as $pid => &$speaker) {
$speaker['count'] = $speaker_count[$pid];
$speaker['pmaxdate'] = $maxdate[$pid];
$speaker['pmindate'] = $mindate[$pid];
$ok = 1;
if (!isset($party_count[$speaker['party']])) {
$party_count[$speaker['party']] = 0;
}
$party_count[$speaker['party']] += $count;
}
function sort_by_count($a, $b)
{
if ($a['count'] > $b['count']) {
//.........这里部分代码省略.........
示例2: _get_speaker
function _get_speaker($speaker_id, $hdate)
{
// Pass it the id of a speaker. If $this->speakers doesn't
// already contain data about the speaker, it's fetched from the DB
// and put in $this->speakers.
// So we don't have to keep fetching the same speaker info about chatterboxes.
if ($speaker_id != 0) {
if (!isset($this->speakers[$speaker_id])) {
// Speaker isn't cached, so fetch the data.
$q = $this->db->query("SELECT title, first_name,\n\t\t\t\t\t\t\t\t\t\tlast_name,\n\t\t\t\t\t\t\t\t\t\thouse,\n\t\t\t\t\t\t\t\t\t\tconstituency,\n\t\t\t\t\t\t\t\t\t\tparty,\n person_id\n\t\t\t\t\t\t\t\tFROM \tmember\n\t\t\t\t\t\t\t\tWHERE\tmember_id = '" . mysql_escape_string($speaker_id) . "'\n\t\t\t\t\t\t\t\t");
if ($q->rows() > 0) {
// *SHOULD* only get one row back here...
$house = $q->field(0, 'house');
if ($house == 1) {
$URL = new URL('mp');
} elseif ($house == 2) {
$URL = new URL('peer');
} elseif ($house == 3) {
$URL = new URL('mla');
} elseif ($house == 4) {
$URL = new URL('msp');
} elseif ($house == 0) {
$URL = new URL('royal');
}
$URL->insert(array('m' => $speaker_id));
$speaker = array('member_id' => $speaker_id, 'title' => $q->field(0, 'title'), "first_name" => $q->field(0, "first_name"), "last_name" => $q->field(0, "last_name"), 'house' => $q->field(0, 'house'), "constituency" => $q->field(0, "constituency"), "party" => $q->field(0, "party"), "person_id" => $q->field(0, "person_id"), "url" => $URL->generate());
global $parties;
// Manual fix for Speakers.
if (isset($parties[$speaker['party']])) {
$speaker['party'] = $parties[$speaker['party']];
}
$q = $this->db->query("SELECT dept, position FROM moffice WHERE person={$speaker['person_id']}\n\t\t\t\t\t\t\t\tAND to_date>='{$hdate}' AND from_date<='{$hdate}'");
if ($q->rows() > 0) {
for ($row = 0; $row < $q->rows(); $row++) {
$dept = $q->field($row, 'dept');
$pos = $q->field($row, 'position');
if ($pos && $pos != 'Chairman') {
$speaker['office'][] = array('dept' => $dept, 'position' => $pos, 'pretty' => prettify_office($pos, $dept));
}
}
}
$this->speakers[$speaker_id] = $speaker;
return $speaker;
} else {
return array();
}
} else {
// Already cached, so just return that.
return $this->speakers[$speaker_id];
}
} else {
return array();
}
}
示例3: person_committees_and_topics
function person_committees_and_topics($member, $extra_info) {
$chairmens_panel = false;
echo '<a name="topics"></a>
<h2>Topics of interest</h2>';
$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 "<h3>Select Committee membership</h3>";
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="<?=$WRANSURL->generate()?>">written questions asked by <?=$member['full_name']?></a> and answered by departments)</small></p><?
}
# Public Bill Committees
if (count($extra_info['pbc'])) {
$topics_block_empty = false;
print '<h3>Public Bill Committees <small>(sittings attended)</small></h3>';
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 public bill committee
and has had no written questions answered for which we know the department or subject.</em></p>";
}
$member['chairmens_panel'] = $chairmens_panel;
}
示例4: render_mps_row
function render_mps_row($mp, &$style, $order, $MPURL)
{
// Stripes
$style = $style == '1' ? '2' : '1';
$name = member_full_name(1, $mp['title'], $mp['first_name'], $mp['last_name'], $mp['constituency']);
$url = $MPURL->generate() . make_member_url($mp['first_name'] . ' ' . $mp['last_name'], $mp['constituency'], 1);
# $MPURL->insert(array('pid'=>$mp['person_id']));
list($image, $sz) = find_rep_image($mp['person_id'], true);
?>
<tr>
<td class="row">
<?php
if ($image) {
echo '<a href="', $url, '">', '<img class="portrait" alt="" src="', $image, '">', '</a>';
}
?>
</td>
<td class="row-<?php
echo $style;
?>
"><a href="<?php
echo $MPURL->generate() . make_member_url($mp['first_name'] . ' ' . $mp['last_name'], $mp['constituency'], 1);
?>
"><?php
echo $name;
?>
</a></td>
<td class="row-<?php
echo $style;
?>
"><?php
echo $mp['party'];
?>
</td>
<td class="row-<?php
echo $style;
?>
"><?php
echo $mp['constituency'];
?>
</td>
<td class="row-<?php
echo $style;
?>
"><?php
if (is_array($mp['dept'])) {
print join('<br>', array_map('manymins', $mp['pos'], $mp['dept']));
} elseif ($mp['dept'] || $mp['pos']) {
print prettify_office($mp['pos'], $mp['dept']);
} else {
print ' ';
}
?>
</td>
<?php
if ($order == 'expenses') {
?>
<td class="row-<?php
echo $style;
?>
">£<?php
echo number_format($mp['data_value']);
?>
</td>
<?php
} elseif ($order == 'debates') {
?>
<td class="row-<?php
echo $style;
?>
"><?php
echo number_format($mp['data_value']);
?>
</td>
<?php
} elseif ($order == 'safety') {
?>
<td class="row-<?php
echo $style;
?>
"><?php
echo $mp['data_value'];
?>
</td>
<?php
}
?>
</tr>
<?php
}
示例5: round
$dist_miles = round($dist / 1.609344, 0);
$out .= ' <small title="Centre to centre">(' . $dist_miles . ' miles)</small>';
$out .= '</li>';
}
$out .= '</ul>';
$sidebars[] = array('type' => 'html', 'content' => '<div class="block"><h4>Nearby constituencies</h4><div class="blockbody">' . $out . ' </div></div>');
}
}
}
if (array_key_exists('office', $MEMBER->extra_info())) {
$office = $MEMBER->extra_info();
$office = $office['office'];
$mins = '';
foreach ($office as $row) {
if ($row['to_date'] != '9999-12-31') {
$mins .= '<li>' . prettify_office($row['position'], $row['dept']);
$mins .= ' (';
if (!($row['source'] == 'chgpages/selctee' && $row['from_date'] == '2004-05-28') && !($row['source'] == 'chgpages/privsec' && $row['from_date'] == '2004-05-13')) {
if ($row['source'] == 'chgpages/privsec' && $row['from_date'] == '2005-11-10') {
$mins .= 'before ';
}
$mins .= format_date($row['from_date'], SHORTDATEFORMAT) . ' ';
}
$mins .= 'to ';
if ($row['source'] == 'chgpages/privsec' && $row['to_date'] == '2005-11-10') {
$mins .= 'before ';
}
$mins .= format_date($row['to_date'], SHORTDATEFORMAT);
$mins .= ')</li>';
}
}
示例6: offices
/**
* Offices
*
* Return an array of Office objects held (or previously held) by the member.
*
* @param string $include_only Restrict the list to include only "previous" or "current" offices.
* @param bool $priority_only Restrict the list to include only positions in the $priority_offices list.
*
* @return array An array of Office objects.
*/
public function offices($include_only = NULL, $priority_only = FALSE)
{
$out = array();
if (array_key_exists('office', $this->extra_info())) {
$office = $this->extra_info();
$office = $office['office'];
foreach ($office as $row) {
$office_title = prettify_office($row['position'], $row['dept']);
if ($officeObject = $this->getOfficeObject($include_only, $priority_only, $office_title, $row)) {
$out[] = $officeObject;
}
}
}
return $out;
}
示例7: MEMBER
exit;
}
$member = new MEMBER(array('person_id' => $pid));
if (!$member->valid) {
print '<error>Unknown ID</error>';
exit;
}
$member->load_extra_info();
$row = array('person_id' => $pid, 'full_name' => $member->full_name(), 'constituency' => $member->constituency(), 'party' => $member->party_text(), 'majority_in_seat' => number_format($member->extra_info['majority_in_seat']), 'swing_to_lose_seat_today' => number_format($member->extra_info['swing_to_lose_seat_today']));
list($image, $sz) = find_rep_image($pid, true);
if ($image) {
$row['image'] = $image;
}
foreach ($member->extra_info['office'] as $office) {
if ($office['to_date'] == '9999-12-31' && $office['source'] == 'chgpages/selctee') {
$row['selctee'][] = prettify_office($office['position'], $office['dept']);
}
}
$none = false;
$output = array();
$pw_keys = array_filter(array_keys($member->extra_info), create_function('$a', '
if (substr($a, 0, 11) != "public_whip") return false;
if (substr($a, -7) == "_absent") return false;
return true;
'));
sort($pw_keys);
foreach ($pw_keys as $key) {
$value = $member->extra_info[$key];
$key = str_replace(array('public_whip_dreammp', '_distance'), '', $key);
if ($none) {
$none = false;
示例8: display_member
//.........这里部分代码省略.........
$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 ' — ' . $member['entered_house'][2]['reason'];
}
示例9: render_peers_row
function render_peers_row($peer, &$style, $order, $URL)
{
global $parties;
// Stripes
$style = $style == '1' ? '2' : '1';
if (array_key_exists($peer['party'], $parties)) {
$party = $parties[$peer['party']];
} else {
$party = $peer['party'];
}
# $MPURL->insert(array('pid'=>$peer['person_id']));
?>
<tr>
<td class="row">
<?php
list($image, $sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($peer['person_id'], true, 'lord');
if ($image) {
echo '<a href="' . $URL->generate() . $peer['url'] . '" class="speakerimage"><img height="59" alt="" src="', $image, '"';
echo '></a>';
}
?>
</td>
<td class="row-<?php
echo $style;
?>
"><a href="<?php
echo $URL->generate() . $peer['url'];
?>
"><?php
echo ucfirst($peer['name']);
?>
</a></td>
<td class="row-<?php
echo $style;
?>
"><?php
echo $party;
?>
</td>
<td class="row-<?php
echo $style;
?>
"><?php
if (is_array($peer['dept'])) {
print join('<br>', array_map('manymins', $peer['pos'], $peer['dept']));
} elseif ($peer['dept']) {
print prettify_office($peer['pos'], $peer['dept']);
} else {
print ' ';
}
?>
</td>
</tr>
<?php
}
示例10: display_member
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) {
//.........这里部分代码省略.........
示例11: _get_speaker_offices
private function _get_speaker_offices($speaker, $hdate)
{
$offices = array();
$q = $this->db->query("SELECT dept, position, source FROM moffice\n WHERE person=:person_id\n AND from_date <= :hdate and :hdate <= to_date", array(':person_id' => $speaker['person_id'], ':hdate' => $hdate));
$rows = $q->rows();
if (!$rows) {
return $offices;
}
for ($row = 0; $row < $rows; $row++) {
$dept = $q->field($row, 'dept');
$pos = $q->field($row, 'position');
$source = $q->field($row, 'source');
if ($source == 'chgpages/libdem' && $hdate > '2009-01-15') {
continue;
}
if (!$pos || $pos == 'Chairman' || $pos == 'Member') {
continue;
}
$offices[] = array('dept' => $dept, 'position' => $pos, 'source' => $source, 'pretty' => prettify_office($pos, $dept));
}
return $offices;
}
示例12: display_member
//.........这里部分代码省略.........
$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 ' — ' . $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 ' — ' . $member['left_house'][1]['reason'];
}
print '</li>';
}
} elseif (isset($member['entered_house'][2]['date'])) {
print '<li><strong>Became a Senator ';
示例13: render_mps_row
function render_mps_row($mp, &$style, $order, $MPURL, $letter = false)
{
// Stripes
$style = $style == '1' ? '2' : '1';
# $MPURL->insert(array('pid'=>$mp['person_id']));
?>
<tr>
<td class="row">
<?php
if ($letter) {
echo '<a name="' . $letter . '"></a>';
}
list($image, $sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($mp['person_id'], true, true);
if ($image) {
echo '<a href="' . $MPURL->generate() . $mp['url'] . '" class="speakerimage"><img height="59" alt="" src="', $image, '"';
echo '></a>';
}
?>
</td>
<td class="row-<?php
echo $style;
?>
"><a href="<?php
echo $MPURL->generate() . $mp['url'];
?>
"><?php
echo $mp['name'];
?>
</a>
<?php
if ($mp['left_reason'] == 'general_election_not_standing') {
print '<br><em>Standing down</em>';
}
?>
</td>
<td class="row-<?php
echo $style;
?>
"><?php
echo $mp['party'];
?>
</td>
<td class="row-<?php
echo $style;
?>
"><?php
echo $mp['constituency'];
?>
</td>
<td class="row-<?php
echo $style;
?>
"><?php
if (is_array($mp['pos'])) {
print join('<br>', array_map('prettify_office', $mp['pos'], $mp['dept']));
} elseif ($mp['pos'] || $mp['dept']) {
print prettify_office($mp['pos'], $mp['dept']);
} else {
print ' ';
}
?>
</td>
<?php
if ($order == 'expenses') {
?>
<td class="row-<?php
echo $style;
?>
">£<?php
echo number_format($mp['data_value']);
?>
</td>
<?php
} elseif ($order == 'debates') {
?>
<td class="row-<?php
echo $style;
?>
"><?php
echo number_format($mp['data_value']);
?>
</td>
<?php
} elseif ($order == 'safety') {
?>
<td class="row-<?php
echo $style;
?>
"><?php
echo $mp['data_value'];
?>
</td>
<?php
}
?>
</tr>
<?php
}
示例14: render_mps_row
function render_mps_row($mp, &$style, $order, $MPURL)
{
// Stripes
$style = $style == '1' ? '2' : '1';
$name = member_full_name(1, $mp['title'], $mp['first_name'], $mp['last_name'], $mp['constituency']);
# $MPURL->insert(array('pid'=>$mp['person_id']));
?>
<tr>
<td class="row">
<?php
list($image, $sz) = find_rep_image($mp['person_id'], true, true);
if ($image) {
echo '<a href="' . $MPURL->generate() . make_member_url($mp['first_name'] . ' ' . $mp['last_name'], $mp['constituency'], 1) . '" class="speakerimage"><img height="59" class="portrait" alt="" src="', $image, '"';
echo '></a>';
}
?>
</td>
<td class="row-<?php
echo $style;
?>
"><a href="<?php
echo $MPURL->generate() . make_member_url($mp['first_name'] . ' ' . $mp['last_name'], $mp['constituency'], 1);
?>
"><?php
echo $name;
?>
</a>
<?php
if ($mp['left_reason'] == 'general_election_not_standing') {
print '<br><em>Standing down</em>';
}
?>
</td>
<td class="row-<?php
echo $style;
?>
"><?php
echo $mp['party'];
?>
</td>
<td class="row-<?php
echo $style;
?>
"><?php
echo $mp['constituency'];
?>
</td>
<td class="row-<?php
echo $style;
?>
"><?php
if (is_array($mp['pos'])) {
print join('<br>', array_map('prettify_office', $mp['pos'], $mp['dept']));
} elseif ($mp['pos'] || $mp['dept']) {
print prettify_office($mp['pos'], $mp['dept']);
} else {
print ' ';
}
?>
</td>
<?php
if ($order == 'expenses') {
?>
<td class="row-<?php
echo $style;
?>
">£<?php
echo number_format($mp['data_value']);
?>
</td>
<?php
} elseif ($order == 'debates') {
?>
<td class="row-<?php
echo $style;
?>
"><?php
echo number_format($mp['data_value']);
?>
</td>
<?php
} elseif ($order == 'safety') {
?>
<td class="row-<?php
echo $style;
?>
"><?php
echo $mp['data_value'];
?>
</td>
<?php
}
?>
</tr>
<?php
}
示例15: member_full_name
if (!$q->rows()) {
print '<error>Unknown ID</error>';
exit;
}
$row = $q->row(0);
$row['full_name'] = member_full_name($row['house'], $row['title'], $row['first_name'], $row['last_name'], $row['constituency']);
if (isset($parties[$row['party']])) {
$row['party'] = $parties[$row['party']];
}
list($image, $sz) = find_rep_image($row['person_id'], true);
if ($image) {
$row['image'] = $image;
}
$q = $db->query("SELECT position,dept FROM moffice WHERE to_date='9999-12-31'\n\tand source='chgpages/selctee' and person=" . mysql_real_escape_string($pid) . ' ORDER BY from_date DESC');
for ($i = 0; $i < $q->rows(); $i++) {
$row['selctee'][] = prettify_office($q->field($i, 'position'), $q->field($i, 'dept'));
}
/*
$q = $db->query("SELECT title,chairman from pbc_members,bills where member_id=".$row['member_id']
. ' and bill_id=bills.id');
for ($i=0; $i<$q->rows(); $i++) {
$member = 'Member';
if ($q->field($i, 'chairman')) {
$member = 'Chairman';
}
$row['selctee'][] = $member . ', ' . $q->field($i, 'title');
}
*/
$q = $db->query("select data_key, data_value from personinfo\n\twhere data_key like 'public\\_whip%' and person_id = '" . mysql_real_escape_string($pid) . "'\n\torder by data_key");
# order so both_voted is always first...
$none = false;