예제 #1
0
파일: dat.php 프로젝트: palfrey/twfy
# Compile data for MP page in Google gadget
# XXX Lots here copied from elsewhere... Damn you deadlines.
include_once 'min-init.php';
include_once INCLUDESPATH . 'easyparliament/member.php';
include_once '../api/api_functions.php';
$pid = $_GET['pid'];
if (!$pid) {
    print '<error>No ID</error>';
    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;
예제 #2
0
파일: index.php 프로젝트: palfrey/twfy
function load_member($pid)
{
    $member = new MEMBER(array('person_id' => $pid));
    if (!$member->valid) {
        output_error('Unknown ID');
    }
    $member->load_extra_info();
    return $member;
}
예제 #3
0
function load_member($pid) {
	$member = new MEMBER(array('guardian_aristotle_id' => $pid));
	if (!$member->valid) output_error('Unknown ID');
	$member->load_extra_info();
	return $member;
}
예제 #4
0
 /**
  * Test loading extra info
  *
  * @todo Implement testing of the Public Whip info loading
  */
 public function testLoadExtraInfo()
 {
     $MEMBER = new MEMBER(array('person_id' => 16));
     $MEMBER->load_extra_info();
     // Have we correctly loaded the office?
     $this->assertEquals(1, $MEMBER->extra_info['office'][0]['moffice_id']);
     // Have we correctly loaded the member arbitrary key/value pair?
     $this->assertEquals('Test Member Value', $MEMBER->extra_info['test_member_key']);
     // Have we correctly loaded the person arbitrary key/value pair?
     $this->assertEquals('Test Person Value', $MEMBER->extra_info['test_person_key']);
     // Have we correctly loaded the constituency arbitrary key/value pair?
     $this->assertEquals('Test Constituency Value', $MEMBER->extra_info['test_constituency_key']);
     // Have we correctly loaded the PBC membership?
     $this->assertEquals(array('title' => 'Test Bill', 'session' => '2013-14', 'attending' => 1, 'chairman' => 1, 'outof' => 0), $MEMBER->extra_info['pbc'][1]);
 }