@@ -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 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $policy_maxes = array(); |
| 50 | 50 | $row_count = $q->rows(); |
| 51 | 51 | for ($n = 0; $n < $row_count; $n++) { |
| 52 | - $policy_maxes[$q->field($n, 'policy_id')] = $q->field( $n, 'recent' ); |
|
| 52 | + $policy_maxes[$q->field($n, 'policy_id')] = $q->field($n, 'recent'); |
|
| 53 | 53 | } |
| 54 | 54 | $policy_maxes['latest'] = $policy_maxes ? max(array_values($policy_maxes)) : ''; |
| 55 | 55 | return $policy_maxes; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | public function getMemberDivisionsForPolicy($policyID = null) { |
| 117 | 117 | $where_extra = ''; |
| 118 | 118 | $args = array(':person_id' => $this->member->person_id); |
| 119 | - if ( $policyID ) { |
|
| 119 | + if ($policyID) { |
|
| 120 | 120 | $where_extra = 'AND policy_id = :policy_id'; |
| 121 | 121 | $args[':policy_id'] = $policyID; |
| 122 | 122 | } |
@@ -174,15 +174,15 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $vote = $q->field($n, 'vote'); |
| 176 | 176 | $policy_vote = str_replace('3', '', $q->field($n, 'policy_vote')); |
| 177 | - if ( $vote == 'absent' ) { |
|
| 177 | + if ($vote == 'absent') { |
|
| 178 | 178 | $summary['absent'] += $q->field($n, 'total'); |
| 179 | - } else if ( $vote == 'both' ) { |
|
| 179 | + } else if ($vote == 'both') { |
|
| 180 | 180 | $summary['both'] += $q->field($n, 'total'); |
| 181 | - } else if ( strpos($vote, 'tell') !== FALSE ) { |
|
| 181 | + } else if (strpos($vote, 'tell') !== FALSE) { |
|
| 182 | 182 | $summary['tell'] += $q->field($n, 'total'); |
| 183 | - } else if ( $policy_vote == $vote ) { |
|
| 183 | + } else if ($policy_vote == $vote) { |
|
| 184 | 184 | $summary['for'] += $q->field($n, 'total'); |
| 185 | - } else if ( $policy_vote != $vote ) { |
|
| 185 | + } else if ($policy_vote != $vote) { |
|
| 186 | 186 | $summary['against'] += $q->field($n, 'total'); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -270,8 +270,8 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | foreach ($votes as $vote => $count) { // array('yes_votes', 'no_votes', 'absent_votes', 'both_votes') as $vote) { |
| 272 | 272 | $votes[$vote . '_by_party'] = $votes[$vote]; |
| 273 | - usort($votes[$vote . '_by_party'], function ($a, $b) { |
|
| 274 | - return $a['party']>$b['party']; |
|
| 273 | + usort($votes[$vote . '_by_party'], function($a, $b) { |
|
| 274 | + return $a['party'] > $b['party']; |
|
| 275 | 275 | }); |
| 276 | 276 | } |
| 277 | 277 | |
@@ -311,10 +311,10 @@ discard block |
||
| 311 | 311 | $votes['against'] . ' ' . make_plural('vote', $votes['against']) . ' against' |
| 312 | 312 | ); |
| 313 | 313 | |
| 314 | - if ( $votes['both'] ) { |
|
| 314 | + if ($votes['both']) { |
|
| 315 | 315 | $actions[] = $votes['both'] . ' ' . make_plural('abstention', $votes['both']); |
| 316 | 316 | } |
| 317 | - if ( $votes['absent'] ) { |
|
| 317 | + if ($votes['absent']) { |
|
| 318 | 318 | $actions[] = $votes['absent'] . ' ' . make_plural('absence', $votes['absent']); |
| 319 | 319 | } |
| 320 | 320 | if ($max == $min) { |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | private function constructYesNoVoteDescription($direction, $title, $short_text) { |
| 381 | 381 | $text = ' voted '; |
| 382 | - if ( $short_text ) { |
|
| 382 | + if ($short_text) { |
|
| 383 | 383 | $text .= $short_text; |
| 384 | 384 | } else { |
| 385 | 385 | $text .= "$direction on <em>$title</em>"; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | * votes so we need to generate some text using the title of the division |
| 398 | 398 | */ |
| 399 | 399 | |
| 400 | - switch ( strtolower($vote) ) { |
|
| 400 | + switch (strtolower($vote)) { |
|
| 401 | 401 | case 'yes': |
| 402 | 402 | case 'aye': |
| 403 | 403 | $description = $this->constructYesNoVoteDescription('yes', $division_title, $yes_text); |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | if (array_key_exists('direction', $row)) { |
| 447 | 447 | $division['direction'] = $row['direction']; |
| 448 | - if ( strpos( $row['direction'], 'strong') !== FALSE ) { |
|
| 448 | + if (strpos($row['direction'], 'strong') !== FALSE) { |
|
| 449 | 449 | $division['strong'] = TRUE; |
| 450 | 450 | } else { |
| 451 | 451 | $division['strong'] = FALSE; |
@@ -489,24 +489,24 @@ discard block |
||
| 489 | 489 | for ($n = 0; $n < $row_count; $n++) { |
| 490 | 490 | $policy_id = $q->field($n, 'policy_id'); |
| 491 | 491 | |
| 492 | - if ( !array_key_exists($policy_id, $policies) ) { |
|
| 492 | + if (!array_key_exists($policy_id, $policies)) { |
|
| 493 | 493 | $policies[$policy_id] = array( |
| 494 | 494 | 'policy_id' => $policy_id, |
| 495 | 495 | 'weak_count' => 0, |
| 496 | 496 | 'divisions' => array() |
| 497 | 497 | ); |
| 498 | - if ( $this->policies ) { |
|
| 498 | + if ($this->policies) { |
|
| 499 | 499 | $policies[$policy_id]['desc'] = $this->policies->getPolicies()[$policy_id]; |
| 500 | 500 | $policies[$policy_id]['header'] = $this->policies->getPolicyDetails($policy_id); |
| 501 | 501 | } |
| 502 | - if ( $this->positions ) { |
|
| 502 | + if ($this->positions) { |
|
| 503 | 503 | $policies[$policy_id]['position'] = $this->positions->positionsById[$policy_id]; |
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | $division = $this->getDivisionDetails($q->row($n)); |
| 508 | 508 | |
| 509 | - if ( !$division['strong'] ) { |
|
| 509 | + if (!$division['strong']) { |
|
| 510 | 510 | $policies[$policy_id]['weak_count']++; |
| 511 | 511 | } |
| 512 | 512 | |
@@ -521,9 +521,9 @@ discard block |
||
| 521 | 521 | |
| 522 | 522 | $gid = get_canonical_gid($gid); |
| 523 | 523 | |
| 524 | - $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", array( ':gid' => $gid )); |
|
| 524 | + $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", array(':gid' => $gid)); |
|
| 525 | 525 | $parent_gid = $q->field(0, 'gid'); |
| 526 | - if ( !$parent_gid ) { |
|
| 526 | + if (!$parent_gid) { |
|
| 527 | 527 | return ''; |
| 528 | 528 | } |
| 529 | 529 | $parent_gid = fix_gid_from_db($parent_gid); |
@@ -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 | |
@@ -46,28 +46,28 @@ |
||
| 46 | 46 | |
| 47 | 47 | public static function getCountryDetails($house) { |
| 48 | 48 | $details = array( |
| 49 | - HOUSE_TYPE_COMMONS => array ( |
|
| 49 | + HOUSE_TYPE_COMMONS => array( |
|
| 50 | 50 | 'country' => 'UK', |
| 51 | 51 | 'assembly' => 'uk-commons', |
| 52 | 52 | 'location' => '– in the House of Commons', |
| 53 | 53 | 'cons_type' => 'WMC', |
| 54 | 54 | 'assembly_name' => 'House of Commons', |
| 55 | 55 | ), |
| 56 | - HOUSE_TYPE_NI => array ( |
|
| 56 | + HOUSE_TYPE_NI => array( |
|
| 57 | 57 | 'country' => 'NORTHERN IRELAND', |
| 58 | 58 | 'assembly' => 'ni', |
| 59 | 59 | 'location' => '– in the Northern Ireland Assembly', |
| 60 | 60 | 'cons_type' => 'NIE', |
| 61 | 61 | 'assembly_name' => 'Northern Ireland Assembly', |
| 62 | 62 | ), |
| 63 | - HOUSE_TYPE_SCOTLAND => array ( |
|
| 63 | + HOUSE_TYPE_SCOTLAND => array( |
|
| 64 | 64 | 'country' => 'SCOTLAND', |
| 65 | 65 | 'assembly' => 'scotland', |
| 66 | 66 | 'location' => '– in the Scottish Parliament', |
| 67 | 67 | 'cons_type' => 'SPC', |
| 68 | 68 | 'assembly_name' => 'Scottish Parliament', |
| 69 | 69 | ), |
| 70 | - HOUSE_TYPE_LORDS => array ( |
|
| 70 | + HOUSE_TYPE_LORDS => array( |
|
| 71 | 71 | 'country' => 'UK', |
| 72 | 72 | 'assembly' => 'uk-lords', |
| 73 | 73 | 'location' => '– in the House of Lords', |
@@ -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 } ?> |
@@ -1,7 +1,7 @@ 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 | 6 | '<li><a href="/mp/?p=%d">%s</a> <span class="party">%s</span></li>', |
| 7 | 7 | $vote['person_id'], |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | <?php if (count($tellers) > 0) { ?> |
| 28 | 28 | <h4>Tellers</h4> |
| 29 | 29 | <ul class="division-names"> |
| 30 | - <?php foreach($tellers as $teller) { |
|
| 30 | + <?php foreach ($tellers as $teller) { |
|
| 31 | 31 | print_voter($teller); |
| 32 | 32 | } ?> |
| 33 | 33 | </p> |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | Based on postcode <strong><?= $mp_data['postcode'] ?></strong> |
| 27 | 27 | <a href="<?= $mp_data['change_url'] ?>">(Change postcode)</a> |
| 28 | 28 | </p> |
| 29 | - <?php if ( isset( $mp_data ) && $type != 'mlas' ) { ?> |
|
| 29 | + <?php if (isset($mp_data) && $type != 'mlas') { ?> |
|
| 30 | 30 | <h3>Your <?= $mp_data['former'] ? $mp_data['former'] . ' ' : '' ?><?= $rep_name ?> is</h3> |
| 31 | 31 | </div> |
| 32 | 32 | <a href="<?= $mp_data['mp_url'] ?>" class="people-list__person"> |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | </p> |
| 39 | 39 | </a> |
| 40 | 40 | <?php } |
| 41 | - if ( isset($reps) ) { |
|
| 42 | - if ( isset($mp_data) && $type != 'mlas' ) { ?> |
|
| 41 | + if (isset($reps)) { |
|
| 42 | + if (isset($mp_data) && $type != 'mlas') { ?> |
|
| 43 | 43 | <div class="people-list__your-mp__replist-header"> |
| 44 | 44 | <?php } ?> |
| 45 | 45 | <h3>Your <?=$former ?> <?= $rep_plural == 'MSPs' ? 'regional ' : '' ?><?= $rep_plural ?> are</h3> |
| 46 | 46 | </div> |
| 47 | - <?php foreach ( $reps as $rep ) { ?> |
|
| 47 | + <?php foreach ($reps as $rep) { ?> |
|
| 48 | 48 | <a href="<?= $rep['mp_url'] ?>" class="people-list__person"> |
| 49 | 49 | <img class="people-list__person__image" src="<?= $rep['image'] ?>"> |
| 50 | 50 | <h2 class="people-list__person__name"><?= $rep['name'] ?></h2> |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | <div class="search-page__section search-page__section--search"> |
| 66 | 66 | <div class="search-page__section__primary"> |
| 67 | 67 | <p class="search-page-main-inputs"> |
| 68 | - <?php if ( $type == 'peers' ) { ?> |
|
| 68 | + <?php if ($type == 'peers') { ?> |
|
| 69 | 69 | <label for="find-mp-by-name-or-postcode">Find <?= $rep_plural ?> by name:</label> |
| 70 | - <?php } elseif ( $type == 'mlas' || $type == 'msps' ) { ?> |
|
| 70 | + <?php } elseif ($type == 'mlas' || $type == 'msps') { ?> |
|
| 71 | 71 | <label for="find-mp-by-name-or-postcode">Find your <?= $rep_name ?> by postcode:</label> |
| 72 | 72 | <?php } else { ?> |
| 73 | 73 | <label for="find-mp-by-name-or-postcode">Find your <?= $rep_name ?> by name or postcode:</label> |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | <div class="search-page__section__primary"> |
| 109 | 109 | <h2>All <?= $rep_plural ?></h2> |
| 110 | 110 | |
| 111 | - <?php if ( $type != 'peers' ) { ?> |
|
| 111 | + <?php if ($type != 'peers') { ?> |
|
| 112 | 112 | <ul class="search-result-display-options"> |
| 113 | - <?php if ( $order == 'given_name' ) { ?> |
|
| 113 | + <?php if ($order == 'given_name') { ?> |
|
| 114 | 114 | <li><strong>Sorted by</strong> First name</li> |
| 115 | 115 | <li>Sort by <a href="<?= $urls['by_last'] ?>">Last name</a> / <a href="<?= $urls['by_party'] ?>">Party</a></li> |
| 116 | - <?php } else if ( $order == 'party' ) { ?> |
|
| 116 | + <?php } else if ($order == 'party') { ?> |
|
| 117 | 117 | <li><strong>Sorted by</strong> Party</li> |
| 118 | 118 | <li>Sort by <a href="<?= $urls['by_first'] ?>">First name</a> / <a href="<?= $urls['by_last'] ?>">Last name</a></li> |
| 119 | 119 | <?php } else { ?> |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | </ul> |
| 124 | 124 | <?php } else { ?> |
| 125 | 125 | <ul class="search-result-display-options"> |
| 126 | - <?php if ( $order == 'party' ) { ?> |
|
| 126 | + <?php if ($order == 'party') { ?> |
|
| 127 | 127 | <li><strong>Sorted by</strong> Party</li> |
| 128 | 128 | <li>Sort by <a href="<?= $urls['by_name'] ?>">Name</a></li> |
| 129 | 129 | <?php } else { ?> |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | $initial_link = ''; |
| 176 | - foreach ( $data as $person ) { |
|
| 176 | + foreach ($data as $person) { |
|
| 177 | 177 | if ($order != 'party') { |
| 178 | - $initial = substr( strtoupper($person[$a_to_z_key]), 0, 1); |
|
| 179 | - if ( $initial != $current_initial ) { |
|
| 178 | + $initial = substr(strtoupper($person[$a_to_z_key]), 0, 1); |
|
| 179 | + if ($initial != $current_initial) { |
|
| 180 | 180 | $current_initial = $initial; |
| 181 | 181 | $initial_link = "name=\"$initial\" "; |
| 182 | 182 | } else { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | <img class="people-list__person__image" src="<?= $person['image'] ?>"> |
| 189 | 189 | <h2 class="people-list__person__name"><?= ucfirst($person['name']) ?></h2> |
| 190 | 190 | <p class="people-list__person__memberships"> |
| 191 | - <?php if ( $person['constituency'] ) { ?> |
|
| 191 | + <?php if ($person['constituency']) { ?> |
|
| 192 | 192 | <span class="people-list__person__constituency"><?= $person['constituency'] ?></span> |
| 193 | 193 | <?php } ?> |
| 194 | 194 | <span class="people-list__person__party <?= slugify($person['party']) ?>"><?= $person['party'] ?></span> |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | <a href="<?= $urls['by_csv'] ?>">Download this list as a CSV</a> |
| 207 | 207 | suitable for Excel |
| 208 | 208 | </p> |
| 209 | - <?php if ( $type == 'mps' ) { ?> |
|
| 209 | + <?php if ($type == 'mps') { ?> |
|
| 210 | 210 | <form method="get" action="<?= $urls['plain'] ?>" class="sidebar-item-with-icon sidebar-item-with-icon--date"> |
| 211 | 211 | <p> |
| 212 | 212 | Or view a past list |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | }) |
| 259 | 259 | }); |
| 260 | 260 | </script> |
| 261 | - <?php } else if ( $type == 'msps' ) { ?> |
|
| 261 | + <?php } else if ($type == 'msps') { ?> |
|
| 262 | 262 | <p class="past-list-dates" id="past-list-dates"> |
| 263 | 263 | <a href="<?= $urls['plain'] ?>?date=2011-05-05">MSPs at 2011 election</a> |
| 264 | 264 | <a href="<?= $urls['plain'] ?>?date=2007-05-03">MSPs at 2007 election</a> |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | </p> |
| 273 | 273 | <?php } ?> |
| 274 | 274 | |
| 275 | - <?php include( dirname(__FILE__) . '/../sidebar/looking_for.php' ) ?> |
|
| 275 | + <?php include(dirname(__FILE__) . '/../sidebar/looking_for.php') ?> |
|
| 276 | 276 | </div> |
| 277 | 277 | </div> |
| 278 | 278 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | if ($data['division']['house'] == 'pbc') { |
| 59 | 59 | $location = '– in a Public Bill Committee'; |
| 60 | 60 | } |
| 61 | -$data['debate_time_human'] = False; |
|
| 61 | +$data['debate_time_human'] = false; |
|
| 62 | 62 | $data['debate_day_human'] = format_date($data['division']['date'], LONGDATEFORMAT); |
| 63 | 63 | $data['col_country'] = $country; |
| 64 | 64 | $data['location'] = $location; |
@@ -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( |
@@ -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 | |
@@ -55,17 +55,17 @@ |
||
| 55 | 55 | ), |
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | -foreach ( $division_sections as $s ) { |
|
| 59 | - $vote_title = $vote_sets[ $s['thekey'] ]['title']; |
|
| 60 | - $anchor = $vote_sets[ $s['thekey'] ]['anchor']; |
|
| 61 | - $summary = $division['party_breakdown'][ $s['thekey'] ]; |
|
| 58 | +foreach ($division_sections as $s) { |
|
| 59 | + $vote_title = $vote_sets[$s['thekey']]['title']; |
|
| 60 | + $anchor = $vote_sets[$s['thekey']]['anchor']; |
|
| 61 | + $summary = $division['party_breakdown'][$s['thekey']]; |
|
| 62 | 62 | |
| 63 | - if ( $s['style'] == 'dot_vote_list' ) { |
|
| 64 | - $votes = $division[ $s['thekey'] . '_by_party' ]; |
|
| 63 | + if ($s['style'] == 'dot_vote_list') { |
|
| 64 | + $votes = $division[$s['thekey'] . '_by_party']; |
|
| 65 | 65 | include '_dot_vote_list.php'; |
| 66 | 66 | |
| 67 | - } else if ( $s['style'] == 'name_vote_list' ) { |
|
| 68 | - $votes = $division[ $s['thekey'] ]; |
|
| 67 | + } else if ($s['style'] == 'name_vote_list') { |
|
| 68 | + $votes = $division[$s['thekey']]; |
|
| 69 | 69 | include '_name_vote_list.php'; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -1,5 +1,6 @@ |
||
| 1 | 1 | <div class="debate-speech__division__your-mp"> |
| 2 | - <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
| 2 | + <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { |
|
| 3 | +/* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
| 3 | 4 | <div class="your-mp__header"> |
| 4 | 5 | <h3>How your <?= $division['members']['singular'] ?> voted</h3> |
| 5 | 6 | <p> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <div class="debate-speech__division__your-mp"> |
| 2 | - <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
| 2 | + <?php if (!isset($main_vote_mp) || !$main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
| 3 | 3 | <div class="your-mp__header"> |
| 4 | 4 | <h3>How your <?= $division['members']['singular'] ?> voted</h3> |
| 5 | 5 | <p> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | </div> |
| 10 | 10 | <?php } ?> |
| 11 | 11 | <a href="<?= $data['mp_data']['mp_url'] ?>" class="your-mp__content"> |
| 12 | - <?php if ( isset($mp_vote) ) { ?> |
|
| 12 | + <?php if (isset($mp_vote)) { ?> |
|
| 13 | 13 | <span class="your-mp__vote your-mp__vote--<?= $mp_vote['vote'] ?>"><?php |
| 14 | 14 | switch ($mp_vote['vote']) { |
| 15 | 15 | case 'aye': |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | echo 'N/A'; |
| 34 | 34 | } |
| 35 | 35 | ?></span> |
| 36 | - <?php } else if ( isset($before_mp) || isset($after_mp) ) { ?> |
|
| 36 | + <?php } else if (isset($before_mp) || isset($after_mp)) { ?> |
|
| 37 | 37 | <span class="your-mp__vote">N/A</span> |
| 38 | 38 | <?php } ?> |
| 39 | 39 | <img class="your-mp__image" src="<?= $data['mp_data']['image'] ?>"> |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | <h2 class="people-list__person__name"><?= $data['mp_data']['name'] ?></h2> |
| 42 | 42 | <p class="people-list__person__memberships"> |
| 43 | 43 | <span class="people-list__person__constituency"><?= $data['mp_data']['constituency'] ?></span> |
| 44 | - <span class="people-list__person__party <?= slugify( $data['mp_data']['party'] ) ?>"><?= $data['mp_data']['party'] ?></span> |
|
| 44 | + <span class="people-list__person__party <?= slugify($data['mp_data']['party']) ?>"><?= $data['mp_data']['party'] ?></span> |
|
| 45 | 45 | </p> |
| 46 | 46 | </div> |
| 47 | 47 | </a> |
@@ -11,28 +11,28 @@ |
||
| 11 | 11 | <a href="<?= $data['mp_data']['mp_url'] ?>" class="your-mp__content"> |
| 12 | 12 | <?php if ( isset($mp_vote) ) { ?> |
| 13 | 13 | <span class="your-mp__vote your-mp__vote--<?= $mp_vote['vote'] ?>"><?php |
| 14 | - switch ($mp_vote['vote']) { |
|
| 15 | - case 'aye': |
|
| 14 | + switch ($mp_vote['vote']) { |
|
| 15 | + case 'aye': |
|
| 16 | 16 | echo 'Aye'; |
| 17 | - break; |
|
| 18 | - case 'no': |
|
| 17 | + break; |
|
| 18 | + case 'no': |
|
| 19 | 19 | echo 'No'; |
| 20 | - break; |
|
| 21 | - case 'absent': |
|
| 20 | + break; |
|
| 21 | + case 'absent': |
|
| 22 | 22 | echo 'Absent'; |
| 23 | - break; |
|
| 24 | - case 'both': |
|
| 23 | + break; |
|
| 24 | + case 'both': |
|
| 25 | 25 | echo 'Abstain'; |
| 26 | - break; |
|
| 27 | - case 'tellaye': |
|
| 26 | + break; |
|
| 27 | + case 'tellaye': |
|
| 28 | 28 | echo 'Aye (Teller)'; |
| 29 | - break; |
|
| 30 | - case 'tellno': |
|
| 29 | + break; |
|
| 30 | + case 'tellno': |
|
| 31 | 31 | echo 'No (Teller)'; |
| 32 | - break; |
|
| 33 | - default: |
|
| 32 | + break; |
|
| 33 | + default: |
|
| 34 | 34 | echo 'N/A'; |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | ?></span> |
| 37 | 37 | <?php } else if ( isset($before_mp) || isset($after_mp) ) { ?> |
| 38 | 38 | <span class="your-mp__vote">N/A</span> |
@@ -21,14 +21,14 @@ |
||
| 21 | 21 | if (isset($THEUSER) && $THEUSER->postcode_is_set()) { |
| 22 | 22 | try { |
| 23 | 23 | $MEMBER = new MySociety\TheyWorkForYou\Member(array('postcode' => $THEUSER->postcode(), 'house' => \MySociety\TheyWorkForYou\Utility\House::majorToHouse($view->major)[0])); |
| 24 | - } catch ( MySociety\TheyWorkForYou\MemberException $e ) { |
|
| 24 | + } catch (MySociety\TheyWorkForYou\MemberException $e) { |
|
| 25 | 25 | $MEMBER = null; |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $data = $view->display(); |
| 30 | 30 | if ($data) { |
| 31 | - if ( !empty($data['template']) ) { |
|
| 31 | + if (!empty($data['template'])) { |
|
| 32 | 32 | $template = $data['template']; |
| 33 | 33 | } else { |
| 34 | 34 | $template = 'section/section'; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | if ($type = ucfirst(get_http_var('type'))) { |
| 16 | - $class_name = "MySociety\TheyWorkForYou\SectionView\\${type}View"; |
|
| 16 | + $class_name = "MySociety\TheyWorkForYou\SectionView\\${type}view"; |
|
| 17 | 17 | $view = new $class_name(); |
| 18 | 18 | |
| 19 | 19 | // use this for generating member vote data |