コード例 #1
0
ファイル: DebatesView.php プロジェクト: vijo/theyworkforyou
 protected function display_front()
 {
     global $PAGE, $DATA, $this_page;
     // No date or debate id. Show some recent debates
     $this_page = "alldebatesfront";
     $DEBATELIST = new \DEBATELIST();
     $debates = array();
     $debates['data'] = $DEBATELIST->display('biggest_debates', array('days' => 7, 'num' => 10), 'none');
     $args = array('months' => 1);
     $debates['calendar'] = $DEBATELIST->display('calendar', $args, 'none');
     $debates['rssurl'] = $DATA->page_metadata($this_page, 'rss');
     $this_page = "whallfront";
     $whall = array();
     $WHALLLIST = new \WHALLLIST();
     $whall['data'] = $WHALLLIST->display('biggest_debates', array('days' => 7, 'num' => 10), 'none');
     $args = array('months' => 1);
     $whall['calendar'] = $WHALLLIST->display('calendar', $args, 'none');
     $whall['rssurl'] = $DATA->page_metadata($this_page, 'rss');
     $this_page = "lordsdebatesfront";
     $lords = array();
     $LORDSDEBATELIST = new \LORDSDEBATELIST();
     $lords['data'] = $LORDSDEBATELIST->display('biggest_debates', array('days' => 7, 'num' => 10), 'none');
     $args = array('months' => 1);
     $lords['calendar'] = $LORDSDEBATELIST->display('calendar', $args, 'none');
     $lords['rssurl'] = $DATA->page_metadata($this_page, 'rss');
     $data = array('debates' => $debates, 'lords' => $lords, 'whall' => $whall);
     $data['template'] = 'section/index';
     $this_page = "alldebatesfront";
     return $data;
 }
コード例 #2
0
ファイル: distance.php プロジェクト: vijo/theyworkforyou
function day_speeches($search, $type, $date)
{
    $search = "{$search} date:{$date} section:{$type} groupby:speech";
    global $SEARCHENGINE, $want;
    $SEARCHENGINE = new SEARCHENGINE($search);
    $db = new ParlDB();
    $q = $db->query("select hpos from hansard where gid = :gid", array(':gid' => 'uk.org.publicwhip/' . $want['gid']));
    $want['hpos'] = $q->field(0, 'hpos');
    $LIST = new DEBATELIST();
    $args = array('s' => $search, 'p' => 1, 'num' => 200, 'pop' => 1, 'o' => 'd');
    $LIST->display('search_video', $args, 'html');
}
コード例 #3
0
ファイル: distance.php プロジェクト: henare/theyworkforyou
function day_speeches($search, $type, $date) {
	$search = "$search date:$date section:$type groupby:speech";

	global $SEARCHENGINE, $want;
	$SEARCHENGINE = new SEARCHENGINE($search);

	$db = new ParlDB;
	$q_gid = mysql_real_escape_string('uk.org.publicwhip/' . $want['gid']);
	$q = $db->query("select hpos from hansard where gid='$q_gid'");
	$want['hpos'] = $q->field(0, 'hpos');

	$LIST = new DEBATELIST;
    	$args = array (
    		's' => $search,
    		'p' => 1,
    		'num' => 200,
		'pop' => 1,
		'o' => 'd',
    	);
	$LIST->display('search_video', $args, 'html');
}
コード例 #4
0
ファイル: Homepage.php プロジェクト: vijo/theyworkforyou
 public function getFeaturedDebate($gid, $title, $context, $related)
 {
     if (strpos($gid, 'lords') !== false) {
         $debatelist = new \LORDSDEBATELIST();
     } else {
         $debatelist = new \DEBATELIST();
     }
     $item = $debatelist->display('featured_gid', array('gid' => $gid), 'none');
     $item = $item['data'];
     $item['headline'] = $title;
     $item['context'] = $context;
     $item['featured'] = true;
     $related_debates = array();
     foreach ($related as $related_gid) {
         if ($related_gid) {
             $related_item = $debatelist->display('featured_gid', array('gid' => $related_gid), 'none');
             $related_debates[] = $related_item['data'];
         }
     }
     $item['related'] = $related_debates;
     return $item;
 }
コード例 #5
0
ファイル: index.php プロジェクト: leowmjw/twfy
function comment_on_recent_bullet_point()
{
    global $hansardmajors;
    ?>
	<li><p><strong>Read and comment on:</strong></p>

<?php 
    $DEBATELIST = new DEBATELIST();
    $data[1] = $DEBATELIST->most_recent_day();
    $WRANSLIST = new WRANSLIST();
    $data[3] = $WRANSLIST->most_recent_day();
    $WHALLLIST = new WHALLLIST();
    $data[2] = $WHALLLIST->most_recent_day();
    $WMSLIST = new WMSLIST();
    $data[4] = $WMSLIST->most_recent_day();
    $LORDSDEBATELIST = new LORDSDEBATELIST();
    $data[101] = $LORDSDEBATELIST->most_recent_day();
    $NILIST = new NILIST();
    $data[5] = $NILIST->most_recent_day();
    foreach (array_keys($hansardmajors) as $major) {
        if (array_key_exists($major, $data)) {
            unset($data[$major]['listurl']);
            if (count($data[$major]) == 0) {
                unset($data[$major]);
            }
        }
    }
    major_summary($data);
    ?>
 </li> <?php 
}
コード例 #6
0
ファイル: index.php プロジェクト: palfrey/twfy
?>

<!-- Campaign -->
<div class="campaign">
    <p>
        TheyWorkForYou needs your help <span class="chev"><span class="hide">-</span></span> <a href="http://www.pledgebank.com/twfypatrons">Become a patron, donate &pound;5 a month ...</a>
    </p>
</div>

<!-- Latest in parliament -->
<div class="latest col3">
    <h3>Recently in the UK Parliament</h3>
    <div>
        <?php 
//Latest activity (column 1)
$DEBATELIST = new DEBATELIST();
$LORDSDEBATELIST = new LORDSDEBATELIST();
$last_dates = array();
// holds the most recent data there is data for, indexed by type
$last_dates[1] = $DEBATELIST->most_recent_day();
$last_dates[101] = $LORDSDEBATELIST->most_recent_day();
//get html
$latest_html = major_summary($last_dates, false);
echo $latest_html;
?>
    </div>
    <div>
        <?php 
//Latest activity (column 2)
$WHALLLIST = new WHALLLIST();
$WMSLIST = new WMSLIST();
コード例 #7
0
ファイル: alertmailer.php プロジェクト: NathanaelB/twfy
}
$active = 0;
$queries = 0;
$unregistered = 0;
$registered = 0;
$sentemails = 0;
$LIVEALERTS = new ALERT();
$current_email = '';
$email_text = '';
$globalsuccess = 1;
# Fetch all confirmed, non-deleted alerts
$confirmed = 1;
$deleted = 0;
$alertdata = $LIVEALERTS->fetch($confirmed, $deleted);
$alertdata = $alertdata['data'];
$DEBATELIST = new DEBATELIST();
# Nothing debate specific, but has to be one of them
$sects = array('', 'House of Representatives debate', 'Westminster Hall debate', 'Written Answer', 'Written Ministerial Statement', 'Northern Ireland Assembly debate');
$sects[101] = 'Lords debate';
$sects_short = array('', 'debate', 'westminhall', 'wrans', 'wms', 'ni');
$sects_short[101] = 'lords';
$results = array();
$outof = count($alertdata);
$start_time = time();
foreach ($alertdata as $alertitem) {
    $active++;
    $email = $alertitem['email'];
    if ($onlyemail && $email != $onlyemail) {
        continue;
    }
    if ($fromemail && strtolower($email) <= $fromemail) {
コード例 #8
0
ファイル: index.php プロジェクト: alanl/twfy
    $PAGE->page_end();
    exit;
}
$this_page = 'hansard';
$PAGE->page_start();
// Page title will appear here.
$PAGE->stripe_start('head-1');
$message = $PAGE->recess_message();
if ($message != '') {
    print "<p><strong>{$message}</strong></p>\n";
}
$PAGE->stripe_end();
$PAGE->stripe_start();
?>
				<h3>Busiest House of Representatives debates from the most recent week</h3>
<?php 
$DEBATELIST = new DEBATELIST();
$DEBATELIST->display('biggest_debates', array('days' => 7, 'num' => $number_of_debates_to_show));
$MOREURL = new URL('debatesfront');
$anchor = $number_of_debates_to_show + 1;
?>
				<p><strong><a href="<?php 
echo $MOREURL->generate();
?>
#d<?php 
echo $anchor;
?>
">See more debates</a></strong></p>
<?php 
$PAGE->stripe_end(array(array('type' => 'include', 'content' => "hocdebates_short"), array('type' => 'include', 'content' => "calendar_hocdebates")));
$PAGE->page_end();
コード例 #9
0
ファイル: mobile.php プロジェクト: leowmjw/twfy
    		),
    		array (
    			'type' => 'include',
    			'content' => "hocdebates"
    		)
    	));
    */
} else {
    // No date or debate id. Show recent years with debates on.
    $this_page = "debatesfront";
    $PAGE->page_start_mobile();
    $PAGE->stripe_start();
    ?>
				<h4>Busiest debates from the most recent week</h4>
<?php 
    $DEBATELIST = new DEBATELIST();
    $DEBATELIST->display('biggest_debates', array('days' => 7, 'num' => 20, 'mobile' => 1));
    $rssurl = $DATA->page_metadata($this_page, 'rss');
    /*
    	$PAGE->stripe_end(array(
    		array (
    			'type' => 'nextprev'
    		),
    		array (
    			'type' => 'include',
    			'content' => 'calendar_hocdebates'
    		),
    		array (
    			'type' => 'include',
    			'content' => "hocdebates"
    		),
コード例 #10
0
ファイル: DebatesView.php プロジェクト: udp12/theyworkforyou
 protected function display_front()
 {
     global $PAGE, $DATA, $this_page;
     // No date or debate id. Show some recent debates
     $this_page = "alldebatesfront";
     $PAGE->page_start();
     $PAGE->stripe_start();
     ?>
     <h2>Recent House of Commons debates</h2>
 <?php 
     $DEBATELIST = new \DEBATELIST();
     $DEBATELIST->display('biggest_debates', array('days' => 7, 'num' => 10));
     $rssurl = $DATA->page_metadata($this_page, 'rss');
     $PAGE->stripe_end(array(array('type' => 'include', 'content' => 'minisurvey'), array('type' => 'html', 'content' => '
 <div class="block">
 <h4>Search debates</h4>
 <div class="blockbody">
 <form action="/search/" method="get">
 <p><input type="text" name="q" id="search_input" value="" size="40"> <input type="submit" value="Go">
 <br><input type="checkbox" name="section[]" value="debates" checked id="section_commons">
 <label for="section_commons">Commons</label>
 <input type="checkbox" name="section[]" value="whall" checked id="section_whall">
 <label for="section_whall">Westminster Hall</label>
 <input type="checkbox" name="section[]" value="lords" checked id="section_lords">
 <label for="section_lords">Lords</label>
 </p>
 </form>
 </div>
 </div>
 '), array('type' => 'include', 'content' => 'calendar_hocdebates'), array('type' => 'include', 'content' => "hocdebates"), array('type' => 'html', 'content' => '<div class="block">
 <h4>RSS feed</h4>
 <p><a href="' . WEBPATH . $rssurl . '"><img align="middle" src="http://www.theyworkforyou.com/images/rss.gif" border="0" alt="RSS feed"></a>
 <a href="' . WEBPATH . $rssurl . '">RSS feed of most recent debates</a></p>
 </div>')));
     $this_page = "whallfront";
     $PAGE->page_start();
     $PAGE->stripe_start();
     ?>
     <h2>Recent Westminster Hall debates</h2>
 <?php 
     $WHALLLIST = new \WHALLLIST();
     $WHALLLIST->display('biggest_debates', array('days' => 7, 'num' => 10));
     $rssurl = $DATA->page_metadata($this_page, 'rss');
     $PAGE->stripe_end(array(array('type' => 'include', 'content' => 'minisurvey'), array('type' => 'include', 'content' => 'calendar_whalldebates'), array('type' => 'include', 'content' => "whalldebates"), array('type' => 'html', 'content' => '<div class="block">
 <h4>RSS feed</h4>
 <p><a href="' . WEBPATH . $rssurl . '"><img alt="RSS feed" border="0" align="middle" src="http://www.theyworkforyou.com/images/rss.gif"></a>
 <a href="' . WEBPATH . $rssurl . '">RSS feed of most recent debates</a></p>
 </div>')));
     $this_page = "lordsdebatesfront";
     $PAGE->page_start();
     $PAGE->stripe_start();
     ?>
     <h2>Recent House of Lords debates</h2>
 <?php 
     $LORDSDEBATELIST = new \LORDSDEBATELIST();
     $LORDSDEBATELIST->display('biggest_debates', array('days' => 7, 'num' => 10));
     $rssurl = $DATA->page_metadata($this_page, 'rss');
     $PAGE->stripe_end(array(array('type' => 'nextprev'), array('type' => 'include', 'content' => 'minisurvey'), array('type' => 'include', 'content' => 'calendar_holdebates'), array('type' => 'include', 'content' => "holdebates"), array('type' => 'html', 'content' => '<div class="block">
 <h4>RSS feed</h4>
 <p><a href="' . WEBPATH . $rssurl . '"><img alt="RSS feed" border="0" align="middle" src="http://www.theyworkforyou.com/images/rss.gif"></a>
 <a href="' . WEBPATH . $rssurl . '">RSS feed of most recent debates</a></p>
 </div>')));
 }
コード例 #11
0
ファイル: index.php プロジェクト: palfrey/twfy
    }
    $PAGE->page_start();
    $PAGE->stripe_start();
    $args = array('year' => get_http_var('y'));
    $LIST = new DEBATELIST();
    $LIST->display('calendar', $args);
    $PAGE->stripe_end(array(array('type' => 'nextprev'), array('type' => 'include', 'content' => "hocdebates")));
} else {
    // No date or debate id. Show some recent debates
    $this_page = "alldebatesfront";
    $PAGE->page_start();
    $PAGE->stripe_start();
    ?>
	<h4>Recent House of Commons debates</h4>
<?php 
    $DEBATELIST = new DEBATELIST();
    $DEBATELIST->display('biggest_debates', array('days' => 7, 'num' => 10));
    $rssurl = $DATA->page_metadata($this_page, 'rss');
    $PAGE->stripe_end(array(array('type' => 'html', 'content' => '
<div class="block">
<h4>Search debates</h4>
<div class="blockbody">
<form action="/search/" method="get">
<p><input type="text" name="s" value="" size="40"> <input type="submit" value="Go">
<br><input type="checkbox" name="section[]" value="debates" checked id="section_commons">
<label for="section_commons">Commons</label>
<input type="checkbox" name="section[]" value="whall" checked id="section_whall">
<label for="section_whall">Westminster Hall</label>
<input type="checkbox" name="section[]" value="lords" checked id="section_lords">
<label for="section_lords">Lords</label>
</p>
コード例 #12
0
<?php

$this_page = "home";
include_once '../includes/easyparliament/init.php';
include_once INCLUDESPATH . "easyparliament/member.php";
$PAGE->page_start();
$PAGE->stripe_start();
///////////////////////////////////////////////////////////////////////////
//  SEARCH AND RECENT HANSARD
// Get the dates, timestamps and links for the most recent debates and wrans.
$DEBATELIST = new DEBATELIST();
$debatesdata = $DEBATELIST->most_recent_day();
$WRANSLIST = new WRANSLIST();
$wransdata = $WRANSLIST->most_recent_day();
$WHALLLIST = new WHALLLIST();
$whalldata = $WHALLLIST->most_recent_day();
$WMSLIST = new WMSLIST();
$wmsdata = $WMSLIST->most_recent_day();
if (count($debatesdata) > 0 && count($wransdata) > 0 && count($whalldata) > 0 && count($wmsdata) > 0) {
    // Links to Debates and Wrans.
    $debatestext = '<a href="' . $debatesdata['listurl'] . '">Debates</a>';
    $wranstext = '<a href="' . $wransdata['listurl'] . '">Written Answers</a>';
    $whalltext = '<a href="' . $whalldata['listurl'] . '">Westminster Hall debates</a>';
    $wmstext = '<a href="' . $wmsdata['listurl'] . '">Written Ministerial Statements</a>';
    // Now we work out whether the debates/wrans are from yesterday or another day...
    // And create the appropriate text ($daytext) to display accordingly.
    $todaystime = gmmktime(0, 0, 0, date('m'), date('d'), date('Y'));
    if ($debatesdata['hdate'] == $wransdata['hdate'] && $debatesdata['hdate'] == $whalldata['hdate'] && $debatesdata['hdate'] == $wmsdata['hdate']) {
        // They're on the same day, which is nice, and most common.
        if ($todaystime - $debatesdata['timestamp'] == 86400) {
            $daytext = "yesterday's";
コード例 #13
0
ファイル: index.php プロジェクト: udp12/theyworkforyou
<?php

include_once '../../includes/easyparliament/init.php';
include_once INCLUDESPATH . "easyparliament/glossary.php";
$this_page = "debate";
$this_page = "debates";
$dates = file('alldates');
shuffle($dates);
$date = trim($dates[0]);
$db = new ParlDB();
$q = $db->query("select gid from hansard where htype in (10,11) and major=1 and hdate='{$date}' order by rand() limit 1");
$gid = $q->field(0, 'gid');
$args = array('gid' => fix_gid_from_db($gid), 'sort' => 'regexp_replace');
$GLOSSARY = new GLOSSARY($args);
$LIST = new DEBATELIST();
$result = $LIST->display('gid', $args);
$PAGE->page_end();
コード例 #14
0
ファイル: hansardlist.php プロジェクト: udp12/theyworkforyou
 public function __construct($session = '', $title = '')
 {
     parent::__construct();
     $this->bill_title = $title;
     $title = str_replace(' ', '_', $title);
     $this->url = urlencode($session) . '/' . urlencode($title) . '/';
 }
コード例 #15
0
ファイル: statistics.php プロジェクト: leowmjw/twfy
<?php

include_once "../../includes/easyparliament/init.php";
$this_page = "admin_statistics";
$db = new ParlDB();
$PAGE->page_start();
$PAGE->stripe_start();
?>

<h4>Hansard data in database</h4>

<?php 
$DEBATELIST = new DEBATELIST();
$debate_items = $DEBATELIST->total_items();
$WRANSLIST = new WRANSLIST();
$wrans_items = $WRANSLIST->total_items();
$debate_speeches = $DEBATELIST->total_speeches();
$wrans_questions = $WRANSLIST->total_questions();
$q = $db->query("SELECT min(hdate) as mindate, max(hdate) as maxdate from hansard");
$datefrom = format_date($q->field(0, 'mindate'), SHORTDATEFORMAT);
$dateto = format_date($q->field(0, 'maxdate'), SHORTDATEFORMAT);
$q = $db->query("SELECT count(distinct hdate) as count from hansard");
$uniquedates = $q->field(0, 'count');
?>


<p><b><?php 
echo $datefrom;
?>
</b> to <b><?php 
echo $dateto;
コード例 #16
0
ファイル: index.php プロジェクト: nallachaitu/theyworkforyou
<?php

include_once "../includes/easyparliament/init.php";
//set page name (selects relevant bottom menu item)
$this_page = 'overview';
$PAGE->page_start();
$PAGE->supress_heading = true;
$PAGE->stripe_start("full");
$last_dates = array();
// holds the most recent data there is data for, indexed by type
$DEBATELIST = new DEBATELIST();
$LORDSDEBATELIST = new LORDSDEBATELIST();
$WHALLLIST = new WHALLLIST();
$WMSLIST = new WMSLIST();
$WRANSLIST = new WRANSLIST();
$COMMITTEE = new StandingCommittee();
$last_dates[1] = $DEBATELIST->most_recent_day();
$last_dates[101] = $LORDSDEBATELIST->most_recent_day();
$last_dates[4] = $WMSLIST->most_recent_day();
$last_dates[2] = $WHALLLIST->most_recent_day();
$last_dates[3] = $WRANSLIST->most_recent_day();
$last_dates[6] = $COMMITTEE->most_recent_day();
?>

<div class="welcome_col1">

<!-- Actions -->
<div id="welcome_uk" class="welcome_actions">

    <div>
        <h2>Your representative</h2>
コード例 #17
0
ファイル: debateday.php プロジェクト: bruno/openaustralia-app
<?php

include_once '../../includes/easyparliament/init.php';
$LIST = new DEBATELIST();
# Guess it should really use a View of none, but this way I get all
# the display stuff done for me...
ob_start();
$LIST->display('date', array('date' => get_http_var('d')));
$cal = ob_get_clean();
$cal = preg_replace('#^.*?(<ul id="hansard-day">)#s', '$1', $cal);
$cal = preg_replace('#<!-- end hansard-day -->.*$#s', '', $cal);
$cal = str_replace('<a href="', '<a target="_blank" href="http://www.theyworkforyou.com', $cal);
print $cal;
コード例 #18
0
ファイル: index.php プロジェクト: leowmjw/twfy
<?php

include_once "../../includes/easyparliament/init.php";
include_once INCLUDESPATH . "easyparliament/glossary.php";
$this_page = "debate";
// For displaying a SINGLE speech from a debate, with comments and
// an 'Add comment' form.
if (get_http_var('id') != '') {
    // We have the id of the gid of a Hansard item to display, so show it.
    $args = array('gid' => get_http_var('id'), 'glossarise' => 1, 'sort' => 'regexp_replace');
    $DEBATELIST = new DEBATELIST();
    $GLOSSARY = new GLOSSARY($args);
    $result = $DEBATELIST->display('gid', $args);
    // If it is a redirect, change URL
    if (is_string($result)) {
        $URL = new URL('debate');
        $URL->insert(array('id' => $result));
        header('Location: http://' . DOMAIN . $URL->generate('none'), true, 301);
        exit;
    }
    // 12 is speech
    // 13 is procedural - see http://parl.stand.org.uk/cgi-bin/moin.cgi/DataSchema
    if ($DEBATELIST->htype() == '12' || $DEBATELIST->htype() == '13') {
        $PAGE->stripe_start('side', 'comments');
        // Display all comments for this ep object.
        $COMMENTLIST = new COMMENTLIST();
        $args['user_id'] = get_http_var('u');
        // For highlighting their comments.
        $args['epobject_id'] = $DEBATELIST->epobject_id();
        $COMMENTLIST->display('ep', $args);
        $PAGE->stripe_end();
コード例 #19
0
ファイル: cal.php プロジェクト: leowmjw/twfy
<?php

include_once '../../includes/easyparliament/init.php';
$LIST = new DEBATELIST();
# Guess it should really use a View of none, but this way I get all
# the display stuff done for me...
ob_start();
$LIST->display('calendar', array('months' => 1));
$cal = ob_get_clean();
$cal = preg_replace('#<a href="' . WEBPATH . '/debates/\\?d=(.*?)"#', '<a onclick="return loadDay(\'$1\');" target="_blank" href="http://www.openaustralia.org/debates/?d=$1"', $cal);
print $cal;
コード例 #20
0
<?php

global $PAGE;
// The calendar that appears in sidebars linking to debates.
// There is a separate one for wrans (so we can have both on the same page).
// Contents varies depending on the page we're on...
if ($this_page == 'debatesday') {
    $date = get_http_var('d');
    if (preg_match('#^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$#', $date, $m)) {
        $year = $m[1];
        $month = $m[2];
        $day = $m[3];
        $args = array('year' => $year, 'month' => $month, 'onday' => $date);
        $title = 'Debates this month';
    } else {
        $args = array('months' => 1);
        $title = 'Recent debates';
    }
} else {
    $args = array('months' => 1);
    $title = 'Recent debates';
}
$PAGE->block_start(array('title' => $title, 'id' => 'calendar'));
$LIST = new DEBATELIST();
$LIST->display('calendar', $args);
$PAGE->block_end();