本文整理汇总了PHP中MEMBER::full_name方法的典型用法代码示例。如果您正苦于以下问题:PHP MEMBER::full_name方法的具体用法?PHP MEMBER::full_name怎么用?PHP MEMBER::full_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MEMBER
的用法示例。
在下文中一共展示了MEMBER::full_name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: manage
public static function manage($email)
{
$db = new \ParlDB();
$q = $db->query('SELECT * FROM alerts WHERE email = :email
AND deleted != 1 ORDER BY created', array(':email' => $email));
$out = '';
for ($i = 0; $i < $q->rows(); ++$i) {
$row = $q->row($i);
$criteria = explode(' ', $row['criteria']);
$ccc = array();
$current = true;
foreach ($criteria as $c) {
if (preg_match('#^speaker:(\\d+)#', $c, $m)) {
$MEMBER = new \MEMBER(array('person_id' => $m[1]));
$ccc[] = 'spoken by ' . $MEMBER->full_name();
if (!$MEMBER->current_member_anywhere()) {
$current = false;
}
} else {
$ccc[] = $c;
}
}
$criteria = join(' ', $ccc);
$token = $row['alert_id'] . '-' . $row['registrationtoken'];
$action = '<form action="/alert/" method="post"><input type="hidden" name="t" value="' . $token . '">';
if (!$row['confirmed']) {
$action .= '<input type="submit" name="action" value="Confirm">';
} elseif ($row['deleted'] == 2) {
$action .= '<input type="submit" name="action" value="Resume">';
} else {
$action .= '<input type="submit" name="action" value="Suspend"> <input type="submit" name="action" value="Delete">';
}
$action .= '</form>';
$out .= '<tr><td>' . $criteria . '</td><td align="center">' . $action . '</td></tr>';
if (!$current) {
$out .= '<tr><td colspan="2"><small> — <em>not a current member of any body covered by TheyWorkForYou</em></small></td></tr>';
}
}
if ($out) {
print '<table cellpadding="3" cellspacing="0"><tr><th>Criteria</th><th>Action</th></tr>' . $out . '</table>';
} else {
print '<p>You currently have no email alerts set up.</p>';
}
}
示例2: meta
public static function meta($e)
{
$private = false;
if ($e['committee_name']) {
$title = $e['committee_name'];
if ($e['title'] == 'to consider the Bill') {
} elseif ($e['title'] && $e['title'] != 'This is a private meeting.') {
$title .= ': ' . $e['title'];
} else {
$private = true;
}
} else {
$title = $e['title'];
if ($pid = $e['person_id']) {
$MEMBER = new \MEMBER(array('person_id' => $pid));
$name = $MEMBER->full_name();
$title .= " – <a href='/mp/?p={$pid}'>{$name}</a>";
}
}
$meta = array();
if ($d = $e['debate_type']) {
if ($d == 'Adjournment') {
$d = 'Adjournment debate';
}
$meta[] = $d;
}
if ($e['time_start'] || $e['location']) {
if ($e['time_start']) {
$time = format_time($e['time_start'], TIMEFORMAT);
if ($e['time_end']) {
$time .= ' – ' . format_time($e['time_end'], TIMEFORMAT);
}
$meta[] = $time;
}
if ($e['location']) {
$meta[] = $e['location'];
}
}
if ($private) {
$meta[] = 'Private meeting';
}
return array($title, $meta);
}
示例3: add_alert
function add_alert($details)
{
global $ALERT, $PAGE, $THEUSER, $this_page;
$extra = null;
// Instantiate an instance of ALERT
$ALERT = new ALERT();
$external_auth = auth_verify_with_shared_secret($details['email'], OPTION_AUTH_SHARED_SECRET, get_http_var('sign'));
if ($external_auth) {
$site = get_http_var('site');
$extra = 'from_' . $site . '=1';
$confirm = false;
} elseif ($THEUSER->loggedin()) {
$confirm = false;
} else {
$confirm = true;
}
// If this goes well, the alert will be added to the database and a confirmation email
// will be sent to them.
$success = $ALERT->add($details, $confirm);
// Display results message on blank page for both success and failure
$this_page = 'alertwelcome';
$URL = new URL('alertwelcome');
$backlink = $URL->generate();
$PAGE->page_start();
$PAGE->stripe_start();
$advert = false;
if ($success > 0 && !$confirm) {
if ($details['pid']) {
$MEMBER = new MEMBER(array('person_id' => $details['pid']));
$criteria = $MEMBER->full_name();
if ($details['keyword']) {
$criteria .= ' mentions \'' . $details['keyword'] . '\'';
} else {
$criteria .= ' contributes';
}
} elseif ($details['keyword']) {
$criteria = '\'' . $details['keyword'] . '\' is mentioned';
}
$message = array('title' => 'Your alert has been added', 'text' => 'You will now receive email alerts on any day when ' . $criteria . ' in parliament.');
$advert = true;
} elseif ($success > 0) {
$message = array('title' => "We're nearly done...", 'text' => "You should receive an email shortly which will contain a link. You will need to follow that link to confirm your email address to receive the alert. Thanks.");
} elseif ($success == -2) {
$message = array('title' => 'You already have this alert', 'text' => 'You already appear to be subscribed to this email alert, so we have not signed you up to it again.');
$advert = true;
} else {
$message = array('title' => "This alert has not been accepted", 'text' => "Sorry, we were unable to create this alert. Please <a href=\"mailto:" . CONTACTEMAIL . "\">let us know</a>. Thanks.");
}
$PAGE->message($message);
if ($advert) {
$advert_shown = alert_confirmation_advert($details);
if ($extra) {
$extra .= "; ";
}
$extra .= "advert={$advert_shown}";
}
$PAGE->stripe_end();
$PAGE->page_end($extra);
}
示例4: SEARCHENGINE
//.........这里部分代码省略.........
$qd = $query->get_description();
twfy_debug("SEARCH", "queryparser original description -- " . $qd);
$qd = substr($qd, 14, -1);
# Strip Xapian::Query()
$qd = preg_replace('#:\\(.*?\\)#', '', $qd);
# Don't need pos or weight
# Date range
$qd = preg_replace('#VALUE_RANGE 1 (\\d+) (\\d+)#e', 'preg_replace("#(\\d{4})(\\d\\d)(\\d\\d)#", "\\$3/\\$2/\\$1", $1)
. ".." . preg_replace("#(\\d{4})(\\d\\d)(\\d\\d)#", "\\$3/\\$2/\\$1", $2)', $qd);
# Replace phrases with the phrase in quotes
preg_match_all('#\\(([^(]*? PHRASE [^(]*?)\\)#', $qd, $m);
foreach ($m[1] as $phrase) {
$phrase_new = preg_replace('# PHRASE \\d+#', '', $phrase);
#$this->phrases[] = preg_split('#\s+#', $phrase_new);
$qd = str_replace("({$phrase})", '"' . $phrase_new . '"', $qd);
}
preg_match_all('#\\(([^(]*? NEAR [^(]*?)\\)#', $qd, $m);
foreach ($m[1] as $mm) {
$mmn = preg_replace('# NEAR \\d+ #', ' NEAR ', $mm);
$qd = str_replace("({$mm})", "({$mmn})", $qd);
}
# Awesome regexes to get rid of superfluous matching brackets
$qd = preg_replace('/( \\( ( (?: (?>[^ ()]+) | (?1) ) (?: [ ](?:AND|OR|XOR|FILTER|NEAR[ ]\\d+|PHRASE[ ]\\d+)[ ] (?: (?>[^ ()]+) | (?1) ) )* ) \\) ) [ ] (FILTER|AND_NOT)/x', '$2 $3', $qd);
$qd = preg_replace('/(?:FILTER | 0 [ ] \\* ) [ ] ( \\( ( (?: (?>[^ ()]+) | (?1) ) (?: [ ](?:AND|OR|XOR)[ ] (?: (?>[^ ()]+) | (?1) ) )* ) \\) )/x', '$2', $qd);
$qd = preg_replace('/(?:FILTER | 0 [ ] \\* ) [ ] ( [^()] )/x', '$1', $qd);
$qd = str_replace('AND ', '', $qd);
# AND is the default
$qd = preg_replace('/^ ( \\( ( (?: (?>[^()]+) | (?1) )* ) \\) ) $/x', '$2', $qd);
# Other prefixes
$qd = preg_replace('#\\bU(\\d+)\\b#', 'segment:$1', $qd);
$qd = preg_replace('#\\bC(\\d+)\\b#', 'column:$1', $qd);
$qd = preg_replace('#\\bQ(.*?)\\b#', 'gid:$1', $qd);
$qd = preg_replace('#\\bP(.*?)\\b#e', '"party:" . (isset($parties[ucfirst("$1")]) ? $parties[ucfirst("$1")] : "$1")', $qd);
$qd = preg_replace('#\\bD(.*?)\\b#', 'date:$1', $qd);
$qd = preg_replace('#\\bG(.*?)\\b#', 'department:$1', $qd);
# XXX Lookup to show proper name of dept
if (strstr($qd, 'M1 OR M2 OR M3 OR M4 OR M6 OR M101')) {
$qd = str_replace('M1 OR M2 OR M3 OR M4 OR M6 OR M101', 'section:uk', $qd);
} elseif (strstr($qd, 'M7 OR M8')) {
$qd = str_replace('M7 OR M8', 'section:scotland', $qd);
}
$qd = preg_replace('#\\bM(\\d+)\\b#e', '"in the \'" . (isset($hansardmajors[$1]["title"]) ? $hansardmajors[$1]["title"] . "\'" : "$1")', $qd);
$qd = preg_replace('#\\bMF\\b#', 'in Future Business', $qd);
# Replace stemmed things with their unstemmed terms from the query
$used = array();
preg_match_all('#Z[^\\s()]+#', $qd, $m);
foreach ($m[0] as $mm) {
$iter = $this->queryparser->unstem_begin($mm);
$end = $this->queryparser->unstem_end($mm);
while (!$iter->equals($end)) {
$tt = $iter->get_term();
if (!in_array($tt, $used)) {
break;
}
$iter->next();
}
$used[] = $tt;
$qd = preg_replace('#' . preg_quote($mm, '#') . '#', $tt, $qd, 1);
}
# Speakers
for ($n = 0; $n < $merged->rows(); $n++) {
$from_id = str_replace('uk.org.publicwhip/person/', '', $merged->field($n, 'gid_from'));
$to_id = str_replace('uk.org.publicwhip/person/', '', $merged->field($n, 'gid_to'));
$qd = str_replace("(S{$from_id} OR S{$to_id})", "S{$to_id}", $qd);
$qd = str_replace("S{$from_id} OR S{$to_id}", "S{$to_id}", $qd);
}
preg_match_all('#S(\\d+)#', $qd, $m);
foreach ($m[1] as $mm) {
$member = new MEMBER(array('person_id' => $mm));
$name = iconv('iso-8859-1', 'utf-8//TRANSLIT', $member->full_name());
# Names are currently in ISO-8859-1
$qd = str_replace("S{$mm}", "speaker:{$name}", $qd);
}
# Simplify display of excluded words
$qd = preg_replace('#AND_NOT ([a-z0-9"]+)#', '-$1', $qd);
preg_match_all('#AND_NOT \\((.*?)\\)#', $qd, $m);
foreach ($m[1] as $mm) {
$mmn = '-' . join(' -', explode(' OR ', $mm));
$qd = str_replace("AND_NOT ({$mm})", $mmn, $qd);
}
foreach ($this->prefixed as $items) {
if ($items[0] == 'groupby') {
if ($items[1] == 'debate') {
$qd .= ' grouped by debate';
} elseif ($items[1] == 'speech') {
$qd .= ' showing all speeches';
} else {
$PAGE->error_message("Unknown group by '{$items['1']}' ignored");
}
}
}
$qd = iconv('utf-8', 'iso-8859-1//TRANSLIT', $qd);
# Xapian is UTF-8, site is ISO8859-1
$this->query_desc = trim($qd);
#print 'DEBUG: ' . $query->get_description();
twfy_debug("SEARCH", "words: " . var_export($this->words, true));
twfy_debug("SEARCH", "phrases: " . var_export($this->phrases, true));
twfy_debug("SEARCH", "queryparser description -- " . $this->query_desc);
$this->valid = true;
}
示例5: display_form
function display_form($details = array(), $errors = array())
{
global $this_page, $ALERT, $PAGE, $THEUSER;
$ACTIONURL = new URL($this_page);
$ACTIONURL->reset();
?>
<p>This page allows you to request an email alert from OpenAustralia.org.</p>
<?php
if (!get_http_var('only')) {
?>
<ul>
<li>To receive an alert <strong>every time a particular person appears</strong>,
select their name from the drop-down list and
leave the word/phrase box blank.</li>
<li>To receive an alert <strong>every time a particular keyword or phrase appears</strong>,
select "Any Representative or Senator" from the drop-down list, and enter your search term in
the box underneath. The results are selected using the same rules as for a
normal search (see the box to the right for help on setting your criteria).</li>
<li>You can also <strong>combine</strong> both types of criteria to be alerted
<strong>only</strong> when a particular person uses the keywords you have defined.
To do this, select the person from the drop-down list <em>and</em> enter the keyword(s) as
above.</li>
</ul>
<p>Please note that you should only enter one topic per alert - if you wish to receive alerts on more than one topic, or for more than one person, simply fill in this form as many times as you need.</p>
<?php
}
?>
<form method="post" action="<?php
echo $ACTIONURL->generate();
?>
">
<?php
if (!$THEUSER->loggedin()) {
if (isset($errors["email"]) && (get_http_var('submitted') || get_http_var('only'))) {
$PAGE->error_message($errors["email"]);
}
?>
<div class="row">
<span class="label"><label for="email">Your email address:</label></span>
<span class="formw"><input type="text" name="email" id="email" value="<?php
if (isset($details["email"])) {
echo htmlentities($details["email"]);
}
?>
" maxlength="255" size="30" class="form"></span>
</div>
<?php
}
if (!get_http_var('only') || !$details['keyword']) {
if (isset($errors['pid'])) {
$PAGE->error_message($errors['pid']);
}
?>
<div class="row">
<span class="label"><label for="pid">Person you wish to receive alerts for:</label></span>
<span class="formw"><?php
if (get_http_var('only') && $details['pid']) {
$MEMBER = new MEMBER(array('person_id' => $details['pid']));
print $MEMBER->full_name();
print '<input type="hidden" name="pid" value="' . htmlspecialchars($details['pid']) . '">';
} else {
?>
<select name="pid">
<option value="Any">Any Representative or Senator</option>
<?php
// Get a list of MPs/Lords for displaying in the form using the PEOPLE class
$LIST = new PEOPLE();
$args['order'] = 'last_name';
if ($details['pid']) {
$args['pid'] = $details['pid'];
}
$LIST->listoptions($args);
?>
</select>
<?php
}
?>
</span>
</div>
<?php
}
if (!get_http_var('only') || !$details['pid']) {
if (isset($errors["keyword"])) {
$PAGE->error_message($errors["keyword"]);
}
?>
<div class="row">
<span class="label"><label for="keyword">Word or phrase you wish to receive alerts for:</label></span>
<span class="formw"><input type="text" name="keyword" id="keyword" value="<?php
if ($details['keyword']) {
echo htmlentities($details['keyword']);
}
?>
//.........这里部分代码省略.........
示例6: appearances
}
$date = $hdate . 'T' . $htime . '+00:00';
$items .= '<rdf:li rdf:resource="' . $link . '" />' . "\n";
$entries .= "<item rdf:about=\"{$link}\">\n\t<title>{$title}</title>\n\t<link>{$link}</link>\n\t<description>{$description}</description>\n\t<content:encoded><![CDATA[{$contentencoded}]]></content:encoded>\n\t<dc:date>{$date}</dc:date>\n</item>\n";
}
}
// Prepare the whole text of the RSS file.
$rsstext = '<?xml version="1.0" encoding="iso-8859-1"?>
<rdf:RDF
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel rdf:about="http://' . DOMAIN . $mpurl . '">
<title>' . entities_to_numbers($MEMBER->full_name()) . '\'s recent appearances (TheyWorkForYou)</title>
<link>http://' . DOMAIN . $mpurl . '</link>
<description></description>
<dc:language>en-gb</dc:language>
<dc:creator>TheyWorkForYou.com, mprss.php script</dc:creator>
<dc:date>' . $datenow . '</dc:date>
<items>
<rdf:Seq>
' . $items . '</rdf:Seq>
</items>
</channel>
' . $entries . '
示例7: criteria_pretty
public function criteria_pretty($html = false)
{
$criteria = explode(' ', $this->criteria);
$words = array();
$spokenby = '';
foreach ($criteria as $c) {
if (preg_match('#^speaker:(\\d+)#', $c, $m)) {
$MEMBER = new MEMBER(array('person_id' => $m[1]));
$spokenby = $MEMBER->full_name();
} else {
$words[] = $c;
}
}
$criteria = '';
if (count($words)) {
$criteria .= ($html ? '<li>' : '* ') . 'Mentions of [' . join(' ', $words) . ']' . ($html ? '</li>' : '') . "\n";
}
if ($spokenby) {
$criteria .= ($html ? '<li>' : '* ') . "Things by {$spokenby}" . ($html ? '</li>' : '') . "\n";
}
return $criteria;
}
示例8: display_user
//.........这里部分代码省略.........
?>
</strong></div>
<?php
}
if (isset($optin)) {
?>
<div class="row">Receive TheyWorkForYou.com emails? <strong><?php
echo htmlentities($optin);
?>
</strong></div>
<?php
}
if (isset($status)) {
?>
<div class="row">
<span class="label">Status</span>
<span class="formw"><?php
echo htmlentities($status);
?>
</span>
</div>
<?php
}
if (isset($registrationtime)) {
?>
<div class="row">
<span class="label">Joined</span>
<span class="formw"><?php
echo htmlentities($registrationtime);
?>
</span>
</div>
<?php
}
if ($edited && $this_page == 'userviewself') {
$EDITURL = new URL('useredit');
$VIEWURL = new URL('userviewself');
?>
<p> <br><a href="<?php
echo $EDITURL->generate();
?>
">Edit again</a> or <a href="<?php
echo $VIEWURL->generate();
?>
">see how others see you</a>.</p>
<?php
}
$PAGE->stripe_end();
# Email alerts
if ($this_page == 'userviewself') {
$PAGE->stripe_start();
print '<h3>Your email alerts</h3>';
$db = new ParlDB();
$q = $db->query('SELECT * FROM alerts WHERE email = "' . mysql_escape_string($THEUSER->email()) . '" ORDER BY confirmed,deleted,alert_id');
$out = '';
for ($i = 0; $i < $q->rows(); ++$i) {
$row = $q->row($i);
$criteria = explode(' ', $row['criteria']);
$ccc = array();
foreach ($criteria as $c) {
if (preg_match('#^speaker:(\\d+)#', $c, $m)) {
$MEMBER = new MEMBER(array('person_id' => $m[1]));
$ccc[] = 'spoken by ' . $MEMBER->full_name();
} else {
$ccc[] = $c;
}
}
$criteria = join(' ', $ccc);
$token = $row['alert_id'] . '-' . $row['registrationtoken'];
if (!$row['confirmed']) {
$action = '<a href="/A/' . $token . '">Confirm</a>';
} elseif ($row['deleted']) {
$action = '<form action="/alert/undelete/" method="post"><input type="hidden" name="t" value="' . $token . '"><input type="submit" value="Undelete"></form>';
} else {
$action = '<form action="/alert/delete/" method="post"><input type="hidden" name="t" value="' . $token . '"><input type="submit" value="Delete"></form>';
}
$out .= '<tr><td>' . $criteria . '</td><td>' . $action . '</td></tr>';
}
print '<p>To add a new alert, simply visit an MP or Peer\'s page or conduct a search — to be given the option of turning them into alerts automatically — or visit <a href="/alert/">the manual addition page</a>.</p>';
if ($out) {
print '<p>Here are your email alerts:</p>';
print '<table cellpadding="3" cellspacing="0"><tr><th>Criteria</th><th>Action</th></tr>' . $out . '</table>';
} else {
print '<p>You currently have no email alerts set up.</p>';
}
$PAGE->stripe_end();
}
if (!$edited) {
$args = array('user_id' => $user_id, 'page' => get_http_var('p'));
$COMMENTLIST = new COMMENTLIST();
$COMMENTLIST->display('user', $args);
}
} else {
$message = array('title' => 'Sorry...', 'text' => "We don't have a user ID, so we can't show you anyone's details.");
$PAGE->message($message);
}
$PAGE->page_end();
}
示例9: URL
function search_form($value = '')
{
global $SEARCHENGINE;
// Search box on the search page.
// If $value is set then it will be displayed in the form.
// Otherwise the value of 's' in the URL will be displayed.
$wtt = get_http_var('wtt');
$URL = new URL('search');
$URL->reset();
// no need to pass any query params as a form action. They are not used.
if ($value == '') {
$value = get_http_var('s');
}
echo '<div class="mainsearchbox">';
if ($wtt < 2) {
echo '<form action="', $URL->generate(), '" method="get">';
if (get_http_var('o')) {
echo '<input type="hidden" name="o" value="', htmlentities(get_http_var('o')), '">';
}
if (get_http_var('house')) {
echo '<input type="hidden" name="house" value="', htmlentities(get_http_var('house')), '">';
}
echo '<input type="text" name="s" value="', htmlentities($value), '" size="20"> ';
echo '<input type="submit" value=" ', $wtt ? 'Modify search' : 'Search', ' "><br>';
if ($wtt) {
print '<input type="hidden" name="wtt" value="1">';
}
} else {
?>
<form action="http://www.writetothem.com/lords" method="get">
<input type="hidden" name="pid" value="<?php
echo htmlentities(get_http_var('pid'));
?>
">
<input type="submit" style="font-size: 150%" value=" I want to write to this Lord "><br>
<?php
}
if (!$wtt) {
echo '<div style="margin-top: 5px">';
$orderUrl = new URL('search');
$ordering = get_http_var('o');
if ($ordering != 'r' && $ordering != 'd' && $ordering != 'p') {
$ordering = 'd';
}
if ($ordering == 'r') {
print '<strong>Most relevant results are first</strong>';
} else {
printf("<a href='%s'>Show most relevant results first</a>", $orderUrl->generate('html', array('o' => 'r')));
}
print " | ";
if ($ordering == 'd') {
print '<strong>Most recent results are first</strong>';
} else {
printf("<a href='%s'>Show most recent results first</a>", $orderUrl->generate('html', array('o' => 'd')));
}
print " | ";
if ($ordering == 'p') {
print '<strong>Use by person</strong>';
} else {
printf('<a href="%s">Show use by person</a>', $orderUrl->generate('html', array('o' => 'p')));
}
echo '</div>';
$person_id = get_http_var('pid');
if ($person_id != "") {
$member = new MEMBER(array('person_id' => $person_id));
if ($member->valid) {
$name = $member->full_name();
?>
<p>
<input type="radio" name="pid" value="<?php
echo htmlentities($person_id);
?>
" checked>Search only <?php
echo htmlentities($name);
?>
<input type="radio" name="pid" value="">Search all speeches
</p>
<?php
}
}
}
echo '</form> </div>';
}
示例10: 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 ‘" . _htmlentities($searchterm) . "’</h2>";
print "<ul>{$out}</ul>";
}
}
示例11: array
if (is_numeric(get_http_var('y'))) {
$DATA->set_page_metadata($this_page, 'title', get_http_var('y'));
}
$PAGE->page_start();
$PAGE->stripe_start();
$args = array('year' => get_http_var('y'));
$LIST = new WRANSLIST();
$LIST->display('calendar', $args);
$PAGE->stripe_end(array(array('type' => 'nextprev'), array('type' => 'include', 'content' => "wrans")));
} elseif (get_http_var('pid')) {
$this_page = "wransmp";
$args = array('person_id' => get_http_var('pid'), 'page' => get_http_var('p'));
$MEMBER = new MEMBER(array('person_id' => $args['person_id']));
if ($MEMBER->valid) {
$pagetitle = $DATA->page_metadata($this_page, 'title');
$DATA->set_page_metadata($this_page, 'title', $pagetitle . ' ' . $MEMBER->full_name());
}
$LIST = new WRANSLIST();
$LIST->display('mp', $args);
} else {
// No date or wrans id. Show recent days with wrans on.
$this_page = "wransfront";
$PAGE->page_start();
$PAGE->stripe_start();
?>
<h2>Some recent written answers</h2>
<?php
$WRANSLIST = new WRANSLIST();
$WRANSLIST->display('recent_wrans', array('days' => 7, 'num' => 20));
$PAGE->stripe_end(array(array('type' => 'nextprev'), array('type' => 'include', 'content' => 'calendar_wrans'), array('type' => 'include', 'content' => "wrans")));
}
示例12: search_form
public function search_form($value = '')
{
global $SEARCHENGINE;
// Search box on the search page.
// If $value is set then it will be displayed in the form.
// Otherwise the value of 's' in the URL will be displayed.
$wtt = get_http_var('wtt');
$URL = new URL('search');
$URL->reset();
// no need to pass any query params as a form action. They are not used.
if ($value == '') {
if (get_http_var('q') !== '') {
$value = get_http_var('q');
} else {
$value = get_http_var('s');
}
}
$person_name = '';
if (preg_match_all('#speaker:(\\d+)#', $value, $m) == 1) {
$person_id = $m[1][0];
$member = new MEMBER(array('person_id' => $person_id));
if ($member->valid) {
$value = str_replace("speaker:{$person_id}", '', $value);
$person_name = $member->full_name();
}
}
echo '<div class="mainsearchbox">';
if ($wtt < 2) {
echo '<form action="', $URL->generate(), '" method="get">';
if (get_http_var('o')) {
echo '<input type="hidden" name="o" value="', _htmlentities(get_http_var('o')), '">';
}
if (get_http_var('house')) {
echo '<input type="hidden" name="house" value="', _htmlentities(get_http_var('house')), '">';
}
echo '<input type="text" name="q" value="', _htmlentities($value), '" size="50"> ';
echo '<input type="submit" value=" ', $wtt ? 'Modify search' : 'Search', ' ">';
$URL = new URL('search');
$URL->insert(array('adv' => 1));
echo ' <a href="' . $URL->generate() . '">More options</a>';
echo '<br>';
if ($wtt) {
print '<input type="hidden" name="wtt" value="1">';
}
} else {
?>
<form action="http://www.writetothem.com/lords" method="get">
<input type="hidden" name="pid" value="<?php
echo _htmlentities(get_http_var('pid'));
?>
">
<input type="submit" style="font-size: 150%" value=" I want to write to this Lord "><br>
<?php
}
if (!$wtt && ($value || $person_name)) {
echo '<div style="margin-top: 5px">';
$orderUrl = new URL('search');
$orderUrl->insert(array('s' => $value));
# Need the parsed value
$ordering = get_http_var('o');
if ($ordering != 'r' && $ordering != 'd' && $ordering != 'p' && $ordering != 'o') {
$ordering = 'd';
}
if ($ordering == 'r') {
print '<strong>Sorted by relevance</strong>';
} else {
printf("<a href='%s'>Sort by relevance</a>", $orderUrl->generate('html', array('o' => 'r')));
}
print " | ";
if ($ordering == 'd') {
print '<strong>Sorted by date: newest</strong> / <a href="' . $orderUrl->generate('html', array('o' => 'o')) . '">oldest</a>';
} elseif ($ordering == 'o') {
print '<strong>Sorted by date:</strong> <a href="' . $orderUrl->generate('html', array('o' => 'd')) . '">newest</a> / <strong>oldest</strong>';
} else {
printf("Sort by date: <a href='%s'>newest</a> / <a href='%s'>oldest</a>", $orderUrl->generate('html', array('o' => 'd')), $orderUrl->generate('html', array('o' => 'o')));
}
print " | ";
if ($ordering == 'p') {
print '<strong>Use by person</strong>';
} else {
printf('<a href="%s">Show use by person</a>', $orderUrl->generate('html', array('o' => 'p')));
}
echo '</div>';
if ($person_name) {
?>
<p>
<input type="radio" name="pid" value="<?php
echo _htmlentities($person_id);
?>
" checked>Search only <?php
echo _htmlentities($person_name);
?>
<input type="radio" name="pid" value="">Search all speeches
</p>
<?php
}
}
echo '</form> </div>';
}
示例13: array
$tots = array();
$name = array();
for ($i = 0; $i < $q->rows(); $i++) {
$c = $q->field($i, 'c');
$criteria = $q->field($i, 'criteria');
if (!preg_match('#^speaker:(\\d+)#', $criteria, $m)) {
continue;
}
$person_id = $m[1];
$MEMBER = new MEMBER(array('person_id' => $person_id));
if ($MEMBER->valid) {
if (!array_key_exists($person_id, $tots)) {
$tots[$person_id] = 0;
}
$tots[$person_id] += $c;
$name[$person_id] = $MEMBER->full_name();
}
}
$q = $db->query('select count(*) as c, criteria from alerts where criteria like "speaker:%" and not confirmed group by criteria order by c desc');
$unconfirmed = array();
for ($i = 0; $i < $q->rows(); $i++) {
$c = $q->field($i, 'c');
$criteria = $q->field($i, 'criteria');
if (!preg_match('#^speaker:(\\d+)#', $criteria, $m)) {
continue;
}
$person_id = $m[1];
if (isset($name[$person_id])) {
if (!array_key_exists($person_id, $unconfirmed)) {
$unconfirmed[$person_id] = 0;
}
示例14: appearances
}
$date = $hdate . 'T' . $htime . '+00:00';
$items .= '<rdf:li rdf:resource="' . $link . '" />' . "\n";
$entries .= "<item rdf:about=\"{$link}\">\n\t<title>{$title}</title>\n\t<link>{$link}</link>\n\t<description>{$description}</description>\n\t<content:encoded><![CDATA[{$contentencoded}]]></content:encoded>\n\t<dc:date>{$date}</dc:date>\n</item>\n";
}
}
// Prepare the whole text of the RSS file.
$rsstext = '<?xml version="1.0" encoding="iso-8859-1"?>
<rdf:RDF
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel rdf:about="http://' . DOMAIN . $mpurl . '">
<title>' . entities_to_numbers($MEMBER->full_name()) . '\'s recent appearances (OpenAustralia.org)</title>
<link>http://' . DOMAIN . $mpurl . '</link>
<description></description>
<dc:language>en-gb</dc:language>
<dc:creator>OpenAustralia.org, mprss.php script</dc:creator>
<dc:date>' . $datenow . '</dc:date>
<items>
<rdf:Seq>
' . $items . '</rdf:Seq>
</items>
</channel>
' . $entries . '
示例15: display_search_form
function display_search_form($alert, $details = array(), $errors = array())
{
global $this_page, $PAGE;
$ACTIONURL = new URL($this_page);
$ACTIONURL->reset();
$form_start = '<form action="' . $ACTIONURL->generate() . '" method="post">
<input type="hidden" name="t" value="' . _htmlspecialchars(get_http_var('t')) . '">
<input type="hidden" name="email" value="' . _htmlspecialchars(get_http_var('email')) . '">';
if (isset($details['members']) && $details['members']->rows() > 0) {
echo '<ul class="hilites">';
$q = $details['members'];
for ($n = 0; $n < $q->rows(); $n++) {
echo '<li>';
echo $form_start . '<input type="hidden" name="pid" value="' . $q->field($n, 'person_id') . '">';
echo 'Things by ';
$name = member_full_name($q->field($n, 'house'), $q->field($n, 'title'), $q->field($n, 'given_name'), $q->field($n, 'family_name'), $q->field($n, 'lordofname'));
if ($q->field($n, 'constituency')) {
echo $name . ' (' . $q->field($n, 'constituency') . ') ';
} else {
echo $name;
}
echo ' <input type="submit" value="Subscribe"></form>';
echo "</li>\n";
}
echo '</ul>';
}
if (isset($details['constituencies'])) {
echo '<ul class="hilites">';
foreach ($details['constituencies'] as $constituency) {
$MEMBER = new MEMBER(array('constituency' => $constituency, 'house' => 1));
echo "<li>";
echo $form_start . '<input type="hidden" name="pid" value="' . $MEMBER->person_id() . '">';
if ($details['valid_postcode']) {
echo '<input type="hidden" name="pc" value="' . _htmlspecialchars($details['alertsearch']) . '">';
}
echo $MEMBER->full_name();
echo ' (' . _htmlspecialchars($constituency) . ')';
echo ' <input type="submit" value="Subscribe"></form>';
echo "</li>";
}
echo '</ul>';
}
if ($details['alertsearch']) {
echo '<ul class="hilites"><li>';
echo $form_start . '<input type="hidden" name="keyword" value="' . _htmlspecialchars($details['alertsearch']) . '">';
echo 'Mentions of [';
$alertsearch = $details['alertsearch'];
if (preg_match('#speaker:(\\d+)#', $alertsearch, $m)) {
$MEMBER = new MEMBER(array('person_id' => $m[1]));
$alertsearch = str_replace("speaker:{$m['1']}", "speaker:" . $MEMBER->full_name(), $alertsearch);
}
echo _htmlspecialchars($alertsearch) . '] ';
echo ' <input type="submit" value="Subscribe"></form>';
# Use original alertsearch variable here, because name replacement might introduce a comma
if (strstr($details['alertsearch'], ',') > -1) {
echo '<em class="error">You have used a comma in your search term – are you sure this is what you want?
You cannot sign up to multiple search terms using a comma – either use OR, or fill in this form multiple times.</em>';
}
if (preg_match('#([A-Z]{1,2}\\d+[A-Z]? ?\\d[A-Z]{2})#i', $alertsearch, $m) && strlen($alertsearch) > strlen($m[1]) && validate_postcode($m[1])) {
$scottish_text = '';
$mp_display_text = '';
if (postcode_is_scottish($m[1])) {
$mp_display_text = 'your MP, ';
$scottish_text = ' or MSP';
}
echo '<em class="error">You have used a postcode and something else in your search term – are you sure this is what you want?
You will only get an alert if all of these are mentioned in the same debate. Did you mean to get alerts for when your MP' . $scottish_text . ' mentions something instead? If so click subscribe below.</em></li>';
try {
$MEMBER = new MEMBER(array('postcode' => $m[1]));
// move the postcode to the front just to be tidy
$tidy_alertsearch = $m[1] . " " . trim(str_replace("{$m['1']}", "", $alertsearch));
$alertsearch_display = str_replace("{$m['1']} ", "", $tidy_alertsearch);
$alertsearch = str_replace("{$m['1']}", "speaker:" . $MEMBER->person_id, $tidy_alertsearch);
echo "<li>";
echo $form_start . '<input type="hidden" name="keyword" value="' . _htmlspecialchars($alertsearch) . '">';
echo 'Mentions of [';
echo _htmlspecialchars($alertsearch_display) . '] by ' . $mp_display_text . $MEMBER->full_name();
echo ' <input type="submit" value="Subscribe"></form>';
if ($scottish_text) {
$constituencies = postcode_to_constituencies($m[1]);
if (isset($constituencies['SPC'])) {
$MEMBER = new MEMBER(array('constituency' => $constituencies['SPC'], 'house' => 4));
// move the postcode to the front just to be tidy
$alertsearch = str_replace("{$m['1']}", "speaker:" . $MEMBER->person_id, $tidy_alertsearch);
echo "</li><li>";
echo $form_start . '<input type="hidden" name="keyword" value="' . _htmlspecialchars($alertsearch) . '">';
echo 'Mentions of [';
echo _htmlspecialchars($alertsearch_display) . '] by your MSP, ' . $MEMBER->full_name();
echo ' <input type="submit" value="Subscribe"></form>';
}
}
} catch (MySociety\TheyWorkForYou\MemberException $e) {
echo '<p>We had a problem looking up your representative.</p>';
}
}
echo "</li></ul>";
}
if ($details['pid']) {
$MEMBER = new MEMBER(array('person_id' => $details['pid']));
echo '<ul class="hilites"><li>';
//.........这里部分代码省略.........