示例#1
0
 protected function getMLAList()
 {
     global $THEUSER;
     $mreg = array();
     if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) {
         return \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, 3, 'NIE');
     }
     return $mreg;
 }
示例#2
0
 public function getRegionalReps($cons_type, $mp_house)
 {
     global $THEUSER;
     $mreg = array();
     if ($THEUSER->isloggedin() && $THEUSER->postcode() != '' || $THEUSER->postcode_is_set()) {
         $reps = \MySociety\TheyWorkForYou\Member::getRegionalList($THEUSER->postcode, $mp_house, $cons_type);
         foreach ($reps as $rep) {
             $member = new \MySociety\TheyWorkForYou\Member(array('person_id' => $rep['person_id']));
             $mreg[$rep['person_id']] = $this->constructMPData($member, $THEUSER, $mp_house);
         }
     }
     return $mreg;
 }
示例#3
0
 public function testGetRegionalList()
 {
     $this->assertEquals(array(), \MySociety\TheyWorkForYou\Member::getRegionalList('', '', ''));
     $msps = array(array('person_id' => "19", 'name' => "Mr Regional MSP1", 'constituency' => "Mid Scotland and Fife", 'house' => "4"), array('person_id' => "20", 'name' => "Mr Regional MSP2", 'constituency' => "Mid Scotland and Fife", 'house' => "4"));
     $this->assertEquals($msps, \MySociety\TheyWorkForYou\Member::getRegionalList('KY16 8YG', 4, 'SPE'));
     $mlas = array(array('person_id' => "21", 'name' => "Mr Regional MLA1", 'constituency' => "Belfast West", 'house' => "3"), array('person_id' => "22", 'name' => "Mr Regional MLA2", 'constituency' => "Belfast West", 'house' => "3"));
     $this->assertEquals($mlas, \MySociety\TheyWorkForYou\Member::getRegionalList('BT17 0XD', 3, 'NIE'));
     $this->assertEquals(array(), \MySociety\TheyWorkForYou\Member::getRegionalList('BT17 0XD', 4, 'NIE'));
     $this->assertEquals(array(), \MySociety\TheyWorkForYou\Member::getRegionalList('BT17 0XD', 3, 'SPE'));
     $this->assertEquals(array(), \MySociety\TheyWorkForYou\Member::getRegionalList('KY16 8YG', 3, 'SPE'));
     $this->assertEquals(array(), \MySociety\TheyWorkForYou\Member::getRegionalList('KY16 8YG', 4, 'NIE'));
     $this->assertEquals(array(), \MySociety\TheyWorkForYou\Member::getRegionalList('KY16 8YG', 4, ''));
     $this->assertEquals(array(), \MySociety\TheyWorkForYou\Member::getRegionalList('KY16 8YG', '', ''));
 }