From 7bcfc3bbfaf18b6101ae46c38641c960fc6617f2 Mon Sep 17 00:00:00 2001
From: Matthew Somerville Fetch a particular MS. Fetch a list of MSs.Arguments
+
+
+
+Example Response
+<twfy>
+ </twfy>
+
+
+
+Arguments
+
+
+
+Example Response, serialised PHP
+a:646:{
+ i:0; a:5:{
+ s:9:"member_id"; s:4:"1368";
+ s:9:"person_id"; s:5:"10900";
+ s:4:"name"; s:13:"Hywel Francis";
+ s:5:"party"; s:6:"Labour";
+ s:12:"constituency"; s:8:"Aberavon";
+ }
+ i:1; ...
+
+
+constituency();
}
+// Enhance title if this is a member of Welsh Parliament
+if ($MEMBER->house(HOUSE_TYPE_WALES)) {
+ if ($MEMBER->house(HOUSE_TYPE_COMMONS) || $MEMBER->house(HOUSE_TYPE_LORDS)) {
+ $desc = str_replace('Parliament', 'the UK and Welsh Parliaments', $desc);
+ } else {
+ $desc = str_replace('Parliament', 'the Welsh Parliament', $desc);
+ }
+ $desc = str_replace(', and get email alerts on their activity', '', $desc);
+ if (!$MEMBER->current_member(HOUSE_TYPE_WALES)) {
+ $title .= ', former';
+ }
+ $title .= ' MS, '.$MEMBER->constituency();
+}
+
$known_for = '';
$current_offices_ignoring_committees = $MEMBER->offices('current', TRUE);
if (count($current_offices_ignoring_committees) > 0) {
@@ -539,6 +556,8 @@ function get_regional_by_user_postcode($pc, $page) {
$this_page = "your$page";
if ($page == 'msp' && \MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsScottish($pc)) {
regional_list($pc, 'SPC', $page);
+ } elseif ($page == 'ms' && \MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsWelsh($pc)) {
+ regional_list($pc, 'WAC', $page);
} elseif ($page == 'mla' && \MySociety\TheyWorkForYou\Utility\Postcode::postcodeIsNi($pc)) {
regional_list($pc, 'NIE', $page);
} else {
@@ -684,7 +703,7 @@ function person_summary_description ($MEMBER) {
$desc .= $last['from'] . ' ';
}
}
- if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND) {
+ if ($house==HOUSE_TYPE_COMMONS || $house==HOUSE_TYPE_NI || $house==HOUSE_TYPE_SCOTLAND || $house==HOUSE_TYPE_WALES) {
$desc .= ' ';
if ($house==HOUSE_TYPE_COMMONS) {
$desc .= 'MP';
@@ -695,6 +714,9 @@ function person_summary_description ($MEMBER) {
if ($house==HOUSE_TYPE_SCOTLAND) {
$desc .= 'MSP';
}
+ if ($house==HOUSE_TYPE_WALES) {
+ $desc .= 'MS';
+ }
if ($party_br) {
$desc .= " ($party_br)";
}
@@ -984,7 +1006,7 @@ function regional_list($pc, $area_type, $rep_type) {
WHERE constituency IN ('" . join("','", $a) . "')
AND member.person_id = pn.person_id AND pn.type = 'name'
AND pn.end_date = (SELECT MAX(end_date) FROM person_names WHERE person_names.person_id = member.person_id)";
- $q = $db->query($query_base . " AND left_reason = 'still_in_office' AND house in (" . HOUSE_TYPE_NI . "," . HOUSE_TYPE_SCOTLAND . ")");
+ $q = $db->query($query_base . " AND left_reason = 'still_in_office' AND house in (" . HOUSE_TYPE_NI . "," . HOUSE_TYPE_SCOTLAND . "," . HOUSE_TYPE_WALES . ")");
$current = true;
if (!$q->rows() && ($dissolution = MySociety\TheyWorkForYou\Dissolution::db())) {
$current = false;
@@ -1005,6 +1027,12 @@ function regional_list($pc, $area_type, $rep_type) {
} elseif ($cons == $constituencies['SPE']) {
$mreg[] = $row;
}
+ } elseif ($house == HOUSE_TYPE_WALES) {
+ if ($cons == $constituencies['WAC']) {
+ $mcon = $row;
+ } elseif ($cons == $constituencies['WAE']) {
+ $mreg[] = $row;
+ }
} else {
throw new MySociety\TheyWorkForYou\MemberException('Odd result returned!' . $house);
}
@@ -1021,6 +1049,18 @@ function regional_list($pc, $area_type, $rep_type) {
$data['members_statement'] .= $mcon['given_name'] . ' ' . $mcon['family_name'] . ', MSP for ' . $mcon['constituency'];
$data['members_statement'] .= '.
Your ' . $constituencies['SPE'] . ' region MSPs were:
'; } + } elseif ($rep_type == 'ms') { + if ($current) { + $data['members_statement'] = 'You have one constituency MS (Member of the Senedd) and multiple region MSs.
'; + $data['members_statement'] .= 'Your constituency MS is '; + $data['members_statement'] .= $mcon['given_name'] . ' ' . $mcon['family_name'] . ', MS for ' . $mcon['constituency']; + $data['members_statement'] .= '.
Your ' . $constituencies['WAE'] . ' region MSs are:
'; + } else { + $data['members_statement'] = 'You had one constituency MS (Member of the Senedd) and multiple region MSs.
'; + $data['members_statement'] .= 'Your constituency MS was '; + $data['members_statement'] .= $mcon['given_name'] . ' ' . $mcon['family_name'] . ', MS for ' . $mcon['constituency']; + $data['members_statement'] .= '.
Your ' . $constituencies['WAE'] . ' region MSs were:
'; + } } else { if ($current) { $data['members_statement'] = 'You have multiple MLAs (Members of the Legislative Assembly) who represent you in ' . $constituencies['NIE'] . '. They are:
'; diff --git a/www/docs/mps/index.php b/www/docs/mps/index.php index 96dff30c14..3b400368ed 100644 --- a/www/docs/mps/index.php +++ b/www/docs/mps/index.php @@ -12,6 +12,9 @@ case 'msp': $people = new MySociety\TheyWorkForYou\People\MSPs(); break; + case 'ms': + $people = new MySociety\TheyWorkForYou\People\MSs(); + break; case 'london-assembly-member': $people = new MySociety\TheyWorkForYou\People\LondonAssemblyMembers(); break; diff --git a/www/includes/easyparliament/hansardlist.php b/www/includes/easyparliament/hansardlist.php index 9b3d93d9b5..bb2869423c 100644 --- a/www/includes/easyparliament/hansardlist.php +++ b/www/includes/easyparliament/hansardlist.php @@ -2193,6 +2193,8 @@ private function _get_speaker_url($house) { $URL = new \MySociety\TheyWorkForYou\Url('mla'); } elseif ($house == HOUSE_TYPE_SCOTLAND) { $URL = new \MySociety\TheyWorkForYou\Url('msp'); + } elseif ($house == HOUSE_TYPE_WALES) { + $URL = new \MySociety\TheyWorkForYou\Url('ms'); } elseif ($house == HOUSE_TYPE_ROYAL) { $URL = new \MySociety\TheyWorkForYou\Url('royal'); } diff --git a/www/includes/easyparliament/member.php b/www/includes/easyparliament/member.php index 5cba011ca6..81c44ddf39 100644 --- a/www/includes/easyparliament/member.php +++ b/www/includes/easyparliament/member.php @@ -30,6 +30,7 @@ class MEMBER { 2 => 'House of Lords', 3 => 'Northern Ireland Assembly', 4 => 'Scottish Parliament', + 5 => 'Senedd', 6 => 'London Assembly', ); @@ -84,6 +85,7 @@ private function isHigherPriorityHouse(int $house) if (! (bool) $this->house_disp) { if ($house == HOUSE_TYPE_LONDON_ASSEMBLY # London Assembly || $house == HOUSE_TYPE_SCOTLAND # MSPs and + || $house == HOUSE_TYPE_WALES # MSs and || $house == HOUSE_TYPE_NI # MLAs have lowest priority || $house == HOUSE_TYPE_COMMONS # MPs ) { @@ -359,6 +361,8 @@ public function name_to_person_id($name, $const='') { $params[':house'] = HOUSE_TYPE_LORDS; } elseif ($this_page == 'msp') { $params[':house'] = HOUSE_TYPE_SCOTLAND; + } elseif ($this_page == 'ms') { + $params[':house'] = HOUSE_TYPE_WALES; } elseif ($this_page == 'mla') { $params[':house'] = HOUSE_TYPE_NI; } elseif ($this_page == 'royal') { @@ -523,7 +527,7 @@ public function given_name() { return $this->given_name; } public function family_name() { return $this->family_name; } public function full_name($no_mp_title = false) { $title = $this->title; - if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND)) { + if ($no_mp_title && ($this->house_disp==HOUSE_TYPE_COMMONS || $this->house_disp==HOUSE_TYPE_NI || $this->house_disp==HOUSE_TYPE_SCOTLAND || $this->house_disp==HOUSE_TYPE_WALES)) { $title = ''; } return member_full_name($this->house_disp, $title, $this->given_name, $this->family_name, $this->lordofname); @@ -665,6 +669,10 @@ public function url($absolute = false) { $URL = new \MySociety\TheyWorkForYou\Url('msp'); break; + case HOUSE_TYPE_WALES: + $URL = new \MySociety\TheyWorkForYou\Url('ms'); + break; + case HOUSE_TYPE_LONDON_ASSEMBLY: $URL = new \MySociety\TheyWorkForYou\Url('london-assembly-member'); break; diff --git a/www/includes/easyparliament/metadata.php b/www/includes/easyparliament/metadata.php index d6995d7b89..5b41b660f7 100644 --- a/www/includes/easyparliament/metadata.php +++ b/www/includes/easyparliament/metadata.php @@ -1056,6 +1056,20 @@ 'url' => 'wales/', 'parent' => 'wales_home', ), + 'mss' => array ( + 'parent' => 'wales_home', + 'menu' => array ( + 'text' => 'MSs', + 'title' => "List of Members of the Senedd (MSs)" + ), + 'title' => '', + 'url' => 'mss/' + ), + 'ms' => array ( + 'parent' => 'mss', + 'title' => 'Find your MS', + 'url' => 'ms/' + ), /* Westminster Hall */ 'whall' => array ( diff --git a/www/includes/easyparliament/templates/html/search/by-person.php b/www/includes/easyparliament/templates/html/search/by-person.php index c9379852a1..6ae1ae27aa 100644 --- a/www/includes/easyparliament/templates/html/search/by-person.php +++ b/www/includes/easyparliament/templates/html/search/by-person.php @@ -19,6 +19,8 @@ No results for Peers only No results for MSPs only + + No results for MSs only No results for MLAs only @@ -69,6 +71,12 @@ MSPs only | + + MSs only + + MSs only + + | MLAs only