protected function display_front() { global $this_page, $DATA; $this_page = 'spwransfront'; $data = array(); $args = array('months' => 1); $WRANSLIST = new \SPWRANSLIST(); $wrans = array(); $wrans['data'] = $WRANSLIST->display('recent_wrans', array('days' => 7, 'num' => 5), 'none'); $wrans['calendar'] = $WRANSLIST->display('calendar', $args, 'none'); $data['content'] = $wrans; return $data; }
<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();
<?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();
$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();