예제 #1
0
 private function spwrans_redirect($spid)
 {
     global $PAGE;
     # We have a Scottish Parliament ID, need to find the date
     $SPWRANSLIST = new \SPWRANSLIST();
     $gid = $SPWRANSLIST->get_gid_from_spid($spid);
     if ($gid) {
         if (preg_match('/uk\\.org\\.publicwhip\\/spwa\\/(\\d{4}-\\d\\d-\\d\\d\\.(.*))/', $gid, $m)) {
             $URL = new \URL('spwrans');
             $URL->reset();
             $URL->insert(array('id' => $m[1]));
             $fragment_identifier = '#g' . $m[2];
             header('Location: http://' . DOMAIN . $URL->generate('none') . $fragment_identifier, true, 303);
             exit;
         } elseif (preg_match('/uk\\.org\\.publicwhip\\/spor\\/(\\d{4}-\\d\\d-\\d\\d\\.(.*))/', $gid, $m)) {
             $URL = new \URL('spdebates');
             $URL->reset();
             $URL->insert(array('id' => $m[1]));
             $fragment_identifier = '#g' . $m[2];
             header('Location: http://' . DOMAIN . $URL->generate('none') . $fragment_identifier, true, 303);
             exit;
         } else {
             $PAGE->error_message("Strange GID ({$gid}) for that Scottish Parliament ID.");
         }
     }
     $PAGE->error_message("Couldn't match that Scottish Parliament ID to a GID.");
 }
예제 #2
0
파일: index.php 프로젝트: palfrey/twfy
<h3>Busiest Scottish Parliament debates from the most recent week</h3>
<?php 
$DEBATELIST = new SPLIST();
$DEBATELIST->display('biggest_debates', array('days' => 7, 'num' => $number_of_debates_to_show));
$MOREURL = new URL('spdebatesfront');
$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' => "spdebates"), array('type' => 'include', 'content' => "calendar_spdebates")));
$PAGE->stripe_start();
?>
<h3>Some recent written answers</h3>
<?php 
$WRANSLIST = new SPWRANSLIST();
$WRANSLIST->display('recent_wrans', array('days' => 7, 'num' => $number_of_wrans_to_show));
$MOREURL = new URL('spwransfront');
?>
				<p><strong><a href="<?php 
echo $MOREURL->generate();
?>
">See more written answers</a></strong></p>
<?php 
$PAGE->stripe_end(array(array('type' => 'include', 'content' => "calendar_spwrans")));
$PAGE->page_end();
예제 #3
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 == 'wransday') {
    $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 = 'Answers this month';
    } else {
        $args = array('months' => 1);
        $title = 'Recent written answers';
    }
} else {
    $args = array('months' => 1);
    $title = 'Recent written answers';
}
$PAGE->block_start(array('title' => $title, 'id' => 'calendar'));
$LIST = new SPWRANSLIST();
$LIST->display('calendar', $args);
$PAGE->block_end();
예제 #4
0
        $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 SPWRANSLIST();
    $LIST->display('calendar', $args);
    $PAGE->stripe_end(array(array('type' => 'nextprev'), array('type' => 'include', 'content' => "spwrans")));
} elseif (get_http_var('pid')) {
    $this_page = "spwransmp";
    $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 SPWRANSLIST();
    $LIST->display('mp', $args);
} else {
    // No date or wrans id. Show recent days with wrans on.
    $this_page = "spwransfront";
    $PAGE->page_start();
    $PAGE->stripe_start();
    ?>
				<h2>Some recent written answers</h2>
<?php 
    $SPWRANSLIST = new SPWRANSLIST();
    $SPWRANSLIST->display('recent_wrans', array('days' => 7, 'num' => 20));
    $PAGE->stripe_end(array(array('type' => 'nextprev'), array('type' => 'include', 'content' => 'calendar_spwrans'), array('type' => 'include', 'content' => "spwrans")));
}
$PAGE->page_end();