@@ -128,24 +128,24 @@ discard block |
||
128 | 128 | <?php } ?> |
129 | 129 | |
130 | 130 | <?php |
131 | - if( |
|
132 | - (isset($members) && $members->rows() > 0) || |
|
131 | + if( |
|
132 | + (isset($members) && $members->rows() > 0) || |
|
133 | 133 | (isset($constituencies) && count($constituencies) > 0) || |
134 | 134 | ($alertsearch) |
135 | - ) { |
|
136 | - /* We need to disambiguate the user's instructions */ |
|
137 | - $member_options = false; |
|
138 | - ?> |
|
135 | + ) { |
|
136 | + /* We need to disambiguate the user's instructions */ |
|
137 | + $member_options = false; |
|
138 | + ?> |
|
139 | 139 | <div class="alert-section alert-section--disambiguation"> |
140 | 140 | <div class="alert-section__primary"> |
141 | 141 | |
142 | 142 | <?php if (isset($members) && $members->rows() > 0) { |
143 | - $member_options = true; ?> |
|
143 | + $member_options = true; ?> |
|
144 | 144 | <h3>Sign up for alerts when people matching <i><?= _htmlspecialchars($alertsearch) ?></i> speaks</h3> |
145 | 145 | <ul> |
146 | 146 | <?php |
147 | 147 | foreach ($members as $row) { |
148 | - ?> |
|
148 | + ?> |
|
149 | 149 | <li> |
150 | 150 | <form action="<?= $actionurl ?>" method="post"> |
151 | 151 | <input type="hidden" name="t" value="<?= _htmlspecialchars($token) ?>"> |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <?php } ?> |
166 | 166 | |
167 | 167 | <?php if (isset($constituencies) && count($constituencies) > 0) { |
168 | - $member_options = true; ?> |
|
168 | + $member_options = true; ?> |
|
169 | 169 | <h3>Sign up for alerts when MPs for constituencies matching <i><?= _htmlspecialchars($alertsearch) ?></i> speaks</h3> |
170 | 170 | <ul> |
171 | 171 | <?php foreach ($constituencies as $constituency => $member) { ?> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <div class="full-page"> |
2 | 2 | <div class="full-page__row"> |
3 | 3 | |
4 | - <?php if ( $message ) { ?> |
|
4 | + <?php if ($message) { ?> |
|
5 | 5 | <div class="alert-section alert-section--feedback"> |
6 | 6 | <div class="alert-section__primary"> |
7 | 7 | <h3><?= $message['title'] ?></h3> |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | </div> |
13 | 13 | <?php } ?> |
14 | 14 | |
15 | - <?php if ( $results ) { ?> |
|
15 | + <?php if ($results) { ?> |
|
16 | 16 | <div class="alert-section alert-section--feedback"> |
17 | 17 | <div class="alert-section__primary"> |
18 | - <?php if ( $results == 'alert-confirmed' ) { ?> |
|
18 | + <?php if ($results == 'alert-confirmed') { ?> |
|
19 | 19 | <h3>Your alert has been confirmed</h3> |
20 | 20 | <p> |
21 | 21 | You will now receive email alerts for the following criteria: |
@@ -45,32 +45,32 @@ discard block |
||
45 | 45 | </div> |
46 | 46 | </noscript> |
47 | 47 | |
48 | - <?php } elseif ( $results == 'alert-suspended' ) { ?> |
|
48 | + <?php } elseif ($results == 'alert-suspended') { ?> |
|
49 | 49 | <h3>Alert suspended</h3> |
50 | 50 | <p> |
51 | 51 | You can reactivate the alert at any time, from the sidebar below. |
52 | 52 | </p> |
53 | 53 | |
54 | - <?php } elseif ( $results == 'alert-resumed' ) { ?> |
|
54 | + <?php } elseif ($results == 'alert-resumed') { ?> |
|
55 | 55 | <h3>Alert resumed</h3> |
56 | 56 | <p> |
57 | 57 | You will now receive email alerts on any day when there |
58 | 58 | are entries in Hansard that match your criteria. |
59 | 59 | </p> |
60 | 60 | |
61 | - <?php } elseif ( $results == 'alert-deleted' ) { ?> |
|
61 | + <?php } elseif ($results == 'alert-deleted') { ?> |
|
62 | 62 | <h3>Alert deleted</h3> |
63 | 63 | <p> |
64 | 64 | You will no longer receive this alert. |
65 | 65 | </p> |
66 | 66 | |
67 | - <?php } elseif ( $results == 'all-alerts-deleted' ) { ?> |
|
67 | + <?php } elseif ($results == 'all-alerts-deleted') { ?> |
|
68 | 68 | <h3>All alerts deleted</h3> |
69 | 69 | <p> |
70 | 70 | You will no longer receive any alerts. |
71 | 71 | </p> |
72 | 72 | |
73 | - <?php } elseif ( $results == 'alert-fail' ) { ?> |
|
73 | + <?php } elseif ($results == 'alert-fail') { ?> |
|
74 | 74 | <h3>Hmmm, something’s not right</h3> |
75 | 75 | <p> |
76 | 76 | The link you followed to reach this page appears to be incomplete. |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | and let us know, and we'll help out! |
87 | 87 | </p> |
88 | 88 | |
89 | - <?php } elseif ( $results == 'alert-added' ) { ?> |
|
89 | + <?php } elseif ($results == 'alert-added') { ?> |
|
90 | 90 | <h3>Your alert has been added</h3> |
91 | 91 | <p> |
92 | 92 | You will now receive email alerts on any day when |
93 | 93 | <?= _htmlspecialchars($criteria) ?> in parliament. |
94 | 94 | </p> |
95 | 95 | |
96 | - <?php } elseif ( $results == 'alert-confirmation' ) { ?> |
|
96 | + <?php } elseif ($results == 'alert-confirmation') { ?> |
|
97 | 97 | <h3>We’re nearly done…</h3> |
98 | 98 | <p> |
99 | 99 | You should receive an email shortly which will contain a link. |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | and receive future alerts. Thanks. |
102 | 102 | </p> |
103 | 103 | |
104 | - <?php } elseif ( $results == 'alert-exists' ) { ?> |
|
104 | + <?php } elseif ($results == 'alert-exists') { ?> |
|
105 | 105 | <h3>You’re already subscribed to that!</h3> |
106 | 106 | <p> |
107 | 107 | It’s good to know you’re keen though. |
108 | 108 | </p> |
109 | 109 | |
110 | - <?php } elseif ( $results == 'alert-already-signed' ) { ?> |
|
110 | + <?php } elseif ($results == 'alert-already-signed') { ?> |
|
111 | 111 | <h3>We’re nearly done</h3> |
112 | 112 | <p> |
113 | 113 | You should receive an email shortly which will contain a link. |
114 | 114 | You will need to follow that link to confirm your email address to receive the alert. Thanks. |
115 | 115 | </p> |
116 | 116 | |
117 | - <?php } elseif ( $results == 'alert-fail' ) { ?> |
|
117 | + <?php } elseif ($results == 'alert-fail') { ?> |
|
118 | 118 | <h3>Alert could not be created</h3> |
119 | 119 | <p> |
120 | 120 | Sorry, we were unable to create that alert. Please |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | <?php } ?> |
129 | 129 | |
130 | 130 | <?php |
131 | - if( |
|
131 | + if ( |
|
132 | 132 | (isset($members) && $members->rows() > 0) || |
133 | 133 | (isset($constituencies) && count($constituencies) > 0) || |
134 | 134 | ($alertsearch) |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | <input type="hidden" name="email" value="<?= _htmlspecialchars($email) ?>"> |
153 | 153 | <input type="hidden" name="pid" value="<?= $row['person_id'] ?>"> |
154 | 154 | When |
155 | - <?= member_full_name($row['house'], $row['title'], $row['given_name'], $row['family_name'], $row['lordofname'] ) ?> |
|
155 | + <?= member_full_name($row['house'], $row['title'], $row['given_name'], $row['family_name'], $row['lordofname']) ?> |
|
156 | 156 | <?php if ($row['constituency']) { ?> |
157 | 157 | (<?= $row['constituency'] ?>) |
158 | 158 | <?php } ?> |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | <?php } ?> |
184 | 184 | |
185 | 185 | <?php if ($alertsearch) { |
186 | - if ( $member_options ) { ?> |
|
186 | + if ($member_options) { ?> |
|
187 | 187 | <h3>Sign up for alerts for topics</h3> |
188 | 188 | <?php } else { ?> |
189 | 189 | <h3>Great! Can you just confirm what you mean?</h3> |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | Receive alerts when <?= _htmlspecialchars($alertsearch_pretty) ?> |
198 | 198 | <input type="submit" class="button small" value="Subscribe"> |
199 | 199 | </form> |
200 | - <?php if ( isset($mistakes['multiple']) ) { ?> |
|
200 | + <?php if (isset($mistakes['multiple'])) { ?> |
|
201 | 201 | <em class="error"> |
202 | 202 | You have used a comma in your search term – |
203 | 203 | are you sure this is what you want? You cannot |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | for each individual term. |
207 | 207 | </em> |
208 | 208 | <?php } ?> |
209 | - <?php if ( isset($mistakes['postcode_and']) ) { ?> |
|
209 | + <?php if (isset($mistakes['postcode_and'])) { ?> |
|
210 | 210 | <em class="error"> |
211 | 211 | You have used a postcode and something else in your |
212 | 212 | search term – are you sure this is what you |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | <div class="alert-section__secondary"> |
256 | 256 | <?php if ($email_verified) { ?> |
257 | 257 | |
258 | - <?php if ( $alerts ) { ?> |
|
258 | + <?php if ($alerts) { ?> |
|
259 | 259 | <?php include('_list.php'); ?> |
260 | 260 | <?php } ?> |
261 | 261 | |
262 | - <?php if ( $current_mp ) { ?> |
|
262 | + <?php if ($current_mp) { ?> |
|
263 | 263 | <h3>Your MP alert</h3> |
264 | 264 | <ul class="alerts-manage__list"> |
265 | 265 | <li> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $divisions_to_link = array(); |
4 | -foreach($data['rows'] as $speech) { |
|
4 | +foreach ($data['rows'] as $speech) { |
|
5 | 5 | |
6 | 6 | # Only care about divisions... |
7 | 7 | if ($speech['htype'] != 14) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <li><a href="#g<?= gid_to_anchor($speech['gid']) ?>">Division number <?= $division['number'] ?></a> |
35 | 35 | <?php if ($division['has_description']) { ?> |
36 | 36 | <br><span class="policy-vote__text"> |
37 | - <?php include( dirname(__FILE__) . '/../divisions/_vote_description.php'); ?> |
|
37 | + <?php include(dirname(__FILE__) . '/../divisions/_vote_description.php'); ?> |
|
38 | 38 | </span> |
39 | 39 | <?php } ?> |
40 | 40 |
@@ -207,15 +207,17 @@ |
||
207 | 207 | $query .= 'LEFT OUTER JOIN personinfo ON member.person_id = personinfo.person_id AND data_key="' . $personinfo_key . '" '; |
208 | 208 | } |
209 | 209 | $query .= ' JOIN person_names p ON p.person_id = member.person_id AND p.type = "name" '; |
210 | - if (isset($args['date'])) |
|
211 | - $query .= 'AND start_date <= :date AND :date <= end_date '; |
|
212 | - else |
|
213 | - $query .= 'AND end_date="9999-12-31" '; |
|
210 | + if (isset($args['date'])) { |
|
211 | + $query .= 'AND start_date <= :date AND :date <= end_date '; |
|
212 | + } else { |
|
213 | + $query .= 'AND end_date="9999-12-31" '; |
|
214 | + } |
|
214 | 215 | $query .= 'WHERE house=' . $this->house . ' '; |
215 | - if (isset($args['date'])) |
|
216 | - $query .= 'AND entered_house <= :date AND :date <= left_house '; |
|
217 | - elseif (!isset($args['all']) || $this->house == HOUSE_TYPE_COMMONS) |
|
218 | - $query .= 'AND left_house = (SELECT MAX(left_house) FROM member) '; |
|
216 | + if (isset($args['date'])) { |
|
217 | + $query .= 'AND entered_house <= :date AND :date <= left_house '; |
|
218 | + } elseif (!isset($args['all']) || $this->house == HOUSE_TYPE_COMMONS) { |
|
219 | + $query .= 'AND left_house = (SELECT MAX(left_house) FROM member) '; |
|
220 | + } |
|
219 | 221 | |
220 | 222 | if (isset($args['order'])) { |
221 | 223 | $order = $args['order']; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $data = $this->_get_data_by_group($args); |
37 | 37 | |
38 | 38 | $user = new User(); |
39 | - if ( $reps = $this->getRegionalReps($user) ) { |
|
39 | + if ($reps = $this->getRegionalReps($user)) { |
|
40 | 40 | $data['reps'] = $reps; |
41 | 41 | } |
42 | 42 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $args['all'] = true; |
69 | 69 | } |
70 | 70 | |
71 | - if ( $this->type == 'peers' ) { |
|
71 | + if ($this->type == 'peers') { |
|
72 | 72 | $args['order'] = 'name'; |
73 | 73 | } |
74 | 74 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | |
135 | 135 | private function addImagesToData($data) { |
136 | 136 | $new_data = array(); |
137 | - foreach ( $data as $pid => $details ) { |
|
138 | - list($image, ) = Utility\Member::findMemberImage($pid, true, $this->subs_missing_image); |
|
137 | + foreach ($data as $pid => $details) { |
|
138 | + list($image,) = Utility\Member::findMemberImage($pid, true, $this->subs_missing_image); |
|
139 | 139 | $details['image'] = $image; |
140 | 140 | $new_data[$pid] = $details; |
141 | 141 | } |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | |
153 | 153 | $urls['plain'] = $URL->generate(); |
154 | 154 | |
155 | - $URL->insert(array( 'o' => 'n')); |
|
155 | + $URL->insert(array('o' => 'n')); |
|
156 | 156 | $urls['by_name'] = $URL->generate(); |
157 | 157 | |
158 | - $URL->insert(array( 'o' => 'l')); |
|
158 | + $URL->insert(array('o' => 'l')); |
|
159 | 159 | $urls['by_last'] = $URL->generate(); |
160 | 160 | |
161 | - $URL->insert(array( 'o' => 'f')); |
|
161 | + $URL->insert(array('o' => 'f')); |
|
162 | 162 | $urls['by_first'] = $URL->generate(); |
163 | 163 | |
164 | - $URL->insert(array( 'o' => 'p')); |
|
164 | + $URL->insert(array('o' => 'p')); |
|
165 | 165 | $urls['by_party'] = $URL->generate(); |
166 | 166 | |
167 | - $URL->insert(array( 'f' => 'csv')); |
|
168 | - $URL->remove(array( 'o')); |
|
169 | - if ( $date = get_http_var('date') ) { |
|
167 | + $URL->insert(array('f' => 'csv')); |
|
168 | + $URL->remove(array('o')); |
|
169 | + if ($date = get_http_var('date')) { |
|
170 | 170 | $URL->insert(array('date' => $date)); |
171 | 171 | } |
172 | 172 | $urls['by_csv'] = $URL->generate(); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $name = member_full_name($this->house, $row['title'], $row['given_name'], $row['family_name'], $row['lordofname']); |
243 | 243 | $constituency = $row['constituency']; |
244 | 244 | $url = make_member_url($name, $constituency, $this->house, $p_id); |
245 | - $narray = array ( |
|
245 | + $narray = array( |
|
246 | 246 | 'person_id' => $p_id, |
247 | 247 | 'given_name' => $row['given_name'], |
248 | 248 | 'family_name' => $row['family_name'], |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | uasort($data, 'by_peer_name'); |
277 | 277 | } |
278 | 278 | |
279 | - $data = array ( |
|
280 | - 'info' => array ( |
|
279 | + $data = array( |
|
280 | + 'info' => array( |
|
281 | 281 | 'order' => $order |
282 | 282 | ), |
283 | 283 | 'data' => $data |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param Member $member The member to get positions for. |
30 | 30 | */ |
31 | 31 | |
32 | - public function __construct(Member $member = NULL, PolicyPositions $positions = NULL, Policies $policies = NULL) |
|
32 | + public function __construct(Member $member = null, PolicyPositions $positions = null, Policies $policies = null) |
|
33 | 33 | { |
34 | 34 | $this->member = $member; |
35 | 35 | $this->positions = $positions; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param string|string[] $houses House name (eg: "commons") or array of |
60 | 60 | * house names. Optional. |
61 | 61 | */ |
62 | - public function getRecentDivisions($number = 20, $houses = NULL) { |
|
62 | + public function getRecentDivisions($number = 20, $houses = null) { |
|
63 | 63 | $select = ''; |
64 | 64 | $where = ''; |
65 | 65 | $order = 'ORDER BY division_date DESC, division_number DESC'; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param int|int[] $majors Major types (e.g. 1) or array of |
124 | 124 | * major types. Optional. |
125 | 125 | */ |
126 | - public function getRecentDebatesWithDivisions($number = 20, $majors = NULL) { |
|
126 | + public function getRecentDebatesWithDivisions($number = 20, $majors = null) { |
|
127 | 127 | global $hansardmajors; |
128 | 128 | |
129 | 129 | if (!is_array($majors)) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $summary['absent'] += $row['total']; |
277 | 277 | } else if ( $vote == 'both' ) { |
278 | 278 | $summary['both'] += $row['total']; |
279 | - } else if ( strpos($vote, 'tell') !== FALSE ) { |
|
279 | + } else if ( strpos($vote, 'tell') !== false ) { |
|
280 | 280 | $summary['tell'] += $row['total']; |
281 | 281 | } else if ( $policy_vote == $vote ) { |
282 | 282 | $summary['for'] += $row['total']; |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | 'teller' => false |
366 | 366 | ); |
367 | 367 | |
368 | - if (strpos($vote['vote'], 'tell') !== FALSE) { |
|
368 | + if (strpos($vote['vote'], 'tell') !== false) { |
|
369 | 369 | $detail['teller'] = true; |
370 | 370 | } |
371 | 371 | |
@@ -568,10 +568,10 @@ discard block |
||
568 | 568 | |
569 | 569 | if (array_key_exists('direction', $row)) { |
570 | 570 | $division['direction'] = $row['direction']; |
571 | - if ( strpos( $row['direction'], 'strong') !== FALSE ) { |
|
572 | - $division['strong'] = TRUE; |
|
571 | + if ( strpos( $row['direction'], 'strong') !== false ) { |
|
572 | + $division['strong'] = true; |
|
573 | 573 | } else { |
574 | - $division['strong'] = FALSE; |
|
574 | + $division['strong'] = false; |
|
575 | 575 | } |
576 | 576 | } |
577 | 577 |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $divisions = array(); |
194 | 194 | foreach ($q as $row) { |
195 | - $divisions[] = $this->getParliamentDivisionDetails($row); |
|
195 | + $divisions[] = $this->getParliamentDivisionDetails($row); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | return $divisions; |
@@ -247,44 +247,44 @@ discard block |
||
247 | 247 | ); |
248 | 248 | |
249 | 249 | foreach ($q as $row) { |
250 | - $policy_id = $row['policy_id']; |
|
250 | + $policy_id = $row['policy_id']; |
|
251 | 251 | |
252 | - if (!array_key_exists($policy_id, $policy_divisions)) { |
|
252 | + if (!array_key_exists($policy_id, $policy_divisions)) { |
|
253 | 253 | $summary = array( |
254 | - 'max' => $row['latest'], |
|
255 | - 'min' => $row['earliest'], |
|
256 | - 'total' => $row['total'], |
|
257 | - 'for' => 0, 'against' => 0, 'absent' => 0, 'both' => 0, 'tell' => 0 |
|
254 | + 'max' => $row['latest'], |
|
255 | + 'min' => $row['earliest'], |
|
256 | + 'total' => $row['total'], |
|
257 | + 'for' => 0, 'against' => 0, 'absent' => 0, 'both' => 0, 'tell' => 0 |
|
258 | 258 | ); |
259 | 259 | |
260 | 260 | $policy_divisions[$policy_id] = $summary; |
261 | - } |
|
262 | - |
|
263 | - $summary = $policy_divisions[$policy_id]; |
|
264 | - |
|
265 | - $summary['total'] += $row['total']; |
|
266 | - if ($summary['max'] < $row['latest']) { |
|
267 | - $summary['max'] = $row['latest']; |
|
268 | - } |
|
269 | - if ($summary['min'] > $row['latest']) { |
|
270 | - $summary['min'] = $row['latest']; |
|
271 | - } |
|
272 | - |
|
273 | - $vote = $row['vote']; |
|
274 | - $policy_vote = str_replace('3', '', $row['policy_vote']); |
|
275 | - if ( $vote == 'absent' ) { |
|
276 | - $summary['absent'] += $row['total']; |
|
277 | - } else if ( $vote == 'both' ) { |
|
278 | - $summary['both'] += $row['total']; |
|
279 | - } else if ( strpos($vote, 'tell') !== FALSE ) { |
|
280 | - $summary['tell'] += $row['total']; |
|
281 | - } else if ( $policy_vote == $vote ) { |
|
282 | - $summary['for'] += $row['total']; |
|
283 | - } else if ( $policy_vote != $vote ) { |
|
284 | - $summary['against'] += $row['total']; |
|
285 | - } |
|
286 | - |
|
287 | - $policy_divisions[$policy_id] = $summary; |
|
261 | + } |
|
262 | + |
|
263 | + $summary = $policy_divisions[$policy_id]; |
|
264 | + |
|
265 | + $summary['total'] += $row['total']; |
|
266 | + if ($summary['max'] < $row['latest']) { |
|
267 | + $summary['max'] = $row['latest']; |
|
268 | + } |
|
269 | + if ($summary['min'] > $row['latest']) { |
|
270 | + $summary['min'] = $row['latest']; |
|
271 | + } |
|
272 | + |
|
273 | + $vote = $row['vote']; |
|
274 | + $policy_vote = str_replace('3', '', $row['policy_vote']); |
|
275 | + if ( $vote == 'absent' ) { |
|
276 | + $summary['absent'] += $row['total']; |
|
277 | + } else if ( $vote == 'both' ) { |
|
278 | + $summary['both'] += $row['total']; |
|
279 | + } else if ( strpos($vote, 'tell') !== FALSE ) { |
|
280 | + $summary['tell'] += $row['total']; |
|
281 | + } else if ( $policy_vote == $vote ) { |
|
282 | + $summary['for'] += $row['total']; |
|
283 | + } else if ( $policy_vote != $vote ) { |
|
284 | + $summary['against'] += $row['total']; |
|
285 | + } |
|
286 | + |
|
287 | + $policy_divisions[$policy_id] = $summary; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | return $policy_divisions; |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | ); |
339 | 339 | |
340 | 340 | $votes = array( |
341 | - 'yes_votes' => array(), |
|
342 | - 'no_votes' => array(), |
|
343 | - 'absent_votes' => array(), |
|
344 | - 'both_votes' => array() |
|
341 | + 'yes_votes' => array(), |
|
342 | + 'no_votes' => array(), |
|
343 | + 'absent_votes' => array(), |
|
344 | + 'both_votes' => array() |
|
345 | 345 | ); |
346 | 346 | |
347 | 347 | $party_breakdown = array( |
348 | - 'yes_votes' => array(), |
|
349 | - 'no_votes' => array(), |
|
350 | - 'absent_votes' => array(), |
|
351 | - 'both_votes' => array() |
|
348 | + 'yes_votes' => array(), |
|
349 | + 'no_votes' => array(), |
|
350 | + 'absent_votes' => array(), |
|
351 | + 'both_votes' => array() |
|
352 | 352 | ); |
353 | 353 | |
354 | 354 | # Sort Lords specially |
@@ -359,12 +359,12 @@ discard block |
||
359 | 359 | |
360 | 360 | foreach ($data as $vote) { |
361 | 361 | $detail = array( |
362 | - 'person_id' => $vote['person_id'], |
|
363 | - 'name' => ucfirst(member_full_name($args['house'], $vote['title'], $vote['given_name'], |
|
362 | + 'person_id' => $vote['person_id'], |
|
363 | + 'name' => ucfirst(member_full_name($args['house'], $vote['title'], $vote['given_name'], |
|
364 | 364 | $vote['family_name'], $vote['lordofname'])), |
365 | - 'party' => $vote['party'], |
|
366 | - 'proxy' => false, |
|
367 | - 'teller' => false |
|
365 | + 'party' => $vote['party'], |
|
366 | + 'proxy' => false, |
|
367 | + 'teller' => false |
|
368 | 368 | ); |
369 | 369 | |
370 | 370 | if (strpos($vote['vote'], 'tell') !== FALSE) { |
@@ -385,23 +385,23 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | if ($vote['vote'] == 'aye' or $vote['vote'] == 'tellaye') { |
388 | - $votes['yes_votes'][] = $detail; |
|
389 | - @$party_breakdown['yes_votes'][$detail['party']]++; |
|
388 | + $votes['yes_votes'][] = $detail; |
|
389 | + @$party_breakdown['yes_votes'][$detail['party']]++; |
|
390 | 390 | } else if ($vote['vote'] == 'no' or $vote['vote'] == 'tellno') { |
391 | - $votes['no_votes'][] = $detail; |
|
392 | - @$party_breakdown['no_votes'][$detail['party']]++; |
|
391 | + $votes['no_votes'][] = $detail; |
|
392 | + @$party_breakdown['no_votes'][$detail['party']]++; |
|
393 | 393 | } else if ($vote['vote'] == 'absent') { |
394 | - $votes['absent_votes'][] = $detail; |
|
395 | - @$party_breakdown['absent_votes'][$detail['party']]++; |
|
394 | + $votes['absent_votes'][] = $detail; |
|
395 | + @$party_breakdown['absent_votes'][$detail['party']]++; |
|
396 | 396 | } else if ($vote['vote'] == 'both') { |
397 | - $votes['both_votes'][] = $detail; |
|
398 | - @$party_breakdown['both_votes'][$detail['party']]++; |
|
397 | + $votes['both_votes'][] = $detail; |
|
398 | + @$party_breakdown['both_votes'][$detail['party']]++; |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
402 | 402 | foreach ($votes as $vote => $count) { // array('yes_votes', 'no_votes', 'absent_votes', 'both_votes') as $vote) { |
403 | - $votes[$vote . '_by_party'] = $votes[$vote]; |
|
404 | - usort($votes[$vote . '_by_party'], function ($a, $b) { |
|
403 | + $votes[$vote . '_by_party'] = $votes[$vote]; |
|
404 | + usort($votes[$vote . '_by_party'], function ($a, $b) { |
|
405 | 405 | return $a['party']>$b['party']; |
406 | 406 | }); |
407 | 407 | } |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | ':count' => $number |
69 | 69 | ); |
70 | 70 | |
71 | - if ( is_string($houses) ) { |
|
72 | - $houses = array( $houses ); |
|
71 | + if (is_string($houses)) { |
|
72 | + $houses = array($houses); |
|
73 | 73 | } |
74 | 74 | |
75 | - if ( is_array($houses) && count($houses) > 0 ) { |
|
75 | + if (is_array($houses) && count($houses) > 0) { |
|
76 | 76 | $where = 'WHERE house IN ("' . implode('", "', $houses) . '")'; |
77 | 77 | } |
78 | 78 | |
79 | - if ( $this->member ) { |
|
79 | + if ($this->member) { |
|
80 | 80 | $select = "SELECT divisions.*, vote FROM divisions |
81 | 81 | LEFT JOIN persondivisionvotes ON divisions.division_id=persondivisionvotes.division_id AND person_id=:person_id"; |
82 | 82 | $params[':person_id'] = $this->member->person_id; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | public function getMemberDivisionsForPolicy($policyID = null) { |
216 | 216 | $where_extra = ''; |
217 | 217 | $args = array(':person_id' => $this->member->person_id); |
218 | - if ( $policyID ) { |
|
218 | + if ($policyID) { |
|
219 | 219 | $where_extra = 'AND policy_id = :policy_id'; |
220 | 220 | $args[':policy_id'] = $policyID; |
221 | 221 | } |
@@ -272,15 +272,15 @@ discard block |
||
272 | 272 | |
273 | 273 | $vote = $row['vote']; |
274 | 274 | $policy_vote = str_replace('3', '', $row['policy_vote']); |
275 | - if ( $vote == 'absent' ) { |
|
275 | + if ($vote == 'absent') { |
|
276 | 276 | $summary['absent'] += $row['total']; |
277 | - } else if ( $vote == 'both' ) { |
|
277 | + } else if ($vote == 'both') { |
|
278 | 278 | $summary['both'] += $row['total']; |
279 | - } else if ( strpos($vote, 'tell') !== FALSE ) { |
|
279 | + } else if (strpos($vote, 'tell') !== FALSE) { |
|
280 | 280 | $summary['tell'] += $row['total']; |
281 | - } else if ( $policy_vote == $vote ) { |
|
281 | + } else if ($policy_vote == $vote) { |
|
282 | 282 | $summary['for'] += $row['total']; |
283 | - } else if ( $policy_vote != $vote ) { |
|
283 | + } else if ($policy_vote != $vote) { |
|
284 | 284 | $summary['against'] += $row['total']; |
285 | 285 | } |
286 | 286 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | FROM person_names AS pn |
378 | 378 | WHERE person_id = :person_id |
379 | 379 | AND start_date <= :division_date AND end_date >= :division_date", |
380 | - [ ':person_id' => $vote['proxy'], ':division_date' => $row['division_date'] ] |
|
380 | + [':person_id' => $vote['proxy'], ':division_date' => $row['division_date']] |
|
381 | 381 | )->first(); |
382 | 382 | $detail['proxy'] = ucfirst(member_full_name( |
383 | 383 | HOUSE_TYPE_COMMONS, $q['title'], $q['given_name'], |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | |
402 | 402 | foreach ($votes as $vote => $count) { // array('yes_votes', 'no_votes', 'absent_votes', 'both_votes') as $vote) { |
403 | 403 | $votes[$vote . '_by_party'] = $votes[$vote]; |
404 | - usort($votes[$vote . '_by_party'], function ($a, $b) { |
|
405 | - return $a['party']>$b['party']; |
|
404 | + usort($votes[$vote . '_by_party'], function($a, $b) { |
|
405 | + return $a['party'] > $b['party']; |
|
406 | 406 | }); |
407 | 407 | } |
408 | 408 | |
@@ -456,10 +456,10 @@ discard block |
||
456 | 456 | $votes['against'] . ' ' . make_plural('vote', $votes['against']) . ' against' |
457 | 457 | ); |
458 | 458 | |
459 | - if ( $votes['both'] ) { |
|
459 | + if ($votes['both']) { |
|
460 | 460 | $actions[] = $votes['both'] . ' ' . make_plural('abstention', $votes['both']); |
461 | 461 | } |
462 | - if ( $votes['absent'] ) { |
|
462 | + if ($votes['absent']) { |
|
463 | 463 | $actions[] = $votes['absent'] . ' ' . make_plural('absence', $votes['absent']); |
464 | 464 | } |
465 | 465 | if ($max == $min) { |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | |
518 | 518 | private function constructYesNoVoteDescription($direction, $title, $short_text) { |
519 | 519 | $text = ' voted '; |
520 | - if ( $short_text ) { |
|
520 | + if ($short_text) { |
|
521 | 521 | $text .= $short_text; |
522 | 522 | } else { |
523 | 523 | $text .= "$direction on <em>$title</em>"; |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | * votes so we need to generate some text using the title of the division |
536 | 536 | */ |
537 | 537 | |
538 | - switch ( strtolower($vote) ) { |
|
538 | + switch (strtolower($vote)) { |
|
539 | 539 | case 'yes': |
540 | 540 | case 'aye': |
541 | 541 | $description = $this->constructYesNoVoteDescription('yes', $division_title, $yes_text); |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | |
584 | 584 | if (array_key_exists('direction', $row)) { |
585 | 585 | $division['direction'] = $row['direction']; |
586 | - if ( strpos( $row['direction'], 'strong') !== FALSE ) { |
|
586 | + if (strpos($row['direction'], 'strong') !== FALSE) { |
|
587 | 587 | $division['strong'] = TRUE; |
588 | 588 | } else { |
589 | 589 | $division['strong'] = FALSE; |
@@ -615,24 +615,24 @@ discard block |
||
615 | 615 | foreach ($q as $row) { |
616 | 616 | $policy_id = $row['policy_id']; |
617 | 617 | |
618 | - if ( !array_key_exists($policy_id, $policies) ) { |
|
618 | + if (!array_key_exists($policy_id, $policies)) { |
|
619 | 619 | $policies[$policy_id] = array( |
620 | 620 | 'policy_id' => $policy_id, |
621 | 621 | 'weak_count' => 0, |
622 | 622 | 'divisions' => array() |
623 | 623 | ); |
624 | - if ( $this->policies ) { |
|
624 | + if ($this->policies) { |
|
625 | 625 | $policies[$policy_id]['desc'] = $this->policies->getPolicies()[$policy_id]; |
626 | 626 | $policies[$policy_id]['header'] = $this->policies->getPolicyDetails($policy_id); |
627 | 627 | } |
628 | - if ( $this->positions ) { |
|
628 | + if ($this->positions) { |
|
629 | 629 | $policies[$policy_id]['position'] = $this->positions->positionsById[$policy_id]; |
630 | 630 | } |
631 | 631 | } |
632 | 632 | |
633 | 633 | $division = $this->getDivisionDetails($row); |
634 | 634 | |
635 | - if ( !$division['strong'] ) { |
|
635 | + if (!$division['strong']) { |
|
636 | 636 | $policies[$policy_id]['weak_count']++; |
637 | 637 | } |
638 | 638 | |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | |
648 | 648 | $gid = get_canonical_gid($gid); |
649 | 649 | |
650 | - $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", array( ':gid' => $gid ))->first(); |
|
650 | + $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", array(':gid' => $gid))->first(); |
|
651 | 651 | if (!$q) { |
652 | 652 | return ''; |
653 | 653 | } |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if ( count($divisions) > 0 ) { ?> |
|
1 | +<?php if (count($divisions) > 0) { ?> |
|
2 | 2 | <h2 style="position: relative;"> |
3 | 3 | Recent Votes |
4 | 4 | <div class="meta excerpt__category"><a href="/divisions/">Show all recent votes</a></div> |
@@ -9,7 +9,7 @@ |
||
9 | 9 | remove_form(); |
10 | 10 | list_ignored(); |
11 | 11 | $PAGE->stripe_end([ |
12 | - [ 'type' => 'html', 'content' => $PAGE->admin_menu() ], |
|
12 | + ['type' => 'html', 'content' => $PAGE->admin_menu()], |
|
13 | 13 | ]); |
14 | 14 | $PAGE->page_end(); |
15 | 15 |
@@ -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%s</span></li>', |
7 | 7 | $vote['person_id'], |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | <?php if (count($tellers) > 0) { ?> |
29 | 29 | <h4>Tellers</h4> |
30 | 30 | <ul class="division-names"> |
31 | - <?php foreach($tellers as $teller) { |
|
31 | + <?php foreach ($tellers as $teller) { |
|
32 | 32 | print_voter($teller); |
33 | 33 | } ?> |
34 | 34 | </p> |
@@ -1,15 +1,15 @@ 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%s</span></li>', |
|
7 | - $vote['person_id'], |
|
8 | - $vote['name'], |
|
9 | - $vote['party'], |
|
10 | - $vote['proxy'] ? " (proxy vote cast by $vote[proxy])" : '' |
|
6 | + '<li><a href="/mp/?p=%d">%s</a> <span class="party">%s%s</span></li>', |
|
7 | + $vote['person_id'], |
|
8 | + $vote['name'], |
|
9 | + $vote['party'], |
|
10 | + $vote['proxy'] ? " (proxy vote cast by $vote[proxy])" : '' |
|
11 | 11 | ); |
12 | - } |
|
12 | + } |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | if (count($votes) > 0) { ?> |
@@ -18,18 +18,18 @@ discard block |
||
18 | 18 | <?php $tellers = array(); ?> |
19 | 19 | <ul class="division-names js-vote-accordion"> |
20 | 20 | <?php foreach ($votes as $vote) { |
21 | - if ($vote['teller']) { |
|
22 | - $tellers[] = $vote; |
|
23 | - } else { |
|
21 | + if ($vote['teller']) { |
|
22 | + $tellers[] = $vote; |
|
23 | + } else { |
|
24 | 24 | print_voter($vote); |
25 | - } |
|
25 | + } |
|
26 | 26 | } ?> |
27 | 27 | </ul> |
28 | 28 | <?php if (count($tellers) > 0) { ?> |
29 | 29 | <h4>Tellers</h4> |
30 | 30 | <ul class="division-names"> |
31 | 31 | <?php foreach($tellers as $teller) { |
32 | - print_voter($teller); |
|
32 | + print_voter($teller); |
|
33 | 33 | } ?> |
34 | 34 | </p> |
35 | 35 | <?php } ?> |