@@ -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); |
@@ -28,11 +28,19 @@ 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 | + } |
|
34 | + else { |
|
35 | + $from = '1935-10-01'; |
|
36 | + } |
|
33 | 37 | $to = parse_date(get_http_var('to')); |
34 | - if ($to) $to = $to['iso']; |
|
35 | - else $to = date('Y-m-d'); |
|
38 | + if ($to) { |
|
39 | + $to = $to['iso']; |
|
40 | + } |
|
41 | + else { |
|
42 | + $to = date('Y-m-d'); |
|
43 | + } |
|
36 | 44 | $searchstring .= " $from..$to"; |
37 | 45 | } |
38 | 46 | |
@@ -45,11 +53,14 @@ discard block |
||
45 | 53 | if ($column = trim(get_http_var('column'))) { |
46 | 54 | if (preg_match('#^(\d+)W$#', $column, $m)) { |
47 | 55 | $searchstring .= " column:$m[1] section:wrans"; |
48 | - } elseif (preg_match('#^(\d+)WH$#', $column, $m)) { |
|
56 | + } |
|
57 | + elseif (preg_match('#^(\d+)WH$#', $column, $m)) { |
|
49 | 58 | $searchstring .= " column:$m[1] section:whall"; |
50 | - } elseif (preg_match('#^(\d+)WS$#', $column, $m)) { |
|
59 | + } |
|
60 | + elseif (preg_match('#^(\d+)WS$#', $column, $m)) { |
|
51 | 61 | $searchstring .= " column:$m[1] section:wms"; |
52 | - } elseif (preg_match('#^\d+$#', $column)) { |
|
62 | + } |
|
63 | + elseif (preg_match('#^\d+$#', $column)) { |
|
53 | 64 | $searchstring .= " column:$column"; |
54 | 65 | } |
55 | 66 | } |
@@ -105,11 +116,14 @@ discard block |
||
105 | 116 | } |
106 | 117 | |
107 | 118 | $advsection = get_http_var('section'); |
108 | - if (!$advsection) |
|
109 | - $advsection = get_http_var('maj'); # Old URLs had this |
|
119 | + if (!$advsection) { |
|
120 | + $advsection = get_http_var('maj'); |
|
121 | + } |
|
122 | + # Old URLs had this |
|
110 | 123 | if (is_array($advsection)) { |
111 | 124 | $searchstring .= ' section:' . join(' section:', $advsection); |
112 | - } elseif ($advsection) { |
|
125 | + } |
|
126 | + elseif ($advsection) { |
|
113 | 127 | $searchstring .= " section:$advsection"; |
114 | 128 | } |
115 | 129 | |
@@ -123,7 +137,8 @@ discard block |
||
123 | 137 | $search_main = "($search_main)"; |
124 | 138 | } |
125 | 139 | $searchstring = "$search_main $searchstring"; |
126 | - } elseif ($search_main) { |
|
140 | + } |
|
141 | + elseif ($search_main) { |
|
127 | 142 | $searchstring = $search_main; |
128 | 143 | } |
129 | 144 | |
@@ -135,7 +150,8 @@ discard block |
||
135 | 150 | // If q has a value (other than the default empty string) use that over s. |
136 | 151 | if (get_http_var('q') != '') { |
137 | 152 | $search_main = trim(get_http_var('q')); |
138 | - } else { |
|
153 | + } |
|
154 | + else { |
|
139 | 155 | $search_main = trim(get_http_var('s')); |
140 | 156 | } |
141 | 157 |
@@ -20,7 +20,8 @@ |
||
20 | 20 | |
21 | 21 | if ($q->rows() == 0) { |
22 | 22 | return $this->gid; |
23 | - } else { |
|
23 | + } |
|
24 | + else { |
|
24 | 25 | do { |
25 | 26 | $gid = $q->field(0, 'gid_to'); |
26 | 27 | $q = $this->db->query( |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $gids = join('","', $gids); |
37 | 37 | $db = new \ParlDB; |
38 | 38 | $q = $db->query('SELECT gid,person_id,hdate FROM hansard WHERE gid IN ("' . $gids . '")'); |
39 | - for ($n=0; $n<$q->rows(); $n++) { |
|
39 | + for ($n = 0; $n < $q->rows(); $n++) { |
|
40 | 40 | $gid = $q->field($n, 'gid'); |
41 | 41 | $person_id = $q->field($n, 'person_id'); |
42 | 42 | $hdate = $q->field($n, 'hdate'); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | WHERE member.person_id IN (' . $person_ids . ') |
64 | 64 | ' . ($house ? " AND house=$house" : '') . ' |
65 | 65 | ORDER BY left_house DESC'); |
66 | - for ($n=0; $n<$q->rows(); $n++) { |
|
66 | + for ($n = 0; $n < $q->rows(); $n++) { |
|
67 | 67 | $mid = $q->field($n, 'member_id'); |
68 | 68 | if (!isset($pids[$mid])) { |
69 | 69 | $title = $q->field($n, 'title'); |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | if ($dept && $q->field($n, 'to_date') == '9999-12-31') |
85 | 85 | $speakers[$pid]['office'][$moffice_id] = prettify_office($posn, $dept); |
86 | 86 | if (!isset($speakers[$pid]['name'])) { |
87 | - $speakers[$pid]['name'] = $full_name . ($house==1?' MP':''); |
|
87 | + $speakers[$pid]['name'] = $full_name . ($house == 1 ? ' MP' : ''); |
|
88 | 88 | } |
89 | - if ( !isset($speakers[$pid]['party']) && $party ) { |
|
89 | + if (!isset($speakers[$pid]['party']) && $party) { |
|
90 | 90 | $speakers[$pid]['party'] = $party; |
91 | 91 | } |
92 | 92 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * Return query result from looking for MPs |
140 | 140 | */ |
141 | 141 | |
142 | - public static function searchMemberDbLookup($searchstring, $current_only=false) { |
|
142 | + public static function searchMemberDbLookup($searchstring, $current_only = false) { |
|
143 | 143 | if (!$searchstring) return false; |
144 | 144 | $searchwords = explode(' ', $searchstring, 3); |
145 | 145 | $params = array(); |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | // And here we're assuming the user's put the names in the right order. |
152 | 152 | $params[':like_0'] = '%' . $searchwords[0] . '%'; |
153 | 153 | $params[':like_1'] = '%' . $searchwords[1] . '%'; |
154 | - $params[':like_0_and_1'] = '%' . $searchwords[0] . ' '. $searchwords[1] . '%'; |
|
155 | - $params[':like_0_and_1_hyphen'] = '%' . $searchwords[0] . '-'. $searchwords[1] . '%'; |
|
154 | + $params[':like_0_and_1'] = '%' . $searchwords[0] . ' ' . $searchwords[1] . '%'; |
|
155 | + $params[':like_0_and_1_hyphen'] = '%' . $searchwords[0] . '-' . $searchwords[1] . '%'; |
|
156 | 156 | $where = "(given_name LIKE :like_0 AND family_name LIKE :like_1)"; |
157 | 157 | $where .= " OR (given_name LIKE :like_1 AND family_name LIKE :like_0)"; |
158 | 158 | $where .= " OR (title LIKE :like_0 AND family_name LIKE :like_1)"; |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | $params[':like_0'] = '%' . $searchwords[0] . '%'; |
168 | 168 | $params[':like_1'] = '%' . $searchwords[1] . '%'; |
169 | 169 | $params[':like_2'] = '%' . $searchwords[2] . '%'; |
170 | - $params[':like_0_and_1'] = '%' . $searchwords[0] . ' '. $searchwords[1] . '%'; |
|
171 | - $params[':like_1_and_2'] = '%' . $searchwords[1] . ' '. $searchwords[2] . '%'; |
|
172 | - $params[':like_1_and_2_hyphen'] = '%' . $searchwords[1] . '-'. $searchwords[2] . '%'; |
|
170 | + $params[':like_0_and_1'] = '%' . $searchwords[0] . ' ' . $searchwords[1] . '%'; |
|
171 | + $params[':like_1_and_2'] = '%' . $searchwords[1] . ' ' . $searchwords[2] . '%'; |
|
172 | + $params[':like_1_and_2_hyphen'] = '%' . $searchwords[1] . '-' . $searchwords[2] . '%'; |
|
173 | 173 | $where = "(given_name LIKE :like_0_and_1 AND family_name LIKE :like_2)"; |
174 | 174 | $where .= " OR (given_name LIKE :like_0 AND family_name LIKE :like_1_and_2)"; |
175 | 175 | $where .= " OR (given_name LIKE :like_0 AND family_name LIKE :like_1_and_2_hyphen)"; |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | return $q; |
185 | 185 | } |
186 | 186 | |
187 | - public static function searchMemberDbLookupWithNames($searchstring, $current_only=false) { |
|
187 | + public static function searchMemberDbLookupWithNames($searchstring, $current_only = false) { |
|
188 | 188 | $q = self::searchMemberDbLookup($searchstring, $current_only); |
189 | 189 | |
190 | - if ( !$q->rows ) { |
|
190 | + if (!$q->rows) { |
|
191 | 191 | return $q; |
192 | 192 | } |
193 | 193 | |
194 | 194 | $person_ids = array(); |
195 | - for ($i=0; $i<$q->rows(); ++$i) { |
|
195 | + for ($i = 0; $i < $q->rows(); ++$i) { |
|
196 | 196 | $pid = $q->field($i, 'person_id'); |
197 | 197 | $person_ids[$pid] = 1; |
198 | 198 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | // Looks like a postcode - can we find the constituency? |
240 | 240 | $constituency = Postcode::postcodeToConstituency($searchterm); |
241 | 241 | if ($constituency) { |
242 | - return array( array($constituency), true ); |
|
242 | + return array(array($constituency), true); |
|
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | $q = $db->query($query, array(':try' => '%' . $try . '%')); |
254 | 254 | |
255 | 255 | $constituencies = array(); |
256 | - for ($n=0; $n<$q->rows(); $n++) { |
|
256 | + for ($n = 0; $n < $q->rows(); $n++) { |
|
257 | 257 | $constituencies[] = $q->field($n, 'name'); |
258 | 258 | } |
259 | 259 | |
260 | - return array( $constituencies, false ); |
|
260 | + return array($constituencies, false); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $speakers = []; |
274 | 274 | |
275 | 275 | foreach ($criteria as $c) { |
276 | - if (preg_match('#^speaker:(\d+)#',$c,$m)) { |
|
276 | + if (preg_match('#^speaker:(\d+)#', $c, $m)) { |
|
277 | 277 | $MEMBER = new \MEMBER(array('person_id'=>$m[1])); |
278 | 278 | $speakers[$m[1]] = $MEMBER->full_name(); |
279 | 279 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | public static function speakerIDsToNames($searchstring) { |
293 | 293 | $speakers = self::speakerNamesForIDs($searchstring); |
294 | 294 | |
295 | - foreach ( $speakers as $id => $name ) { |
|
295 | + foreach ($speakers as $id => $name) { |
|
296 | 296 | $searchstring = str_replace('speaker:' . $id, "speaker:$name", $searchstring); |
297 | 297 | } |
298 | 298 |
@@ -28,8 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | return $data; |
30 | 30 | } |
31 | - if (count($gids) == 5000) |
|
32 | - $data['limit_reached'] = true; |
|
31 | + if (count($gids) == 5000) { |
|
32 | + $data['limit_reached'] = true; |
|
33 | + } |
|
33 | 34 | |
34 | 35 | # Fetch all the speakers of the results, count them up and get min/max date usage |
35 | 36 | $speaker_count = array(); |
@@ -46,8 +47,12 @@ discard block |
||
46 | 47 | $mindate[$person_id] = '9999-12-31'; |
47 | 48 | } |
48 | 49 | $speaker_count[$person_id]++; |
49 | - if ($hdate < $mindate[$person_id]) $mindate[$person_id] = $hdate; |
|
50 | - if ($hdate > $maxdate[$person_id]) $maxdate[$person_id] = $hdate; |
|
50 | + if ($hdate < $mindate[$person_id]) { |
|
51 | + $mindate[$person_id] = $hdate; |
|
52 | + } |
|
53 | + if ($hdate > $maxdate[$person_id]) { |
|
54 | + $maxdate[$person_id] = $hdate; |
|
55 | + } |
|
51 | 56 | } |
52 | 57 | |
53 | 58 | # Fetch details of all the speakers |
@@ -81,8 +86,9 @@ discard block |
||
81 | 86 | $dept = $q->field($n, 'dept'); |
82 | 87 | $posn = $q->field($n, 'position'); |
83 | 88 | $moffice_id = $q->field($n, 'moffice_id'); |
84 | - if ($dept && $q->field($n, 'to_date') == '9999-12-31') |
|
85 | - $speakers[$pid]['office'][$moffice_id] = prettify_office($posn, $dept); |
|
89 | + if ($dept && $q->field($n, 'to_date') == '9999-12-31') { |
|
90 | + $speakers[$pid]['office'][$moffice_id] = prettify_office($posn, $dept); |
|
91 | + } |
|
86 | 92 | if (!isset($speakers[$pid]['name'])) { |
87 | 93 | $speakers[$pid]['name'] = $full_name . ($house==1?' MP':''); |
88 | 94 | } |
@@ -140,13 +146,16 @@ discard block |
||
140 | 146 | */ |
141 | 147 | |
142 | 148 | public static function searchMemberDbLookup($searchstring, $current_only=false) { |
143 | - if (!$searchstring) return false; |
|
149 | + if (!$searchstring) { |
|
150 | + return false; |
|
151 | + } |
|
144 | 152 | $searchwords = explode(' ', $searchstring, 3); |
145 | 153 | $params = array(); |
146 | 154 | if (count($searchwords) == 1) { |
147 | 155 | $params[':like_0'] = '%' . $searchwords[0] . '%'; |
148 | 156 | $where = "given_name LIKE :like_0 OR family_name LIKE :like_0 OR lordofname LIKE :like_0"; |
149 | - } elseif (count($searchwords) == 2) { |
|
157 | + } |
|
158 | + elseif (count($searchwords) == 2) { |
|
150 | 159 | // We don't do anything special if there are more than two search words. |
151 | 160 | // And here we're assuming the user's put the names in the right order. |
152 | 161 | $params[':like_0'] = '%' . $searchwords[0] . '%'; |
@@ -162,7 +171,8 @@ discard block |
||
162 | 171 | if (strtolower($searchwords[0]) == 'nick') { |
163 | 172 | $where .= " OR (given_name LIKE '%nicholas%' AND family_name LIKE :like_1)"; |
164 | 173 | } |
165 | - } else { |
|
174 | + } |
|
175 | + else { |
|
166 | 176 | $searchwords[2] = str_replace('of ', '', $searchwords[2]); |
167 | 177 | $params[':like_0'] = '%' . $searchwords[0] . '%'; |
168 | 178 | $params[':like_1'] = '%' . $searchwords[1] . '%'; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!empty($details['pid'])) { |
22 | - $criteria[] = 'speaker:'.$details['pid']; |
|
22 | + $criteria[] = 'speaker:' . $details['pid']; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $criteria = join(' ', $criteria); |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | ':email' => $email |
34 | 34 | )); |
35 | 35 | $out = ''; |
36 | - for ($i=0; $i<$q->rows(); ++$i) { |
|
36 | + for ($i = 0; $i < $q->rows(); ++$i) { |
|
37 | 37 | $row = $q->row($i); |
38 | - $criteria = explode(' ',$row['criteria']); |
|
38 | + $criteria = explode(' ', $row['criteria']); |
|
39 | 39 | $ccc = array(); |
40 | 40 | $current = true; |
41 | 41 | foreach ($criteria as $c) { |
42 | - if (preg_match('#^speaker:(\d+)#',$c,$m)) { |
|
42 | + if (preg_match('#^speaker:(\d+)#', $c, $m)) { |
|
43 | 43 | $MEMBER = new \MEMBER(array('person_id'=>$m[1])); |
44 | 44 | $ccc[] = 'spoken by ' . $MEMBER->full_name(); |
45 | 45 | if (!$MEMBER->current_member_anywhere()) { |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | $ccc[] = $c; |
50 | 50 | } |
51 | 51 | } |
52 | - $criteria = join(' ',$ccc); |
|
52 | + $criteria = join(' ', $ccc); |
|
53 | 53 | $token = $row['alert_id'] . '-' . $row['registrationtoken']; |
54 | - $action = '<form action="/alert/" method="post"><input type="hidden" name="t" value="'.$token.'">'; |
|
54 | + $action = '<form action="/alert/" method="post"><input type="hidden" name="t" value="' . $token . '">'; |
|
55 | 55 | if (!$row['confirmed']) { |
56 | 56 | $action .= '<input type="submit" name="action" value="Confirm">'; |
57 | - } elseif ($row['deleted']==2) { |
|
57 | + } elseif ($row['deleted'] == 2) { |
|
58 | 58 | $action .= '<input type="submit" name="action" value="Resume">'; |
59 | 59 | } else { |
60 | 60 | $action .= '<input type="submit" name="action" value="Suspend"> <input type="submit" name="action" value="Delete">'; |
@@ -45,7 +45,8 @@ discard block |
||
45 | 45 | if (!$MEMBER->current_member_anywhere()) { |
46 | 46 | $current = false; |
47 | 47 | } |
48 | - } else { |
|
48 | + } |
|
49 | + else { |
|
49 | 50 | $ccc[] = $c; |
50 | 51 | } |
51 | 52 | } |
@@ -54,9 +55,11 @@ discard block |
||
54 | 55 | $action = '<form action="/alert/" method="post"><input type="hidden" name="t" value="'.$token.'">'; |
55 | 56 | if (!$row['confirmed']) { |
56 | 57 | $action .= '<input type="submit" name="action" value="Confirm">'; |
57 | - } elseif ($row['deleted']==2) { |
|
58 | + } |
|
59 | + elseif ($row['deleted']==2) { |
|
58 | 60 | $action .= '<input type="submit" name="action" value="Resume">'; |
59 | - } else { |
|
61 | + } |
|
62 | + else { |
|
60 | 63 | $action .= '<input type="submit" name="action" value="Suspend"> <input type="submit" name="action" value="Delete">'; |
61 | 64 | } |
62 | 65 | $action .= '</form>'; |
@@ -67,7 +70,8 @@ discard block |
||
67 | 70 | } |
68 | 71 | if ($out) { |
69 | 72 | print '<table cellpadding="3" cellspacing="0"><tr><th>Criteria</th><th>Action</th></tr>' . $out . '</table>'; |
70 | - } else { |
|
73 | + } |
|
74 | + else { |
|
71 | 75 | print '<p>You currently have no email alerts set up. You can create alerts <a href="/alert/">here</a>.</p>'; |
72 | 76 | } |
73 | 77 | } |
@@ -28,19 +28,24 @@ discard block |
||
28 | 28 | if (!$smallonly && is_file(BASEDIR . '/images/mpsL/' . $pid . '.jpeg')) { |
29 | 29 | $image = IMAGEPATH . 'mpsL/' . $pid . '.jpeg'; |
30 | 30 | $sz = 'L'; |
31 | - } elseif (!$smallonly && is_file(BASEDIR . '/images/mpsL/' . $pid . '.jpg')) { |
|
31 | + } |
|
32 | + elseif (!$smallonly && is_file(BASEDIR . '/images/mpsL/' . $pid . '.jpg')) { |
|
32 | 33 | $image = IMAGEPATH . 'mpsL/' . $pid . '.jpg'; |
33 | 34 | $sz = 'L'; |
34 | - } elseif (!$smallonly && is_file(BASEDIR . '/images/mpsL/' . $pid . '.png')) { |
|
35 | + } |
|
36 | + elseif (!$smallonly && is_file(BASEDIR . '/images/mpsL/' . $pid . '.png')) { |
|
35 | 37 | $image = IMAGEPATH . 'mpsL/' . $pid . '.png'; |
36 | 38 | $sz = 'L'; |
37 | - } elseif (is_file(BASEDIR . '/images/mps/' . $pid . '.jpeg')) { |
|
39 | + } |
|
40 | + elseif (is_file(BASEDIR . '/images/mps/' . $pid . '.jpeg')) { |
|
38 | 41 | $image = IMAGEPATH . 'mps/' . $pid . '.jpeg'; |
39 | 42 | $sz = 'S'; |
40 | - } elseif (is_file(BASEDIR . '/images/mps/' . $pid . '.jpg')) { |
|
43 | + } |
|
44 | + elseif (is_file(BASEDIR . '/images/mps/' . $pid . '.jpg')) { |
|
41 | 45 | $image = IMAGEPATH . 'mps/' . $pid . '.jpg'; |
42 | 46 | $sz = 'S'; |
43 | - } elseif (is_file(BASEDIR . '/images/mps/' . $pid . '.png')) { |
|
47 | + } |
|
48 | + elseif (is_file(BASEDIR . '/images/mps/' . $pid . '.png')) { |
|
44 | 49 | $image = IMAGEPATH . 'mps/' . $pid . '.png'; |
45 | 50 | $sz = 'S'; |
46 | 51 | } |
@@ -50,14 +55,17 @@ discard block |
||
50 | 55 | if ($smallonly) { |
51 | 56 | if ($substitute_missing === "lord") { |
52 | 57 | $image = IMAGEPATH . "unknownlord.png"; |
53 | - } else { |
|
58 | + } |
|
59 | + else { |
|
54 | 60 | $image = IMAGEPATH . "unknownperson.png"; |
55 | 61 | } |
56 | 62 | $sz = 'S'; |
57 | - } else { |
|
63 | + } |
|
64 | + else { |
|
58 | 65 | if ($substitute_missing === "lord") { |
59 | 66 | $image = IMAGEPATH . "unknownlord_large.png"; |
60 | - } else { |
|
67 | + } |
|
68 | + else { |
|
61 | 69 | $image = IMAGEPATH . "unknownperson_large.png"; |
62 | 70 | } |
63 | 71 | $sz = 'L'; |
@@ -91,7 +91,7 @@ |
||
91 | 91 | } else { |
92 | 92 | $title = $e['title']; |
93 | 93 | if ($pid = $e['person_id']) { |
94 | - $MEMBER = new \MEMBER(array( 'person_id' => $pid )); |
|
94 | + $MEMBER = new \MEMBER(array('person_id' => $pid)); |
|
95 | 95 | $name = $MEMBER->full_name(); |
96 | 96 | $title .= " – <a href='/mp/?p=$pid'>$name</a>"; |
97 | 97 | } |
@@ -31,7 +31,8 @@ discard block |
||
31 | 31 | if (!$q->rows()) { |
32 | 32 | if ($date >= date('Y-m-d')) { |
33 | 33 | $PAGE->error_message('There is currently no information available for that date.', false, 404); |
34 | - } else { |
|
34 | + } |
|
35 | + else { |
|
35 | 36 | $PAGE->error_message('There is no information available for that date.', false, 404); |
36 | 37 | } |
37 | 38 | |
@@ -53,7 +54,8 @@ discard block |
||
53 | 54 | |
54 | 55 | if (strstr($e['chamber'], 'Select Committee')) { |
55 | 56 | print '<dt class="sc" id="cal' . $e['id'] . '">'; |
56 | - } else { |
|
57 | + } |
|
58 | + else { |
|
57 | 59 | print '<li id="cal' . $e['id'] . '">'; |
58 | 60 | } |
59 | 61 | |
@@ -65,7 +67,8 @@ discard block |
||
65 | 67 | |
66 | 68 | if (strstr($e['chamber'], 'Select Committee')) { |
67 | 69 | print "</dt>\n"; |
68 | - } else { |
|
70 | + } |
|
71 | + else { |
|
69 | 72 | print "</li>\n"; |
70 | 73 | } |
71 | 74 | |
@@ -83,12 +86,15 @@ discard block |
||
83 | 86 | if ($e['committee_name']) { |
84 | 87 | $title = $e['committee_name']; |
85 | 88 | if ($e['title'] == 'to consider the Bill') { |
86 | - } elseif ($e['title'] && $e['title'] != 'This is a private meeting.') { |
|
89 | + } |
|
90 | + elseif ($e['title'] && $e['title'] != 'This is a private meeting.') { |
|
87 | 91 | $title .= ': ' . $e['title']; |
88 | - } else { |
|
92 | + } |
|
93 | + else { |
|
89 | 94 | $private = true; |
90 | 95 | } |
91 | - } else { |
|
96 | + } |
|
97 | + else { |
|
92 | 98 | $title = $e['title']; |
93 | 99 | if ($pid = $e['person_id']) { |
94 | 100 | $MEMBER = new \MEMBER(array( 'person_id' => $pid )); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | public function getDataSet() |
13 | 13 | { |
14 | - return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/api.xml'); |
|
14 | + return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/api.xml'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | private function fetch_page($method, $vars = array()) |
@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | public function getDataSet() |
13 | 13 | { |
14 | - return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/topics.xml'); |
|
14 | + return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/topics.xml'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | private function fetch_topics_page($vars) |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function getDataSet() |
13 | 13 | { |
14 | - return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/alertspage.xml'); |
|
14 | + return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/alertspage.xml'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | private function fetch_page($vars) |
@@ -21,37 +21,37 @@ discard block |
||
21 | 21 | |
22 | 22 | public function testFetchPage() |
23 | 23 | { |
24 | - $page = $this->fetch_page( array() ); |
|
24 | + $page = $this->fetch_page(array()); |
|
25 | 25 | $this->assertContains('TheyWorkForYou Email Alerts', $page); |
26 | 26 | } |
27 | 27 | |
28 | 28 | public function testKeywordOnly() { |
29 | - $page = $this->fetch_page( array( 'alertsearch' => 'elephant') ); |
|
29 | + $page = $this->fetch_page(array('alertsearch' => 'elephant')); |
|
30 | 30 | $this->assertContains('Receive alerts when [elephant] is mentioned', $page); |
31 | 31 | } |
32 | 32 | |
33 | 33 | public function testPostCodeOnly() { |
34 | - $page = $this->fetch_page( array( 'alertsearch' => 'SE17 3HE') ); |
|
34 | + $page = $this->fetch_page(array('alertsearch' => 'SE17 3HE')); |
|
35 | 35 | $this->assertContains('when Mrs Test Current-MP', $page); |
36 | 36 | } |
37 | 37 | |
38 | 38 | public function testPostCodeWithKeyWord() |
39 | 39 | { |
40 | - $page = $this->fetch_page( array( 'alertsearch' => 'SE17 3HE elephant') ); |
|
40 | + $page = $this->fetch_page(array('alertsearch' => 'SE17 3HE elephant')); |
|
41 | 41 | $this->assertContains('You have used a postcode and something else', $page); |
42 | 42 | $this->assertContains('Mentions of [elephant] by Mrs Test Current-MP', $page); |
43 | 43 | $this->assertNotContains('by your MSP', $page); |
44 | 44 | } |
45 | 45 | |
46 | 46 | public function testScottishPostcodeWithKeyword() { |
47 | - $page = $this->fetch_page( array( 'alertsearch' => 'PH6 2DB elephant') ); |
|
47 | + $page = $this->fetch_page(array('alertsearch' => 'PH6 2DB elephant')); |
|
48 | 48 | $this->assertContains('You have used a postcode and something else', $page); |
49 | 49 | $this->assertContains('Mentions of [elephant] by your MP, Mr Test2 Current-MP', $page); |
50 | 50 | $this->assertContains('Mentions of [elephant] by your MSP, Mrs Test Current-MSP', $page); |
51 | 51 | } |
52 | 52 | |
53 | 53 | public function testPostcodeAndKeywordWithNoSittingMP() { |
54 | - $page = $this->fetch_page( array( 'alertsearch' => 'OX1 4LF elephant') ); |
|
54 | + $page = $this->fetch_page(array('alertsearch' => 'OX1 4LF elephant')); |
|
55 | 55 | $this->assertContains('You have used a postcode and something else', $page); |
56 | 56 | $this->assertNotContains('Did you mean to get alerts for when your MP', $page); |
57 | 57 | } |