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); }
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 }
if ($NILIST->htype() == '12' || $NILIST->htype() == '13') { $PAGE->stripe_start('side', 'comments'); $COMMENTLIST = new COMMENTLIST(); $args['user_id'] = get_http_var('u'); $args['epobject_id'] = $NILIST->epobject_id(); $COMMENTLIST->display('ep', $args); $PAGE->stripe_end(); $PAGE->stripe_start('side', 'addcomment'); $commendata = array('epobject_id' => $NILIST->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); } else { $PAGE->stripe_end(); } } } else { $this_page = "nidebatesfront"; $PAGE->page_start(); $PAGE->stripe_start(); ?> <h4>Busiest debates from the most recent week</h4> <?php $LIST = new NILIST(); $LIST->display('biggest_debates', array('days' => 7, 'num' => 20)); $rssurl = $DATA->page_metadata($this_page, 'rss'); $PAGE->stripe_end(array(array('type' => 'nextprev'), array('type' => 'include', 'content' => 'calendar_nidebates'), array('type' => 'include', 'content' => "nidebates"), array('type' => 'html', 'content' => '<div class="block"><h4><a href="' . WEBPATH . '/' . $rssurl . '">RSS feed of most recent debates</a></h4></div>'))); } $PAGE->page_end(); twfy_debug_timestamp("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 == 'nidebatesday') { $date = get_http_var('d'); list($year, $month, $day) = explode('-', $date); $args = array('year' => $year, 'month' => $month, 'onday' => $date); $title = 'Debates this month'; } else { $args = array('months' => 1); $title = 'Recent debates'; } $PAGE->block_start(array('title' => $title)); $LIST = new NILIST(); $LIST->display('calendar', $args); $PAGE->block_end();
function ni_front_page() { global $this_page, $PAGE, $THEUSER, $SEARCHURL; $this_page = "nioverview"; $PAGE->page_start(); $PAGE->stripe_start('full'); $SEARCHURL = new URL('search'); ?> <div class="welcome_col1"> <div id="welcome_ni" class="welcome_actions"> <div> <h2>Your representative</h2> <form action="/postcode/" method="get"> <p><strong>Find out about your <acronym title="Members of the Legislative Assembly">MLAs</acronym></strong><br> <label for="pc">Enter your postcode here:</label> <input type="text" name="pc" id="pc" size="8" maxlength="10" value="<?php echo htmlentities($THEUSER->postcode()); ?> " class="text"> <input type="submit" value=" Go " class="submit"></p> </form> <p>Read debates they’ve taken part in, see how they voted, sign up for an email alert, and more.</p> </div> <!-- Search / alerts --> <div id="welcome_search"> <form action="<?php echo $SEARCHURL->generate(); ?> " method="get"> <h2><label for="s">Search, create an alert or RSS feed</label></h2> <p> <input type="text" name="s" id="s" size="20" maxlength="100" class="text" value="<?php echo htmlspecialchars(get_http_var("keyword")); ?> "> <input type="hidden" name="section" value="ni"> <input type="submit" value="Go" class="submit"> <small>e.g. a <em>word</em>, <em>phrase</em>, or <em>person</em> | <a href="/search/?adv=1">More options</a></small> </p> </form> </div> <a class="credit" href="http://www.flickr.com/photos/lyng883/255250716/">Photo by Lyn Gateley</a> <br class="clear"> </div> <?php $PAGE->include_sidebar_template('nidebates'); ?> </div> <div class="welcome_col2"> <h2>Recent Northern Ireland Assembly debates</h2> <?php $DEBATELIST = new NILIST(); $DEBATELIST->display('recent_debates', array('days' => 30, 'num' => 5)); $MOREURL = new URL('nidebatesfront'); ?> <p align="right"><strong><a href="<?php echo $MOREURL->generate(); ?> ?more=1">See more debates</a></strong></p> </div> <?php $PAGE->stripe_end(); }