@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public function __construct($name) { |
21 | 21 | // treat Labour and Labour/Co-operative the same as that's how |
22 | 22 | // people view them and it'll confuse the results otherwise |
23 | - if ( $name == 'Labour/Co-operative' ) { |
|
23 | + if ($name == 'Labour/Co-operative') { |
|
24 | 24 | $name = 'Labour'; |
25 | 25 | } |
26 | 26 | $this->name = $name; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ':date' => date('Y-m-d'), |
43 | 43 | ) |
44 | 44 | ); |
45 | - if ( $member_count->rows ) { |
|
45 | + if ($member_count->rows) { |
|
46 | 46 | $num_members = $member_count->field(0, 'num_members'); |
47 | 47 | return $num_members; |
48 | 48 | } else { |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | ) |
71 | 71 | ); |
72 | 72 | |
73 | - if ( $position->rows ) { |
|
73 | + if ($position->rows) { |
|
74 | 74 | $score = $position->field(0, 'score'); |
75 | 75 | $score_desc = score_to_strongly($score); |
76 | 76 | |
77 | - if ( $want_score ) { |
|
78 | - return array( $score_desc, $score); |
|
77 | + if ($want_score) { |
|
78 | + return array($score_desc, $score); |
|
79 | 79 | } else { |
80 | 80 | return $score_desc; |
81 | 81 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ':party' => $this->name |
115 | 115 | ); |
116 | 116 | |
117 | - if ( $this->name == 'Labour' ) { |
|
117 | + if ($this->name == 'Labour') { |
|
118 | 118 | $party_where = '( party = :party OR party = :party2 )'; |
119 | 119 | $params = array( |
120 | 120 | ':party' => $this->name, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | ); |
123 | 123 | } |
124 | 124 | |
125 | - for ( $i = 0; $i < $num_divs; $i++ ) { |
|
125 | + for ($i = 0; $i < $num_divs; $i++) { |
|
126 | 126 | $division_id = $divisions->field($i, 'division_id'); |
127 | 127 | $weights = $this->get_vote_scores($divisions->field($i, 'policy_vote')); |
128 | 128 | |
@@ -142,42 +142,42 @@ discard block |
||
142 | 142 | ); |
143 | 143 | |
144 | 144 | $num_votes = 0; |
145 | - for ( $j = 0; $j < $votes->rows(); $j++ ) { |
|
145 | + for ($j = 0; $j < $votes->rows(); $j++) { |
|
146 | 146 | $vote_dir = $votes->field($j, 'vote'); |
147 | - if ( $vote_dir == '' ) continue; |
|
148 | - if ( $vote_dir == 'tellno' ) $vote_dir = 'no'; |
|
149 | - if ( $vote_dir == 'tellaye' ) $vote_dir = 'aye'; |
|
147 | + if ($vote_dir == '') continue; |
|
148 | + if ($vote_dir == 'tellno') $vote_dir = 'no'; |
|
149 | + if ($vote_dir == 'tellaye') $vote_dir = 'aye'; |
|
150 | 150 | |
151 | 151 | $num_votes += $votes->field($j, 'num_votes'); |
152 | 152 | $score += ($votes->field($j, 'num_votes') * $weights[$vote_dir]); |
153 | 153 | } |
154 | 154 | |
155 | 155 | $total_votes += $num_votes; |
156 | - $max_score += $num_votes * max( array_values( $weights ) ); |
|
156 | + $max_score += $num_votes * max(array_values($weights)); |
|
157 | 157 | } |
158 | 158 | |
159 | - if ( $total_votes == 0 ) { |
|
159 | + if ($total_votes == 0) { |
|
160 | 160 | return null; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // this implies that all the divisions in the policy have a policy |
164 | 164 | // position of absent so we set weight to -1 to indicate we can't |
165 | 165 | // really say what the parties position is. |
166 | - if ( $max_score == 0 ) { |
|
166 | + if ($max_score == 0) { |
|
167 | 167 | $weight = -1; |
168 | 168 | } else { |
169 | - $weight = 1 - ( $score/$max_score ); |
|
169 | + $weight = 1 - ($score / $max_score); |
|
170 | 170 | } |
171 | 171 | $score_desc = score_to_strongly($weight); |
172 | 172 | |
173 | - if ( $want_score ) { |
|
174 | - return array( $score_desc, $weight); |
|
173 | + if ($want_score) { |
|
174 | + return array($score_desc, $weight); |
|
175 | 175 | } else { |
176 | 176 | return $score_desc; |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - public function cache_position( $position ) { |
|
180 | + public function cache_position($position) { |
|
181 | 181 | $this->db->query( |
182 | 182 | "REPLACE INTO partypolicy |
183 | 183 | (party, house, policy_id, score) |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | return $positions; |
198 | 198 | } |
199 | 199 | |
200 | - foreach ( $policies->getPolicies() as $policy_id => $policy_text ) { |
|
201 | - list( $position, $score ) = $this->$method($policy_id, true); |
|
202 | - if ( $position === null ) { |
|
200 | + foreach ($policies->getPolicies() as $policy_id => $policy_text) { |
|
201 | + list($position, $score) = $this->$method($policy_id, true); |
|
202 | + if ($position === null) { |
|
203 | 203 | continue; |
204 | 204 | } |
205 | 205 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $both = 1; |
220 | 220 | $agree = 10; |
221 | 221 | |
222 | - if ( stripos($vote, '3') !== FALSE ) { |
|
222 | + if (stripos($vote, '3') !== FALSE) { |
|
223 | 223 | $agree = 50; |
224 | 224 | $absent = 25; |
225 | 225 | $both = 25; |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | 'both' => $both |
231 | 231 | ); |
232 | 232 | |
233 | - if ( stripos($vote, 'aye') !== FALSE ) { |
|
233 | + if (stripos($vote, 'aye') !== FALSE) { |
|
234 | 234 | $scores['aye'] = $agree; |
235 | 235 | $scores['no'] = 0; |
236 | - } else if ( stripos($vote, 'no') !== FALSE ) { |
|
236 | + } else if (stripos($vote, 'no') !== FALSE) { |
|
237 | 237 | $scores['no'] = $agree; |
238 | 238 | $scores['aye'] = 0; |
239 | 239 | } else { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $parties = array(); |
257 | 257 | $party_count = $party_list->rows; |
258 | 258 | |
259 | - for ( $i = 0; $i < $party_count; $i++ ) { |
|
259 | + for ($i = 0; $i < $party_count; $i++) { |
|
260 | 260 | $party = $party_list->field($i, 'party'); |
261 | 261 | if ( |
262 | 262 | !$party |
@@ -144,9 +144,15 @@ |
||
144 | 144 | $num_votes = 0; |
145 | 145 | for ( $j = 0; $j < $votes->rows(); $j++ ) { |
146 | 146 | $vote_dir = $votes->field($j, 'vote'); |
147 | - if ( $vote_dir == '' ) continue; |
|
148 | - if ( $vote_dir == 'tellno' ) $vote_dir = 'no'; |
|
149 | - if ( $vote_dir == 'tellaye' ) $vote_dir = 'aye'; |
|
147 | + if ( $vote_dir == '' ) { |
|
148 | + continue; |
|
149 | + } |
|
150 | + if ( $vote_dir == 'tellno' ) { |
|
151 | + $vote_dir = 'no'; |
|
152 | + } |
|
153 | + if ( $vote_dir == 'tellaye' ) { |
|
154 | + $vote_dir = 'aye'; |
|
155 | + } |
|
150 | 156 | |
151 | 157 | $num_votes += $votes->field($j, 'num_votes'); |
152 | 158 | $score += ($votes->field($j, 'num_votes') * $weights[$vote_dir]); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $both = 1; |
220 | 220 | $agree = 10; |
221 | 221 | |
222 | - if ( stripos($vote, '3') !== FALSE ) { |
|
222 | + if ( stripos($vote, '3') !== false ) { |
|
223 | 223 | $agree = 50; |
224 | 224 | $absent = 25; |
225 | 225 | $both = 25; |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | 'both' => $both |
231 | 231 | ); |
232 | 232 | |
233 | - if ( stripos($vote, 'aye') !== FALSE ) { |
|
233 | + if ( stripos($vote, 'aye') !== false ) { |
|
234 | 234 | $scores['aye'] = $agree; |
235 | 235 | $scores['no'] = 0; |
236 | - } else if ( stripos($vote, 'no') !== FALSE ) { |
|
236 | + } else if ( stripos($vote, 'no') !== false ) { |
|
237 | 237 | $scores['no'] = $agree; |
238 | 238 | $scores['aye'] = 0; |
239 | 239 | } else { |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | public $source; |
20 | 20 | |
21 | 21 | /** |
22 | - * To String |
|
23 | - * |
|
24 | - * Return the office title as a string. |
|
25 | - * |
|
26 | - * @return string The title of the office, or "Unnamed Office" |
|
27 | - */ |
|
22 | + * To String |
|
23 | + * |
|
24 | + * Return the office title as a string. |
|
25 | + * |
|
26 | + * @return string The title of the office, or "Unnamed Office" |
|
27 | + */ |
|
28 | 28 | |
29 | 29 | public function __toString() { |
30 | 30 | if (isset ($this->title)){ |
@@ -35,25 +35,25 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | - * Pretty Dates |
|
39 | - * |
|
40 | - * Return a string containing prettified dates of this office. |
|
41 | - * |
|
42 | - * 2004-05-28 and 2004-05-13 are the first dates for data scraped from the |
|
43 | - * old selctee/privsec pages on parliament.uk (you can see this in |
|
44 | - * cmpages/chgpages' privsec0001_2004-06-08.html and |
|
45 | - * selctee0001_2004-06-08.html). So if the date is those dates for those two |
|
46 | - * things, you don't want to display it because it's not a known start date, |
|
47 | - * it could have been before that date. 2005-11-10 is because the PPS changes |
|
48 | - * did not all happen on that date but the website did not update until that |
|
49 | - * date so it outputs "before" in either from/to date in that case. |
|
50 | - * 2009-01-16 is the last date before the page disappeared off parliament.uk |
|
51 | - * entirely so that displays that fact that after then we don't know. |
|
52 | - * |
|
53 | - * @todo https://github.com/mysociety/theyworkforyou/issues/632 |
|
54 | - * |
|
55 | - * @return string The dates of this office in a readable form. |
|
56 | - */ |
|
38 | + * Pretty Dates |
|
39 | + * |
|
40 | + * Return a string containing prettified dates of this office. |
|
41 | + * |
|
42 | + * 2004-05-28 and 2004-05-13 are the first dates for data scraped from the |
|
43 | + * old selctee/privsec pages on parliament.uk (you can see this in |
|
44 | + * cmpages/chgpages' privsec0001_2004-06-08.html and |
|
45 | + * selctee0001_2004-06-08.html). So if the date is those dates for those two |
|
46 | + * things, you don't want to display it because it's not a known start date, |
|
47 | + * it could have been before that date. 2005-11-10 is because the PPS changes |
|
48 | + * did not all happen on that date but the website did not update until that |
|
49 | + * date so it outputs "before" in either from/to date in that case. |
|
50 | + * 2009-01-16 is the last date before the page disappeared off parliament.uk |
|
51 | + * entirely so that displays that fact that after then we don't know. |
|
52 | + * |
|
53 | + * @todo https://github.com/mysociety/theyworkforyou/issues/632 |
|
54 | + * |
|
55 | + * @return string The dates of this office in a readable form. |
|
56 | + */ |
|
57 | 57 | |
58 | 58 | public function pretty_dates() { |
59 | 59 |
@@ -64,7 +64,7 @@ |
||
64 | 64 | $output = ''; |
65 | 65 | |
66 | 66 | if ( |
67 | - !($this->source == 'chgpages/selctee' && $this->from_date == '2004-05-28') AND |
|
67 | + !($this->source == 'chgpages/selctee' && $this->from_date == '2004-05-28') and |
|
68 | 68 | !($this->source == 'chgpages/privsec' && $this->from_date == '2004-05-13') |
69 | 69 | ) { |
70 | 70 | if ($this->source == 'chgpages/privsec' && $this->from_date == '2005-11-10') { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | |
29 | 29 | public function __toString() { |
30 | - if (isset ($this->title)){ |
|
30 | + if (isset ($this->title)) { |
|
31 | 31 | return (string) $this->title; |
32 | 32 | } else { |
33 | 33 | return 'Unnamed Office'; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if ($this->source == 'chgpages/privsec' && $this->from_date == '2005-11-10') { |
71 | 71 | $output .= 'before '; |
72 | 72 | } |
73 | - $output .= format_date($this->from_date,SHORTDATEFORMAT) . ' '; |
|
73 | + $output .= format_date($this->from_date, SHORTDATEFORMAT) . ' '; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $output .= 'to '; |
@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | |
29 | 29 | public function __toString() { |
30 | - if (isset ($this->title)){ |
|
30 | + if (isset ($this->title)) { |
|
31 | 31 | return (string) $this->title; |
32 | 32 | } else { |
33 | 33 | return 'Unnamed Office'; |
@@ -28,11 +28,17 @@ discard block |
||
28 | 28 | |
29 | 29 | if (get_http_var('from') || get_http_var('to')) { |
30 | 30 | $from = parse_date(get_http_var('from')); |
31 | - if ($from) $from = $from['iso']; |
|
32 | - else $from = '1935-10-01'; |
|
31 | + if ($from) { |
|
32 | + $from = $from['iso']; |
|
33 | + } else { |
|
34 | + $from = '1935-10-01'; |
|
35 | + } |
|
33 | 36 | $to = parse_date(get_http_var('to')); |
34 | - if ($to) $to = $to['iso']; |
|
35 | - else $to = date('Y-m-d'); |
|
37 | + if ($to) { |
|
38 | + $to = $to['iso']; |
|
39 | + } else { |
|
40 | + $to = date('Y-m-d'); |
|
41 | + } |
|
36 | 42 | $searchstring .= " $from..$to"; |
37 | 43 | } |
38 | 44 | |
@@ -105,8 +111,10 @@ discard block |
||
105 | 111 | } |
106 | 112 | |
107 | 113 | $advsection = get_http_var('section'); |
108 | - if (!$advsection) |
|
109 | - $advsection = get_http_var('maj'); # Old URLs had this |
|
114 | + if (!$advsection) { |
|
115 | + $advsection = get_http_var('maj'); |
|
116 | + } |
|
117 | + # Old URLs had this |
|
110 | 118 | if (is_array($advsection)) { |
111 | 119 | $searchstring .= ' section:' . join(' section:', $advsection); |
112 | 120 | } elseif ($advsection) { |
@@ -81,7 +81,7 @@ |
||
81 | 81 | $q = \MySociety\TheyWorkForYou\Utility\Search::searchMemberDbLookup($searchspeaker); |
82 | 82 | $pids = array(); |
83 | 83 | $row_count = $q->rows(); |
84 | - for ($i=0; $i<$row_count; $i++) { |
|
84 | + for ($i = 0; $i < $row_count; $i++) { |
|
85 | 85 | $pids[$q->field($i, 'person_id')] = true; |
86 | 86 | } |
87 | 87 | $pids = array_keys($pids); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->db = new \ParlDB; |
34 | 34 | |
35 | 35 | if (is_null($data)) { |
36 | - return; |
|
36 | + return; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $this->id = $data['id']; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | private function _getContentIDs() { |
126 | 126 | $q = $this->db->query( |
127 | - "SELECT body, gid, ep.epobject_id FROM epobject ep |
|
127 | + "SELECT body, gid, ep.epobject_id FROM epobject ep |
|
128 | 128 | JOIN hansard h on ep.epobject_id = h.epobject_id |
129 | 129 | JOIN topic_epobjects te on te.epobject_id = ep.epobject_id |
130 | 130 | WHERE topic_key = :topic_key", |
@@ -180,24 +180,24 @@ discard block |
||
180 | 180 | |
181 | 181 | function addContent($gid) { |
182 | 182 | $q = $this->db->query( |
183 | - "SELECT epobject_id FROM hansard WHERE gid = :gid", |
|
184 | - array( |
|
183 | + "SELECT epobject_id FROM hansard WHERE gid = :gid", |
|
184 | + array( |
|
185 | 185 | ":gid" => $gid |
186 | - ) |
|
186 | + ) |
|
187 | 187 | ); |
188 | 188 | |
189 | 189 | if (!$q->success() || $q->rows == 0) { |
190 | - return false; |
|
190 | + return false; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | $epobject_id = $q->field(0, 'epobject_id'); |
194 | 194 | |
195 | 195 | $q = $this->db->query( |
196 | - "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)", |
|
197 | - array( |
|
196 | + "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)", |
|
197 | + array( |
|
198 | 198 | ":topic" => $this->id, |
199 | 199 | ":ep_id" => $epobject_id |
200 | - ) |
|
200 | + ) |
|
201 | 201 | ); |
202 | 202 | |
203 | 203 | return $q->success(); |
@@ -205,31 +205,31 @@ discard block |
||
205 | 205 | |
206 | 206 | function deleteContent($id) { |
207 | 207 | $q = $this->db->query( |
208 | - "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id", |
|
209 | - array( |
|
208 | + "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id", |
|
209 | + array( |
|
210 | 210 | ":topic" => $this->id, |
211 | 211 | ":ep_id" => $id |
212 | - ) |
|
212 | + ) |
|
213 | 213 | ); |
214 | 214 | |
215 | 215 | return $q->success(); |
216 | 216 | } |
217 | 217 | |
218 | 218 | function getPolicySets() { |
219 | - $q = $this->db->query( |
|
219 | + $q = $this->db->query( |
|
220 | 220 | "SELECT policyset FROM topic_policysets WHERE topic_key = :key", |
221 | 221 | array( |
222 | - ':key' => $this->id |
|
222 | + ':key' => $this->id |
|
223 | 223 | ) |
224 | - ); |
|
224 | + ); |
|
225 | 225 | |
226 | - $sets = array(); |
|
227 | - $count = $q->rows; |
|
228 | - for ($i = 0; $i < $count; $i++) { |
|
226 | + $sets = array(); |
|
227 | + $count = $q->rows; |
|
228 | + for ($i = 0; $i < $count; $i++) { |
|
229 | 229 | $sets[] = $q->field($i, 'policyset'); |
230 | - } |
|
230 | + } |
|
231 | 231 | |
232 | - return $sets; |
|
232 | + return $sets; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | function addPolicySets($sets) { |
@@ -259,20 +259,20 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | function getPolicies() { |
262 | - $q = $this->db->query( |
|
262 | + $q = $this->db->query( |
|
263 | 263 | 'SELECT policy_id FROM topic_policies WHERE topic_key = :key', |
264 | 264 | array( |
265 | - ':key' => $this->id |
|
265 | + ':key' => $this->id |
|
266 | 266 | ) |
267 | - ); |
|
267 | + ); |
|
268 | 268 | |
269 | - $policies = array(); |
|
270 | - $count = $q->rows; |
|
271 | - for ($i = 0; $i < $count; $i++) { |
|
269 | + $policies = array(); |
|
270 | + $count = $q->rows; |
|
271 | + for ($i = 0; $i < $count; $i++) { |
|
272 | 272 | $policies[] = $q->field($i, 'policy_id'); |
273 | - } |
|
273 | + } |
|
274 | 274 | |
275 | - return $policies; |
|
275 | + return $policies; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | function addPolicies($policies) { |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | |
317 | 317 | function save() { |
318 | 318 | $q = $this->db->query( |
319 | - "REPLACE INTO topics |
|
319 | + "REPLACE INTO topics |
|
320 | 320 | (id, title, slug, description, search_string, front_page, image) |
321 | 321 | VALUES |
322 | 322 | (:id, :title, :slug, :description, :search_string, :front_page, :image)", |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | */ |
30 | 30 | |
31 | - public function __construct($data = NULL) |
|
31 | + public function __construct($data = null) |
|
32 | 32 | { |
33 | 33 | $this->db = new \ParlDB; |
34 | 34 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | function sctitle() { |
55 | 55 | $title = $this->title; |
56 | - if (strpos($title, 'The ') === 0 ) { |
|
56 | + if (strpos($title, 'The ') === 0) { |
|
57 | 57 | $title = lcfirst($title); |
58 | 58 | } |
59 | 59 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | ); |
243 | 243 | } else { |
244 | 244 | foreach ($sets as $set) { |
245 | - if ($set == '' ) { |
|
245 | + if ($set == '') { |
|
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | $q = $this->db->query( |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | ); |
286 | 286 | } else { |
287 | 287 | foreach ($policies as $policy) { |
288 | - if ($policy == '' ) { |
|
288 | + if ($policy == '') { |
|
289 | 289 | continue; |
290 | 290 | } |
291 | 291 | $q = $this->db->query( |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | protected function getSearchSections() { |
26 | 26 | return array( |
27 | - array( 'section' => 'sp' ) |
|
27 | + array('section' => 'sp') |
|
28 | 28 | ); |
29 | 29 | } |
30 | 30 | } |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | |
13 | 13 | protected function display_front() { |
14 | 14 | global $DATA, $this_page; |
15 | - if ( get_http_var('type') == 'wrans') { |
|
15 | + if (get_http_var('type') == 'wrans') { |
|
16 | 16 | return parent::display_front(); |
17 | 17 | } |
18 | 18 | |
19 | 19 | $data = array(); |
20 | 20 | |
21 | - $args = array( 'months' => 1 ); |
|
21 | + $args = array('months' => 1); |
|
22 | 22 | $WRANSLIST = new \WRANSLIST; |
23 | 23 | |
24 | 24 | $wrans = array(); |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | |
51 | 51 | protected function getSearchSections() { |
52 | 52 | $sections = array( |
53 | - array( 'section' => 'wrans', 'title' => 'Written Answers' ), |
|
53 | + array('section' => 'wrans', 'title' => 'Written Answers'), |
|
54 | 54 | ); |
55 | - if ( get_http_var('type') == '') { |
|
56 | - $sections[] = array( 'section' => 'wms', 'title' => 'Written Ministerial Statements' ); |
|
55 | + if (get_http_var('type') == '') { |
|
56 | + $sections[] = array('section' => 'wms', 'title' => 'Written Ministerial Statements'); |
|
57 | 57 | } |
58 | 58 | return $sections; |
59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | # speech bar the first (assuming that's the question) |
63 | 63 | private $votelinks_so_far = 0; |
64 | 64 | |
65 | - protected function generate_votes ($votes, $id, $gid) { |
|
65 | + protected function generate_votes($votes, $id, $gid) { |
|
66 | 66 | /* |
67 | 67 | Returns HTML for the 'Does this answer the question?' links (wrans) in the sidebar. |
68 | 68 | $votes = => array ( |
@@ -66,7 +66,9 @@ discard block |
||
66 | 66 | private $first_gid = ''; |
67 | 67 | |
68 | 68 | protected function get_video_html($row, $heading_hpos, $speeches) { |
69 | - if (!$this->first_gid) $this->first_gid = $row['gid']; |
|
69 | + if (!$this->first_gid) { |
|
70 | + $this->first_gid = $row['gid']; |
|
71 | + } |
|
70 | 72 | |
71 | 73 | $video_content = ''; |
72 | 74 | if (!$this->first_video_displayed && $row['video_status']&4 && !($row['video_status']&8)) { |
@@ -97,7 +99,9 @@ discard block |
||
97 | 99 | $adate = $vq->field(0, 'adate'); |
98 | 100 | $time = $vq->field(0, 'atime'); |
99 | 101 | $videodb = \MySociety\TheyWorkForYou\Utility\Video::dbConnect(); |
100 | - if (!$videodb) return ''; |
|
102 | + if (!$videodb) { |
|
103 | + return ''; |
|
104 | + } |
|
101 | 105 | $video = \MySociety\TheyWorkForYou\Utility\Video::fromTimestamp($videodb, $adate, $time); |
102 | 106 | $start = $video['offset']; |
103 | 107 | $out = ''; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $DEBATELIST = new \DEBATELIST; |
17 | 17 | $debates = array(); |
18 | 18 | $debates['data'] = $DEBATELIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none'); |
19 | - $args = array( 'months' => 1 ); |
|
19 | + $args = array('months' => 1); |
|
20 | 20 | $debates['calendar'] = $DEBATELIST->display('calendar', $args, 'none'); |
21 | 21 | $debates['rssurl'] = $DATA->page_metadata($this_page, 'rss'); |
22 | 22 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $WHALLLIST = new \WHALLLIST; |
28 | 28 | $whall['data'] = $WHALLLIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none'); |
29 | - $args = array( 'months' => 1 ); |
|
29 | + $args = array('months' => 1); |
|
30 | 30 | $whall['calendar'] = $WHALLLIST->display('calendar', $args, 'none'); |
31 | 31 | $whall['rssurl'] = $DATA->page_metadata($this_page, 'rss'); |
32 | 32 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $LORDSDEBATELIST = new \LORDSDEBATELIST; |
38 | 38 | $lords['data'] = $LORDSDEBATELIST->display('biggest_debates', array('days'=>7, 'num'=>10), 'none'); |
39 | - $args = array( 'months' => 1 ); |
|
39 | + $args = array('months' => 1); |
|
40 | 40 | $lords['calendar'] = $LORDSDEBATELIST->display('calendar', $args, 'none'); |
41 | 41 | |
42 | 42 | $lords['rssurl'] = $DATA->page_metadata($this_page, 'rss'); |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | |
56 | 56 | protected function getSearchSections() { |
57 | 57 | return array( |
58 | - array( 'section' => 'debates', 'title' => 'House of Commons' ), |
|
59 | - array( 'section' => 'lords', 'title' => 'House of Lords' ), |
|
60 | - array( 'section' => 'whall', 'title' => 'Westminster Hall' ) |
|
58 | + array('section' => 'debates', 'title' => 'House of Commons'), |
|
59 | + array('section' => 'lords', 'title' => 'House of Lords'), |
|
60 | + array('section' => 'whall', 'title' => 'Westminster Hall') |
|
61 | 61 | ); |
62 | 62 | } |
63 | 63 | |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | if (!$this->first_gid) $this->first_gid = $row['gid']; |
70 | 70 | |
71 | 71 | $video_content = ''; |
72 | - if (!$this->first_video_displayed && $row['video_status']&4 && !($row['video_status']&8)) { |
|
72 | + if (!$this->first_video_displayed && $row['video_status'] & 4 && !($row['video_status'] & 8)) { |
|
73 | 73 | $video_content = $this->video_sidebar($row, $heading_hpos, $speeches); |
74 | 74 | $this->first_video_displayed = true; |
75 | 75 | } |
76 | - if (!$video_content && !$this->first_speech_displayed && $row['video_status']&1 && !($row['video_status']&12)) { |
|
76 | + if (!$video_content && !$this->first_speech_displayed && $row['video_status'] & 1 && !($row['video_status'] & 12)) { |
|
77 | 77 | $video_content = $this->video_advert($row); |
78 | 78 | $this->first_speech_displayed = true; |
79 | 79 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if ($count > 1) { |
105 | 105 | $out .= '<div class="debate__video" id="video_wrap"><div>'; |
106 | 106 | if ($row['gid'] != $this->first_gid) { |
107 | - $out .= '<p class="video-instructions">This video starts around ' . ($row['hpos']-$heading_hpos) . ' speeches in (<a href="#g' . gid_to_anchor($row['gid']) . '">move there in text</a>)</p>'; |
|
107 | + $out .= '<p class="video-instructions">This video starts around ' . ($row['hpos'] - $heading_hpos) . ' speeches in (<a href="#g' . gid_to_anchor($row['gid']) . '">move there in text</a>)</p>'; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | $out .= \MySociety\TheyWorkForYou\Utility\Video::object($video['id'], $start, "$gid_type/$row[gid]"); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | protected function getSearchSections() { |
34 | 34 | return array( |
35 | - array( 'section' => 'ni' ) |
|
35 | + array('section' => 'ni') |
|
36 | 36 | ); |
37 | 37 | } |
38 | 38 | |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | |
53 | 53 | $debates = $DEBATELIST->display('recent_debates', array('days' => 30, 'num' => 6), 'none'); |
54 | 54 | $MOREURL = new \URL('nidebatesfront'); |
55 | - $MOREURL->insert( array( 'more' => 1 ) ); |
|
55 | + $MOREURL->insert(array('more' => 1)); |
|
56 | 56 | |
57 | 57 | // this makes sure that we don't repeat this debate in the list below |
58 | 58 | $random_debate = NULL; |
59 | - if ( isset($debates['data']) && count($debates['data']) ) { |
|
59 | + if (isset($debates['data']) && count($debates['data'])) { |
|
60 | 60 | $random_debate = $debates['data'][0]; |
61 | 61 | } |
62 | 62 | |
63 | 63 | $recent = array(); |
64 | - if ( isset($debates['data']) && count($debates['data']) ) { |
|
64 | + if (isset($debates['data']) && count($debates['data'])) { |
|
65 | 65 | // at the start of a session there may be less than 6 |
66 | 66 | // debates |
67 | 67 | $max = 6; |
68 | - if ( count($debates['data']) < 6 ) { |
|
68 | + if (count($debates['data']) < 6) { |
|
69 | 69 | $max = count($debates['data']); |
70 | 70 | } |
71 | - for ( $i = 1; $i < $max; $i++ ) { |
|
71 | + for ($i = 1; $i < $max; $i++) { |
|
72 | 72 | $debate = $debates['data'][$i]; |
73 | 73 | $debate['desc'] = "Northern Ireland Assembly debates"; |
74 | 74 | $debate['more_url'] = $MOREURL->generate(); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | $featured = array(); |
80 | - if ( $random_debate ) { |
|
80 | + if ($random_debate) { |
|
81 | 81 | $featured = $random_debate; |
82 | 82 | $featured['more_url'] = $MOREURL->generate(); |
83 | 83 | $featured['desc'] = 'Northern Ireland Assembly debate'; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $data['featured'] = $featured; |
89 | - $data['debates'] = array( 'recent' => $recent); |
|
89 | + $data['debates'] = array('recent' => $recent); |
|
90 | 90 | |
91 | 91 | $data['regional'] = $this->getMLAList(); |
92 | 92 | $data['template'] = 'ni/index'; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $data = array(); |
44 | 44 | $urls = array(); |
45 | 45 | |
46 | - $data['popular_searches'] = NULL; |
|
46 | + $data['popular_searches'] = null; |
|
47 | 47 | |
48 | 48 | |
49 | 49 | $data['urls'] = $this->getURLs($data); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $MOREURL->insert( array( 'more' => 1 ) ); |
56 | 56 | |
57 | 57 | // this makes sure that we don't repeat this debate in the list below |
58 | - $random_debate = NULL; |
|
58 | + $random_debate = null; |
|
59 | 59 | if ( isset($debates['data']) && count($debates['data']) ) { |
60 | 60 | $random_debate = $debates['data'][0]; |
61 | 61 | } |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | $gid = $featured->get_gid(); |
58 | 58 | $gidCheck = new Gid($gid); |
59 | 59 | $gid = $gidCheck->checkForRedirect(); |
60 | - if ( $gid ) { |
|
60 | + if ($gid) { |
|
61 | 61 | $title = $featured->get_title(); |
62 | 62 | $context = $featured->get_context(); |
63 | 63 | $related = $featured->get_related(); |
64 | 64 | $item = $this->getFeaturedDebate($gid, $title, $context, $related); |
65 | 65 | } else { |
66 | 66 | $item = $debatelist->display('recent_debates', array('days' => 7, 'num' => 1), 'none'); |
67 | - if ( isset($item['data']) && count($item['data']) ) { |
|
67 | + if (isset($item['data']) && count($item['data'])) { |
|
68 | 68 | $item = $item['data'][0]; |
69 | 69 | $more_url = new \URL('debates'); |
70 | 70 | $item['more_url'] = $more_url->generate(); |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | $item['featured'] = true; |
96 | 96 | |
97 | 97 | $related_debates = array(); |
98 | - foreach ( $related as $related_gid ) { |
|
99 | - if ( $related_gid ) { |
|
98 | + foreach ($related as $related_gid) { |
|
99 | + if ($related_gid) { |
|
100 | 100 | $related_item = $debatelist->display('featured_gid', array('gid' => $related_gid), 'none'); |
101 | 101 | $related_debates[] = $related_item['data']; |
102 | 102 | } |
@@ -121,21 +121,21 @@ discard block |
||
121 | 121 | |
122 | 122 | $recent_content = array(); |
123 | 123 | |
124 | - foreach ( $this->recent_types as $class => $recent ) { |
|
124 | + foreach ($this->recent_types as $class => $recent) { |
|
125 | 125 | $class = "\\$class"; |
126 | 126 | $instance = new $class(); |
127 | 127 | $more_url = new \URL($recent[1]); |
128 | - if ( $recent[0] == 'recent_pbc_debates' ) { |
|
129 | - $content = array( 'data' => $instance->display($recent[0], array('num' => 5), 'none') ); |
|
128 | + if ($recent[0] == 'recent_pbc_debates') { |
|
129 | + $content = array('data' => $instance->display($recent[0], array('num' => 5), 'none')); |
|
130 | 130 | } else { |
131 | 131 | $content = $instance->display($recent[0], array('days' => 7, 'num' => 1), 'none'); |
132 | - if ( isset($content['data']) && count($content['data']) ) { |
|
132 | + if (isset($content['data']) && count($content['data'])) { |
|
133 | 133 | $content = $content['data'][0]; |
134 | 134 | } else { |
135 | 135 | $content = array(); |
136 | 136 | } |
137 | 137 | } |
138 | - if ( $content ) { |
|
138 | + if ($content) { |
|
139 | 139 | $content['more_url'] = $more_url->generate(); |
140 | 140 | $content['desc'] = $recent[2]; |
141 | 141 | $recent_content[] = $content; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | WHERE event_date >= :date |
155 | 155 | AND deleted = 0 |
156 | 156 | ORDER BY event_date, chamber, pos", |
157 | - array( ':date' => $date ) |
|
157 | + array(':date' => $date) |
|
158 | 158 | ); |
159 | 159 | |
160 | 160 | if (!$q->rows()) { |
@@ -48,7 +48,7 @@ |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | protected function getRegionalList() { |
51 | - return NULL; |
|
51 | + return null; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | protected function getEditorialContent() { |