@@ -167,8 +167,7 @@ discard block |
||
167 | 167 | $ga = $this->getGeoAnalysis($id, false); |
168 | 168 | |
169 | 169 | $id = Database::commit(); |
170 | - } |
|
171 | - catch(\Exception $ex) { |
|
170 | + } catch(\Exception $ex) { |
|
172 | 171 | Database::rollback(); |
173 | 172 | $ga = null; |
174 | 173 | Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage()); |
@@ -210,8 +209,7 @@ discard block |
||
210 | 209 | $ga = $this->getGeoAnalysis($ga->getId(), false); |
211 | 210 | |
212 | 211 | $id = Database::commit(); |
213 | - } |
|
214 | - catch(\Exception $ex) { |
|
212 | + } catch(\Exception $ex) { |
|
215 | 213 | Database::rollback(); |
216 | 214 | Log::addErrorLog('The Geo Analysis ID “' . $ga->getId() . '” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage()); |
217 | 215 | $ga = null; |
@@ -350,8 +348,7 @@ discard block |
||
350 | 348 | if(!$this->place_hierarchy) { |
351 | 349 | if($place_structure = $this->getPlacesHierarchyFromHeader()) { |
352 | 350 | $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure); |
353 | - } |
|
354 | - else { |
|
351 | + } else { |
|
355 | 352 | $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData()); |
356 | 353 | } |
357 | 354 | } |
@@ -217,39 +217,34 @@ discard block |
||
217 | 217 | $placest = implode(I18N::$list_separator, array_slice($levels, 0, $this->analysis_level)); |
218 | 218 | if(isset($placesDispGeneral['places'][$placest])) { |
219 | 219 | $placesDispGeneral['places'][$placest] += 1; |
220 | - } |
|
221 | - else { |
|
220 | + } else { |
|
222 | 221 | $placesDispGeneral['places'][$placest] = 1; |
223 | 222 | } |
224 | - if($placesDispGeneral['places'][$placest]>$placesDispGeneral['max']) |
|
225 | - $placesDispGeneral['max'] = $placesDispGeneral['places'][$placest]; |
|
223 | + if($placesDispGeneral['places'][$placest]>$placesDispGeneral['max']) { |
|
224 | + $placesDispGeneral['max'] = $placesDispGeneral['places'][$placest]; |
|
225 | + } |
|
226 | 226 | foreach($genstab as $gen) { |
227 | 227 | if(isset($placesDispGenerations[$gen]['places'][$placest])) { |
228 | 228 | $placesDispGenerations[$gen]['places'][$placest] += 1; |
229 | - } |
|
230 | - else { |
|
229 | + } else { |
|
231 | 230 | $placesDispGenerations[$gen]['places'][$placest] = 1; |
232 | 231 | } |
233 | 232 | if(isset($placesDispGenerations[$gen]['sum'])) { |
234 | 233 | $placesDispGenerations[$gen]['sum'] += 1; |
235 | - } |
|
236 | - else { |
|
234 | + } else { |
|
237 | 235 | $placesDispGenerations[$gen]['sum'] = 1; |
238 | 236 | } |
239 | 237 | } |
240 | - } |
|
241 | - else{ |
|
238 | + } else{ |
|
242 | 239 | if(isset($placesDispGeneral['other'])) { |
243 | 240 | $placesDispGeneral['other'] += 1; |
244 | - } |
|
245 | - else { |
|
241 | + } else { |
|
246 | 242 | $placesDispGeneral['other'] = 1; |
247 | 243 | } |
248 | 244 | foreach($genstab as $gen) { |
249 | 245 | if(isset($placesDispGenerations[$gen]['other'])) { |
250 | 246 | $placesDispGenerations[$gen]['other'] += 1; |
251 | - } |
|
252 | - else { |
|
247 | + } else { |
|
253 | 248 | $placesDispGenerations[$gen]['other'] = 1; |
254 | 249 | } |
255 | 250 | } |
@@ -263,8 +258,7 @@ discard block |
||
263 | 258 | foreach($genstab as $gen) { |
264 | 259 | if(isset($placesDispGenerations[$gen]['unknown'])) { |
265 | 260 | $placesDispGenerations[$gen]['unknown'] += 1; |
266 | - } |
|
267 | - else { |
|
261 | + } else { |
|
268 | 262 | $placesDispGenerations[$gen]['unknown'] = 1; |
269 | 263 | } |
270 | 264 | } |
@@ -70,7 +70,9 @@ discard block |
||
70 | 70 | $this->is_loaded = false; |
71 | 71 | $this->subdivisions = array(); |
72 | 72 | $this->mappings = array(); |
73 | - if($load) $this->load(); |
|
73 | + if($load) { |
|
74 | + $this->load(); |
|
75 | + } |
|
74 | 76 | } |
75 | 77 | |
76 | 78 | /** |
@@ -117,7 +119,9 @@ discard block |
||
117 | 119 | foreach($xml->subdivisions->children() as $subdivision){ |
118 | 120 | $attributes = $subdivision->attributes(); |
119 | 121 | $key = trim($attributes['name']); |
120 | - if(isset($attributes['parent'])) $key .= '@'.trim($attributes['parent']); |
|
122 | + if(isset($attributes['parent'])) { |
|
123 | + $key .= '@'.trim($attributes['parent']); |
|
124 | + } |
|
121 | 125 | $this->subdivisions[$key] = array( |
122 | 126 | 'id' => trim($attributes['id']), |
123 | 127 | 'displayname' => trim($attributes['name']), |
@@ -142,7 +146,9 @@ discard block |
||
142 | 146 | * @return string |
143 | 147 | */ |
144 | 148 | public function getFileName() { |
145 | - if(!$this->is_loaded) $this->load(); |
|
149 | + if(!$this->is_loaded) { |
|
150 | + $this->load(); |
|
151 | + } |
|
146 | 152 | return $this->filename; |
147 | 153 | } |
148 | 154 | |
@@ -151,7 +157,9 @@ discard block |
||
151 | 157 | * @return string |
152 | 158 | */ |
153 | 159 | public function getDescription() { |
154 | - if(!$this->is_loaded) $this->load(); |
|
160 | + if(!$this->is_loaded) { |
|
161 | + $this->load(); |
|
162 | + } |
|
155 | 163 | return $this->description; |
156 | 164 | } |
157 | 165 | |
@@ -160,7 +168,9 @@ discard block |
||
160 | 168 | * @return string |
161 | 169 | */ |
162 | 170 | public function getTopLevelName() { |
163 | - if(!$this->is_loaded) $this->load(); |
|
171 | + if(!$this->is_loaded) { |
|
172 | + $this->load(); |
|
173 | + } |
|
164 | 174 | return $this->top_level_name; |
165 | 175 | } |
166 | 176 | |
@@ -169,7 +179,9 @@ discard block |
||
169 | 179 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMapCanvas |
170 | 180 | */ |
171 | 181 | public function getCanvas() { |
172 | - if(!$this->is_loaded) $this->load(); |
|
182 | + if(!$this->is_loaded) { |
|
183 | + $this->load(); |
|
184 | + } |
|
173 | 185 | return $this->canvas; |
174 | 186 | } |
175 | 187 | |
@@ -178,7 +190,9 @@ discard block |
||
178 | 190 | * @return array |
179 | 191 | */ |
180 | 192 | public function getSubdivisions() { |
181 | - if(!$this->is_loaded) $this->load(); |
|
193 | + if(!$this->is_loaded) { |
|
194 | + $this->load(); |
|
195 | + } |
|
182 | 196 | return $this->subdivisions; |
183 | 197 | } |
184 | 198 | |
@@ -187,7 +201,9 @@ discard block |
||
187 | 201 | * @return array |
188 | 202 | */ |
189 | 203 | public function getPlacesMappings() { |
190 | - if(!$this->is_loaded) $this->load(); |
|
204 | + if(!$this->is_loaded) { |
|
205 | + $this->load(); |
|
206 | + } |
|
191 | 207 | return $this->mappings; |
192 | 208 | } |
193 | 209 |
@@ -79,7 +79,9 @@ discard block |
||
79 | 79 | |
80 | 80 | $other_trees = array(); |
81 | 81 | foreach (Tree::getAll() as $tree) { |
82 | - if($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree; |
|
82 | + if($tree->getTreeId() != $WT_TREE->getTreeId()) { |
|
83 | + $other_trees[] = $tree; |
|
84 | + } |
|
83 | 85 | } |
84 | 86 | $data->set('other_trees', $other_trees); |
85 | 87 | |
@@ -182,7 +184,9 @@ discard block |
||
182 | 184 | |
183 | 185 | // Generate an AJAX/JSON response for datatables to load a block of rows |
184 | 186 | $search = Filter::postArray('search'); |
185 | - if($search) $search = $search['value']; |
|
187 | + if($search) { |
|
188 | + $search = $search['value']; |
|
189 | + } |
|
186 | 190 | $start = Filter::postInteger('start'); |
187 | 191 | $length = Filter::postInteger('length'); |
188 | 192 | $order = Filter::postArray('order'); |
@@ -336,8 +340,7 @@ discard block |
||
336 | 340 | if($use_map) { |
337 | 341 | $options->setMap(new OutlineMap($map_file)); |
338 | 342 | $options->setMapLevel($map_top_level + 1); |
339 | - } |
|
340 | - else { |
|
343 | + } else { |
|
341 | 344 | $options->setMap(null); |
342 | 345 | } |
343 | 346 | } |
@@ -348,8 +351,7 @@ discard block |
||
348 | 351 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$res->getId().'” has been updated.'); |
349 | 352 | $ga = $res; |
350 | 353 | $success = true; |
351 | - } |
|
352 | - else { |
|
354 | + } else { |
|
353 | 355 | FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger'); |
354 | 356 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.'); |
355 | 357 | } |
@@ -367,8 +369,7 @@ discard block |
||
367 | 369 | FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully added.', $ga->getTitle()), 'success'); |
368 | 370 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” has been added.'); |
369 | 371 | $success = true; |
370 | - } |
|
371 | - else { |
|
372 | + } else { |
|
372 | 373 | FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger'); |
373 | 374 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.'); |
374 | 375 | } |
@@ -378,8 +379,7 @@ discard block |
||
378 | 379 | if(!$success) { |
379 | 380 | if($ga) { |
380 | 381 | $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl(); |
381 | - } |
|
382 | - else { |
|
382 | + } else { |
|
383 | 383 | $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl(); |
384 | 384 | } |
385 | 385 | } |
@@ -437,7 +437,9 @@ discard block |
||
437 | 437 | $data->set('map_list', $map_list); |
438 | 438 | |
439 | 439 | $gen_details = array(0 => I18N::translate('All')); |
440 | - for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
440 | + for($i = 1; $i <= 10 ; $i++) { |
|
441 | + $gen_details[$i] = $i; |
|
442 | + } |
|
441 | 443 | $data->set('generation_details', $gen_details); |
442 | 444 | |
443 | 445 | ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
@@ -54,7 +54,10 @@ |
||
54 | 54 | <?php echo I18N::translate('Description'); ?> |
55 | 55 | </label> |
56 | 56 | <div class="col-sm-9"> |
57 | - <input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php if(!$is_new) echo 'value="' . Filter::escapeHtml($ga->getTitle()) .'"'; ?> dir="auto"> |
|
57 | + <input class="form-control" type="text" id="description" name="description" required maxlength="70" <?php if(!$is_new) { |
|
58 | + echo 'value="' . Filter::escapeHtml($ga->getTitle()) .'"'; |
|
59 | +} |
|
60 | +?> dir="auto"> |
|
58 | 61 | <p class="small text-muted"> |
59 | 62 | <?php echo I18N::translate('Description to be given to the geographical dispersion analysis. It will be used as the page title for it.'); ?> |
60 | 63 | </p> |
@@ -65,8 +65,7 @@ discard block |
||
65 | 65 | if(!is_null($max_details_gen) && $max_details_gen == 0){ |
66 | 66 | $html .= I18N::translate('<strong><em>Place</em> or <em>Flag</em> aa (bb %%)</strong>: The first number indicates the total number of ancestors born in this place, the percentage relates this count to the total number of found places. No percentage means it is less than 10%%.').'<br />'; |
67 | 67 | $html .= I18N::translate('If any, the darker area indicates the number of unknown places within the generation or places outside the analysed area, and its percentage compared to the number of ancestors. No percentage means it is less than 10%%.'); |
68 | - } |
|
69 | - else{ |
|
68 | + } else{ |
|
70 | 69 | $html .= I18N::translate('<strong><em>Place</em> [aa - bb %%]</strong>: The first number indicates the total number of ancestors born in this place, the percentage compares this count to the total number of found places.').'<br />'; |
71 | 70 | $html .= I18N::translate('Only the %d more frequent places for each generation are displayed.', $max_details_gen); |
72 | 71 | } |
@@ -97,16 +96,16 @@ discard block |
||
97 | 96 | $content = ''; |
98 | 97 | if(isset($dataplace['flag'])){ |
99 | 98 | $content .= '<td class="geodispersion_flag">'. FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']) .'</td><td>'; |
100 | - } |
|
101 | - else{ |
|
99 | + } else{ |
|
102 | 100 | $content .= '<td><span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span><br/>'; |
103 | 101 | } |
104 | 102 | $count = $dataplace['count']; |
105 | 103 | $content .= I18N::number($count); |
106 | 104 | $perc = Functions::safeDivision($count, $sum_gen + $unknownother); |
107 | 105 | $perc2= Functions::safeDivision($count, $sum_gen); |
108 | - if($perc2>=0.1) |
|
109 | - $content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>'; |
|
106 | + if($perc2>=0.1) { |
|
107 | + $content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>'; |
|
108 | + } |
|
110 | 109 | $content .= '</td>'; |
111 | 110 | |
112 | 111 | $html .= ' |
@@ -126,7 +125,9 @@ discard block |
||
126 | 125 | if($unknownother>0){ |
127 | 126 | $perc= Functions::safeDivision($unknownother, $sum_gen + $unknownother); |
128 | 127 | $html .='<td class="geodispersion_unknownitem left" >'.I18N::number($unknownother); |
129 | - if($perc>=0.1) $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>'; |
|
128 | + if($perc>=0.1) { |
|
129 | + $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>'; |
|
130 | + } |
|
130 | 131 | $html .='</td>'; |
131 | 132 | } |
132 | 133 | |
@@ -152,8 +153,7 @@ discard block |
||
152 | 153 | if($placename != 'other'){ |
153 | 154 | $levels = array_map('trim',explode(',', $placename)); |
154 | 155 | $placename = '<span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span>'; |
155 | - } |
|
156 | - else{ |
|
156 | + } else{ |
|
157 | 157 | $placename = I18N::translate('Other places'); |
158 | 158 | } |
159 | 159 | $tmp_places[] = I18N::translate('<strong>%s</strong> [%d - %s]', $placename, $count, I18N::percentage(Functions::safeDivision($count, $sum_gen + $other), 1)); |
@@ -86,7 +86,9 @@ |
||
86 | 86 | $html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);'; |
87 | 87 | if(isset($location['transparency'])) { |
88 | 88 | $textToolTip = '<strong>'.$location['displayname'].'</strong><br/>'; |
89 | - if($this->data->get('use_flags') && $location['flag'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>'; |
|
89 | + if($this->data->get('use_flags') && $location['flag'] != '') { |
|
90 | + $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>'; |
|
91 | + } |
|
90 | 92 | $textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1); |
91 | 93 | $html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");'; |
92 | 94 | $html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });'; |
@@ -37,14 +37,15 @@ |
||
37 | 37 | $perc = Functions::safeDivision($nb, $nb_found - $nb_other); |
38 | 38 | if($nb!=$previous_nb){ |
39 | 39 | $j= I18N::number($i); |
40 | - } |
|
41 | - else{ |
|
40 | + } else{ |
|
42 | 41 | $j=' '; |
43 | 42 | } |
44 | 43 | |
45 | 44 | $levels = array_map('trim',explode(',', $place)); |
46 | 45 | $placename = $levels[$analysis_level-1]; |
47 | - if($placename == '' && $analysis_level > 1) $placename = I18N::translate('Unknown (%s)', $levels[$analysis_level-2]); |
|
46 | + if($placename == '' && $analysis_level > 1) { |
|
47 | + $placename = I18N::translate('Unknown (%s)', $levels[$analysis_level-2]); |
|
48 | + } |
|
48 | 49 | $html.= |
49 | 50 | '<div class="maj-row"> |
50 | 51 | <div class="label"><strong>'.$j.'</strong></div> |
@@ -146,14 +146,15 @@ discard block |
||
146 | 146 | $this->provider->setGeoAnalysisStatus($ga, $status); |
147 | 147 | $res['status'] = $status; |
148 | 148 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
149 | - } |
|
150 | - catch (\Exception $ex) { |
|
149 | + } catch (\Exception $ex) { |
|
151 | 150 | $res['error'] = $ex->getMessage(); |
152 | 151 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
153 | 152 | } |
154 | 153 | |
155 | 154 | $controller->pageHeader(); |
156 | - if($res['error']) http_response_code(500); |
|
155 | + if($res['error']) { |
|
156 | + http_response_code(500); |
|
157 | + } |
|
157 | 158 | |
158 | 159 | echo \Zend_Json::encode($res); |
159 | 160 | } |
@@ -179,14 +180,15 @@ discard block |
||
179 | 180 | try{ |
180 | 181 | $this->provider->deleteGeoAnalysis($ga); |
181 | 182 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
182 | - } |
|
183 | - catch (\Exception $ex) { |
|
183 | + } catch (\Exception $ex) { |
|
184 | 184 | $res['error'] = $ex->getMessage(); |
185 | 185 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
186 | 186 | } |
187 | 187 | |
188 | 188 | $controller->pageHeader(); |
189 | - if($res['error']) http_response_code(500); |
|
189 | + if($res['error']) { |
|
190 | + http_response_code(500); |
|
191 | + } |
|
190 | 192 | |
191 | 193 | echo \Zend_Json::encode($res); |
192 | 194 | } |
@@ -242,7 +244,9 @@ discard block |
||
242 | 244 | |
243 | 245 | $nb_found = $placesGeneralResults['knownsum']; |
244 | 246 | $nb_other = 0; |
245 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
247 | + if(isset($placesGeneralResults['other'])) { |
|
248 | + $nb_other =$placesGeneralResults['other']; |
|
249 | + } |
|
246 | 250 | $nb_unknown = $placesGeneralResults['unknown']; |
247 | 251 | |
248 | 252 | $data->set('stats_gen_nb_found', $nb_found); |
@@ -264,11 +268,12 @@ discard block |
||
264 | 268 | if($level_map >= 0 && $level_map < count($levelvalues)) { |
265 | 269 | $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
266 | 270 | if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
267 | - } |
|
268 | - else { |
|
271 | + } else { |
|
269 | 272 | $levelref = $levelvalues[0]; |
270 | 273 | } |
271 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
274 | + if(isset($places_mappings[$levelref])) { |
|
275 | + $levelref = $places_mappings[$levelref]; |
|
276 | + } |
|
272 | 277 | if(isset($results_by_subdivs[$levelref])) { |
273 | 278 | $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
274 | 279 | $count_subd += $count; |
@@ -285,8 +290,7 @@ discard block |
||
285 | 290 | $data->set('results_by_subdivisions', $results_by_subdivs); |
286 | 291 | |
287 | 292 | $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
288 | - } |
|
289 | - else { |
|
293 | + } else { |
|
290 | 294 | $results = $placesGeneralResults['places']; |
291 | 295 | arsort($results); |
292 | 296 | $data->set('results', $results); |
@@ -294,8 +298,7 @@ discard block |
||
294 | 298 | |
295 | 299 | $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
296 | 300 | } |
297 | - } |
|
298 | - else { |
|
301 | + } else { |
|
299 | 302 | $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
300 | 303 | } |
301 | 304 | return $html; |
@@ -330,9 +333,15 @@ discard block |
||
330 | 333 | $sum = 0; |
331 | 334 | $other = 0; |
332 | 335 | $unknown = 0; |
333 | - if(isset($genData['sum'])) $sum = $genData['sum']; |
|
334 | - if(isset($genData['other'])) $other = $genData['other']; |
|
335 | - if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
336 | + if(isset($genData['sum'])) { |
|
337 | + $sum = $genData['sum']; |
|
338 | + } |
|
339 | + if(isset($genData['other'])) { |
|
340 | + $other = $genData['other']; |
|
341 | + } |
|
342 | + if(isset($genData['unknown'])) { |
|
343 | + $unknown = $genData['unknown']; |
|
344 | + } |
|
336 | 345 | |
337 | 346 | if($sum > 0) { |
338 | 347 | $results_by_gen[$gen]['sum'] = $sum; |
@@ -351,8 +360,7 @@ discard block |
||
351 | 360 | $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
352 | 361 | } |
353 | 362 | } |
354 | - } |
|
355 | - else { |
|
363 | + } else { |
|
356 | 364 | $tmp = $genData['places']; |
357 | 365 | if($other > 0) { |
358 | 366 | $tmp = array_slice($tmp, 0, 5, true); |
@@ -368,8 +376,7 @@ discard block |
||
368 | 376 | |
369 | 377 | $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
370 | 378 | |
371 | - } |
|
372 | - else { |
|
379 | + } else { |
|
373 | 380 | $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
374 | 381 | } |
375 | 382 | return $html; |