Exemplo n.º 1
0
            $THEUSER->set_postcode_cookie($pc);
        }
        list($out, $sidebars) = pick_multiple($pc, $constituencies, 'SPE', 'MSP');
    } elseif (isset($constituencies['NIE'])) {
        $MEMBER = new MEMBER(array('constituency' => $constituencies['WMC']));
        if ($MEMBER->person_id()) {
            $THEUSER->set_postcode_cookie($pc);
        }
        list($out, $sidebars) = pick_multiple($pc, $constituencies, 'NIE', 'MLA');
    } else {
        # Just have an MP, redirect instantly to the canonical page
        $MEMBER = new MEMBER(array('constituency' => $constituencies['WMC']));
        if ($MEMBER->person_id()) {
            $THEUSER->set_postcode_cookie($pc);
        }
        member_redirect($MEMBER);
    }
} else {
    $errors['pc'] = "Sorry, " . htmlentities($pc) . " isn't a valid postcode";
    twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form.");
}
$PAGE->page_start();
$PAGE->stripe_start();
if (isset($errors['pc'])) {
    $PAGE->error_message($errors['pc']);
    $PAGE->postcode_form();
}
echo $out;
$PAGE->stripe_end($sidebars);
$PAGE->page_end();
# ---
Exemplo n.º 2
0
function get_mp_by_user_postcode($pc)
{
    $MEMBER = new MySociety\TheyWorkForYou\Member(array('postcode' => $pc, 'house' => HOUSE_TYPE_COMMONS));
    member_redirect($MEMBER, 302);
}