diff --git a/classes/Divisions.php b/classes/Divisions.php index 586366c555..39f70ef5f9 100644 --- a/classes/Divisions.php +++ b/classes/Divisions.php @@ -171,6 +171,7 @@ public function getRecentDebatesWithDivisions($number = 20, $majors = null) { 'url' => $url->generate() . $anchor, 'title' => "$debate[section_body] : $debate[subsection_body]", 'date' => $debate['hdate'], + 'major' => $debate['major'], ]; } diff --git a/classes/Homepage/Base.php b/classes/Homepage/Base.php new file mode 100644 index 0000000000..6f441263d5 --- /dev/null +++ b/classes/Homepage/Base.php @@ -0,0 +1,79 @@ +page; + + $data = []; + + $common = new \MySociety\TheyWorkForYou\Common(); + + $data['debates'] = $this->getDebatesData(); + + $user = new \MySociety\TheyWorkForYou\User(); + $data['mp_data'] = $user->getRep($this->cons_type, $this->mp_house); + + $data['regional'] = $this->getRegionalList(); + $data['popular_searches'] = $common->getPopularSearches(); + $data['featured'] = $this->getEditorialContent($data); + $data['divisions'] = $this->getRecentDivisions(); + $data['search_box'] = $this->getSearchBox($data); + + return $data; + } + + abstract protected function getSearchBox(array $data): \MySociety\TheyWorkForYou\Search\SearchBox; + abstract protected function getEditorialContent(array &$data); + + protected function getRegionalList() { + return null; + } + + private function getRecentDivisions() { + $divisions = new \MySociety\TheyWorkForYou\Divisions(); + return $divisions->getRecentDebatesWithDivisions(5, $this->houses); + } + + protected function getDebatesData() { + $debates = []; // holds the most recent data there is data for, indexed by type + + $recent_content = []; + + foreach ($this->recent_types as $class => $recent) { + $class = "\\$class"; + $instance = new $class(); + $more_url = new \MySociety\TheyWorkForYou\Url($recent[1]); + if ($recent[0] == 'recent_pbc_debates') { + $content = [ 'data' => $instance->display($recent[0], ['num' => 5], 'none') ]; + } elseif ($recent[1] == 'senedddebatesfront' || $recent[1] == 'nidebatesfront') { + $content = $instance->display($recent[0], ['days' => 30, 'num' => 6], 'none'); + # XXX Bit hacky, for now + foreach ($content['data'] as $d) { + $d['more_url'] = $more_url->generate(); + $d['desc'] = ''; + $recent_content[] = $d; + } + $content = []; + } else { + $content = $instance->display($recent[0], ['days' => 7, 'num' => 1], 'none'); + if (isset($content['data']) && count($content['data'])) { + $content = $content['data'][0]; + } else { + $content = []; + } + } + if ($content) { + $content['more_url'] = $more_url->generate(); + $content['desc'] = $recent[2]; + $recent_content[] = $content; + } + } + + $debates['recent'] = $recent_content; + + return $debates; + } +} diff --git a/classes/Homepage/NI.php b/classes/Homepage/NI.php new file mode 100644 index 0000000000..dbb1ba7e45 --- /dev/null +++ b/classes/Homepage/NI.php @@ -0,0 +1,72 @@ + ['recent_debates', 'nidebatesfront', 'Northern Ireland Assembly debates'], + ]; + + public function display() { + $data = parent::display(); + $data['popular_searches'] = null; + $data['template'] = 'ni/index'; + return $data; + } + + protected function getEditorialContent(&$data) { + $featured = []; + if (count($data['debates']['recent'])) { + $MOREURL = new \MySociety\TheyWorkForYou\Url('nidebatesfront'); + $MOREURL->insert([ 'more' => 1 ]); + $featured = array_shift($data['debates']['recent']); + $featured['more_url'] = $MOREURL->generate(); + $featured['desc'] = 'Northern Ireland Assembly debate'; + $featured['related'] = []; + $featured['featured'] = false; + } + return $featured; + } + + protected function getSearchBox(array $data): \MySociety\TheyWorkForYou\Search\SearchBox { + + global $THEUSER; + + if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) { + $postcode = $THEUSER->postcode(); + } else { + $postcode = null; + } + + $search_box = new \MySociety\TheyWorkForYou\Search\SearchBox(); + $search_box->homepage_panel_class = "panel--homepage--niassembly"; + $search_box->homepage_subhead = "Northern Ireland Assembly"; + $search_box->homepage_desc = ""; + $search_box->search_section = "ni"; + $search_box->quick_links = []; + if (count($data["regional"])) { + $constituency = $data["regional"][0]["constituency"]; + $search_box->add_quick_link('Find out more about your MLAs for ' . $constituency, '/postcode/?pc=' . $postcode, 'torso'); + } + $search_box->add_quick_link('Create and manage email alerts', '/alert/', 'megaphone'); + $search_box->add_quick_link(gettext('Subscribe to our newsletter'), '/about/#about-mysociety', 'mail'); + $search_box->add_quick_link('Donate to support our work', '/support-us/', 'heart'); + $search_box->add_quick_link('Learn more about TheyWorkForYou', '/about/', 'magnifying-glass'); + return $search_box; + } + + protected function getRegionalList() { + global $THEUSER; + + $mreg = []; + if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) { + return \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, 3, 'NIE'); + } + + return $mreg; + } +} diff --git a/classes/SPHomepage.php b/classes/Homepage/Scotland.php similarity index 65% rename from classes/SPHomepage.php rename to classes/Homepage/Scotland.php index e11bada617..5e92dce6e9 100644 --- a/classes/SPHomepage.php +++ b/classes/Homepage/Scotland.php @@ -1,11 +1,10 @@ ['recent_wrans', 'spwransfront', 'Written answers'], ]; - protected function getSearchBox(array $data): Search\SearchBox { - $search_box = new Search\SearchBox(); + protected function getSearchBox(array $data): \MySociety\TheyWorkForYou\Search\SearchBox { + $search_box = new \MySociety\TheyWorkForYou\Search\SearchBox(); $search_box->homepage_panel_class = "panel--homepage--scotland"; $search_box->homepage_subhead = "Scottish Parliament"; $search_box->homepage_desc = ""; @@ -32,43 +31,25 @@ protected function getSearchBox(array $data): Search\SearchBox { return $search_box; } - protected function getEditorialContent() { + protected function getEditorialContent(&$data) { $debatelist = new \SPLIST(); $item = $debatelist->display('recent_debates', ['days' => 7, 'num' => 1], 'none'); - - $item = $item['data'][0]; - $more_url = new Url('spdebatesfront'); - $item['more_url'] = $more_url->generate(); - $item['desc'] = 'Scottish Parliament debate'; - $item['related'] = []; - $item['featured'] = false; - + if (count($item['data'])) { + $item = $item['data'][0]; + $more_url = new \MySociety\TheyWorkForYou\Url('spdebatesfront'); + $item['more_url'] = $more_url->generate(); + $item['desc'] = 'Scottish Parliament debate'; + $item['related'] = []; + $item['featured'] = false; + } return $item; } - protected function getURLs() { - $urls = []; - - $regional = new Url('msp'); - $urls['regional'] = $regional->generate(); - - return $urls; - } - - protected function getCalendarData() { - return null; - } - - protected function getRegionalList() { global $THEUSER; - - $mreg = []; - if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) { - return Member::getRegionalList($THEUSER->postcode, 4, 'SPE'); + return \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, 4, 'SPE'); } - - return $mreg; + return []; } } diff --git a/classes/Homepage.php b/classes/Homepage/UK.php similarity index 57% rename from classes/Homepage.php rename to classes/Homepage/UK.php index 00dddef5f1..57709f3f7b 100644 --- a/classes/Homepage.php +++ b/classes/Homepage/UK.php @@ -1,15 +1,13 @@ ['recent_debates', 'debatesfront', 'Commons debates'], @@ -20,39 +18,15 @@ class Homepage { 'StandingCommittee' => ['recent_pbc_debates', 'pbcfront', 'Public Bill committees'], ]; - public function __construct() { - $this->db = new \ParlDB(); - } - public function display() { - global $this_page; - $this_page = $this->page; - - $data = []; - - $common = new Common(); - $dissolution = Dissolution::dates(); - - $data['debates'] = $this->getDebatesData(); - - $user = new User(); - $data['mp_data'] = $user->getRep($this->cons_type, $this->mp_house); - $data["commons_dissolved"] = isset($dissolution[1]); - - $data['regional'] = $this->getRegionalList(); - $data['popular_searches'] = $common->getPopularSearches(); - $data['urls'] = $this->getURLs(); + $data = parent::display(); $data['calendar'] = $this->getCalendarData(); - $data['featured'] = $this->getEditorialContent(); $data['topics'] = $this->getFrontPageTopics(); - $data['divisions'] = $this->getRecentDivisions(); - $data['search_box'] = $this->getSearchBox($data); - return $data; } - protected function getSearchBox(array $data): Search\SearchBox { - $search_box = new Search\SearchBox(); + protected function getSearchBox(array $data): \MySociety\TheyWorkForYou\Search\SearchBox { + $search_box = new \MySociety\TheyWorkForYou\Search\SearchBox(); $search_box->homepage_panel_class = "panel--homepage--overall"; $search_box->homepage_subhead = ""; $search_box->homepage_desc = "Understand who represents you, across the UK’s Parliaments."; @@ -68,15 +42,11 @@ protected function getSearchBox(array $data): Search\SearchBox { return $search_box; } - protected function getRegionalList() { - return null; - } - - protected function getEditorialContent() { + protected function getEditorialContent(&$data) { $debatelist = new \DEBATELIST(); - $featured = new Model\Featured(); + $featured = new \MySociety\TheyWorkForYou\Model\Featured(); $gid = $featured->get_gid(); - $gidCheck = new Gid($gid); + $gidCheck = new \MySociety\TheyWorkForYou\Gid($gid); $gid = $gidCheck->checkForRedirect(); if ($gid) { $title = $featured->get_title(); @@ -85,9 +55,9 @@ protected function getEditorialContent() { $item = $this->getFeaturedDebate($gid, $title, $context, $related); } else { $item = $debatelist->display('recent_debates', ['days' => 7, 'num' => 1], 'none'); - if (isset($item['data']) && count($item['data'])) { + if (count($item['data'])) { $item = $item['data'][0]; - $more_url = new Url('debates'); + $more_url = new \MySociety\TheyWorkForYou\Url('debates'); $item['more_url'] = $more_url->generate(); $item['desc'] = 'Commons Debates'; $item['related'] = []; @@ -127,54 +97,12 @@ public function getFeaturedDebate($gid, $title, $context, $related) { } protected function getFrontPageTopics() { - $topics = new Topics(); + $topics = new \MySociety\TheyWorkForYou\Topics(); return $topics->getFrontPageTopics(); } - private function getRecentDivisions() { - $divisions = new Divisions(); - return $divisions->getRecentDebatesWithDivisions(5, $this->houses); - } - - protected function getURLs() { - $urls = []; - - return $urls; - } - - protected function getDebatesData() { - $debates = []; // holds the most recent data there is data for, indexed by type - - $recent_content = []; - - foreach ($this->recent_types as $class => $recent) { - $class = "\\$class"; - $instance = new $class(); - $more_url = new Url($recent[1]); - if ($recent[0] == 'recent_pbc_debates') { - $content = [ 'data' => $instance->display($recent[0], ['num' => 5], 'none') ]; - } else { - $content = $instance->display($recent[0], ['days' => 7, 'num' => 1], 'none'); - if (isset($content['data']) && count($content['data'])) { - $content = $content['data'][0]; - } else { - $content = []; - } - } - if ($content) { - $content['more_url'] = $more_url->generate(); - $content['desc'] = $recent[2]; - $recent_content[] = $content; - } - } - - $debates['recent'] = $recent_content; - - return $debates; - } - private function getCalendarData() { - return Utility\Calendar::fetchFuture(); + return \MySociety\TheyWorkForYou\Utility\Calendar::fetchFuture(); } } diff --git a/classes/Homepage/Wales.php b/classes/Homepage/Wales.php new file mode 100644 index 0000000000..c1d24916f8 --- /dev/null +++ b/classes/Homepage/Wales.php @@ -0,0 +1,81 @@ +houses = [11]; + $class = 'SENEDDCYLIST'; + } else { + $this->houses = [10]; + $class = 'SENEDDENLIST'; + } + $this->recent_types = [ + $class => ['recent_debates', 'senedddebatesfront', 'Senedd'], + ]; + } + + public function display() { + $data = parent::display(); + $data['popular_searches'] = null; + $data['template'] = 'senedd/index'; + return $data; + } + + protected function getEditorialContent(&$data) { + $featured = []; + if (count($data['debates']['recent'])) { + $MOREURL = new \MySociety\TheyWorkForYou\Url('senedddebatesfront'); + $MOREURL->insert([ 'more' => 1 ]); + $featured = array_shift($data['debates']['recent']); + $featured['more_url'] = $MOREURL->generate(); + $featured['desc'] = 'Senedd'; + $featured['related'] = []; + $featured['featured'] = false; + } + return $featured; + } + + protected function getSearchBox(array $data): \MySociety\TheyWorkForYou\Search\SearchBox { + $search_box = new \MySociety\TheyWorkForYou\Search\SearchBox(); + $search_box->homepage_panel_class = "panel--homepage--senedd"; + $search_box->homepage_subhead = gettext("Senedd / Welsh Parliament"); + $search_box->homepage_desc = ""; + $search_box->search_section = "senedd"; + $search_box->quick_links = []; + if (count($data["regional"])) { + // get all unique constituencies + $constituencies = []; + foreach ($data["regional"] as $member) { + $constituencies[$member["constituency"]] = 1; + } + $constituencies = array_keys($constituencies); + $search_box->add_quick_link(sprintf(gettext('Find out more about your MSs for %s and %s'), $constituencies[0], $constituencies[1]), '/postcode/?pc=' . $data["mp_data"]['postcode'], 'torso'); + } + $search_box->add_quick_link(gettext('Create and manage email alerts'), '/alert/', 'megaphone'); + $search_box->add_quick_link(gettext('Subscribe to our newsletter'), '/about/#about-mysociety', 'mail'); + $search_box->add_quick_link(gettext('Donate to support our work'), '/support-us/', 'heart'); + $search_box->add_quick_link(gettext('Learn more about TheyWorkForYou'), '/about/', 'magnifying-glass'); + return $search_box; + } + + protected function getRegionalList() { + global $THEUSER; + + $mreg = []; + if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) { + return array_merge( + \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, 5, 'WAC'), + \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, 5, 'WAE') + ); + } + + return $mreg; + } +} diff --git a/classes/SectionView/NiView.php b/classes/SectionView/NiView.php index 3530f3f4a1..69466be49b 100644 --- a/classes/SectionView/NiView.php +++ b/classes/SectionView/NiView.php @@ -11,7 +11,8 @@ protected function display_front() { if (get_http_var('more')) { return parent::display_front(); } else { - return $this->display_front_ni(); + $homepage = new \MySociety\TheyWorkForYou\Homepage\NI(); + return $homepage->display(); } } @@ -35,100 +36,4 @@ protected function getSearchSections() { [ 'section' => 'ni' ], ]; } - - protected function display_front_ni() { - global $this_page; - $this_page = "nioverview"; - - $data = []; - - $data['popular_searches'] = null; - - - $data['urls'] = $this->getURLs($data); - - $DEBATELIST = new \NILIST(); - - $debates = $DEBATELIST->display('recent_debates', ['days' => 30, 'num' => 6], 'none'); - $MOREURL = new \MySociety\TheyWorkForYou\Url('nidebatesfront'); - $MOREURL->insert([ '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 = []; - if (isset($debates['data']) && count($debates['data'])) { - // at the start of a session there may be less than 6 - // debates - $max = 6; - if (count($debates['data']) < 6) { - $max = count($debates['data']); - } - for ($i = 1; $i < $max; $i++) { - $debate = $debates['data'][$i]; - $debate['desc'] = "Northern Ireland Assembly debates"; - $debate['more_url'] = $MOREURL->generate(); - $recent[] = $debate; - } - } - - $featured = []; - if ($random_debate) { - $featured = $random_debate; - $featured['more_url'] = $MOREURL->generate(); - $featured['desc'] = 'Northern Ireland Assembly debate'; - $featured['related'] = []; - $featured['featured'] = false; - } - - $data['featured'] = $featured; - $data['debates'] = [ 'recent' => $recent]; - - $data['regional'] = $this->getMLAList(); - $data['search_box'] = $this->getSearchBox($data); - $data['template'] = 'ni/index'; - - return $data; - } - - protected function getSearchBox(array $data): \MySociety\TheyWorkForYou\Search\SearchBox { - - global $THEUSER; - - if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) { - $postcode = $THEUSER->postcode(); - } else { - $postcode = null; - } - - $search_box = new \MySociety\TheyWorkForYou\Search\SearchBox(); - $search_box->homepage_panel_class = "panel--homepage--niassembly"; - $search_box->homepage_subhead = "Northern Ireland Assembly"; - $search_box->homepage_desc = ""; - $search_box->search_section = "ni"; - $search_box->quick_links = []; - if (count($data["regional"])) { - $constituency = $data["regional"][0]["constituency"]; - $search_box->add_quick_link('Find out more about your MLAs for ' . $constituency, '/postcode/?pc=' . $postcode, 'torso'); - } - $search_box->add_quick_link('Create and manage email alerts', '/alert/', 'megaphone'); - $search_box->add_quick_link(gettext('Subscribe to our newsletter'), '/about/#about-mysociety', 'mail'); - $search_box->add_quick_link('Donate to support our work', '/support-us/', 'heart'); - $search_box->add_quick_link('Learn more about TheyWorkForYou', '/about/', 'magnifying-glass'); - return $search_box; - } - - protected function getMLAList() { - global $THEUSER; - - $mreg = []; - if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) { - return \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, 3, 'NIE'); - } - - return $mreg; - } } diff --git a/classes/SectionView/SeneddView.php b/classes/SectionView/SeneddView.php index 4ea0b7d452..c478160539 100644 --- a/classes/SectionView/SeneddView.php +++ b/classes/SectionView/SeneddView.php @@ -20,7 +20,8 @@ protected function display_front() { if (get_http_var('more')) { return parent::display_front(); } else { - return $this->display_front_senedd(); + $homepage = new \MySociety\TheyWorkForYou\Homepage\Wales(); + return $homepage->display(); } } @@ -43,101 +44,4 @@ protected function getSearchSections() { [ 'section' => 'wales' ], ]; } - - protected function display_front_senedd() { - global $this_page; - $this_page = "seneddoverview"; - - $data = []; - - $data['popular_searches'] = null; - - $user = new \MySociety\TheyWorkForYou\User(); - $data['mp_data'] = $user->getRep("WMC", 1); - - $data['urls'] = $this->getURLs($data); - - $DEBATELIST = new $this->class(); - - $debates = $DEBATELIST->display('recent_debates', ['days' => 30, 'num' => 6], 'none'); - $MOREURL = new \MySociety\TheyWorkForYou\Url('senedddebatesfront'); - $MOREURL->insert([ '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 = []; - if (isset($debates['data']) && count($debates['data'])) { - // at the start of a session there may be less than 6 - // debates - $max = 6; - if (count($debates['data']) < 6) { - $max = count($debates['data']); - } - for ($i = 1; $i < $max; $i++) { - $debate = $debates['data'][$i]; - $debate['desc'] = "Senedd"; - $debate['more_url'] = $MOREURL->generate(); - $recent[] = $debate; - } - } - - $featured = []; - if ($random_debate) { - $featured = $random_debate; - $featured['more_url'] = $MOREURL->generate(); - $featured['desc'] = 'Senedd'; - $featured['related'] = []; - $featured['featured'] = false; - } - - $data['featured'] = $featured; - $data['debates'] = [ 'recent' => $recent]; - - $data['regional'] = $this->getMSList(); - $data['search_box'] = $this->getSearchBox($data); - $data['template'] = 'senedd/index'; - - return $data; - } - - protected function getSearchBox(array $data): \MySociety\TheyWorkForYou\Search\SearchBox { - $search_box = new \MySociety\TheyWorkForYou\Search\SearchBox(); - $search_box->homepage_panel_class = "panel--homepage--senedd"; - $search_box->homepage_subhead = gettext("Senedd / Welsh Parliament"); - $search_box->homepage_desc = ""; - $search_box->search_section = "senedd"; - $search_box->quick_links = []; - if (count($data["regional"])) { - // get all unique constituencies - $constituencies = []; - foreach ($data["regional"] as $member) { - $constituencies[$member["constituency"]] = 1; - } - $constituencies = array_keys($constituencies); - $search_box->add_quick_link(sprintf(gettext('Find out more about your MSs for %s and %s'), $constituencies[0], $constituencies[1]), '/postcode/?pc=' . $data["mp_data"]['postcode'], 'torso'); - } - $search_box->add_quick_link(gettext('Create and manage email alerts'), '/alert/', 'megaphone'); - $search_box->add_quick_link(gettext('Subscribe to our newsletter'), '/about/#about-mysociety', 'mail'); - $search_box->add_quick_link(gettext('Donate to support our work'), '/support-us/', 'heart'); - $search_box->add_quick_link(gettext('Learn more about TheyWorkForYou'), '/about/', 'magnifying-glass'); - return $search_box; - } - - protected function getMSList() { - global $THEUSER; - - $mreg = []; - if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) { - return array_merge( - \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, 5, 'WAC'), - \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, 5, 'WAE') - ); - } - - return $mreg; - } } diff --git a/www/docs/admin/featured.php b/www/docs/admin/featured.php index 5cdd6086db..1464658d47 100644 --- a/www/docs/admin/featured.php +++ b/www/docs/admin/featured.php @@ -114,7 +114,7 @@ function preview_featured() { print "

Preview Content

"; if ($gid !== null) { - $h = new MySociety\TheyWorkForYou\Homepage(); + $h = new MySociety\TheyWorkForYou\Homepage\UK(); $featured = $h->getFeaturedDebate($gid, $title, $context, [ $related_gid1, $related_gid2, $related_gid3 ]); include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php'; diff --git a/www/docs/index.php b/www/docs/index.php index dbfb31a4de..b0654613e2 100644 --- a/www/docs/index.php +++ b/www/docs/index.php @@ -3,7 +3,7 @@ include_once '../includes/easyparliament/init.php'; include_once '../includes/easyparliament/recess.php'; -$view = new MySociety\TheyWorkForYou\Homepage(); +$view = new MySociety\TheyWorkForYou\Homepage\UK(); $data = $view->display(); MySociety\TheyWorkForYou\Renderer::output('index', $data); diff --git a/www/docs/scotland/index.php b/www/docs/scotland/index.php index 2a8b9d56b5..6d1740d9be 100644 --- a/www/docs/scotland/index.php +++ b/www/docs/scotland/index.php @@ -2,7 +2,7 @@ include_once '../../includes/easyparliament/init.php'; -$view = new MySociety\TheyWorkForYou\SPHomepage(); +$view = new MySociety\TheyWorkForYou\Homepage\Scotland(); $data = $view->display(); MySociety\TheyWorkForYou\Renderer::output('scotland/index', $data); diff --git a/www/includes/easyparliament/hansardlist.php b/www/includes/easyparliament/hansardlist.php index e4b0b87d1d..6a7c51fb70 100644 --- a/www/includes/easyparliament/hansardlist.php +++ b/www/includes/easyparliament/hansardlist.php @@ -2914,7 +2914,7 @@ public function _get_data_by_recent_debates($args = []) { // $args['days'] is the number of days back to look for biggest debates (1 by default). // $args['num'] is the number of links to return (1 by default). - $data = []; + $data = ['info' => [], 'data' => []]; $params = []; @@ -3010,7 +3010,7 @@ public function _get_data_by_recent_debates($args = []) { $childbody = $r['body']; $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major); - $data[] = [ + $data['data'][] = [ 'contentcount' => $contentcount, 'body' => $body, 'hdate' => $hdate, @@ -3028,13 +3028,7 @@ public function _get_data_by_recent_debates($args = []) { } - $data = [ - 'info' => [], - 'data' => $data, - ]; - return $data; - } public function _get_data_by_biggest_debates($args = []) { diff --git a/www/includes/easyparliament/templates/html/homepage/recent-debates.php b/www/includes/easyparliament/templates/html/homepage/recent-debates.php index 021c393385..9559c40a91 100644 --- a/www/includes/easyparliament/templates/html/homepage/recent-debates.php +++ b/www/includes/easyparliament/templates/html/homepage/recent-debates.php @@ -2,7 +2,9 @@
  • +

    +

    diff --git a/www/includes/easyparliament/templates/html/homepage/recent-votes.php b/www/includes/easyparliament/templates/html/homepage/recent-votes.php index 0d53fa38fb..42738d631b 100644 --- a/www/includes/easyparliament/templates/html/homepage/recent-votes.php +++ b/www/includes/easyparliament/templates/html/homepage/recent-votes.php @@ -12,6 +12,8 @@

    + Commons, + Lords,

  • diff --git a/www/includes/easyparliament/templates/html/scotland/index.php b/www/includes/easyparliament/templates/html/scotland/index.php index 827ea78f54..2261c85f61 100644 --- a/www/includes/easyparliament/templates/html/scotland/index.php +++ b/www/includes/easyparliament/templates/html/scotland/index.php @@ -20,14 +20,13 @@
    - -

    Recently in Parliament

    +

    What is the Scottish Parliament?

    diff --git a/www/includes/easyparliament/templates/html/senedd/index.php b/www/includes/easyparliament/templates/html/senedd/index.php index 72f3d5d282..77e58df84b 100644 --- a/www/includes/easyparliament/templates/html/senedd/index.php +++ b/www/includes/easyparliament/templates/html/senedd/index.php @@ -27,6 +27,7 @@ include dirname(__FILE__) . '/../homepage/recent-debates.php'; } ?> +