@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | $data->set('title', $controller->getPageTitle()); |
72 | 72 | $data->set('tree', $WT_TREE); |
73 | 73 | |
74 | - $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'); |
|
74 | + $data->set('root_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig'); |
|
75 | 75 | |
76 | - $table_id = 'table-geoanalysis-' . Uuid::uuid4(); |
|
76 | + $table_id = 'table-geoanalysis-'.Uuid::uuid4(); |
|
77 | 77 | $data->set('table_id', $table_id); |
78 | 78 | |
79 | 79 | $other_trees = array(); |
80 | 80 | foreach (Tree::getAll() as $tree) { |
81 | - if($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree; |
|
81 | + if ($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree; |
|
82 | 82 | } |
83 | 83 | $data->set('other_trees', $other_trees); |
84 | 84 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | processing: true, |
102 | 102 | serverSide : true, |
103 | 103 | ajax : { |
104 | - url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonGeoAnalysisList&ged='. $WT_TREE->getNameUrl().'", |
|
104 | + url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonGeoAnalysisList&ged='.$WT_TREE->getNameUrl().'", |
|
105 | 105 | type : "POST" |
106 | 106 | }, |
107 | 107 | columns: [ |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | url: "module.php", |
126 | 126 | type: "GET", |
127 | 127 | data: { |
128 | - mod: "' . $this->module->getName() .'", |
|
128 | + mod: "' . $this->module->getName().'", |
|
129 | 129 | mod_action: "GeoAnalysis@setStatus", |
130 | 130 | ga_id: ga_id, |
131 | 131 | ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom, |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | }, |
134 | 134 | error: function(result, stat, error) { |
135 | 135 | var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error; |
136 | - alert("' . I18N::translate('An error occured while editing this analysis:') . '" + err); |
|
136 | + alert("' . I18N::translate('An error occured while editing this analysis:').'" + err); |
|
137 | 137 | }, |
138 | 138 | complete: function(result, stat) { |
139 | 139 | geoAnalysisTable.ajax.reload(null, false); |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | url: "module.php", |
147 | 147 | type: "GET", |
148 | 148 | data: { |
149 | - mod: "' . $this->module->getName() .'", |
|
149 | + mod: "' . $this->module->getName().'", |
|
150 | 150 | mod_action: "GeoAnalysis@delete", |
151 | 151 | ga_id: ga_id, |
152 | 152 | ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom |
153 | 153 | }, |
154 | 154 | error: function(result, stat, error) { |
155 | 155 | var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error; |
156 | - alert("' . I18N::translate('An error occured while deleting this analysis:') . '" + err); |
|
156 | + alert("' . I18N::translate('An error occured while deleting this analysis:').'" + err); |
|
157 | 157 | }, |
158 | 158 | complete: function(result, stat) { |
159 | 159 | geoAnalysisTable.ajax.reload(null, false); |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | |
179 | 179 | // Generate an AJAX/JSON response for datatables to load a block of rows |
180 | 180 | $search = Filter::postArray('search'); |
181 | - if($search) $search = $search['value']; |
|
181 | + if ($search) $search = $search['value']; |
|
182 | 182 | $start = Filter::postInteger('start'); |
183 | 183 | $length = Filter::postInteger('length'); |
184 | 184 | $order = Filter::postArray('order'); |
185 | 185 | |
186 | - foreach($order as $key => &$value) { |
|
187 | - switch($value['column']) { |
|
186 | + foreach ($order as $key => &$value) { |
|
187 | + switch ($value['column']) { |
|
188 | 188 | case 3: |
189 | 189 | $value['column'] = 'majgd_descr'; |
190 | 190 | break; |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | |
206 | 206 | $data = array(); |
207 | 207 | $place_hierarchy = $this->provider->getPlacesHierarchy(); |
208 | - foreach($list as $ga) { |
|
208 | + foreach ($list as $ga) { |
|
209 | 209 | /** @var GeoAnalysis $ga */ |
210 | 210 | |
211 | 211 | $datum = array(); |
212 | - $options= $ga->getOptions(); |
|
212 | + $options = $ga->getOptions(); |
|
213 | 213 | |
214 | 214 | $datum[0] = ' |
215 | 215 | <div class="btn-group"> |
@@ -219,50 +219,48 @@ discard block |
||
219 | 219 | <ul class="dropdown-menu" role="menu"> |
220 | 220 | <li> |
221 | 221 | <a href="#" onclick="return set_geoanalysis_status('. $ga->getId().', '.($ga->isEnabled() ? 'false' : 'true').', \''.Filter::escapeJs($WT_TREE->getName()).'\');"> |
222 | - <i class="fa fa-fw '.($ga->isEnabled() ? 'fa-times' : 'fa-check').'"></i> ' . ($ga->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')) . ' |
|
222 | + <i class="fa fa-fw '.($ga->isEnabled() ? 'fa-times' : 'fa-check').'"></i> '.($ga->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')).' |
|
223 | 223 | </a> |
224 | 224 | </li> |
225 | 225 | <li> |
226 | 226 | <a href="module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@edit&ga_id='.$ga->getId().'&ged='.$WT_TREE->getName().'"> |
227 | - <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit') . ' |
|
227 | + <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit').' |
|
228 | 228 | </a> |
229 | 229 | </li> |
230 | 230 | <li class="divider" /> |
231 | 231 | <li> |
232 | 232 | <a href="#" onclick="return delete_geoanalysis('. $ga->getId().', \''.Filter::escapeJs($WT_TREE->getName()).'\');"> |
233 | - <i class="fa fa-fw fa-trash-o"></i> ' . I18N::translate('Delete') . ' |
|
233 | + <i class="fa fa-fw fa-trash-o"></i> ' . I18N::translate('Delete').' |
|
234 | 234 | </a> |
235 | 235 | </li> |
236 | 236 | </ul> |
237 | 237 | </div>'; |
238 | 238 | $datum[1] = $ga->getId(); |
239 | 239 | $datum[2] = $ga->isEnabled() ? |
240 | - '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : |
|
241 | - '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
|
240 | + '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
|
242 | 241 | $datum[3] = $ga->getTitle(); |
243 | 242 | $analysis_level = $ga->getAnalysisLevel(); |
244 | - if($place_hierarchy['type'] == 'header') { |
|
243 | + if ($place_hierarchy['type'] == 'header') { |
|
245 | 244 | $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1]; |
246 | 245 | } else { |
247 | - $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')'; |
|
246 | + $datum[4] = $analysis_level.'('.$place_hierarchy['hierarchy'][$analysis_level - 1].')'; |
|
248 | 247 | } |
249 | 248 | $datum[5] = $ga->getAnalysisLevel(); |
250 | 249 | $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
251 | 250 | $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
252 | - if($ga->hasMap()) { |
|
251 | + if ($ga->hasMap()) { |
|
253 | 252 | $datum[6] = $options->getMap()->getDescription(); |
254 | - $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />'; |
|
253 | + $datum[7] = '<span data-toggle="tooltip" title="'.$options->getMap()->getTopLevelName().'" />'; |
|
255 | 254 | $top_level = $options->getMapLevel(); |
256 | - if($place_hierarchy['type'] == 'header') { |
|
255 | + if ($place_hierarchy['type'] == 'header') { |
|
257 | 256 | $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1]; |
258 | 257 | } else { |
259 | - $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')'; |
|
258 | + $datum[7] .= $top_level.'('.$place_hierarchy['hierarchy'][$top_level - 1].')'; |
|
260 | 259 | } |
261 | 260 | $datum[7] .= '</span>'; |
262 | 261 | } |
263 | 262 | $datum[8] = $options->isUsingFlags() ? |
264 | - '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : |
|
265 | - '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
|
263 | + '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
|
266 | 264 | $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All'); |
267 | 265 | |
268 | 266 | $data[] = $datum; |
@@ -312,24 +310,24 @@ discard block |
||
312 | 310 | $description = Filter::post('description'); |
313 | 311 | $analysislevel = Filter::postInteger('analysislevel'); |
314 | 312 | $use_map = Filter::postBool('use_map'); |
315 | - if($use_map) { |
|
313 | + if ($use_map) { |
|
316 | 314 | $map_file = base64_decode(Filter::post('map_file')); |
317 | - $map_top_level = Filter::postInteger('map_top_level'); |
|
315 | + $map_top_level = Filter::postInteger('map_top_level'); |
|
318 | 316 | } |
319 | 317 | $use_flags = Filter::postBool('use_flags'); |
320 | 318 | $gen_details = Filter::postInteger('gen_details'); |
321 | 319 | |
322 | 320 | $success = false; |
323 | - if($ga_id) { |
|
321 | + if ($ga_id) { |
|
324 | 322 | $ga = $this->provider->getGeoAnalysis($ga_id, false); |
325 | - if($ga) { |
|
323 | + if ($ga) { |
|
326 | 324 | $ga->setTitle($description); |
327 | 325 | $ga->setAnalysisLevel($analysislevel + 1); |
328 | 326 | $options = $ga->getOptions(); |
329 | - if($options) { |
|
327 | + if ($options) { |
|
330 | 328 | $options->setUsingFlags($use_flags); |
331 | 329 | $options->setMaxDetailsInGen($gen_details); |
332 | - if($use_map) { |
|
330 | + if ($use_map) { |
|
333 | 331 | $options->setMap(new OutlineMap($map_file)); |
334 | 332 | $options->setMapLevel($map_top_level + 1); |
335 | 333 | } |
@@ -339,7 +337,7 @@ discard block |
||
339 | 337 | } |
340 | 338 | |
341 | 339 | $res = $this->provider->updateGeoAnalysis($ga); |
342 | - if($res) { |
|
340 | + if ($res) { |
|
343 | 341 | FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully updated', $res->getTitle()), 'success'); |
344 | 342 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$res->getId().'” has been updated.'); |
345 | 343 | $ga = $res; |
@@ -347,7 +345,7 @@ discard block |
||
347 | 345 | } |
348 | 346 | else { |
349 | 347 | FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger'); |
350 | - Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.'); |
|
348 | + Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” could not be updated. See error log.'); |
|
351 | 349 | } |
352 | 350 | } |
353 | 351 | } else { |
@@ -359,7 +357,7 @@ discard block |
||
359 | 357 | $use_flags, |
360 | 358 | $gen_details |
361 | 359 | ); |
362 | - if($ga) { |
|
360 | + if ($ga) { |
|
363 | 361 | FlashMessages::addMessage(I18N::translate('The geographical dispersion analysis “%s” has been successfully added.', $ga->getTitle()), 'success'); |
364 | 362 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'.$ga->getId().'” has been added.'); |
365 | 363 | $success = true; |
@@ -370,16 +368,16 @@ discard block |
||
370 | 368 | } |
371 | 369 | } |
372 | 370 | |
373 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl(); |
|
374 | - if(!$success) { |
|
375 | - if($ga) { |
|
376 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl(); |
|
371 | + $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$WT_TREE->getNameUrl(); |
|
372 | + if (!$success) { |
|
373 | + if ($ga) { |
|
374 | + $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@edit&ga_id='.$ga->getId().'&ged='.$WT_TREE->getNameUrl(); |
|
377 | 375 | } |
378 | 376 | else { |
379 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl(); |
|
377 | + $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@add&ged='.$WT_TREE->getNameUrl(); |
|
380 | 378 | } |
381 | 379 | } |
382 | - header('Location: ' . WT_BASE_URL . $redirection_url); |
|
380 | + header('Location: '.WT_BASE_URL.$redirection_url); |
|
383 | 381 | |
384 | 382 | } |
385 | 383 | |
@@ -410,7 +408,7 @@ discard block |
||
410 | 408 | '); |
411 | 409 | |
412 | 410 | $data = new ViewBag(); |
413 | - if($ga) { |
|
411 | + if ($ga) { |
|
414 | 412 | $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis')); |
415 | 413 | $data->set('geo_analysis', $ga); |
416 | 414 | } else { |
@@ -418,9 +416,9 @@ discard block |
||
418 | 416 | } |
419 | 417 | |
420 | 418 | $data->set('title', $controller->getPageTitle()); |
421 | - $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
|
419 | + $data->set('admin_config_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$WT_TREE->getNameUrl()); |
|
422 | 420 | $data->set('module_title', $this->module->getTitle()); |
423 | - $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl()); |
|
421 | + $data->set('save_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@save&ged='.$WT_TREE->getNameUrl()); |
|
424 | 422 | $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
425 | 423 | |
426 | 424 | $map_list = array_map( |
@@ -433,7 +431,7 @@ discard block |
||
433 | 431 | $data->set('map_list', $map_list); |
434 | 432 | |
435 | 433 | $gen_details = array(0 => I18N::translate('All')); |
436 | - for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
434 | + for ($i = 1; $i <= 10; $i++) $gen_details[$i] = $i; |
|
437 | 435 | $data->set('generation_details', $gen_details); |
438 | 436 | |
439 | 437 | ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $ga_id = Filter::getInteger('ga_id'); |
71 | 71 | |
72 | - if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
72 | + if ($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
73 | 73 | $data->set('has_analysis', true); |
74 | 74 | $data->set('geoanalysis', $ga); |
75 | 75 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | jQuery.get( |
83 | 83 | "module.php", |
84 | 84 | { |
85 | - "mod" : "'. $this->module->getName() .'", |
|
85 | + "mod" : "'. $this->module->getName().'", |
|
86 | 86 | "mod_action": "GeoAnalysis@dataTabs", |
87 | 87 | "ga_id" : "'.$ga_id.'" |
88 | 88 | }, |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $data->set('has_list', false); |
115 | 115 | |
116 | 116 | $ga_list = $this->provider->getGeoAnalysisList(); |
117 | - if(count($ga_list) > 0 ) { |
|
117 | + if (count($ga_list) > 0) { |
|
118 | 118 | $data->set('has_list', true); |
119 | 119 | $data->set('geoanalysislist', $ga_list); |
120 | 120 | } |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | ); |
141 | 141 | |
142 | 142 | $status = Filter::getBool('status'); |
143 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
144 | - try{ |
|
143 | + $res = array('geoanalysis' => $ga->getId(), 'error' => null); |
|
144 | + try { |
|
145 | 145 | $this->provider->setGeoAnalysisStatus($ga, $status); |
146 | 146 | $res['status'] = $status; |
147 | - Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
|
147 | + Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '.($status ? 'enabled' : 'disabled').'.'); |
|
148 | 148 | } |
149 | 149 | catch (\Exception $ex) { |
150 | 150 | $res['error'] = $ex->getMessage(); |
151 | - Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
|
151 | + Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be '.($status ? 'enabled' : 'disabled').'. Error: '.$ex->getMessage()); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | $controller->pageHeader(); |
155 | - if($res['error']) http_response_code(500); |
|
155 | + if ($res['error']) http_response_code(500); |
|
156 | 156 | |
157 | 157 | $controller->encode($res); |
158 | 158 | } |
@@ -174,18 +174,18 @@ discard block |
||
174 | 174 | && $ga |
175 | 175 | ); |
176 | 176 | |
177 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
178 | - try{ |
|
177 | + $res = array('geoanalysis' => $ga->getId(), 'error' => null); |
|
178 | + try { |
|
179 | 179 | $this->provider->deleteGeoAnalysis($ga); |
180 | 180 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
181 | 181 | } |
182 | 182 | catch (\Exception $ex) { |
183 | 183 | $res['error'] = $ex->getMessage(); |
184 | - Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
|
184 | + Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '.$ex->getMessage()); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | $controller->pageHeader(); |
188 | - if($res['error']) http_response_code(500); |
|
188 | + if ($res['error']) http_response_code(500); |
|
189 | 189 | |
190 | 190 | $controller->encode($res); |
191 | 191 | } |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
212 | 212 | |
213 | 213 | $flags = array(); |
214 | - if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
214 | + if ($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
215 | 215 | $mapProvider = new GoogleMapsProvider(); |
216 | - foreach($placesDispGeneral['places'] as $place => $count) { |
|
216 | + foreach ($placesDispGeneral['places'] as $place => $count) { |
|
217 | 217 | $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
218 | 218 | } |
219 | 219 | } |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | * @param (null|array) $flags Array of flags |
233 | 233 | * @return string HTML code for the general tab |
234 | 234 | */ |
235 | - protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
235 | + protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags = null) { |
|
236 | 236 | global $WT_TREE; |
237 | 237 | |
238 | - if(!empty($placesGeneralResults)){ |
|
238 | + if (!empty($placesGeneralResults)) { |
|
239 | 239 | $data = new ViewBag(); |
240 | 240 | |
241 | 241 | $nb_found = $placesGeneralResults['knownsum']; |
242 | 242 | $nb_other = 0; |
243 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
243 | + if (isset($placesGeneralResults['other'])) $nb_other = $placesGeneralResults['other']; |
|
244 | 244 | $nb_unknown = $placesGeneralResults['unknown']; |
245 | 245 | |
246 | 246 | $data->set('stats_gen_nb_found', $nb_found); |
@@ -249,28 +249,28 @@ discard block |
||
249 | 249 | |
250 | 250 | $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
251 | 251 | |
252 | - if($ga->hasMap()) { |
|
252 | + if ($ga->hasMap()) { |
|
253 | 253 | $max = $placesGeneralResults['max']; |
254 | 254 | $map = $ga->getOptions()->getMap(); |
255 | 255 | $results_by_subdivs = $map->getSubdivisions(); |
256 | 256 | $places_mappings = $map->getPlacesMappings(); |
257 | 257 | foreach ($placesGeneralResults['places'] as $location => $count) { |
258 | - $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
258 | + $levelvalues = array_reverse(array_map('trim', explode(',', $location))); |
|
259 | 259 | $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
260 | - if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
261 | - $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
262 | - if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
260 | + if ($level_map >= 0 && $level_map < count($levelvalues)) { |
|
261 | + $levelref = $levelvalues[0].'@'.$levelvalues[$level_map]; |
|
262 | + if (!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
263 | 263 | } |
264 | 264 | else { |
265 | 265 | $levelref = $levelvalues[0]; |
266 | 266 | } |
267 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
268 | - if(isset($results_by_subdivs[$levelref])) { |
|
267 | + if (isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
268 | + if (isset($results_by_subdivs[$levelref])) { |
|
269 | 269 | $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
270 | - $count_subd += $count; |
|
270 | + $count_subd += $count; |
|
271 | 271 | $results_by_subdivs[$levelref]['count'] = $count_subd; |
272 | 272 | $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
273 | - if($ga->getOptions()->isUsingFlags() && $flags) { |
|
273 | + if ($ga->getOptions()->isUsingFlags() && $flags) { |
|
274 | 274 | $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
275 | 275 | $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
276 | 276 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | } |
293 | 293 | } |
294 | 294 | else { |
295 | - $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
295 | + $html = '<p class="warning">'.I18N::translate('No data is available for the general analysis.').'</p>'; |
|
296 | 296 | } |
297 | 297 | return $html; |
298 | 298 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
309 | 309 | global $WT_TREE; |
310 | 310 | |
311 | - if(!empty($placesGenerationsResults) && $ga->getOptions()){ |
|
311 | + if (!empty($placesGenerationsResults) && $ga->getOptions()) { |
|
312 | 312 | $data = new ViewBag(); |
313 | 313 | |
314 | 314 | ksort($placesGenerationsResults); |
@@ -321,26 +321,26 @@ discard block |
||
321 | 321 | $data->set('display_all_places', $display_all_places); |
322 | 322 | |
323 | 323 | $results_by_gen = array(); |
324 | - foreach($placesGenerationsResults as $gen => $genData){ |
|
324 | + foreach ($placesGenerationsResults as $gen => $genData) { |
|
325 | 325 | $sum = 0; |
326 | 326 | $other = 0; |
327 | 327 | $unknown = 0; |
328 | - if(isset($genData['sum'])) $sum = $genData['sum']; |
|
329 | - if(isset($genData['other'])) $other = $genData['other']; |
|
330 | - if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
328 | + if (isset($genData['sum'])) $sum = $genData['sum']; |
|
329 | + if (isset($genData['other'])) $other = $genData['other']; |
|
330 | + if (isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
331 | 331 | |
332 | - if($sum > 0) { |
|
332 | + if ($sum > 0) { |
|
333 | 333 | $results_by_gen[$gen]['sum'] = $sum; |
334 | 334 | $results_by_gen[$gen]['other'] = $other; |
335 | 335 | $results_by_gen[$gen]['unknown'] = $unknown; |
336 | 336 | $results_by_gen[$gen]['places'] = array(); |
337 | 337 | arsort($genData['places']); |
338 | 338 | |
339 | - if($display_all_places){ |
|
340 | - foreach($genData['places'] as $placename=> $count){ |
|
339 | + if ($display_all_places) { |
|
340 | + foreach ($genData['places'] as $placename=> $count) { |
|
341 | 341 | $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
342 | 342 | |
343 | - if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
343 | + if ($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != '') { |
|
344 | 344 | $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
345 | 345 | $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
346 | 346 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | } |
349 | 349 | else { |
350 | 350 | $tmp = $genData['places']; |
351 | - if($other > 0) { |
|
351 | + if ($other > 0) { |
|
352 | 352 | $tmp = array_slice($tmp, 0, 5, true); |
353 | 353 | $tmp['other'] = $other; |
354 | 354 | arsort($tmp); |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | } |
366 | 366 | else { |
367 | - $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
367 | + $html = '<p class="warning">'.I18N::translate('No data is available for the generations analysis.').'</p>'; |
|
368 | 368 | } |
369 | 369 | return $html; |
370 | 370 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $cid = Filter::get('cid'); |
70 | 70 | |
71 | 71 | $certificate = null; |
72 | - if(!empty($cid) && strlen($cid) > 22){ |
|
72 | + if (!empty($cid) && strlen($cid) > 22) { |
|
73 | 73 | $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
74 | 74 | } |
75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $data->set('title', $controller->getPageTitle()); |
78 | 78 | |
79 | 79 | $data->set('has_certif', false); |
80 | - if($certificate) { |
|
80 | + if ($certificate) { |
|
81 | 81 | $controller->restrictAccess($certificate->canShow()); |
82 | 82 | $data->set('title', $certificate->getTitle()); |
83 | 83 | $data->set('has_certif', true); |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | |
86 | 86 | $data->set( |
87 | 87 | 'url_certif_city', |
88 | - 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
89 | - '&mod_action=Certificate@listAll' . |
|
90 | - '&ged=' . $WT_TREE->getNameUrl() . |
|
91 | - '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
88 | + 'module.php?mod='.Constants::MODULE_MAJ_CERTIF_NAME. |
|
89 | + '&mod_action=Certificate@listAll'. |
|
90 | + '&ged='.$WT_TREE->getNameUrl(). |
|
91 | + '&city='.Functions::encryptToSafeBase64($certificate->getCity()) |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | $controller->addInlineJavascript(' |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | $linked_indis = $certificate->linkedIndividuals(); |
103 | 103 | $linked_fams = $certificate->linkedFamilies(); |
104 | 104 | |
105 | - if($linked_indis && count($linked_indis) > 0) { |
|
105 | + if ($linked_indis && count($linked_indis) > 0) { |
|
106 | 106 | $data->set('has_linked_indis', true); |
107 | 107 | $data->set('linked_indis', $linked_indis); |
108 | 108 | } |
109 | 109 | |
110 | - if(!empty($linked_fams)) { |
|
110 | + if (!empty($linked_fams)) { |
|
111 | 111 | $data->set('has_linked_fams', true); |
112 | 112 | $data->set('linked_fams', $linked_fams); |
113 | 113 | } |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | public function image() { |
123 | 123 | global $WT_TREE; |
124 | 124 | |
125 | - $cid = Filter::get('cid'); |
|
125 | + $cid = Filter::get('cid'); |
|
126 | 126 | $certificate = null; |
127 | - if(!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
127 | + if (!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
128 | 128 | |
129 | 129 | $imageBuilder = new ImageBuilder($certificate); |
130 | 130 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $city = Filter::get('city'); |
159 | 159 | |
160 | - if(!empty($city) && strlen($city) > 22){ |
|
160 | + if (!empty($city) && strlen($city) > 22) { |
|
161 | 161 | $city = Functions::decryptFromSafeBase64($city); |
162 | 162 | $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
163 | 163 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | $data->set('selected_city', $city); |
173 | 173 | |
174 | 174 | $data->set('has_list', false); |
175 | - if(!empty($city)) { |
|
176 | - $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
175 | + if (!empty($city)) { |
|
176 | + $table_id = 'table-certiflist-'.Uuid::uuid4(); |
|
177 | 177 | |
178 | 178 | $certif_list = $this->provider->getCertificatesList($city); |
179 | - if(!empty($certif_list)) { |
|
179 | + if (!empty($certif_list)) { |
|
180 | 180 | $data->set('has_list', true); |
181 | 181 | $data->set('table_id', $table_id); |
182 | 182 | $data->set('certificate_list', $certif_list); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
189 | 189 | |
190 | 190 | jQuery("#'.$table_id.'").dataTable( { |
191 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
191 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
192 | 192 | '.I18N::datatablesI18N().', |
193 | 193 | jQueryUI: true, |
194 | 194 | autoWidth: false, |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class Certificate extends Media { |
36 | 36 | |
37 | - const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
37 | + const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
38 | 38 | |
39 | 39 | /** @var string The "TITL" value from the GEDCOM |
40 | 40 | * This is a tweak to overcome the private level from the parent object... |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | |
95 | 95 | $match = null; |
96 | 96 | $ct = preg_match("/(?<year>\d{1,4})(\.(?<month>\d{1,2}))?(\.(?<day>\d{1,2}))?( (?<type>[A-Z]{1,2}) )?(?<details>.*)/", $this->title, $match); |
97 | - if($ct > 0){ |
|
98 | - $monthId = (int) $match['month']; |
|
97 | + if ($ct > 0) { |
|
98 | + $monthId = (int)$match['month']; |
|
99 | 99 | $calendarShortMonths = Functions::getCalendarShortMonths(); |
100 | 100 | $monthShortName = array_key_exists($monthId, $calendarShortMonths) ? $calendarShortMonths[$monthId] : $monthId; |
101 | 101 | $this->certDate = new Date($match['day'].' '.strtoupper($monthShortName).' '.$match['year']); |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | * @see \Fisharebest\Webtrees\GedcomRecord::getInstance() |
112 | 112 | */ |
113 | 113 | static public function getInstance($xref, Tree $tree, $gedcom = null, CertificateProviderInterface $provider = null) { |
114 | - try{ |
|
114 | + try { |
|
115 | 115 | $certfile = Functions::decryptFromSafeBase64($xref); |
116 | 116 | |
117 | 117 | //NEED TO CHECK THAT !!! |
118 | - if(Functions::isValidPath($certfile, true)) { |
|
118 | + if (Functions::isValidPath($certfile, true)) { |
|
119 | 119 | return new Certificate($certfile, $tree, $provider); |
120 | 120 | } |
121 | 121 | } |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @param string|Source $xref |
154 | 154 | */ |
155 | - public function setSource($xref){ |
|
156 | - if($xref instanceof Source){ |
|
155 | + public function setSource($xref) { |
|
156 | + if ($xref instanceof Source) { |
|
157 | 157 | $this->source = $xref; |
158 | 158 | } else { |
159 | 159 | $this->source = Source::getInstance($xref, $this->tree); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @return Date Certificate date |
175 | 175 | */ |
176 | - public function getCertificateDate(){ |
|
176 | + public function getCertificateDate() { |
|
177 | 177 | return $this->certDate; |
178 | 178 | } |
179 | 179 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return string Certificate date |
184 | 184 | */ |
185 | - public function getCertificateType(){ |
|
185 | + public function getCertificateType() { |
|
186 | 186 | return $this->certType; |
187 | 187 | } |
188 | 188 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @return string Certificate details |
193 | 193 | */ |
194 | - public function getCertificateDetails(){ |
|
194 | + public function getCertificateDetails() { |
|
195 | 195 | return $this->certDetails; |
196 | 196 | } |
197 | 197 | |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string|NULL Certificate city |
202 | 202 | */ |
203 | - public function getCity(){ |
|
203 | + public function getCity() { |
|
204 | 204 | $chunks = explode('/', $this->getFilename(), 2); |
205 | - if(count($chunks) > 1) return $chunks[0]; |
|
205 | + if (count($chunks) > 1) return $chunks[0]; |
|
206 | 206 | return null; |
207 | 207 | } |
208 | 208 | |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * {@inhericDoc} |
211 | 211 | * @see \Fisharebest\Webtrees\Media::getServerFilename() |
212 | 212 | */ |
213 | - public function getServerFilename($which='main') { |
|
214 | - $filename = $this->provider->getRealCertificatesDirectory() . $this->getFilename(); |
|
213 | + public function getServerFilename($which = 'main') { |
|
214 | + $filename = $this->provider->getRealCertificatesDirectory().$this->getFilename(); |
|
215 | 215 | return Functions::encodeUtf8ToFileSystem($filename); |
216 | 216 | } |
217 | 217 | |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | public function getHtmlUrlDirect($which = 'main', $download = false) { |
223 | 223 | $sidstr = ($this->source) ? '&sid='.$this->source->getXref() : ''; |
224 | 224 | return |
225 | - 'module.php?mod='. \MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME . |
|
226 | - '&mod_action=Certificate@image' . |
|
227 | - '&ged='. $this->tree->getNameUrl() . |
|
228 | - '&cid=' . $this->getXref() . $sidstr . |
|
229 | - '&cb=' . $this->getEtag($which); |
|
225 | + 'module.php?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME. |
|
226 | + '&mod_action=Certificate@image'. |
|
227 | + '&ged='.$this->tree->getNameUrl(). |
|
228 | + '&cid='.$this->getXref().$sidstr. |
|
229 | + '&cb='.$this->getEtag($which); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -237,26 +237,26 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return string Watermark text |
239 | 239 | */ |
240 | - public function getWatermarkText(){ |
|
240 | + public function getWatermarkText() { |
|
241 | 241 | $module = Module::getModuleByName(Constants::MODULE_MAJ_CERTIF_NAME); |
242 | 242 | |
243 | - if($module) { |
|
243 | + if ($module) { |
|
244 | 244 | $wmtext = $module->getSetting('MAJ_WM_DEFAULT', I18N::translate('This image is protected under copyright law.')); |
245 | - $sid= Filter::get('sid', WT_REGEX_XREF); |
|
245 | + $sid = Filter::get('sid', WT_REGEX_XREF); |
|
246 | 246 | |
247 | - if($sid){ |
|
247 | + if ($sid) { |
|
248 | 248 | $this->source = Source::getInstance($sid, $this->tree); |
249 | 249 | } |
250 | - else{ |
|
251 | - $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
250 | + else { |
|
251 | + $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
252 | 252 | } |
253 | 253 | |
254 | - if($this->source) { |
|
254 | + if ($this->source) { |
|
255 | 255 | $wmtext = '©'; |
256 | 256 | $repofact = $this->source->getFirstFact('REPO'); |
257 | - if($repofact) { |
|
257 | + if ($repofact) { |
|
258 | 258 | $repo = $repofact->getTarget(); |
259 | - if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
259 | + if ($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
260 | 260 | } |
261 | 261 | $wmtext .= $this->source->getFullName(); |
262 | 262 | } |
@@ -279,45 +279,45 @@ discard block |
||
279 | 279 | '; |
280 | 280 | |
281 | 281 | $script = ''; |
282 | - if($controller && !($controller instanceof IndividualController)){ |
|
282 | + if ($controller && !($controller instanceof IndividualController)) { |
|
283 | 283 | $controller->addInlineJavascript('$(document).ready(function() { '.$js.' });'); |
284 | 284 | } else { |
285 | - $script = '<script>' . $js . '</script>'; |
|
285 | + $script = '<script>'.$js.'</script>'; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | if ($which == 'icon' || !file_exists($this->getServerFilename())) { |
289 | 289 | // Use an icon |
290 | 290 | $image = |
291 | - '<i dir="auto" class="icon-maj-certificate margin-h-2"' . |
|
292 | - ' title="' . strip_tags($this->getFullName()) . '"' . |
|
291 | + '<i dir="auto" class="icon-maj-certificate margin-h-2"'. |
|
292 | + ' title="'.strip_tags($this->getFullName()).'"'. |
|
293 | 293 | '></i>'; |
294 | 294 | } else { |
295 | 295 | $imgsize = getimagesize($this->getServerFilename()); |
296 | 296 | $image = |
297 | - '<img' . |
|
298 | - ' class ="'. 'certif_image' . '"' . |
|
299 | - ' dir="' . 'auto' . '"' . // For the tool-tip |
|
300 | - ' src="' . $this->getHtmlUrlDirect() . '"' . |
|
301 | - ' alt="' . strip_tags($this->getFullName()) . '"' . |
|
302 | - ' title="' . strip_tags($this->getFullName()) . '"' . |
|
303 | - $imgsize[3] . // height="yyy" width="xxx" |
|
297 | + '<img'. |
|
298 | + ' class ="'.'certif_image'.'"'. |
|
299 | + ' dir="'.'auto'.'"'.// For the tool-tip |
|
300 | + ' src="'.$this->getHtmlUrlDirect().'"'. |
|
301 | + ' alt="'.strip_tags($this->getFullName()).'"'. |
|
302 | + ' title="'.strip_tags($this->getFullName()).'"'. |
|
303 | + $imgsize[3].// height="yyy" width="xxx" |
|
304 | 304 | '>'; |
305 | 305 | } |
306 | 306 | return |
307 | - '<a' . |
|
308 | - ' class="' . 'certgallery' . '"' . |
|
309 | - ' href="' . $this->getHtmlUrlDirect() . '"' . |
|
310 | - ' type="' . $this->mimeType() . '"' . |
|
311 | - ' data-obje-url="' . $this->getHtmlUrl() . '"' . |
|
312 | - ' data-title="' . strip_tags($this->getFullName()) . '"' . |
|
313 | - '>' . $image . '</a>'.$script; |
|
307 | + '<a'. |
|
308 | + ' class="'.'certgallery'.'"'. |
|
309 | + ' href="'.$this->getHtmlUrlDirect().'"'. |
|
310 | + ' type="'.$this->mimeType().'"'. |
|
311 | + ' data-obje-url="'.$this->getHtmlUrl().'"'. |
|
312 | + ' data-title="'.strip_tags($this->getFullName()).'"'. |
|
313 | + '>'.$image.'</a>'.$script; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
317 | 317 | * {@inhericDoc} |
318 | 318 | * @see \Fisharebest\Webtrees\GedcomRecord::linkedIndividuals() |
319 | 319 | */ |
320 | - public function linkedIndividuals($link = '_ACT'){ |
|
320 | + public function linkedIndividuals($link = '_ACT') { |
|
321 | 321 | $rows = Database::prepare( |
322 | 322 | 'SELECT i_id AS xref, i_gedcom AS gedcom'. |
323 | 323 | ' FROM `##individuals`'. |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * {@inhericDoc} |
342 | 342 | * @see \Fisharebest\Webtrees\GedcomRecord::linkedFamilies() |
343 | 343 | */ |
344 | - public function linkedFamilies($link = '_ACT'){ |
|
344 | + public function linkedFamilies($link = '_ACT') { |
|
345 | 345 | $rows = Database::prepare( |
346 | 346 | 'SELECT f_id AS xref, f_gedcom AS gedcom'. |
347 | 347 | ' FROM `##families`'. |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @return Source|NULL Linked source |
368 | 368 | */ |
369 | - public function fetchALinkedSource(){ |
|
369 | + public function fetchALinkedSource() { |
|
370 | 370 | $sid = null; |
371 | 371 | |
372 | 372 | // Try to find in individual, then families, then other types of records. We are interested in the first available value. |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | 'gedcom_id' => $this->tree->getTreeId(), |
379 | 379 | 'gedcom' => '%_ACT '.$this->getFilename().'%' |
380 | 380 | ))->fetchOne(); |
381 | - if(!$ged){ |
|
381 | + if (!$ged) { |
|
382 | 382 | $ged = Database::prepare( |
383 | 383 | 'SELECT f_gedcom AS gedrec FROM `##families`'. |
384 | 384 | ' WHERE f_file=:gedcom_id AND f_gedcom LIKE :gedcom') |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | 'gedcom_id' => $this->tree->getTreeId(), |
387 | 387 | 'gedcom' => '%_ACT '.$this->getFilename().'%' |
388 | 388 | ))->fetchOne(); |
389 | - if(!$ged){ |
|
389 | + if (!$ged) { |
|
390 | 390 | $ged = Database::prepare( |
391 | 391 | 'SELECT o_gedcom AS gedrec FROM `##other`'. |
392 | 392 | ' WHERE o_file=:gedcom_id AND o_gedcom LIKE :gedcom') |
@@ -397,19 +397,19 @@ discard block |
||
397 | 397 | } |
398 | 398 | } |
399 | 399 | //If a record has been found, parse it to find the source reference. |
400 | - if($ged){ |
|
400 | + if ($ged) { |
|
401 | 401 | $gedlines = explode("\n", $ged); |
402 | 402 | $level = 0; |
403 | 403 | $levelsource = -1; |
404 | - $sid_tmp=null; |
|
404 | + $sid_tmp = null; |
|
405 | 405 | $sourcefound = false; |
406 | - foreach($gedlines as $gedline){ |
|
406 | + foreach ($gedlines as $gedline) { |
|
407 | 407 | // Get the level |
408 | 408 | $match = null; |
409 | 409 | if (!$sourcefound && preg_match('~^('.WT_REGEX_INTEGER.') ~', $gedline, $match)) { |
410 | 410 | $level = $match[1]; |
411 | 411 | //If we are not any more within the context of a source, reset |
412 | - if($level <= $levelsource){ |
|
412 | + if ($level <= $levelsource) { |
|
413 | 413 | $levelsource = -1; |
414 | 414 | $sid_tmp = null; |
415 | 415 | } |
@@ -417,11 +417,11 @@ discard block |
||
417 | 417 | $match2 = null; |
418 | 418 | if (preg_match('~^'.$level.' SOUR @('.WT_REGEX_XREF.')@$~', $gedline, $match2)) { |
419 | 419 | $levelsource = $level; |
420 | - $sid_tmp=$match2[1]; |
|
420 | + $sid_tmp = $match2[1]; |
|
421 | 421 | } |
422 | 422 | // If the image has be found, get the source reference and exit. |
423 | 423 | $match3 = null; |
424 | - if($levelsource>=0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)){ |
|
424 | + if ($levelsource >= 0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)) { |
|
425 | 425 | $sid = $sid_tmp; |
426 | 426 | $sourcefound = true; |
427 | 427 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | - if($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
432 | + if ($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
433 | 433 | |
434 | 434 | return $this->source; |
435 | 435 | } |
@@ -33,39 +33,39 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected function update() { |
35 | 35 | |
36 | - if(Auth::isAdmin()){ |
|
36 | + if (Auth::isAdmin()) { |
|
37 | 37 | |
38 | 38 | $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT')); |
39 | 39 | $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK')); |
40 | 40 | |
41 | - if($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
41 | + if ($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
42 | 42 | $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT); |
43 | 43 | } |
44 | 44 | |
45 | - if($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
45 | + if ($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
46 | 46 | $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE); |
47 | 47 | } |
48 | 48 | |
49 | 49 | // Only accept valid color for MAJ_WM_FONT_COLOR |
50 | 50 | $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}'); |
51 | - if($MAJ_WM_FONT_COLOR) { |
|
51 | + if ($MAJ_WM_FONT_COLOR) { |
|
52 | 52 | $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR); |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Only accept valid folders for MAJ_CERT_ROOTDIR |
56 | - $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/'); |
|
56 | + $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR').'/'); |
|
57 | 57 | if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') { |
58 | 58 | $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1); |
59 | 59 | } |
60 | 60 | |
61 | 61 | if ($MAJ_CERT_ROOTDIR) { |
62 | - if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
62 | + if (is_dir(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)) { |
|
63 | 63 | $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
64 | - } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
64 | + } elseif (File::mkdir(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)) { |
|
65 | 65 | $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
66 | - FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info'); |
|
66 | + FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)), 'info'); |
|
67 | 67 | } else { |
68 | - FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger'); |
|
68 | + FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR.$MAJ_CERT_ROOTDIR)), 'danger'); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | global $WT_TREE; |
87 | 87 | |
88 | 88 | $action = Filter::post('action'); |
89 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
89 | + if ($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
90 | 90 | |
91 | 91 | Theme::theme(new AdministrationTheme)->init($WT_TREE); |
92 | 92 | $ctrl = new PageController(); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param \Fisharebest\Webtrees\Fact $fact_in The Fact to extend |
40 | 40 | */ |
41 | - public function __construct(\Fisharebest\Webtrees\Fact $fact_in){ |
|
41 | + public function __construct(\Fisharebest\Webtrees\Fact $fact_in) { |
|
42 | 42 | $this->fact = $fact_in; |
43 | 43 | } |
44 | 44 | |
@@ -54,22 +54,22 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return int Level of sources |
56 | 56 | */ |
57 | - public function isSourced(){ |
|
58 | - $isSourced=0; |
|
57 | + public function isSourced() { |
|
58 | + $isSourced = 0; |
|
59 | 59 | $date = $this->fact->getDate(); |
60 | - if($date->isOK()) { |
|
61 | - $isSourced=-1; |
|
62 | - if($date->qual1=='' && $date->minimumJulianDay() == $date->maximumJulianDay()){ |
|
63 | - $isSourced=-2; |
|
60 | + if ($date->isOK()) { |
|
61 | + $isSourced = -1; |
|
62 | + if ($date->qual1 == '' && $date->minimumJulianDay() == $date->maximumJulianDay()) { |
|
63 | + $isSourced = -2; |
|
64 | 64 | $citations = $this->fact->getCitations(); |
65 | - foreach($citations as $citation){ |
|
66 | - $isSourced=max($isSourced, 1); |
|
67 | - if(preg_match('/3 _ACT (.*)/', $citation) ){ |
|
68 | - $isSourced=max($isSourced, 2); |
|
65 | + foreach ($citations as $citation) { |
|
66 | + $isSourced = max($isSourced, 1); |
|
67 | + if (preg_match('/3 _ACT (.*)/', $citation)) { |
|
68 | + $isSourced = max($isSourced, 2); |
|
69 | 69 | preg_match_all("/4 DATE (.*)/", $citation, $datessource, PREG_SET_ORDER); |
70 | - foreach($datessource as $daterec){ |
|
70 | + foreach ($datessource as $daterec) { |
|
71 | 71 | $datesource = new Date($daterec[1]); |
72 | - if(abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN){ |
|
72 | + if (abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN) { |
|
73 | 73 | $isSourced = max($isSourced, 3); //If this level increases, do not forget to change the constant MAX_IS_SOURCED_LEVEL |
74 | 74 | } |
75 | 75 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { |
46 | 46 | $view_bag = new ViewBag(); |
47 | 47 | |
48 | - if($parent_controller && $tree) { |
|
48 | + if ($parent_controller && $tree) { |
|
49 | 49 | |
50 | 50 | $view_bag->set('tree', $tree); |
51 | 51 | $view_bag->set('indi', $parent_controller->getSignificantIndividual()); |
@@ -64,22 +64,22 @@ discard block |
||
64 | 64 | '); |
65 | 65 | |
66 | 66 | if (Auth::isAdmin()) { |
67 | - $title='<a class="icon-admin" title="'.I18N::translate('Preferences').'" href="block_edit.php?block_id='.$block_id.'&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; |
|
67 | + $title = '<a class="icon-admin" title="'.I18N::translate('Preferences').'" href="block_edit.php?block_id='.$block_id.'&ged='.$tree->getNameHtml().'&ctype=gedcom"></a>'; |
|
68 | 68 | } else { |
69 | - $title=''; |
|
69 | + $title = ''; |
|
70 | 70 | } |
71 | - $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
71 | + $title .= '<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
72 | 72 | |
73 | 73 | $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); |
74 | 74 | $view_bag->set('piwik_enabled', $piwik_enabled); |
75 | - if($piwik_enabled) { |
|
75 | + if ($piwik_enabled) { |
|
76 | 76 | $parent_controller->addInlineJavascript( |
77 | 77 | '$("#piwik_stats") |
78 | 78 | .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");' |
79 | 79 | ); |
80 | 80 | } |
81 | 81 | |
82 | - $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
82 | + $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
83 | 83 | |
84 | 84 | if ($template) { |
85 | 85 | return Theme::theme()->formatBlock($id, $title, $class, $content); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function config($block_id = null) { |
100 | 100 | |
101 | - if(empty($block_id)) throw new MvcException(404); |
|
101 | + if (empty($block_id)) throw new MvcException(404); |
|
102 | 102 | |
103 | 103 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
104 | 104 | $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled')); |
@@ -36,20 +36,20 @@ discard block |
||
36 | 36 | '<table> |
37 | 37 | <tr> |
38 | 38 | <td> |
39 | - <a href="pedigree.php?rootid=' . $indi->getXref() . '&ged=' . $tree->getNameUrl() . '"> |
|
40 | - <i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . ' |
|
39 | + <a href="pedigree.php?rootid=' . $indi->getXref().'&ged='.$tree->getNameUrl().'"> |
|
40 | + <i class="icon-pedigree"></i><br>' . I18N::translate('Default chart').' |
|
41 | 41 | </a> |
42 | 42 | </td> |
43 | 43 | <td> |
44 | - <a href="individual.php?pid=' . $indi->getXref() . '&ged=' . $tree->getNameUrl() . '"> |
|
45 | - <i class="icon-indis"></i><br>' . I18N::translate('Default individual') . ' |
|
44 | + <a href="individual.php?pid=' . $indi->getXref().'&ged='.$tree->getNameUrl().'"> |
|
45 | + <i class="icon-indis"></i><br>' . I18N::translate('Default individual').' |
|
46 | 46 | </a> |
47 | 47 | </td>'; |
48 | 48 | |
49 | 49 | if (Site::getPreference('USE_REGISTRATION_MODULE') && !Auth::check()) { |
50 | 50 | $content .= ' |
51 | 51 | <td> |
52 | - <a href="' . WT_LOGIN_URL . '?action=register"> |
|
52 | + <a href="' . WT_LOGIN_URL.'?action=register"> |
|
53 | 53 | <i class="icon-user_add"></i><br>'.I18N::translate('Request a new user account').' |
54 | 54 | </a> |
55 | 55 | </td>'; |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | </table>'; |
60 | 60 | |
61 | 61 | // Piwik Statistics |
62 | - if ($this->data->get('piwik_enabled', false)){ |
|
62 | + if ($this->data->get('piwik_enabled', false)) { |
|
63 | 63 | $content .= ' |
64 | 64 | <div class="center"> |
65 | 65 | <div id="piwik_stats"> |
66 | - <i class="icon-loading-small"></i> ' . I18N::translate('Retrieving Piwik statistics...') . ' |
|
66 | + <i class="icon-loading-small"></i> ' . I18N::translate('Retrieving Piwik statistics...').' |
|
67 | 67 | </div> |
68 | 68 | </div>'; |
69 | 69 | } |
70 | 70 | |
71 | - $content .= '<hr />'; |
|
71 | + $content .= '<hr />'; |
|
72 | 72 | |
73 | 73 | // Login section - based on login_block |
74 | 74 | if (Auth::check()) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | <div class="center"> |
77 | 77 | <form method="post" action="logout.php" name="logoutform" onsubmit="return true;"> |
78 | 78 | <br>' . |
79 | - I18N::translate('You are signed in as %s.', '<a href="edituser.php" class="name2">' . Auth::user()->getRealNameHtml() . '</a>') . |
|
79 | + I18N::translate('You are signed in as %s.', '<a href="edituser.php" class="name2">'.Auth::user()->getRealNameHtml().'</a>'). |
|
80 | 80 | '<br><br> |
81 | 81 | <input type="submit" value="'.I18N::translate('sign out').'"> |
82 | 82 | <br><br> |
@@ -98,34 +98,34 @@ discard block |
||
98 | 98 | </label> |
99 | 99 | </div> |
100 | 100 | <div> |
101 | - <input type="submit" value="'. I18N::translate('sign in'). '"> |
|
101 | + <input type="submit" value="'. I18N::translate('sign in').'"> |
|
102 | 102 | </div> |
103 | 103 | <div> |
104 | 104 | <a href="#" id="maj-passwd_click">'. I18N::translate('Request a new password').'</a> |
105 | 105 | </div>'; |
106 | 106 | if (Site::getPreference('USE_REGISTRATION_MODULE')) { |
107 | - $content.= ' |
|
107 | + $content .= ' |
|
108 | 108 | <div> |
109 | - <a href="'.WT_LOGIN_URL.'?action=register">'. I18N::translate('Request a new user account').'</a> |
|
109 | + <a href="'.WT_LOGIN_URL.'?action=register">'.I18N::translate('Request a new user account').'</a> |
|
110 | 110 | </div>'; |
111 | 111 | } |
112 | - $content.= ' |
|
112 | + $content .= ' |
|
113 | 113 | </form>'; // close "login-form" |
114 | 114 | |
115 | 115 | // hidden New Password block |
116 | - $content.= ' |
|
116 | + $content .= ' |
|
117 | 117 | <div id="maj-new_passwd"> |
118 | 118 | <form id="maj-new_passwd_form" name="new_passwd_form" action="'.WT_LOGIN_URL.'" method="post"> |
119 | 119 | <input type="hidden" name="time" value=""> |
120 | 120 | <input type="hidden" name="action" value="requestpw"> |
121 | 121 | <h4>'. I18N::translate('Lost password request').'</h4> |
122 | 122 | <div> |
123 | - <label for="maj-new_passwd_username">'. I18N::translate('Username or email address') . ' |
|
123 | + <label for="maj-new_passwd_username">'. I18N::translate('Username or email address').' |
|
124 | 124 | <input type="text" id="maj-new_passwd_username" name="new_passwd_username" value=""> |
125 | 125 | </label> |
126 | 126 | </div> |
127 | 127 | <div> |
128 | - <input type="submit" value="'. I18N::translate('Continue'). '"> |
|
128 | + <input type="submit" value="'. I18N::translate('Continue').'"> |
|
129 | 129 | </div> |
130 | 130 | </form> |
131 | 131 | </div> |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | * @param string $period |
31 | 31 | * @param (null|int) Number of visits |
32 | 32 | */ |
33 | - private function getNumberOfVisitsPiwik($block_id, $period='year'){ |
|
33 | + private function getNumberOfVisitsPiwik($block_id, $period = 'year') { |
|
34 | 34 | |
35 | 35 | $piwik_url = $this->module->getBlockSetting($block_id, 'piwik_url'); |
36 | 36 | $piwik_siteid = $this->module->getBlockSetting($block_id, 'piwik_siteid'); |
37 | 37 | $piwik_token = $this->module->getBlockSetting($block_id, 'piwik_token'); |
38 | 38 | |
39 | - if($piwik_url && strlen($piwik_url) > 0 && |
|
40 | - $piwik_siteid && strlen($piwik_siteid) > 0 && |
|
39 | + if ($piwik_url && strlen($piwik_url) > 0 && |
|
40 | + $piwik_siteid && strlen($piwik_siteid) > 0 && |
|
41 | 41 | $piwik_token && strlen($piwik_token) |
42 | 42 | ) |
43 | 43 | { |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | $url .= '&format=PHP'; |
49 | 49 | $url .= '&token_auth='.$piwik_token; |
50 | 50 | |
51 | - if($fetched = File::fetchUrl($url)) { |
|
51 | + if ($fetched = File::fetchUrl($url)) { |
|
52 | 52 | $content = @unserialize($fetched); |
53 | - if(is_numeric($content)) return $content; |
|
53 | + if (is_numeric($content)) return $content; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | $data->set('has_stats', false); |
73 | 73 | |
74 | 74 | $block_id = Filter::get('block_id'); |
75 | - if($block_id){ |
|
75 | + if ($block_id) { |
|
76 | 76 | $cached_item = Cache::get('piwikCountYear', $this->module); |
77 | 77 | $visitCountYear = $cached_item->get(); |
78 | - if(!$cached_item->isHit()) { |
|
78 | + if (!$cached_item->isHit()) { |
|
79 | 79 | $visitCountYear = $this->getNumberOfVisitsPiwik($block_id); |
80 | - if(!is_null($visitCountYear)) { |
|
81 | - $cached_item->expiresAt(new \DateTime('tomorrow')); // Expires the next day at midnight |
|
80 | + if (!is_null($visitCountYear)) { |
|
81 | + $cached_item->expiresAt(new \DateTime('tomorrow')); // Expires the next day at midnight |
|
82 | 82 | Cache::save($cached_item, $visitCountYear); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - if($visitCountYear){ |
|
86 | + if ($visitCountYear) { |
|
87 | 87 | $visitCountToday = max(0, $this->getNumberOfVisitsPiwik($block_id, 'day')); |
88 | - $visitCountYear = max( 0, $visitCountYear); |
|
88 | + $visitCountYear = max(0, $visitCountYear); |
|
89 | 89 | |
90 | 90 | $data->set('has_stats', true); |
91 | 91 | $data->set('visits_today', $visitCountToday); |