当前位置: 首页>>代码示例>>PHP>>正文


PHP MEMBER::party_text方法代码示例

本文整理汇总了PHP中MEMBER::party_text方法的典型用法代码示例。如果您正苦于以下问题:PHP MEMBER::party_text方法的具体用法?PHP MEMBER::party_text怎么用?PHP MEMBER::party_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MEMBER的用法示例。


在下文中一共展示了MEMBER::party_text方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MEMBER

# 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;
	return true;
开发者ID:palfrey,项目名称:twfy,代码行数:31,代码来源:dat.php

示例2: find_constituency

function find_constituency($args)
{
    // We see if the user is searching for a postcode or constituency.
    global $PAGE;
    if ($args['s'] != '') {
        $searchterm = $args['s'];
    } else {
        $PAGE->error_message('No search string');
        return false;
    }
    list($constituencies, $validpostcode) = search_constituencies_by_query($searchterm);
    $constituency = "";
    if (count($constituencies) == 1) {
        $constituency = $constituencies[0];
    }
    if ($constituency != '') {
        // Got a match, display....
        $MEMBER = new MEMBER(array('constituency' => $constituency, 'house' => 1));
        $URL = new URL('mp');
        if ($MEMBER->valid) {
            $URL->insert(array('p' => $MEMBER->person_id()));
            print '<h2>';
            if (!$MEMBER->current_member(1)) {
                print 'Former ';
            }
            print 'MP for ' . preg_replace('#' . preg_quote($searchterm, '#') . '#i', '<span class="hi">$0</span>', $constituency);
            if ($validpostcode) {
                // Display the postcode the user searched for.
                print ' (' . _htmlentities(strtoupper($args['s'])) . ')';
            }
            ?>
</h2>

            <p><a href="<?php 
            echo $URL->generate();
            ?>
"><strong><?php 
            echo $MEMBER->full_name();
            ?>
</strong></a> (<?php 
            echo $MEMBER->party_text();
            ?>
)</p>
    <?php 
        }
    } elseif (count($constituencies)) {
        $out = '';
        $heading = array();
        foreach ($constituencies as $constituency) {
            $MEMBER = new MEMBER(array('constituency' => $constituency, 'house' => 1));
            if ($MEMBER->valid) {
                if ($MEMBER->current_member(1)) {
                    $heading[] = 'MPs';
                } else {
                    $heading[] = 'Former MPs';
                }
                $URL = new URL('mp');
                $URL->insert(array('p' => $MEMBER->person_id()));
                $out .= '<li><a href="' . $URL->generate() . '"><strong>' . $MEMBER->full_name() . '</strong></a> (' . preg_replace('#' . preg_quote($searchterm, '#') . '#i', '<span class="hi">$0</span>', $constituency) . ', ' . $MEMBER->party() . ')</li>';
            }
        }
        print '<h2>';
        print join(" and ", array_unique($heading));
        print " in constituencies matching &lsquo;" . _htmlentities($searchterm) . "&rsquo;</h2>";
        print "<ul>{$out}</ul>";
    }
}
开发者ID:sarahs-synapse,项目名称:theyworkforyou,代码行数:67,代码来源:index.php


注:本文中的MEMBER::party_text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。