コード例 #1
0
ファイル: index.php プロジェクト: leowmjw/twfy
function your_mp_bullet_point()
{
    global $THEUSER, $MPURL;
    print "<li>";
    $pc_form = true;
    if ($THEUSER->constituency_is_set()) {
        // (We don't allow the user to search for a postcode if they
        // already have one set in their prefs.)
        $MEMBER = new MEMBER(array('constituency' => $THEUSER->constituency()));
        if ($MEMBER->valid) {
            $pc_form = false;
            $CHANGEURL = new URL('userchangepc');
            $mpname = $MEMBER->first_name() . ' ' . $MEMBER->last_name();
            $former = "";
            $left_house = $MEMBER->left_house();
            if ($left_house[1]['date'] != '9999-12-31') {
                $former = 'former';
            }
            ?>
	<p><a href="<?php 
            echo $MPURL->generate();
            ?>
"><strong>Find out more about <?php 
            echo $mpname;
            ?>
, your <?php 
            echo $former;
            ?>
 Representative</strong></a>
	(<a href="<?php 
            echo $CHANGEURL->generate();
            ?>
">Change</a>)</p>
<?php 
        }
    }
    if ($pc_form) {
        ?>
		<form action="<?php 
        echo $MPURL->generate();
        ?>
" method="get">
		<p><strong>Find out more about your Representative</strong><br>
		<label for="pc">Enter your Australian postcode here:</label>&nbsp; <input type="text" name="pc" id="pc" size="8" maxlength="10" class="text">&nbsp;&nbsp;<input type="submit" value=" GO " class="submit"></p>
		</form>
	<?php 
    }
    print "</li>";
}
コード例 #2
0
ファイル: index.php プロジェクト: palfrey/twfy
$pc_form = true;
if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) {
    // User is logged in and has a postcode, or not logged in with a cookied postcode.
    // (We don't allow the user to search for a postcode if they
    // already have one set in their prefs.)
    $MEMBER = new MEMBER(array('postcode' => $THEUSER->postcode()));
    if ($MEMBER->valid) {
        $pc_form = false;
        if ($THEUSER->isloggedin()) {
            $CHANGEURL = new URL('useredit');
        } else {
            $CHANGEURL = new URL('userchangepc');
        }
        $mpname = $MEMBER->first_name() . ' ' . $MEMBER->last_name();
        $former = "";
        $left_house = $MEMBER->left_house();
        if ($left_house[1]['date'] != '9999-12-31') {
            $former = 'former';
        }
        ?>
 
        	<p><a href="<?php 
        echo $MPURL->generate();
        ?>
"><strong>Find out about <?php 
        echo $mpname;
        ?>
, your <?php 
        echo $former;
        ?>
 MP</strong></a><br>
コード例 #3
0
ファイル: index.php プロジェクト: bruno/openaustralia-app
function your_mp_bullet_point()
{
    global $THEUSER, $MPURL;
    print "<li>";
    $pc_form = true;
    if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) {
        // User is logged in and has a postcode, or not logged in with a cookied postcode.
        // (We don't allow the user to search for a postcode if they
        // already have one set in their prefs.)
        $MEMBER = new MEMBER(array('postcode' => $THEUSER->postcode()));
        if ($MEMBER->valid) {
            $pc_form = false;
            if ($THEUSER->isloggedin()) {
                $CHANGEURL = new URL('useredit');
            } else {
                $CHANGEURL = new URL('userchangepc');
            }
            $mpname = $MEMBER->first_name() . ' ' . $MEMBER->last_name();
            $former = "";
            $left_house = $MEMBER->left_house();
            if ($left_house[1]['date'] != '9999-12-31') {
                $former = 'former';
            }
            ?>
	<p><a href="<?php 
            echo $MPURL->generate();
            ?>
"><strong>Find out more about <?php 
            echo $mpname;
            ?>
, your <?php 
            echo $former;
            ?>
 MP</strong></a><br>
	In <?php 
            echo strtoupper(htmlentities($THEUSER->postcode()));
            ?>
 (<a href="<?php 
            echo $CHANGEURL->generate();
            ?>
">Change your postcode</a>)</p>
<?php 
        }
    }
    if ($pc_form) {
        ?>
		<form action="<?php 
        echo $MPURL->generate();
        ?>
" method="get">
		<p><strong>Find out more about your Representative</strong><br>
		<label for="pc">Enter your Australian postcode here:</label>&nbsp; <input type="text" name="pc" id="pc" size="8" maxlength="10" value="<?php 
        echo htmlentities($THEUSER->postcode());
        ?>
" class="text">&nbsp;&nbsp;<input type="submit" value=" GO " class="submit"></p>
		</form>
	<?php 
        if (!defined("POSTCODE_SEARCH_DOMAIN") || !POSTCODE_SEARCH_DOMAIN) {
            print '<p align="right"><em>Postcodes are being mapped to a random Representative</em></p>';
        }
    }
    print "</li>";
}