@@ -14,10 +14,10 @@ |
||
| 14 | 14 | </ul> |
| 15 | 15 | <ul class="division-list"> |
| 16 | 16 | <?php foreach ($votes as $vote) { |
| 17 | - $voter = sprintf('<a href="/mp/?p=%d">%s</a>', $vote['person_id'], $vote['name']); |
|
| 18 | - if ($vote['teller']) { |
|
| 19 | - $tellers[] = $voter; |
|
| 20 | - } else { ?> |
|
| 17 | + $voter = sprintf('<a href="/mp/?p=%d">%s</a>', $vote['person_id'], $vote['name']); |
|
| 18 | + if ($vote['teller']) { |
|
| 19 | + $tellers[] = $voter; |
|
| 20 | + } else { ?> |
|
| 21 | 21 | <li><?= $voter ?></li> |
| 22 | 22 | <?php |
| 23 | 23 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function getRecentDivisions($number = 20) { |
| 59 | 59 | $q = $this->db->query( |
| 60 | - "SELECT * FROM divisions ORDER BY division_date DESC, division_number DESC LIMIT :count", |
|
| 60 | + "SELECT * FROM divisions ORDER BY division_date DESC, division_number DESC LIMIT :count", |
|
| 61 | 61 | array( |
| 62 | 62 | ':count' => $number |
| 63 | 63 | ) |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $divisions = array(); |
| 94 | 94 | $row_count = $q->rows(); |
| 95 | 95 | for ($n = 0; $n < $row_count; $n++) { |
| 96 | - $divisions[] = $this->getParliamentDivisionDetails($q->row($n)); |
|
| 96 | + $divisions[] = $this->getParliamentDivisionDetails($q->row($n)); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | return $divisions; |
@@ -149,44 +149,44 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $row_count = $q->rows(); |
| 151 | 151 | for ($n = 0; $n < $row_count; $n++) { |
| 152 | - $policy_id = $q->field($n, 'policy_id'); |
|
| 152 | + $policy_id = $q->field($n, 'policy_id'); |
|
| 153 | 153 | |
| 154 | - if (!array_key_exists($policy_id, $policy_divisions)) { |
|
| 154 | + if (!array_key_exists($policy_id, $policy_divisions)) { |
|
| 155 | 155 | $summary = array( |
| 156 | - 'max' => $q->field($n, 'latest'), |
|
| 157 | - 'min' => $q->field($n, 'earliest'), |
|
| 158 | - 'total' => $q->field($n, 'total'), |
|
| 159 | - 'for' => 0, 'against' => 0, 'absent' => 0, 'both' => 0, 'tell' => 0 |
|
| 156 | + 'max' => $q->field($n, 'latest'), |
|
| 157 | + 'min' => $q->field($n, 'earliest'), |
|
| 158 | + 'total' => $q->field($n, 'total'), |
|
| 159 | + 'for' => 0, 'against' => 0, 'absent' => 0, 'both' => 0, 'tell' => 0 |
|
| 160 | 160 | ); |
| 161 | 161 | |
| 162 | 162 | $policy_divisions[$policy_id] = $summary; |
| 163 | - } |
|
| 164 | - |
|
| 165 | - $summary = $policy_divisions[$policy_id]; |
|
| 166 | - |
|
| 167 | - $summary['total'] += $q->field($n, 'total'); |
|
| 168 | - if ($summary['max'] < $q->field($n, 'latest')) { |
|
| 169 | - $summary['max'] = $q->field($n, 'latest'); |
|
| 170 | - } |
|
| 171 | - if ($summary['min'] > $q->field($n, 'latest')) { |
|
| 172 | - $summary['min'] = $q->field($n, 'latest'); |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - $vote = $q->field($n, 'vote'); |
|
| 176 | - $policy_vote = str_replace('3', '', $q->field($n, 'policy_vote')); |
|
| 177 | - if ( $vote == 'absent' ) { |
|
| 178 | - $summary['absent'] += $q->field($n, 'total'); |
|
| 179 | - } else if ( $vote == 'both' ) { |
|
| 180 | - $summary['both'] += $q->field($n, 'total'); |
|
| 181 | - } else if ( strpos($vote, 'tell') !== FALSE ) { |
|
| 182 | - $summary['tell'] += $q->field($n, 'total'); |
|
| 183 | - } else if ( $policy_vote == $vote ) { |
|
| 184 | - $summary['for'] += $q->field($n, 'total'); |
|
| 185 | - } else if ( $policy_vote != $vote ) { |
|
| 186 | - $summary['against'] += $q->field($n, 'total'); |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - $policy_divisions[$policy_id] = $summary; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + $summary = $policy_divisions[$policy_id]; |
|
| 166 | + |
|
| 167 | + $summary['total'] += $q->field($n, 'total'); |
|
| 168 | + if ($summary['max'] < $q->field($n, 'latest')) { |
|
| 169 | + $summary['max'] = $q->field($n, 'latest'); |
|
| 170 | + } |
|
| 171 | + if ($summary['min'] > $q->field($n, 'latest')) { |
|
| 172 | + $summary['min'] = $q->field($n, 'latest'); |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + $vote = $q->field($n, 'vote'); |
|
| 176 | + $policy_vote = str_replace('3', '', $q->field($n, 'policy_vote')); |
|
| 177 | + if ( $vote == 'absent' ) { |
|
| 178 | + $summary['absent'] += $q->field($n, 'total'); |
|
| 179 | + } else if ( $vote == 'both' ) { |
|
| 180 | + $summary['both'] += $q->field($n, 'total'); |
|
| 181 | + } else if ( strpos($vote, 'tell') !== FALSE ) { |
|
| 182 | + $summary['tell'] += $q->field($n, 'total'); |
|
| 183 | + } else if ( $policy_vote == $vote ) { |
|
| 184 | + $summary['for'] += $q->field($n, 'total'); |
|
| 185 | + } else if ( $policy_vote != $vote ) { |
|
| 186 | + $summary['against'] += $q->field($n, 'total'); |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + $policy_divisions[$policy_id] = $summary; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | return $policy_divisions; |
@@ -239,25 +239,25 @@ discard block |
||
| 239 | 239 | ); |
| 240 | 240 | |
| 241 | 241 | $votes = array( |
| 242 | - 'yes_votes' => array(), |
|
| 243 | - 'no_votes' => array(), |
|
| 244 | - 'absent_votes' => array(), |
|
| 245 | - 'both_votes' => array() |
|
| 242 | + 'yes_votes' => array(), |
|
| 243 | + 'no_votes' => array(), |
|
| 244 | + 'absent_votes' => array(), |
|
| 245 | + 'both_votes' => array() |
|
| 246 | 246 | ); |
| 247 | 247 | |
| 248 | 248 | $party_breakdown = array( |
| 249 | - 'yes_votes' => array(), |
|
| 250 | - 'no_votes' => array(), |
|
| 251 | - 'absent_votes' => array(), |
|
| 252 | - 'both_votes' => array() |
|
| 249 | + 'yes_votes' => array(), |
|
| 250 | + 'no_votes' => array(), |
|
| 251 | + 'absent_votes' => array(), |
|
| 252 | + 'both_votes' => array() |
|
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | 255 | foreach ($q->data as $vote) { |
| 256 | 256 | $detail = array( |
| 257 | - 'person_id' => $vote['person_id'], |
|
| 258 | - 'name' => $vote['given_name'] . ' ' . $vote['family_name'], |
|
| 259 | - 'party' => $vote['party'], |
|
| 260 | - 'teller' => false |
|
| 257 | + 'person_id' => $vote['person_id'], |
|
| 258 | + 'name' => $vote['given_name'] . ' ' . $vote['family_name'], |
|
| 259 | + 'party' => $vote['party'], |
|
| 260 | + 'teller' => false |
|
| 261 | 261 | ); |
| 262 | 262 | |
| 263 | 263 | if (strpos($vote['vote'], 'tell') !== FALSE) { |
@@ -265,23 +265,23 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | if ($vote['vote'] == 'aye' or $vote['vote'] == 'tellaye') { |
| 268 | - $votes['yes_votes'][] = $detail; |
|
| 269 | - @$party_breakdown['yes_votes'][$detail['party']]++; |
|
| 268 | + $votes['yes_votes'][] = $detail; |
|
| 269 | + @$party_breakdown['yes_votes'][$detail['party']]++; |
|
| 270 | 270 | } else if ($vote['vote'] == 'no' or $vote['vote'] == 'tellno') { |
| 271 | - $votes['no_votes'][] = $detail; |
|
| 272 | - @$party_breakdown['no_votes'][$detail['party']]++; |
|
| 271 | + $votes['no_votes'][] = $detail; |
|
| 272 | + @$party_breakdown['no_votes'][$detail['party']]++; |
|
| 273 | 273 | } else if ($vote['vote'] == 'absent') { |
| 274 | - $votes['absent_votes'][] = $detail; |
|
| 275 | - @$party_breakdown['absent_votes'][$detail['party']]++; |
|
| 274 | + $votes['absent_votes'][] = $detail; |
|
| 275 | + @$party_breakdown['absent_votes'][$detail['party']]++; |
|
| 276 | 276 | } else if ($vote['vote'] == 'both') { |
| 277 | - $votes['both_votes'][] = $detail; |
|
| 278 | - @$party_breakdown['both_votes'][$detail['party']]++; |
|
| 277 | + $votes['both_votes'][] = $detail; |
|
| 278 | + @$party_breakdown['both_votes'][$detail['party']]++; |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | foreach ($votes as $vote => $count) { // array('yes_votes', 'no_votes', 'absent_votes', 'both_votes') as $vote) { |
| 283 | - $votes[$vote . '_by_party'] = $votes[$vote]; |
|
| 284 | - usort($votes[$vote . '_by_party'], function ($a, $b) { |
|
| 283 | + $votes[$vote . '_by_party'] = $votes[$vote]; |
|
| 284 | + usort($votes[$vote . '_by_party'], function ($a, $b) { |
|
| 285 | 285 | return $a['party']>$b['party']; |
| 286 | 286 | }); |
| 287 | 287 | } |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | $divisions = array(); |
| 389 | 389 | $row_count = $q->rows(); |
| 390 | 390 | for ($n = 0; $n < $row_count; $n++) { |
| 391 | - if ($context == 'Parliament') { |
|
| 392 | - $divisions[] = $this->getParliamentDivisionDetails($q->row($n)); |
|
| 393 | - } else { |
|
| 394 | - $divisions[] = $this->getDivisionDetails($q->row($n)); |
|
| 395 | - } |
|
| 391 | + if ($context == 'Parliament') { |
|
| 392 | + $divisions[] = $this->getParliamentDivisionDetails($q->row($n)); |
|
| 393 | + } else { |
|
| 394 | + $divisions[] = $this->getDivisionDetails($q->row($n)); |
|
| 395 | + } |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | return $divisions; |
@@ -486,13 +486,13 @@ discard block |
||
| 486 | 486 | |
| 487 | 487 | $division['mp_vote'] = ''; |
| 488 | 488 | if (array_key_exists('vote', $row)) { |
| 489 | - $mp_vote = ' was absent'; |
|
| 490 | - if ($row['vote'] == 'aye') { |
|
| 491 | - $mp_vote = 'voted in favour'; |
|
| 492 | - } else if ($row['vote'] == 'no') { |
|
| 493 | - $mp_vote = 'voted against'; |
|
| 494 | - } |
|
| 495 | - $division['mp_vote'] = $mp_vote; |
|
| 489 | + $mp_vote = ' was absent'; |
|
| 490 | + if ($row['vote'] == 'aye') { |
|
| 491 | + $mp_vote = 'voted in favour'; |
|
| 492 | + } else if ($row['vote'] == 'no') { |
|
| 493 | + $mp_vote = 'voted against'; |
|
| 494 | + } |
|
| 495 | + $division['mp_vote'] = $mp_vote; |
|
| 496 | 496 | } |
| 497 | 497 | $division['division_title'] = $row['division_title']; |
| 498 | 498 | |
@@ -23,20 +23,20 @@ |
||
| 23 | 23 | public static function house_to_members($house) { |
| 24 | 24 | $house_to_members = array( |
| 25 | 25 | HOUSE_TYPE_COMMONS => array( |
| 26 | - 'singular' => 'MP', |
|
| 27 | - 'plural' => 'MPs' |
|
| 26 | + 'singular' => 'MP', |
|
| 27 | + 'plural' => 'MPs' |
|
| 28 | 28 | ), |
| 29 | 29 | HOUSE_TYPE_LORDS => array( |
| 30 | - 'singular' => 'Member of the House of Lords', |
|
| 31 | - 'plural' => 'Members of the House of Lords' |
|
| 30 | + 'singular' => 'Member of the House of Lords', |
|
| 31 | + 'plural' => 'Members of the House of Lords' |
|
| 32 | 32 | ), |
| 33 | 33 | HOUSE_TYPE_NI => array( |
| 34 | - 'singular' => 'MLA', |
|
| 35 | - 'plural' => 'MLAs' |
|
| 34 | + 'singular' => 'MLA', |
|
| 35 | + 'plural' => 'MLAs' |
|
| 36 | 36 | ), |
| 37 | 37 | HOUSE_TYPE_SCOTLAND => array( |
| 38 | - 'singular' => 'MSP', |
|
| 39 | - 'plural' => 'MSPs' |
|
| 38 | + 'singular' => 'MSP', |
|
| 39 | + 'plural' => 'MSPs' |
|
| 40 | 40 | ) |
| 41 | 41 | ); |
| 42 | 42 | |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if (!function_exists('print_voter')) { |
| 4 | - function print_voter($vote){ |
|
| 4 | + function print_voter($vote){ |
|
| 5 | 5 | echo sprintf( |
| 6 | - '<li><a href="/mp/?p=%d">%s</a> <span class="party">%s</span></li>', |
|
| 7 | - $vote['person_id'], |
|
| 8 | - $vote['name'], |
|
| 9 | - $vote['party'] |
|
| 6 | + '<li><a href="/mp/?p=%d">%s</a> <span class="party">%s</span></li>', |
|
| 7 | + $vote['person_id'], |
|
| 8 | + $vote['name'], |
|
| 9 | + $vote['party'] |
|
| 10 | 10 | ); |
| 11 | - } |
|
| 11 | + } |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | if (count($votes) > 0) { ?> |
@@ -17,18 +17,18 @@ discard block |
||
| 17 | 17 | <?php $tellers = array(); ?> |
| 18 | 18 | <ul class="division-names js-vote-accordion"> |
| 19 | 19 | <?php foreach ($votes as $vote) { |
| 20 | - if ($vote['teller']) { |
|
| 21 | - $tellers[] = $vote; |
|
| 22 | - } else { |
|
| 20 | + if ($vote['teller']) { |
|
| 21 | + $tellers[] = $vote; |
|
| 22 | + } else { |
|
| 23 | 23 | print_voter($vote); |
| 24 | - } |
|
| 24 | + } |
|
| 25 | 25 | } ?> |
| 26 | 26 | </ul> |
| 27 | 27 | <?php if (count($tellers) > 0) { ?> |
| 28 | 28 | <h4>Tellers</h4> |
| 29 | 29 | <ul class="division-names"> |
| 30 | 30 | <?php foreach($tellers as $teller) { |
| 31 | - print_voter($teller); |
|
| 31 | + print_voter($teller); |
|
| 32 | 32 | } ?> |
| 33 | 33 | </p> |
| 34 | 34 | <?php } ?> |
@@ -38,20 +38,20 @@ |
||
| 38 | 38 | |
| 39 | 39 | $vote_sets = array( |
| 40 | 40 | 'yes_votes' => array( |
| 41 | - 'title' => 'Aye', |
|
| 42 | - 'anchor' => 'for', |
|
| 41 | + 'title' => 'Aye', |
|
| 42 | + 'anchor' => 'for', |
|
| 43 | 43 | ), |
| 44 | 44 | 'no_votes' => array( |
| 45 | - 'title' => 'No', |
|
| 46 | - 'anchor' => 'against', |
|
| 45 | + 'title' => 'No', |
|
| 46 | + 'anchor' => 'against', |
|
| 47 | 47 | ), |
| 48 | 48 | 'absent_votes' => array( |
| 49 | - 'title' => 'Absent', |
|
| 50 | - 'anchor' => 'absent', |
|
| 49 | + 'title' => 'Absent', |
|
| 50 | + 'anchor' => 'absent', |
|
| 51 | 51 | ), |
| 52 | 52 | 'both_votes' => array( |
| 53 | - 'title' => 'Abstained', |
|
| 54 | - 'anchor' => 'both', |
|
| 53 | + 'title' => 'Abstained', |
|
| 54 | + 'anchor' => 'both', |
|
| 55 | 55 | ), |
| 56 | 56 | ); |
| 57 | 57 | |
@@ -45,11 +45,11 @@ |
||
| 45 | 45 | $data['mp_vote']['with_majority'] = true; |
| 46 | 46 | } |
| 47 | 47 | } else { |
| 48 | - if ($data['division']['date'] < $MEMBER->entered_house($division_votes['house_number'])['date']) { |
|
| 49 | - $data['before_mp'] = true; |
|
| 50 | - } else if ($data['division']['date'] > $MEMBER->left_house($division_votes['house_number'])['date']) { |
|
| 51 | - $data['after_mp'] = true; |
|
| 52 | - } |
|
| 48 | + if ($data['division']['date'] < $MEMBER->entered_house($division_votes['house_number'])['date']) { |
|
| 49 | + $data['before_mp'] = true; |
|
| 50 | + } else if ($data['division']['date'] > $MEMBER->left_house($division_votes['house_number'])['date']) { |
|
| 51 | + $data['after_mp'] = true; |
|
| 52 | + } |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $mp_data = array( |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | <?php if (isset($data['mp_data'])) { |
| 29 | 29 | include('_your_mp.php'); |
| 30 | - } ?> |
|
| 30 | + } ?> |
|
| 31 | 31 | |
| 32 | 32 | <div class="debate-speech__division__details"> |
| 33 | 33 | <p> |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | if ($hansardmajors[$data['info']['major']]['location'] == 'Scotland') { |
| 13 | 13 | $body = preg_replace('# (S\d[O0WF]-\d+)[, ]#', ' <a href="/spwrans/?spid=$1">$1</a> ', $body); |
| 14 | 14 | $body = preg_replace_callback('#<citation id="uk\.org\.publicwhip/(.*?)/(.*?)">\[(.*?)\]</citation>#', function($matches) { |
| 15 | - if ($matches[1] == 'spor') { |
|
| 16 | - $href_segment = 'sp/?g'; |
|
| 17 | - } elseif ($matches[1] == 'spwa') { |
|
| 15 | + if ($matches[1] == 'spor') { |
|
| 16 | + $href_segment = 'sp/?g'; |
|
| 17 | + } elseif ($matches[1] == 'spwa') { |
|
| 18 | 18 | $href_segment = 'spwrans/?'; |
| 19 | 19 | } else { |
| 20 | 20 | $href_segment = 'debates/?'; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $before_mp = isset($speech['before_mp']); |
| 188 | 188 | $after_mp = isset($speech['after_mp']); |
| 189 | 189 | include dirname(__FILE__) . '/../divisions/_your_mp.php'; |
| 190 | - } ?> |
|
| 190 | + } ?> |
|
| 191 | 191 | <div class="debate-speech__division__details"> |
| 192 | 192 | <?php include dirname(__FILE__) . '/../divisions/_votes.php'; ?> |
| 193 | 193 | </div> |
@@ -1840,14 +1840,14 @@ |
||
| 1840 | 1840 | $division_votes = $divisions->getDivisionByGid($this->gidprefix . $item['gid']); |
| 1841 | 1841 | $item['division'] = $division_votes; |
| 1842 | 1842 | if (isset($MEMBER)) { |
| 1843 | - $item['mp_vote'] = $divisions->getDivisionResultsForMember($division_votes['division_id'], $MEMBER->person_id()); |
|
| 1844 | - if (!$item['mp_vote']) { |
|
| 1845 | - if ($division_votes['date'] < $MEMBER->entered_house($division_votes['house_number'])['date']) { |
|
| 1846 | - $item['before_mp'] = true; |
|
| 1847 | - } else if ($division_votes['date'] > $MEMBER->left_house($division_votes['house_number'])['date']) { |
|
| 1848 | - $item['after_mp'] = true; |
|
| 1849 | - } |
|
| 1850 | - } |
|
| 1843 | + $item['mp_vote'] = $divisions->getDivisionResultsForMember($division_votes['division_id'], $MEMBER->person_id()); |
|
| 1844 | + if (!$item['mp_vote']) { |
|
| 1845 | + if ($division_votes['date'] < $MEMBER->entered_house($division_votes['house_number'])['date']) { |
|
| 1846 | + $item['before_mp'] = true; |
|
| 1847 | + } else if ($division_votes['date'] > $MEMBER->left_house($division_votes['house_number'])['date']) { |
|
| 1848 | + $item['after_mp'] = true; |
|
| 1849 | + } |
|
| 1850 | + } |
|
| 1851 | 1851 | } |
| 1852 | 1852 | } |
| 1853 | 1853 | |