protected function generate_votes($votes, $id, $gid) { /* Returns HTML for the 'Does this answer the question?' links (wrans) in the sidebar. $votes = => array ( 'user' => array ( 'yes' => '21', 'no' => '3' ), 'anon' => array ( 'yes' => '132', 'no' => '30' ) ) */ global $this_page; # If there's a "q" we assume it's a question and ignore it if (strstr($gid, 'q')) { return; } $data = array(); if ($this->votelinks_so_far > 0 || strstr($gid, 'r')) { $yesvotes = $votes['user']['yes'] + $votes['anon']['yes']; $novotes = $votes['user']['no'] + $votes['anon']['no']; $yesplural = $yesvotes == 1 ? 'person thinks' : 'people think'; $noplural = $novotes == 1 ? 'person thinks' : 'people think'; $URL = new \URL($this_page); $returl = $URL->generate(); $VOTEURL = new \URL('epvote'); $VOTEURL->insert(array('v' => '1', 'id' => $id, 'ret' => $returl)); $yes_vote_url = $VOTEURL->generate(); $VOTEURL->insert(array('v' => '0')); $no_vote_url = $VOTEURL->generate(); $data = array('yesvotes' => $yesvotes, 'yesplural' => $yesplural, 'yesvoteurl' => $yes_vote_url, 'novoteurl' => $no_vote_url, 'novotes' => $novotes, 'noplural' => $noplural); } $this->votelinks_so_far++; return $data; }
function _api_getPerson_row($row, $has_party = FALSE) { global $parties; $row['full_name'] = member_full_name($row['house'], $row['title'], $row['first_name'], $row['last_name'], $row['constituency']); if ($row['house'] == 1) { $URL = new URL('mp'); $row['url'] = $URL->generate('none') . make_member_url($row['full_name'], $row['constituency'], $row['house']); } if ($has_party && isset($parties[$row['party']])) { $row['party'] = $parties[$row['party']]; } list($image, $sz) = find_rep_image($row['person_id']); if ($image) { list($width, $height) = getimagesize(str_replace(IMAGEPATH, BASEDIR . '/images/', $image)); $row['image'] = $image; $row['image_height'] = $height; $row['image_width'] = $width; } if ($row['house'] == 1 && ($row['left_house'] == '9999-12-31' || $row['left_house'] == '2010-04-12')) { # XXX # Ministerialships and Select Committees $db = new ParlDB(); $q = $db->query('SELECT * FROM moffice WHERE to_date="9999-12-31" and person=' . $row['person_id'] . ' ORDER BY from_date DESC'); for ($i = 0; $i < $q->rows(); $i++) { $row['office'][] = $q->row($i); } } foreach ($row as $k => $r) { if (is_string($r)) { $row[$k] = html_entity_decode($r); } } return $row; }
function display_page($errors = array()) { global $PAGE, $this_page, $THEUSER; $PAGE->page_start(); $PAGE->stripe_start(); if ($THEUSER->isloggedin()) { // Shouldn't really get here, but you never know. $URL = new URL('userlogout'); ?> <p><strong>You are already logged in. <a href="<?php echo $URL->generate(); ?> ">Log out?</a></strong></p> <?php $PAGE->stripe_end(); $PAGE->page_end(); return; } ?> <p>Not yet a member? <a href="<?php $URL = new URL("userjoin"); echo $URL->generate(); ?> ">Join now</a>!</p> <?php $PAGE->login_form($errors); $PAGE->stripe_end(array(array('type' => 'include', 'content' => 'userlogin'))); $PAGE->page_end(); }
/** * Get Menu Links * * Takes an array of pages and returns an array suitable for use in links. */ private function get_menu_links($pages) { global $DATA, $this_page; $links = array(); foreach ($pages as $page) { //get meta data $menu = $DATA->page_metadata($page, 'menu'); if ($menu) { $title = $menu['text']; } else { $title = $DATA->page_metadata($page, 'title'); } $url = $DATA->page_metadata($page, 'url'); $tooltip = $DATA->page_metadata($page, 'heading'); //check for external vs internal menu links if (!valid_url($url)) { $URL = new \URL($page); $url = $URL->generate(); } //make the link if ($page == $this_page) { $links[] = array('href' => '#', 'title' => '', 'classes' => '', 'text' => $title); } else { $links[] = array('href' => $url, 'title' => $tooltip, 'classes' => '', 'text' => $title); } } return $links; }
function get_listurl($q) { global $hansardmajors; $id_data = array( 'gid' => fix_gid_from_db($q->field(0, 'gid')), 'major' => $q->field(0, 'major'), 'htype' => $q->field(0, 'htype'), 'subsection_id' => $q->field(0, 'subsection_id'), ); $db = new ParlDB; $LISTURL = new URL($hansardmajors[$id_data['major']]['page_all']); $fragment = ''; if ($id_data['htype'] == '11' || $id_data['htype'] == '10') { $LISTURL->insert( array( 'id' => $id_data['gid'] ) ); } else { $parent_epobject_id = $id_data['subsection_id']; $parent_gid = ''; $r = $db->query("SELECT gid FROM hansard WHERE epobject_id = '" . mysql_real_escape_string($parent_epobject_id) . "' "); if ($r->rows() > 0) { $parent_gid = fix_gid_from_db( $r->field(0, 'gid') ); } if ($parent_gid != '') { $LISTURL->insert( array( 'id' => $parent_gid ) ); $fragment = '#g' . gid_to_anchor($id_data['gid']); } } return $LISTURL->generate('none') . $fragment; }
protected function getURLs() { $urls = array(); $regional = new \URL('msp'); $urls['regional'] = $regional->generate(); return $urls; }
function generate_rows($q) { global $db; $rows = array(); $USERURL = new URL('userview'); for ($row = 0; $row < $q->rows(); $row++) { $email = $q->field($row, 'email'); $criteria = $q->field($row, 'criteria'); $SEARCHENGINE = new SEARCHENGINE($criteria); $r = $db->query("SELECT user_id,firstname,lastname FROM users WHERE email = '" . mysql_escape_string($email) . "'"); if ($r->rows() > 0) { $user_id = $r->field(0, 'user_id'); $USERURL->insert(array('u' => $user_id)); $name = '<a href="' . $USERURL->generate() . '">' . $r->field(0, 'firstname') . ' ' . $r->field(0, 'lastname') . '</a>'; } else { $name = $email; } $created = $q->field($row, 'created'); if ($created == '0000-00-00 00:00:00') { $created = ' '; } $rows[] = array($name, $SEARCHENGINE->query_description_long(), $created); } return $rows; }
private function getPostCodeChangeURL() { global $THEUSER; $CHANGEURL = new \URL('userchangepc'); if ($THEUSER->isloggedin()) { $CHANGEURL = new \URL('useredit'); } return $CHANGEURL->generate(); }
protected function display_front_ni() { global $this_page; $this_page = "nioverview"; $data = array(); $urls = array(); $data['popular_searches'] = NULL; $search = new \URL('search'); $urls['search'] = $search->generate(); $alert = new \URL('alert'); $urls['alert'] = $alert->generate(); $data['urls'] = $urls; $DEBATELIST = new \NILIST(); $debates = $DEBATELIST->display('recent_debates', array('days' => 30, 'num' => 6), 'none'); $MOREURL = new \URL('nidebatesfront'); $MOREURL->insert(array('more' => 1)); // this makes sure that we don't repeat this debate in the list below $random_debate = NULL; if (isset($debates['data']) && count($debates['data'])) { $random_debate = $debates['data'][0]; } $recent = array(); if (isset($debates['data']) && count($debates['data'])) { for ($i = 1; $i < 6; $i++) { $debate = $debates['data'][$i]; $debate['desc'] = "Northern Ireland Assembly debates"; $debate['more_url'] = $MOREURL->generate(); $recent[] = $debate; } } $featured = array(); if ($random_debate) { $featured = $random_debate; $featured['more_url'] = $MOREURL->generate(); $featured['desc'] = 'Northern Ireland Assembly debate'; $featured['related'] = array(); $featured['featured'] = false; } $data['featured'] = $featured; $data['debates'] = array('recent' => $recent); $data['regional'] = $this->getMLAList(); \MySociety\TheyWorkForYou\Renderer::output('ni/index', $data); }
protected function getURLs() { $urls = array(); $search = new \URL('search'); $urls['search'] = $search->generate(); $alert = new \URL('alert'); $urls['alert'] = $alert->generate(); $regional = new \URL('msp'); $urls['regional'] = $regional->generate(); return $urls; }
public function get_values() { global $this_page; $data = array(); // TODO: think about not hard coding these $current_question = 3; $always_ask = 1; $data['survey_site'] = "twfy-mini-{$current_question}"; $show_survey_qn = 0; $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $has_answered_question = get_http_var('answered_survey'); $hide_question = get_http_var('hide_survey'); $data['show'] = false; if ($hide_question) { $always_ask = 0; $show_survey_qn = $current_question; setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); } elseif ($has_answered_question == $current_question && !$always_ask) { $show_survey_qn = $current_question; setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); } elseif (isset($_COOKIE['survey'])) { $show_survey_qn = $_COOKIE['survey']; } if ($show_survey_qn < $current_question && !$has_answered_question) { $data['show'] = true; $page_url = ''; $hide_url = ''; if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) { global $MEMBER; if ($MEMBER) { $page_url = $MEMBER->url() . "?answered_survey={$current_question}"; $hide_url = $MEMBER->url() . "?hide_survey={$current_question}"; } } else { $URL = new \URL($this_page); $URL->insert(array('answered_survey' => $current_question)); $page_url = 'http://' . DOMAIN . $URL->generate(); $URL = new \URL($this_page); $URL->insert(array('hide_survey' => $current_question)); $hide_url = 'http://' . DOMAIN . $URL->generate(); } $data['page_url'] = $page_url; $data['hide_url'] = $hide_url; $data['user_code'] = bin2hex(urandom_bytes(16)); $data['auth_signature'] = auth_sign_with_shared_secret($data['user_code'], OPTION_SURVEY_SECRET); $data['datetime'] = time(); } $data['current_q'] = $current_question; $data['answered'] = $has_answered_question; return $data; }
private static function addCommonURLs($data) { $urls = array(); if (isset($data['urls'])) { $urls = $data['urls']; } $common_urls = array('search', 'alert'); foreach ($common_urls as $path) { if (!isset($urls[$path])) { $url = new \URL($path); $urls[$path] = $url->generate(); } } $data['urls'] = $urls; return $data; }
function search_bullet_point() { global $SEARCHURL; ?> <li> <?php $SEARCHURL = new URL('search'); ?> <form action="<?php echo $SEARCHURL->generate(); ?> " method="get"> <p><strong><label for="s">Search<?php echo get_http_var("keyword") ? ' Hansard for \'' . htmlspecialchars(get_http_var("keyword")) . '\'' : ''; ?> :</label></strong> <input type="text" name="s" id="s" size="15" maxlength="100" class="text" value="<?php echo htmlspecialchars(get_http_var("keyword")); ?> "> <input type="submit" value="SEARCH" class="submit"></p> <?php // Display popular queries global $SEARCHLOG; $popular_searches = $SEARCHLOG->popular_recent(10); if (count($popular_searches) > 0) { ?> <p>Popular searches today: <?php $lentotal = 0; $correct_amount = array(); // Select a number of queries that will fit in the space foreach ($popular_searches as $popular_search) { $len = strlen($popular_search['visible_name']); if ($lentotal + $len > 32) { continue; } $lentotal += $len; array_push($correct_amount, $popular_search['display']); } print implode(", ", $correct_amount); ?> </p> <?php } ?> </form> </li> <?php }
function display_page($errors = array()) { global $this_page, $PAGE; if (isset($errors["sending"])) { $PAGE->error_message($errors["sending"]); } else { print "<p>If you can't remember your password we can send you a new one.</p>\n<p>If you would like a new password, enter your address below.</p>\n"; } ?> <form method="get" action="<?php $URL = new URL($this_page); echo $URL->generate(); ?> "> <?php if (isset($errors["email"])) { $PAGE->error_message($errors["email"]); } if (isset($errors["passwordchange"])) { $PAGE->error_message($errors["passwordchange"]); } ?> <div class="row"> <div class="left">Email address:</div> <div class="right"><input type="text" name="email" value="<?php echo _htmlentities(get_http_var("email")); ?> " maxlength="100" size="30" class="form"></div> </div> <div class="row"> <div class="left"> </div> <div class="right"><input type="submit" value="Send me a new password"></div> </div> <input type="hidden" name="submitted" value="true"> </form> <?php }
protected function public_bill_committees() { global $this_page, $DATA, $PAGE; $id = get_http_var('id'); $bill_id = null; if ($this->session && $this->bill) { $q = $this->list->db->query('select id,standingprefix from bills where title = :bill and session = :session', array(':bill' => $this->bill, ':session' => $this->session)); if ($q->rows()) { $bill_id = $q->field(0, 'id'); $standingprefix = $q->field(0, 'standingprefix'); } } if ($bill_id && $id) { return $this->display_section_or_speech(array('gid' => $standingprefix . $id)); } elseif ($bill_id) { # Display the page for a particular bill $this_page = 'pbc_bill'; $args = array('id' => $bill_id, 'title' => $this->bill, 'session' => $this->session); $data = array(); $data['content'] = $this->list->display('bill', $args, 'none'); $data['session'] = $this->session; $data['template'] = 'section/pbc_bill'; return $this->addCommonData($data); } elseif ($this->session && $this->bill) { # Illegal bill title, redirect to session page $URL = new \URL('pbc_session'); header('Location: ' . $URL->generate() . urlencode($this->session)); exit; } elseif ($this->session) { # Display the bills for a particular session $this_page = 'pbc_session'; $DATA->set_page_metadata($this_page, 'title', "Session {$this->session}"); $args = array('session' => $this->session); $data = array(); $data['rows'] = $this->list->display('session', $args, 'none'); $data['template'] = 'section/pbc_session'; $data['session'] = $this->session; return $this->addCommonData($data); } else { return $this->display_front(); } }
function _set_url() { global $hansardmajors; // Creates and sets the URL for the comment. if ($this->url == '') { $q = $this->db->query("SELECT major,\n\t\t\t\t\t\t\t\t\tgid\n\t\t\t\t\t\t\tFROM\thansard\n\t\t\t\t\t\t\tWHERE\tepobject_id = '" . addslashes($this->epobject_id) . "'\n\t\t\t\t\t\t\t"); if ($q->rows() > 0) { // If you change stuff here, you might have to change it in // $COMMENTLIST->_get_comment_data() too... $gid = fix_gid_from_db($q->field(0, 'gid')); // In includes/utility.php $major = $q->field(0, 'major'); $page = $hansardmajors[$major]['page']; $gidvar = $hansardmajors[$major]['gidvar']; $URL = new URL($page); $URL->insert(array($gidvar => $gid)); $this->url = $URL->generate() . '#c' . $this->comment_id; } } }
function _get_data_by_session($args) { global $DATA, $this_page; $session = $args['session']; $e_session = mysql_escape_string($session); $q = $this->db->query('select id, title from bills where session="' . $e_session . '" order by title'); $bills = array(); for ($i = 0; $i < $q->rows(); $i++) { $bills[$q->field($i, 'id')] = $q->field($i, 'title'); } $q = $this->db->query('select minor,count(*) as c from hansard where major=6 and htype=12 and minor in (' . join(',', array_keys($bills)) . ') group by minor'); $counts = array(); # $comments = array(); for ($i = 0; $i < $q->rows(); $i++) { $minor = $q->field($i, 'minor'); $counts[$minor] = $q->field($i, 'c'); # $comments[$minor] = 0; } /* $q = $this->db->query('select minor,epobject_id from hansard where major=6 and htype=10 and minor in (' . join(',', array_keys($bills)) . ')'); for ($i=0; $i<$q->rows(); $i++) { $comments[$q->field($i, 'minor')] += $this->_get_comment_count_for_epobject(array( 'epobject_id' => $q->field($i, 'epobject_id'), 'htype' => 10, )); } */ $data = array(); foreach ($bills as $id => $title) { $data[] = array('title' => $title, 'url' => urlencode($title), 'contentcount' => isset($counts[$id]) ? $counts[$id] : '???'); } $YEARURL = new URL('pbc_session'); $nextprev = array(); $nextprev['prev'] = array('body' => 'Previous session', 'title' => ''); $nextprev['next'] = array('body' => 'Next session', 'title' => ''); $q = $this->db->query("SELECT session FROM bills WHERE session < '" . $e_session . "' ORDER BY session DESC LIMIT 1"); $prevyear = $q->field(0, 'session'); $q = $this->db->query("SELECT session FROM bills WHERE session > '" . $e_session . "' ORDER BY session ASC LIMIT 1"); $nextyear = $q->field(0, 'session'); if ($prevyear) { $nextprev['prev']['url'] = $YEARURL->generate() . $prevyear . '/'; } if ($nextyear) { $nextprev['next']['url'] = $YEARURL->generate() . $nextyear . '/'; } $DATA->set_page_metadata($this_page, 'nextprev', $nextprev); return $data; }
// Get the total comments posted for this user. $r = $db->query("SELECT COUNT(*) AS totalcount\n FROM\tcomments\n WHERE\tuser_id = '" . $user_id . "'"); $totalcomments = $r->field(0, 'totalcount'); $percentagedeleted = $q->field($row, 'deletedcount') / $totalcomments * 100; // Get complaints made about this user's comments, but not upheld. $r = $db->query("SELECT COUNT(*) AS count\n FROM commentreports, comments\n WHERE\tcommentreports.comment_id = comments.comment_id\n AND\t\tcomments.user_id = '{$user_id}'\n AND\t\tcommentreports.resolved IS NOT NULL\n AND\t\tcommentreports.upheld = '0'"); $notupheldcount = $r->field(0, 'count'); $USERURL->insert(array('u' => $user_id)); $rows[] = array('<a href="' . $USERURL->generate() . '">' . $q->field($row, 'firstname') . ' ' . $q->field($row, 'lastname') . '</a>', $totalcomments, $q->field($row, 'deletedcount'), $percentagedeleted . '%', $notupheldcount); } $tabledata = array('header' => array('Name', 'Total comments', 'Number deleted', 'Percentage deleted', 'Reports against not upheld'), 'rows' => $rows); $PAGE->display_table($tabledata); /////////////////////////////////////////////////////////////// ?> <h4>Users who've made most rejected reports</h4> <?php $q = $db->query("SELECT COUNT(*) AS rejectedcount,\n cr.user_id,\n u.firstname,\n u.lastname\n FROM\tcommentreports cr, users u\n WHERE\tcr.resolved IS NOT NULL\n AND\t\tcr.upheld = '0'\n AND\t\tcr.user_id = u.user_id\n AND\t\tcr.user_id != 0\n GROUP BY cr.user_id\n ORDER BY rejectedcount DESC"); $rows = array(); $USERURL = new URL('userview'); for ($row = 0; $row < $q->rows(); $row++) { $user_id = $q->field($row, 'user_id'); $USERURL->insert(array('u' => $user_id)); // Get how many valid complaints they've submitted. $r = $db->query("SELECT COUNT(*) AS upheldcount\n FROM commentreports\n WHERE\tuser_id = '{$user_id}'\n AND\t\tupheld = '1'"); $rows[] = array('<a href="' . $USERURL->generate() . '">' . $q->field($row, 'firstname') . ' ' . $q->field($row, 'lastname') . '</a>', $q->field($row, 'rejectedcount'), $r->field(0, 'upheldcount')); } $tabledata = array('header' => array('Name', 'Reports not upheld', 'Reports upheld'), 'rows' => $rows); $PAGE->display_table($tabledata); $menu = $PAGE->admin_menu(); $PAGE->stripe_end(array(array('type' => 'html', 'content' => $menu))); $PAGE->page_end();
<?php $URL = new URL('help'); $helpurl = $URL->generate(); $this->block_start(array('id' => 'help', 'title' => "What are Public Bill Committees?")); ?> <p>Previously called Standing Committees, <strong>Public Bill Commitees</strong> study proposed legislation (Bills) in detail, debating each clause and reporting any amendments to the Commons for further debate. </p> <p>There are at least 16 MPs on a Committee, and the proportion of parties reflects the House of Commons, so the government always has a majority. </p> <?php $this->block_end();
<?php // For a non-logged-in user changing their postcode. include_once "../../../includes/easyparliament/init.php"; $this_page = "userchangepc"; if ($THEUSER->isloggedin()) { // They can't change their postcode here, so send them to the editing page. $URL = new URL('useredit'); header("Location: http://" . DOMAIN . $URL->generate()); } if (get_http_var('forget') == 't') { // The user clicked the 'Forget this postcode' link. $THEUSER->unset_postcode_cookie(); // The cookie will have already been read for this page, so we need to reload. $URL = new URL($this_page); header("Location: http://" . DOMAIN . $URL->generate()); } if (!$THEUSER->postcode_is_set()) { // Change it from 'Change your postcode'. $DATA->set_page_metadata($this_page, 'title', 'Enter your postcode'); } $PAGE->page_start(); $PAGE->stripe_start(); $PAGE->postcode_form(); $PAGE->stripe_end(); $PAGE->page_end();
'last_name' => 'Bloggs, 'person_id' => 23, 'constituency' => 'Here', 'party' => 'Them' ) ); */ global $this_page; twfy_debug("TEMPLATE", "people_mps.php"); $order = $data['info']['order']; $URL = new URL($this_page); if ($order == 'first_name') { $th_name = 'First'; } else { $URL->insert(array('o' => 'f')); $th_name = '<a href="' . $URL->generate() . '">First</a>'; } $th_name .= ' & '; if ($order == 'last_name') { $th_name .= 'Last'; } else { $URL->insert(array('o' => 'l')); $th_name .= '<a href="' . $URL->generate() . '">Last</a>'; } $th_name .= ' name'; $URL->insert(array('o' => 'p')); $th_party = '<a href="' . $URL->generate() . '">Party</a>'; if ($order == 'party') { $th_party = 'Party'; } $URL->insert(array('o' => 'c'));
function find_glossary_items($args) { $searchterm = $args['s']; $GLOSSARY = new GLOSSARY($args); if (isset($GLOSSARY->num_search_matches) && $GLOSSARY->num_search_matches >= 1) { // Got a match(es), display.... $URL = new URL('glossary'); $URL->insert(array('gl' => "")); ?> <h3>Matching glossary terms:</h3> <p><?php $n = 1; foreach ($GLOSSARY->search_matches as $glossary_id => $term) { $URL->update(array("gl" => $glossary_id)); ?> <a href="<?php echo $URL->generate(); ?> "><strong><?php echo htmlentities($term['title']); ?> </strong></a><?php if ($n < $GLOSSARY->num_search_matches) { print ", "; } $n++; } ?> </p> <?php } }
// Get all the person ids we need feeds for... $q = $db->query("SELECT person_id, group_concat(member_id order by member_id separator ',') as member_ids\n\t\t\tFROM member GROUP BY person_id HAVING max(left_house)='9999-12-31'"); if ($q->rows() <= 0) { exit; } $starttime = time(); for ($personrow = 0; $personrow < $q->rows(); $personrow++) { $person_id = $q->field($personrow, 'person_id'); $member_ids = $q->field($personrow, 'member_ids'); $args = array('member_ids' => $member_ids); $speeches = $HANSARDLIST->display('person', $args, 'none'); // Some data about this person that we'll need for the feed. $MEMBER = new MEMBER(array('person_id' => $person_id)); $MPURL = new URL('mp'); $MPURL->insert(array('pid' => $person_id)); $mpurl = $MPURL->generate(); $date = gmdate('Y-m-d'); $time = gmdate('H:i:s'); $datenow = $date . 'T' . $time . '+00:00'; // Prepare the meat of the RSS file. $items = ''; $entries = ''; if (isset($speeches['rows']) && count($speeches['rows']) > 0) { foreach ($speeches['rows'] as $n => $row) { // While we're linking to individual speeches, // the text is the body of the parent, ie (sub)section. $title = htmlentities(str_replace('—', '-', $row['parent']['body'])); $link = isset($row['listurl']) ? $row['listurl'] : ''; $link = 'http://' . DOMAIN . $link; $description = htmlentities(trim_characters($row['body'], 0, 200)); $contentencoded = $row['body'];
?> </a> <?php } else { // There won't be a URL when we're just previewing a comment. echo "\t\t{$time}"; } if ($this_page != 'commentreport' && $this_page != 'addcomment' && $this_page != 'admin_commentreport' && $THEUSER->is_able_to('reportcomment') && !$comment['modflagged']) { // The comment hasn't been reported and we're on a page where we want to // display this link. $URL = new URL('commentreport'); $URL->insert(array('id' => $comment['comment_id'], 'ret' => $comment['url'])); ?> <br> <a href="<?php echo $URL->generate(); ?> " title="Notify moderators that this annotation needs editing or deleting">Report this annotation</a> <?php } elseif ($comment['modflagged']) { ?> <br> This annotation has been reported <?php } ?> </p> </div> <div class="break"> </div> </div> <?php
'last_name' => 'Bloggs, 'person_id' => 23, 'constituency' => 'Here', 'party' => 'Them' ) ); */ global $this_page; twfy_debug("TEMPLATE", "people_mps.php"); $order = $data['info']['order']; $URL = new URL($this_page); if ($order == 'name') { $th_name = 'Name'; } else { $URL->insert(array('o' => 'n')); $th_name = '<a href="' . $URL->generate() . '">Name</a>'; } $URL->insert(array('o' => 'p')); $th_party = '<a href="' . $URL->generate() . '">Party</a>'; if ($order == 'party') { $th_party = 'Party'; } ?> <div class="sort"> Sort by: <ul> <li><?php echo $th_name; ?> |</li> <li><?php
$PAGE->page_start(); $PAGE->stripe_start(); $args = array('year' => get_http_var('y')); $LIST = new LORDSDEBATELIST(); $LIST->display('calendar', $args); $PAGE->stripe_end(array(array('type' => 'nextprev'), array('type' => 'include', 'content' => "holdebates"))); } elseif (get_http_var('gid') != '') { $this_page = 'lordsdebate'; $args = array('gid' => get_http_var('gid')); $LORDSDEBATELIST = new LORDSDEBATELIST(); $result = $LORDSDEBATELIST->display('gid', $args); // If it is a redirect, change URL if (is_string($result)) { $URL = new URL('lordsdebate'); $URL->insert(array('gid' => $result)); header('Location: http://' . DOMAIN . $URL->generate('none'), true, 301); exit; } if ($LORDSDEBATELIST->htype() == '12' || $LORDSDEBATELIST->htype() == '13') { $PAGE->stripe_start('side', 'comments'); $COMMENTLIST = new COMMENTLIST(); $args['user_id'] = get_http_var('u'); $args['epobject_id'] = $LORDSDEBATELIST->epobject_id(); $COMMENTLIST->display('ep', $args); $PAGE->stripe_end(); $PAGE->stripe_start('side', 'addcomment'); $commendata = array('epobject_id' => $LORDSDEBATELIST->epobject_id(), 'gid' => get_http_var('gid'), 'return_page' => $this_page); $PAGE->comment_form($commendata); if ($THEUSER->isloggedin()) { $sidebar = array(array('type' => 'include', 'content' => 'comment')); $PAGE->stripe_end($sidebar);
'last_name' => 'Bloggs, 'person_id' => 23, 'constituency' => 'Here', 'party' => 'Them' ) ); */ global $this_page; twfy_debug("TEMPLATE", "people_mps.php"); $order = $data['info']['order']; $URL = new URL($this_page); if ($order == 'first_name') { $th_first_name = 'First Name |'; } else { $URL->insert(array('o' => 'f')); $th_first_name = '<a href="' . $URL->generate() . '">First name</a> |'; } if ($order == 'last_name') { $th_last_name = 'Last name |'; } else { $URL->insert(array('o' => 'l')); $th_last_name = '<a href="' . $URL->generate() . '">Last name</a> |'; } $URL->insert(array('o' => 'p')); $th_party = '<a href="' . $URL->generate() . '">Party</a>'; $URL->insert(array('o' => 'c')); $th_constituency = '<a href="' . $URL->generate() . '">Constituency</a>'; if ($order == 'party') { $th_party = 'Party'; } elseif ($order == 'constituency') { $th_constituency = 'Constituency';
if (isset($data['rows']) && count($data['rows']) > 0) { echo '<dl id="searchresults">'; for ($i = 0; $i < count($data['rows']); $i++) { $row = $data['rows'][$i]; echo '<dt><a href="', $row['listurl'], '">'; if (isset($row['parent']) && count($row['parent']) > 0) { echo '<strong>' . $row['parent']['body'] . '</strong>'; } echo '</a> <small>(' . format_date($row['hdate'], SHORTDATEFORMAT) . ')'; if ($row['video_status'] == 5 || $row['video_status'] == 7) { echo ' <em>has video</em> '; } if ($row['collapsed'] && $row['subsection_id']) { $URL = new URL('search'); $URL->insert(array('s' => $info['s'] . " segment:{$row['subsection_id']}")); echo ' <a href="', $URL->generate(), '">See ', $row['collapsed'], ' other result', $row['collapsed'] > 1 ? 's' : '', ' from this ', $hansardmajors[$row['major']]['singular'], '</a>'; } echo '</small>'; if ($match = get_http_var('match')) { echo ' – <a href="/search/record.php?result=', $row['gid'], '&match=', htmlspecialchars($match), '">This is the correct match</a>'; } echo '</dt> <dd><p>'; if (isset($row['speaker']) && count($row['speaker'])) { $sp = $row['speaker']; echo "<em>" . ucfirst(member_full_name($sp['house'], $sp['title'], $sp['first_name'], $sp['last_name'], $sp['constituency'])) . "</em>: "; } echo $row['body'] . "</p></dd>\n"; } echo '</dl> <!-- end searchresults -->'; $PAGE->page_links($info); $PAGE->search_form($info['s']);
function url($absolute = true) { $house = $this->house_disp; if ($house == 1) { $URL = new URL('mp'); } elseif ($house == 2) { $URL = new URL('peer'); } elseif ($house == 3) { $URL = new URL('mla'); } elseif ($house == 4) { $URL = new URL('msp'); } elseif ($house == 0) { $URL = new URL('royal'); } $member_url = make_member_url($this->full_name(true), $this->constituency(), $house); if ($absolute) { return 'http://' . DOMAIN . $URL->generate('none') . $member_url; } else { return $URL->generate('none') . $member_url; } }
<?php $this_page = "parliaments"; include_once "../../includes/easyparliament/init.php"; $PAGE->page_start(); $PAGE->stripe_start(); echo '<dl>'; foreach (array('hansard', 'sp_home', 'ni_home', 'wales_home') as $page) { $menu = $DATA->page_metadata($page, 'menu'); $title = $menu['text']; $text = $menu['title']; $URL = new URL($page); $url = $URL->generate(); echo "<dt><a href='{$url}'>{$title}</a></dt><dd>{$text}</dd>\n"; } echo '</ul>'; $PAGE->stripe_end(); $PAGE->page_end();