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


PHP MEMBER::member_id方法代码示例

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


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

示例1: 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('m'=>$MEMBER->member_id()));
            print '<h2>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(); ?>)</p>
    <?php
        }

	} elseif (count($constituencies)) {
        print "<h2>MPs in constituencies matching '".htmlentities($searchterm)."'</h2><ul>";
        foreach ($constituencies as $constituency) {
            $MEMBER = new MEMBER(array('constituency'=>$constituency, 'house' => 1));
            $URL = new URL('mp');
            if ($MEMBER->valid) {
                $URL->insert(array('m'=>$MEMBER->member_id()));
            }
            print '<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 '</ul>';
    }
}
开发者ID:nallachaitu,项目名称:theyworkforyou,代码行数:51,代码来源:index.php

示例2: find_constituency

function find_constituency($args)
{
    // We see if the user is searching for a postcode or constituency.
    global $PAGE, $db;
    if ($args['s'] != '') {
        $searchterm = $args['s'];
    } else {
        $PAGE->error_message('No search string');
        return false;
    }
    $constituencies = array();
    $constituency = '';
    $validpostcode = false;
    if (validate_postcode($searchterm)) {
        // Looks like a postcode - can we find the constituency?
        $constituencies = postcode_to_constituency($searchterm);
        if ($constituencies == '') {
            $constituencies = array();
        } else {
            $validpostcode = true;
        }
        if (!is_array($constituencies)) {
            $constituencies = array($constituencies);
        }
    }
    if ($constituencies == array() && $searchterm) {
        // No luck so far - let's see if they're searching for a constituency.
        $try = strtolower($searchterm);
        if (normalise_constituency_name($try)) {
            $constituency = normalise_constituency_name($try);
        } else {
            $query = "select distinct\n                    (select name from constituency where cons_id = o.cons_id and main_name) as name \n                from constituency AS o where name like '%" . mysql_real_escape_string($try) . "%'\n                and from_date <= date(now()) and date(now()) <= to_date";
            $q = $db->query($query);
            for ($n = 0; $n < $q->rows(); $n++) {
                $constituencies[] = $q->field($n, 'name');
            }
        }
    }
    if (count($constituencies) == 1) {
        $constituency = $constituencies[0];
    }
    if ($constituency != '') {
        // Got a match, display....
        $MEMBER = new MEMBER(array('constituency' => $constituency));
        $URL = new URL('mp');
        if ($MEMBER->valid) {
            $URL->insert(array('m' => $MEMBER->member_id()));
            print '<h3>MP for ' . preg_replace("#{$searchterm}#i", '<span class="hi">$0</span>', $constituency);
            if ($validpostcode) {
                // Display the postcode the user searched for.
                print ' (' . htmlentities(strtoupper($args['s'])) . ')';
            }
            ?>
</h3>
            
            <p><a href="<?php 
            echo $URL->generate();
            ?>
"><strong><?php 
            echo htmlentities($MEMBER->first_name()) . ' ' . htmlentities($MEMBER->last_name());
            ?>
</strong></a> (<?php 
            echo $MEMBER->party();
            ?>
)</p>
    <?php 
        }
    } elseif (count($constituencies)) {
        print "<h3>MPs in constituencies matching '" . htmlentities($searchterm) . "'</h3><ul>";
        foreach ($constituencies as $constituency) {
            $MEMBER = new MEMBER(array('constituency' => $constituency));
            $URL = new URL('mp');
            if ($MEMBER->valid) {
                $URL->insert(array('m' => $MEMBER->member_id()));
            }
            print '<li><a href="' . $URL->generate() . '"><strong>' . htmlentities($MEMBER->first_name()) . ' ' . htmlentities($MEMBER->last_name()) . '</strong></a> (' . preg_replace("#{$searchterm}#i", '<span class="hi">$0</span>', $constituency) . ', ' . $MEMBER->party() . ')</li>';
        }
        print '</ul>';
    }
}
开发者ID:leowmjw,项目名称:twfy,代码行数:80,代码来源:mobile.php

示例3: person_rebellion_rate

/**
 * Person Rebellion Rate
 *
 * How often has this person rebelled against their party?
 *
 * @param MEMBER $member The member to calculate rebellion rate for.
 *
 * @return string A HTML summary of this person's rebellion rate.
 */
function person_rebellion_rate($member)
{
    // Rebellion string may be empty.
    $rebellion_string = '';
    if (isset($member->extra_info['public_whip_rebellions']) && $member->extra_info['public_whip_rebellions'] != 'n/a') {
        $displayed_stuff = 1;
        $rebels_term = 'rebelled';
        $rebellion_string = '<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>' . _htmlentities($member->extra_info['public_whip_rebel_description']) . ' ' . $rebels_term . '</strong></a> against their party';
        if (isset($member->extra_info['public_whip_rebelrank'])) {
            if ($member->extra_info['public_whip_data_date'] == 'complete') {
                $rebellion_string .= ' in their last parliament';
            } else {
                $rebellion_string .= ' in this parliament';
            }
        }
    }
    return $rebellion_string;
}
开发者ID:sarahs-synapse,项目名称:theyworkforyou,代码行数:27,代码来源:index.php


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