Passed
Push — master ( b2ca54...1f995c )
by Jonathan
04:01
created
src/Webtrees/Module/Sosa/SosaListController.php 1 patch
Indentation   +270 added lines, -270 removed lines patch added patch discarded remove patch
@@ -37,67 +37,67 @@  discard block
 block discarded – undo
37 37
  */
38 38
 class SosaListController extends MvcController
39 39
 {
40
-    /**
41
-     * Sosa Provider for the controller
42
-     * @var SosaProvider $sosa_provider
43
-     */
44
-    protected $sosa_provider;
40
+	/**
41
+	 * Sosa Provider for the controller
42
+	 * @var SosaProvider $sosa_provider
43
+	 */
44
+	protected $sosa_provider;
45 45
     
46
-    /**
47
-     * Generation used for the controller
48
-     * @var int $generation
49
-     */
50
-    protected $generation;
46
+	/**
47
+	 * Generation used for the controller
48
+	 * @var int $generation
49
+	 */
50
+	protected $generation;
51 51
     
52
-    /**
53
-     * ViewBag to hold data for the controller
54
-     * @var ViewBag $view_bag
55
-     */
56
-    protected $view_bag;
52
+	/**
53
+	 * ViewBag to hold data for the controller
54
+	 * @var ViewBag $view_bag
55
+	 */
56
+	protected $view_bag;
57 57
     
58
-    /**
59
-     * {@inheritDoc}
60
-     * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module)
61
-     */
62
-    public function __construct(AbstractModule $module) {
63
-        parent::__construct($module);
58
+	/**
59
+	 * {@inheritDoc}
60
+	 * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module)
61
+	 */
62
+	public function __construct(AbstractModule $module) {
63
+		parent::__construct($module);
64 64
 
65
-        $this->sosa_provider = new SosaProvider(Globals::getTree(), Auth::user());
65
+		$this->sosa_provider = new SosaProvider(Globals::getTree(), Auth::user());
66 66
 
67
-        $this->generation = Filter::getInteger('gen');
67
+		$this->generation = Filter::getInteger('gen');
68 68
         
69
-        $this->view_bag = new ViewBag();
70
-        $this->view_bag->set('generation', $this->generation);
71
-        $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration());
72
-        $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0);
69
+		$this->view_bag = new ViewBag();
70
+		$this->view_bag->set('generation', $this->generation);
71
+		$this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration());
72
+		$this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0);
73 73
         
74
-    }
74
+	}
75 75
     
76 76
     
77
-    /**
78
-     * Pages
79
-     */
77
+	/**
78
+	 * Pages
79
+	 */
80 80
     
81
-    /**
82
-     * SosaList@index
83
-     */
84
-    public function index() {
85
-        $wt_tree = Globals::getTree();
86
-        $controller = new PageController();
87
-        $controller
88
-            ->setPageTitle(I18N::translate('Sosa Ancestors'));            
81
+	/**
82
+	 * SosaList@index
83
+	 */
84
+	public function index() {
85
+		$wt_tree = Globals::getTree();
86
+		$controller = new PageController();
87
+		$controller
88
+			->setPageTitle(I18N::translate('Sosa Ancestors'));            
89 89
 
90
-        $this->view_bag->set('title', $controller->getPageTitle());
90
+		$this->view_bag->set('title', $controller->getPageTitle());
91 91
         
92
-        if($this->view_bag->get('is_setup', false)) {
93
-            $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0);
94
-            $this->view_bag->set('url_module', $this->module->getName());
95
-            $this->view_bag->set('url_action', 'SosaList');
96
-            $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); 
97
-            $this->view_bag->set('min_gen', 1);
92
+		if($this->view_bag->get('is_setup', false)) {
93
+			$this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0);
94
+			$this->view_bag->set('url_module', $this->module->getName());
95
+			$this->view_bag->set('url_action', 'SosaList');
96
+			$this->view_bag->set('url_ged', $wt_tree->getNameUrl()); 
97
+			$this->view_bag->set('min_gen', 1);
98 98
             
99
-            if($this->view_bag->get('has_sosa', false)) {            
100
-                $controller->addInlineJavascript('
99
+			if($this->view_bag->get('has_sosa', false)) {            
100
+				$controller->addInlineJavascript('
101 101
             		jQuery("#sosalist-tabs").tabs();
102 102
             		jQuery("#sosalist-tabs").css("visibility", "visible");
103 103
                 
@@ -151,43 +151,43 @@  discard block
 block discarded – undo
151 151
             		);
152 152
                 
153 153
             	');            
154
-            }
155
-        }
154
+			}
155
+		}
156 156
                 
157
-        ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render();   
158
-    }    
157
+		ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render();   
158
+	}    
159 159
     
160 160
 
161
-    /**
162
-     * SosaList@missing
163
-     */
164
-    public function missing() {
165
-        $wt_tree = Globals::getTree();
166
-        $controller = new PageController();
167
-        $controller
168
-        ->setPageTitle(I18N::translate('Missing Ancestors'));
161
+	/**
162
+	 * SosaList@missing
163
+	 */
164
+	public function missing() {
165
+		$wt_tree = Globals::getTree();
166
+		$controller = new PageController();
167
+		$controller
168
+		->setPageTitle(I18N::translate('Missing Ancestors'));
169 169
         
170
-        $this->view_bag->set('title', $controller->getPageTitle());
170
+		$this->view_bag->set('title', $controller->getPageTitle());
171 171
         
172
-        if($this->view_bag->get('is_setup', false)) {
173
-            $this->view_bag->set('url_module', $this->module->getName());
174
-            $this->view_bag->set('url_action', 'SosaList@missing');
175
-            $this->view_bag->set('url_ged', $wt_tree->getNameUrl());
176
-            $this->view_bag->set('min_gen', 2);
172
+		if($this->view_bag->get('is_setup', false)) {
173
+			$this->view_bag->set('url_module', $this->module->getName());
174
+			$this->view_bag->set('url_action', 'SosaList@missing');
175
+			$this->view_bag->set('url_ged', $wt_tree->getNameUrl());
176
+			$this->view_bag->set('min_gen', 2);
177 177
             
178
-            $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation);
179
-            $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0);
178
+			$missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation);
179
+			$this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0);
180 180
             
181
-            $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1));
182
-            $this->view_bag->set('perc_sosa', $perc_sosa);
181
+			$perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1));
182
+			$this->view_bag->set('perc_sosa', $perc_sosa);
183 183
             
184
-            if($this->view_bag->get('has_missing', false)) {
185
-                $table_id = 'table-sosa-missing-' . Uuid::uuid4();
186
-                $this->view_bag->set('table_id', $table_id);
184
+			if($this->view_bag->get('has_missing', false)) {
185
+				$table_id = 'table-sosa-missing-' . Uuid::uuid4();
186
+				$this->view_bag->set('table_id', $table_id);
187 187
                 
188
-                $controller
189
-                ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
190
-                ->addInlineJavascript('
188
+				$controller
189
+				->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
190
+				->addInlineJavascript('
191 191
 				    jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc;
192 192
 				    jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc;
193 193
                     
@@ -239,76 +239,76 @@  discard block
 block discarded – undo
239 239
     				jQuery(".loading-image").css("display", "none");
240 240
     			');
241 241
                         
242
-                $unique_indis = array();
243
-                $sum_missing_different = 0;
244
-                $sum_missing_different_without_hidden = 0;
245
-                foreach($missing_list as $num => $missing_tab) {
246
-                    if(isset($unique_indis[$missing_tab['indi']])) {
247
-                        unset($missing_list[$num]);
248
-                        continue;
249
-                    }
250
-                    $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother'];
251
-                    $person = Individual::getInstance($missing_tab['indi'], $wt_tree);
252
-                    if (!$person || !$person->canShowName()) {
253
-                        unset($missing_list[$num]);
254
-                        continue;
255
-                    }  
256
-                    $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother'];
257
-                    $unique_indis[$person->getXref()] = true;
258
-                    $missing_tab['indi'] = $person;
259
-                    $missing_list[$num] = $missing_tab;
260
-                }
261
-                $this->view_bag->set('missing_list', $missing_list);
262
-                $this->view_bag->set('missing_diff_count', $sum_missing_different);
263
-                $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden);
264
-                $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2));
265
-                $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential);
266
-            }            
267
-        }
242
+				$unique_indis = array();
243
+				$sum_missing_different = 0;
244
+				$sum_missing_different_without_hidden = 0;
245
+				foreach($missing_list as $num => $missing_tab) {
246
+					if(isset($unique_indis[$missing_tab['indi']])) {
247
+						unset($missing_list[$num]);
248
+						continue;
249
+					}
250
+					$sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother'];
251
+					$person = Individual::getInstance($missing_tab['indi'], $wt_tree);
252
+					if (!$person || !$person->canShowName()) {
253
+						unset($missing_list[$num]);
254
+						continue;
255
+					}  
256
+					$sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother'];
257
+					$unique_indis[$person->getXref()] = true;
258
+					$missing_tab['indi'] = $person;
259
+					$missing_list[$num] = $missing_tab;
260
+				}
261
+				$this->view_bag->set('missing_list', $missing_list);
262
+				$this->view_bag->set('missing_diff_count', $sum_missing_different);
263
+				$this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden);
264
+				$perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2));
265
+				$this->view_bag->set('perc_sosa_potential', $perc_sosa_potential);
266
+			}            
267
+		}
268 268
         
269
-        ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render();
270
-    }
269
+		ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render();
270
+	}
271 271
     
272
-    /**
273
-     * SosaList@sosalist
274
-     */
275
-    public function sosalist() {
272
+	/**
273
+	 * SosaList@sosalist
274
+	 */
275
+	public function sosalist() {
276 276
                 
277
-        $type = Filter::get('type', 'indi|fam', null);
277
+		$type = Filter::get('type', 'indi|fam', null);
278 278
         
279
-        $controller = new AjaxController();
280
-        $controller->restrictAccess($this->generation > 0 || !is_null($type));
279
+		$controller = new AjaxController();
280
+		$controller->restrictAccess($this->generation > 0 || !is_null($type));
281 281
         
282
-        switch ($type){
283
-            case 'indi':
284
-                $this->renderSosaListIndi($controller);
285
-                break;
286
-            case 'fam':
287
-                $this->renderFamSosaListIndi($controller);
288
-                break;
289
-            default:
290
-                break;
291
-        }
282
+		switch ($type){
283
+			case 'indi':
284
+				$this->renderSosaListIndi($controller);
285
+				break;
286
+			case 'fam':
287
+				$this->renderFamSosaListIndi($controller);
288
+				break;
289
+			default:
290
+				break;
291
+		}
292 292
 
293
-    }
293
+	}
294 294
     
295
-    /**
296
-     * Render the Ajax response for the sortable table of Sosa individuals
297
-     * @param AjaxController $controller
298
-     */
299
-    protected function renderSosaListIndi(AjaxController $controller) {
300
-        $wt_tree = Globals::getTree();
301
-        $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); 
302
-        $this->view_bag->set('has_sosa', false);
295
+	/**
296
+	 * Render the Ajax response for the sortable table of Sosa individuals
297
+	 * @param AjaxController $controller
298
+	 */
299
+	protected function renderSosaListIndi(AjaxController $controller) {
300
+		$wt_tree = Globals::getTree();
301
+		$listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); 
302
+		$this->view_bag->set('has_sosa', false);
303 303
         
304
-        if(count($listSosa) > 0) {
305
-            $this->view_bag->set('has_sosa', true);
306
-            $table_id = 'table-sosa-indi-' . Uuid::uuid4();
307
-            $this->view_bag->set('table_id', $table_id);
304
+		if(count($listSosa) > 0) {
305
+			$this->view_bag->set('has_sosa', true);
306
+			$table_id = 'table-sosa-indi-' . Uuid::uuid4();
307
+			$this->view_bag->set('table_id', $table_id);
308 308
                      
309
-            $controller
310
-            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
311
-            ->addInlineJavascript('
309
+			$controller
310
+			->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
311
+			->addInlineJavascript('
312 312
                 jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc;
313 313
                 jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc;
314 314
                 
@@ -375,95 +375,95 @@  discard block
 block discarded – undo
375 375
 				jQuery("#btn-toggle-statistics-'.$table_id.'").click();
376 376
            ');
377 377
             
378
-            $stats = new Stats($wt_tree);         
378
+			$stats = new Stats($wt_tree);         
379 379
             
380
-            // Bad data can cause "longest life" to be huge, blowing memory limits
381
-            $max_age = min($wt_tree->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1;
382
-            // Inititialise chart data
383
-            $deat_by_age = array();
384
-            for ($age = 0; $age <= $max_age; $age++) {
385
-                $deat_by_age[$age] = '';
386
-            }
387
-            $birt_by_decade = array();
388
-            $deat_by_decade = array();
389
-            for ($year = 1550; $year < 2030; $year += 10) {
390
-                $birt_by_decade[$year] = '';
391
-                $deat_by_decade[$year] = '';
392
-            }
380
+			// Bad data can cause "longest life" to be huge, blowing memory limits
381
+			$max_age = min($wt_tree->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1;
382
+			// Inititialise chart data
383
+			$deat_by_age = array();
384
+			for ($age = 0; $age <= $max_age; $age++) {
385
+				$deat_by_age[$age] = '';
386
+			}
387
+			$birt_by_decade = array();
388
+			$deat_by_decade = array();
389
+			for ($year = 1550; $year < 2030; $year += 10) {
390
+				$birt_by_decade[$year] = '';
391
+				$deat_by_decade[$year] = '';
392
+			}
393 393
             
394
-            $unique_indis = array(); // Don't double-count indis with multiple names.
395
-            $nb_displayed = 0;
394
+			$unique_indis = array(); // Don't double-count indis with multiple names.
395
+			$nb_displayed = 0;
396 396
             
397
-            Individual::load($wt_tree, $listSosa);
398
-            foreach($listSosa as $sosa => $pid) {
399
-                $person = Individual::getInstance($pid, $wt_tree);
400
-                if (!$person || !$person->canShowName()) {
401
-                    unset($listSosa[$sosa]);
402
-                    continue;
403
-                }
404
-                $nb_displayed++;
405
-                if ($birth_dates=$person->getAllBirthDates()) {
406
-                    if (
407
-                        FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) &&
408
-                        !isset($unique_indis[$person->getXref()])
409
-                        ) {
410
-                        $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex();
411
-                    }
412
-                }
413
-                else {
414
-                    $birth_dates[0]=new Date('');
415
-                }
416
-                if ($death_dates = $person->getAllDeathDates()) {
417
-                    if (
418
-                        FunctionsPrint::isDateWithinChartsRange($death_dates[0]) &&
419
-                        !isset($unique_indis[$person->getXref()])
420
-                        ) {
421
-                        $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex();
422
-                    }
423
-                }
424
-                else {
425
-                    $death_dates[0] = new Date('');
426
-                }
427
-                $age = Date::getAge($birth_dates[0], $death_dates[0], 0);
428
-                if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) {
429
-                    $deat_by_age[$age] .= $person->getSex();
430
-                }
431
-                $listSosa[$sosa] = $person;
432
-                $unique_indis[$person->getXref()] = true;
433
-            }
434
-            $this->view_bag->set('sosa_list', $listSosa);   
397
+			Individual::load($wt_tree, $listSosa);
398
+			foreach($listSosa as $sosa => $pid) {
399
+				$person = Individual::getInstance($pid, $wt_tree);
400
+				if (!$person || !$person->canShowName()) {
401
+					unset($listSosa[$sosa]);
402
+					continue;
403
+				}
404
+				$nb_displayed++;
405
+				if ($birth_dates=$person->getAllBirthDates()) {
406
+					if (
407
+						FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) &&
408
+						!isset($unique_indis[$person->getXref()])
409
+						) {
410
+						$birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex();
411
+					}
412
+				}
413
+				else {
414
+					$birth_dates[0]=new Date('');
415
+				}
416
+				if ($death_dates = $person->getAllDeathDates()) {
417
+					if (
418
+						FunctionsPrint::isDateWithinChartsRange($death_dates[0]) &&
419
+						!isset($unique_indis[$person->getXref()])
420
+						) {
421
+						$deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex();
422
+					}
423
+				}
424
+				else {
425
+					$death_dates[0] = new Date('');
426
+				}
427
+				$age = Date::getAge($birth_dates[0], $death_dates[0], 0);
428
+				if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) {
429
+					$deat_by_age[$age] .= $person->getSex();
430
+				}
431
+				$listSosa[$sosa] = $person;
432
+				$unique_indis[$person->getXref()] = true;
433
+			}
434
+			$this->view_bag->set('sosa_list', $listSosa);   
435 435
             
436
-            $this->view_bag->set('sosa_count', count($listSosa));
437
-            $this->view_bag->set('sosa_theo', pow(2, $this->generation-1));
438
-            $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo')));
436
+			$this->view_bag->set('sosa_count', count($listSosa));
437
+			$this->view_bag->set('sosa_theo', pow(2, $this->generation-1));
438
+			$this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo')));
439 439
             
440
-            $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed);
440
+			$this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed);
441 441
             
442
-            $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth')));
443
-            $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death')));
444
-            $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year')));
445
-        }
442
+			$this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth')));
443
+			$this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death')));
444
+			$this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year')));
445
+		}
446 446
         
447
-        ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render();        
448
-    }
447
+		ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render();        
448
+	}
449 449
     
450
-    /**
451
-     * Render the Ajax response for the sortable table of Sosa family
452
-     * @param AjaxController $controller
453
-     */
454
-    protected function renderFamSosaListIndi(AjaxController $controller) {
455
-        $wt_tree = Globals::getTree();
456
-        $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);;
457
-        $this->view_bag->set('has_sosa', false);
450
+	/**
451
+	 * Render the Ajax response for the sortable table of Sosa family
452
+	 * @param AjaxController $controller
453
+	 */
454
+	protected function renderFamSosaListIndi(AjaxController $controller) {
455
+		$wt_tree = Globals::getTree();
456
+		$listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);;
457
+		$this->view_bag->set('has_sosa', false);
458 458
         
459
-        if(count($listFamSosa) > 0) {
460
-            $this->view_bag->set('has_sosa', true);
461
-            $table_id = 'table-sosa-fam-' . Uuid::uuid4();
462
-            $this->view_bag->set('table_id', $table_id);
459
+		if(count($listFamSosa) > 0) {
460
+			$this->view_bag->set('has_sosa', true);
461
+			$table_id = 'table-sosa-fam-' . Uuid::uuid4();
462
+			$this->view_bag->set('table_id', $table_id);
463 463
              
464
-            $controller
465
-            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
466
-            ->addInlineJavascript('
464
+			$controller
465
+			->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
466
+			->addInlineJavascript('
467 467
 				jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc;
468 468
 				jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc;
469 469
                 
@@ -527,67 +527,67 @@  discard block
 block discarded – undo
527 527
 				jQuery("#btn-toggle-statistics-'.$table_id.'").click();
528 528
            ');
529 529
         
530
-            $stats = new Stats($wt_tree);        
531
-            $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1;
530
+			$stats = new Stats($wt_tree);        
531
+			$max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1;
532 532
             
533
-            //-- init chart data
534
-    		$marr_by_age = array();
535
-    		for ($age=0; $age<=$max_age; $age++) {
536
-    			$marr_by_age[$age] = '';
537
-    		}
538
-    		$birt_by_decade = array();
539
-    		$marr_by_decade = array();
540
-    		for ($year=1550; $year<2030; $year+=10) {
541
-    			$birt_by_decade[$year] = '';
542
-    			$marr_by_decade[$year] = '';
543
-    		}
533
+			//-- init chart data
534
+			$marr_by_age = array();
535
+			for ($age=0; $age<=$max_age; $age++) {
536
+				$marr_by_age[$age] = '';
537
+			}
538
+			$birt_by_decade = array();
539
+			$marr_by_decade = array();
540
+			for ($year=1550; $year<2030; $year+=10) {
541
+				$birt_by_decade[$year] = '';
542
+				$marr_by_decade[$year] = '';
543
+			}
544 544
     		
545
-            foreach($listFamSosa as $sosa => $fid) {
546
-                $sfamily = Family::getInstance($fid, $wt_tree);
547
-                if(!$sfamily || !$sfamily->canShow()) {
548
-                    unset($listFamSosa[$sosa]);
549
-                    continue;
550
-                }
551
-                $mdate=$sfamily->getMarriageDate();
545
+			foreach($listFamSosa as $sosa => $fid) {
546
+				$sfamily = Family::getInstance($fid, $wt_tree);
547
+				if(!$sfamily || !$sfamily->canShow()) {
548
+					unset($listFamSosa[$sosa]);
549
+					continue;
550
+				}
551
+				$mdate=$sfamily->getMarriageDate();
552 552
                 
553
-                if( ($husb = $sfamily->getHusband()) && 
554
-                    ($hdate = $husb->getBirthDate()) && 
555
-                    $hdate->isOK() && $mdate->isOK()) {
556
-                    if (FunctionsPrint::isDateWithinChartsRange($hdate)) {
557
-                        $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex();
558
-                    }
559
-                    $hage = Date::getAge($hdate, $mdate, 0);
560
-                    if ($hage >= 0 && $hage <= $max_age) {
561
-                        $marr_by_age[$hage] .= $husb->getSex();
562
-                    }
563
-                }
553
+				if( ($husb = $sfamily->getHusband()) && 
554
+					($hdate = $husb->getBirthDate()) && 
555
+					$hdate->isOK() && $mdate->isOK()) {
556
+					if (FunctionsPrint::isDateWithinChartsRange($hdate)) {
557
+						$birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex();
558
+					}
559
+					$hage = Date::getAge($hdate, $mdate, 0);
560
+					if ($hage >= 0 && $hage <= $max_age) {
561
+						$marr_by_age[$hage] .= $husb->getSex();
562
+					}
563
+				}
564 564
                 
565
-                if(($wife = $sfamily->getWife()) &&
566
-                    ($wdate=$wife->getBirthDate()) &&
567
-                    $wdate->isOK() && $mdate->isOK()) {
568
-                    if (FunctionsPrint::isDateWithinChartsRange($wdate)) {
569
-                        $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex();
570
-                    }
571
-                    $wage = Date::getAge($wdate, $mdate, 0);
572
-                    if ($wage >= 0 && $wage <= $max_age) {
573
-                        $marr_by_age[$wage] .= $wife->getSex();
574
-                    }
575
-                }                
565
+				if(($wife = $sfamily->getWife()) &&
566
+					($wdate=$wife->getBirthDate()) &&
567
+					$wdate->isOK() && $mdate->isOK()) {
568
+					if (FunctionsPrint::isDateWithinChartsRange($wdate)) {
569
+						$birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex();
570
+					}
571
+					$wage = Date::getAge($wdate, $mdate, 0);
572
+					if ($wage >= 0 && $wage <= $max_age) {
573
+						$marr_by_age[$wage] .= $wife->getSex();
574
+					}
575
+				}                
576 576
 
577
-                if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) {
578
-                    $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex();
579
-                }
577
+				if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) {
578
+					$marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex();
579
+				}
580 580
                 
581
-                $listFamSosa[$sosa] = $sfamily;
582
-            }
583
-            $this->view_bag->set('sosa_list', $listFamSosa);
581
+				$listFamSosa[$sosa] = $sfamily;
582
+			}
583
+			$this->view_bag->set('sosa_list', $listFamSosa);
584 584
         
585
-            $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth')));
586
-            $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage')));
587
-            $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage')));
588
-        }
585
+			$this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth')));
586
+			$this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage')));
587
+			$this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage')));
588
+		}
589 589
         
590
-        ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render();
591
-    }
590
+		ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render();
591
+	}
592 592
     
593 593
 }
594 594
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/GedcomRecord.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 			if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) {
71 71
 				switch ($style) {
72 72
 					case 10:
73
-					    return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .'&nbsp;'. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>';
73
+						return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .'&nbsp;'. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>';
74 74
 					default:
75 75
 						return $this->gedcomrecord->formatFirstMajorFact($facts, $style);
76 76
 				}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	public function canDisplayIsSourced($access_level = null){
89 89
 		if(!$this->gedcomrecord->canShow($access_level)) return false;
90 90
 		if($access_level === null )
91
-		    $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree());
91
+			$access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree());
92 92
 
93 93
 		$global_facts = Globals::getGlobalFacts();
94 94
 		if (isset($global_facts['SOUR'])) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @return int Level of sources
128 128
 	 */
129 129
 	public function isFactSourced($eventslist){
130
-	    if(empty($eventslist)) return 0;
130
+		if(empty($eventslist)) return 0;
131 131
 		$isSourced=0;
132 132
 		$facts = $this->gedcomrecord->getFacts($eventslist);
133 133
 		foreach($facts as $fact){
Please login to merge, or discard this patch.
src/Webtrees/Globals.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -16,48 +16,48 @@
 block discarded – undo
16 16
  */
17 17
 class Globals {
18 18
     
19
-    /**
20
-     * Get global $WT_TREE variable.
21
-     * 
22
-     * @return \Fisharebest\Webtrees\Tree
23
-     */
24
-    public static function getTree() {
25
-        global $WT_TREE;
19
+	/**
20
+	 * Get global $WT_TREE variable.
21
+	 * 
22
+	 * @return \Fisharebest\Webtrees\Tree
23
+	 */
24
+	public static function getTree() {
25
+		global $WT_TREE;
26 26
         
27
-        return $WT_TREE;
28
-    }
27
+		return $WT_TREE;
28
+	}
29 29
     
30
-    /**
31
-     * Check whether the visitor is a bot.
32
-     * 
33
-     * @return boolean
34
-     */
35
-    public static function isSearchSpider() {
36
-        global $SEARCH_SPIDER;
30
+	/**
31
+	 * Check whether the visitor is a bot.
32
+	 * 
33
+	 * @return boolean
34
+	 */
35
+	public static function isSearchSpider() {
36
+		global $SEARCH_SPIDER;
37 37
         
38
-        return $SEARCH_SPIDER;
39
-    }
38
+		return $SEARCH_SPIDER;
39
+	}
40 40
     
41
-    /**
42
-     * Get the current controller.
43
-     * 
44
-     * @return \Fisharebest\Webtrees\BaseController
45
-     */
46
-    public static function getController() {
47
-        global $controller;
41
+	/**
42
+	 * Get the current controller.
43
+	 * 
44
+	 * @return \Fisharebest\Webtrees\BaseController
45
+	 */
46
+	public static function getController() {
47
+		global $controller;
48 48
         
49
-        return $controller;
50
-    }
49
+		return $controller;
50
+	}
51 51
     
52
-    /**
53
-     * Get the global facts
54
-     * 
55
-     * @return array
56
-     */
57
-    public static function getGlobalFacts() {
58
-        global $global_facts;
52
+	/**
53
+	 * Get the global facts
54
+	 * 
55
+	 * @return array
56
+	 */
57
+	public static function getGlobalFacts() {
58
+		global $global_facts;
59 59
         
60
-        return $global_facts;
61
-    }
60
+		return $global_facts;
61
+	}
62 62
     
63 63
 }
Please login to merge, or discard this patch.
src/Webtrees/Functions/Functions.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	 * @return string Encryption key
130 130
 	 */
131 131
 	protected static function getBase64EncryptionKey() {	    
132
-	    $key = 'STANDARDKEYIFNOSERVER';
133
-	    if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
134
-	        $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
132
+		$key = 'STANDARDKEYIFNOSERVER';
133
+		if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE')))
134
+			$key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE'));
135 135
 	    
136
-	    return $key;
136
+		return $key;
137 137
 	}
138 138
 	
139 139
 	/**	  
@@ -172,20 +172,20 @@  discard block
 block discarded – undo
172 172
 			throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
173 173
 		
174 174
 		if (mb_strlen($encrypted, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES))
175
-		    throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
175
+			throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
176 176
 
177
-	    $nonce = mb_substr($encrypted, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit');
178
-	    $ciphertext = mb_substr($encrypted, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit');
177
+		$nonce = mb_substr($encrypted, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit');
178
+		$ciphertext = mb_substr($encrypted, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit');
179 179
         
180
-        $decrypted = sodium_crypto_secretbox_open($ciphertext, $nonce, self::getBase64EncryptionKey());
180
+		$decrypted = sodium_crypto_secretbox_open($ciphertext, $nonce, self::getBase64EncryptionKey());
181 181
 		
182
-        if($decrypted === false) {
183
-            throw new \InvalidArgumentException('The message has been tampered with in transit.');
184
-        }
182
+		if($decrypted === false) {
183
+			throw new \InvalidArgumentException('The message has been tampered with in transit.');
184
+		}
185 185
         
186
-        //sodium_memzero($encrypted);   // Requires PHP 7.2
186
+		//sodium_memzero($encrypted);   // Requires PHP 7.2
187 187
         
188
-        return $decrypted;
188
+		return $decrypted;
189 189
 	}
190 190
 	
191 191
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	public static function encodeFileSystemToUtf8($string){
198 198
 		if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') {
199
-		    return iconv('cp1252', 'utf-8//IGNORE',$string);
199
+			return iconv('cp1252', 'utf-8//IGNORE',$string);
200 200
 		}
201 201
 		return $string;
202 202
 	}
@@ -261,20 +261,20 @@  discard block
 block discarded – undo
261 261
 	 * @return boolean|string Is supported?
262 262
 	 */
263 263
 	public static function isImageTypeSupported($reqtype) {
264
-	    $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
265
-	    $reqtype = strtolower($reqtype);
264
+		$supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png');
265
+		$reqtype = strtolower($reqtype);
266 266
 	
267
-	    if (empty($supportByGD[$reqtype])) {
268
-	        return false;
269
-	    }
267
+		if (empty($supportByGD[$reqtype])) {
268
+			return false;
269
+		}
270 270
 	
271
-	    $type = $supportByGD[$reqtype];
271
+		$type = $supportByGD[$reqtype];
272 272
 	
273
-	    if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) {
274
-	        return $type;
275
-	    }
273
+		if (function_exists('imagecreatefrom'.$type) && function_exists('image'.$type)) {
274
+			return $type;
275
+		}
276 276
 	
277
-	    return false;
277
+		return false;
278 278
 	}
279 279
 		
280 280
 }
Please login to merge, or discard this patch.
src/Webtrees/Hook/HookProvider.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public static function getInstance()
45 45
 	{
46
-	    if (null === static::$instance) {
47
-	        static::$instance = new static();
48
-	    }
46
+		if (null === static::$instance) {
47
+			static::$instance = new static();
48
+		}
49 49
 	
50
-	    return static::$instance;
50
+		return static::$instance;
51 51
 	}
52 52
 	
53 53
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::get()
56 56
 	 */
57 57
 	public function get($hook_function, $hook_context = null) {
58
-	    return new Hook($hook_function, $hook_context);
58
+		return new Hook($hook_function, $hook_context);
59 59
 	}
60 60
 	
61 61
 	/**
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
 	public function getPossibleHooks() {
74 74
 		static $hooks=null;
75 75
 		if ($hooks === null) {
76
-		    $hooks = array();
76
+			$hooks = array();
77 77
 		    
78
-		    // Cannot use the same logic as the core Module loading,
79
-		    // as this forces a new include of the module.php file.
80
-		    // This causes issue when classes are defined in this file.
81
-		    // Cannot use Module::getActiveModules as well, as this is private.
82
-		    $module_names = Database::prepare(
83
-		        'SELECT module_name FROM `##module`'
84
-		    )->fetchOneColumn();
78
+			// Cannot use the same logic as the core Module loading,
79
+			// as this forces a new include of the module.php file.
80
+			// This causes issue when classes are defined in this file.
81
+			// Cannot use Module::getActiveModules as well, as this is private.
82
+			$module_names = Database::prepare(
83
+				'SELECT module_name FROM `##module`'
84
+			)->fetchOneColumn();
85 85
 		    
86
-		    foreach($module_names as $module_name) {
87
-		        $module = Module::getModuleByName($module_name);
86
+			foreach($module_names as $module_name) {
87
+				$module = Module::getModuleByName($module_name);
88 88
 		        
89
-		        if($module instanceof HookSubscriberInterface){
89
+				if($module instanceof HookSubscriberInterface){
90 90
 					$subscribedhooks = $module->getSubscribedHooks();
91 91
 					if(is_array($subscribedhooks)){
92 92
 						foreach($subscribedhooks as $key => $value){
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 							}
112 112
 						}
113 113
 					}
114
-		        }
114
+				}
115 115
 			}
116 116
 		}
117 117
 		return $hooks;
@@ -153,33 +153,33 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	public function updateHooks() {
155 155
 	    
156
-	    if(Auth::isAdmin()){
157
-	        $ihooks = self::getInstalledHooks();
158
-	        $phooks = self::getPossibleHooks();
156
+		if(Auth::isAdmin()){
157
+			$ihooks = self::getInstalledHooks();
158
+			$phooks = self::getPossibleHooks();
159 159
 	        	
160
-	        // Insert hooks not existing yet in the DB
161
-	        if($phooks !== null){
162
-	            foreach($phooks as $phook => $priority){
163
-	                $array_hook = explode('#', $phook);
164
-	                if($ihooks === null || !array_key_exists($phook, $ihooks)){
165
-	                    $chook = new Hook($array_hook[1], $array_hook[2]);
166
-	                    $chook->subscribe($array_hook[0]);
167
-	                    $chook->setPriority($array_hook[0], $priority);
168
-	                }
169
-	            }
170
-	        }
160
+			// Insert hooks not existing yet in the DB
161
+			if($phooks !== null){
162
+				foreach($phooks as $phook => $priority){
163
+					$array_hook = explode('#', $phook);
164
+					if($ihooks === null || !array_key_exists($phook, $ihooks)){
165
+						$chook = new Hook($array_hook[1], $array_hook[2]);
166
+						$chook->subscribe($array_hook[0]);
167
+						$chook->setPriority($array_hook[0], $priority);
168
+					}
169
+				}
170
+			}
171 171
 	        	
172
-	        //Remove hooks not existing any more in the file system
173
-	        if($ihooks !== null){
174
-	            foreach(array_keys($ihooks) as $ihook){
175
-	                $array_hook = explode('#', $ihook);
176
-	                if($phooks === null || !array_key_exists($ihook, $phooks)){
177
-	                    $chook = new Hook($array_hook[1], $array_hook[2]);
178
-	                    $chook->remove($array_hook[0]);
179
-	                }
180
-	            }
181
-	        }
182
-	    }
172
+			//Remove hooks not existing any more in the file system
173
+			if($ihooks !== null){
174
+				foreach(array_keys($ihooks) as $ihook){
175
+					$array_hook = explode('#', $ihook);
176
+					if($phooks === null || !array_key_exists($ihook, $phooks)){
177
+						$chook = new Hook($array_hook[1], $array_hook[2]);
178
+						$chook->remove($array_hook[0]);
179
+					}
180
+				}
181
+			}
182
+		}
183 183
 	}
184 184
 	
185 185
 }
186 186
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoAnalysisProvider.php 1 patch
Indentation   +327 added lines, -327 removed lines patch added patch discarded remove patch
@@ -21,130 +21,130 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class GeoAnalysisProvider {
23 23
     
24
-    /**
25
-     * Reference tree
26
-     * @var Tree $tree
27
-     */
28
-    protected $tree;
24
+	/**
25
+	 * Reference tree
26
+	 * @var Tree $tree
27
+	 */
28
+	protected $tree;
29 29
     
30
-    /**
31
-     * Cached hierarchy of places in the Gedcom file.
32
-     * 
33
-     * @var (array|null) $place_hierarchy
34
-     */
35
-    protected $place_hierarchy;
30
+	/**
31
+	 * Cached hierarchy of places in the Gedcom file.
32
+	 * 
33
+	 * @var (array|null) $place_hierarchy
34
+	 */
35
+	protected $place_hierarchy;
36 36
     
37
-    /**
38
-     * Constructor for GeoAnalysis Provider.
39
-     * A provider is defined in relation to a specific tree.
40
-     *
41
-     * @param Tree $tree
42
-     */
43
-    public function __construct(Tree $tree) {
44
-        $this->tree = $tree;
45
-        $this->place_hierarchy = null;
46
-    }
37
+	/**
38
+	 * Constructor for GeoAnalysis Provider.
39
+	 * A provider is defined in relation to a specific tree.
40
+	 *
41
+	 * @param Tree $tree
42
+	 */
43
+	public function __construct(Tree $tree) {
44
+		$this->tree = $tree;
45
+		$this->place_hierarchy = null;
46
+	}
47 47
     
48
-    /**
49
-     * Creates and returns a GeoAnalysis object from a data row.
50
-     * The row data is expected to be an array with the indexes:
51
-     *  - majgd_id: geodispersion analysis ID
52
-     *  - majgd_descr: geodispersion analysis description/title
53
-     *  - majgd_sublevel: Analysis level
54
-     *  - majgd_useflagsgen: Use flags in places display
55
-     *  - majgd_detailsgen: Number of top places
56
-     *  - majgd_map: file name of the map
57
-     *  - majgd_toplevel: parent level for the map
58
-     * 
59
-     * @param array $row
60
-     * @return GeoAnalysis
61
-     */
62
-    protected function loadGeoAnalysisFromRow($row) {
63
-        $options = new GeoDisplayOptions();
64
-        $options
65
-        ->setUsingFlags($row['majgd_useflagsgen'] == 'yes')
66
-        ->setMaxDetailsInGen($row['majgd_detailsgen']);
48
+	/**
49
+	 * Creates and returns a GeoAnalysis object from a data row.
50
+	 * The row data is expected to be an array with the indexes:
51
+	 *  - majgd_id: geodispersion analysis ID
52
+	 *  - majgd_descr: geodispersion analysis description/title
53
+	 *  - majgd_sublevel: Analysis level
54
+	 *  - majgd_useflagsgen: Use flags in places display
55
+	 *  - majgd_detailsgen: Number of top places
56
+	 *  - majgd_map: file name of the map
57
+	 *  - majgd_toplevel: parent level for the map
58
+	 * 
59
+	 * @param array $row
60
+	 * @return GeoAnalysis
61
+	 */
62
+	protected function loadGeoAnalysisFromRow($row) {
63
+		$options = new GeoDisplayOptions();
64
+		$options
65
+		->setUsingFlags($row['majgd_useflagsgen'] == 'yes')
66
+		->setMaxDetailsInGen($row['majgd_detailsgen']);
67 67
         
68
-        if($row['majgd_map']) {
69
-            $options
70
-            ->setMap(new OutlineMap($row['majgd_map']))
71
-            ->setMapLevel($row['majgd_toplevel']);
72
-        }
68
+		if($row['majgd_map']) {
69
+			$options
70
+			->setMap(new OutlineMap($row['majgd_map']))
71
+			->setMapLevel($row['majgd_toplevel']);
72
+		}
73 73
         
74
-        $enabled = true;
75
-        if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
76
-            $enabled = false;
77
-        }
74
+		$enabled = true;
75
+		if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') {
76
+			$enabled = false;
77
+		}
78 78
         
79
-        return new GeoAnalysis(
80
-            $this->tree,
81
-            $row['majgd_id'],
82
-            $row['majgd_descr'],
83
-            $row['majgd_sublevel'],
84
-            $options,
85
-            $enabled
86
-            );
87
-    }
79
+		return new GeoAnalysis(
80
+			$this->tree,
81
+			$row['majgd_id'],
82
+			$row['majgd_descr'],
83
+			$row['majgd_sublevel'],
84
+			$options,
85
+			$enabled
86
+			);
87
+	}
88 88
     
89
-    /**
90
-     * Returns the number of geographical analysis (active and inactive). 
91
-     * 
92
-     * @return int
93
-     */
94
-    public function getGeoAnalysisCount() {
95
-        return Database::prepare(
96
-            'SELECT COUNT(majgd_id)' .
97
-            ' FROM `##maj_geodispersion`' .
98
-            ' WHERE majgd_file = :gedcom_id'
99
-            )->execute(array(
100
-                'gedcom_id' => $this->tree->getTreeId()
101
-            ))->fetchOne();
102
-    }
89
+	/**
90
+	 * Returns the number of geographical analysis (active and inactive). 
91
+	 * 
92
+	 * @return int
93
+	 */
94
+	public function getGeoAnalysisCount() {
95
+		return Database::prepare(
96
+			'SELECT COUNT(majgd_id)' .
97
+			' FROM `##maj_geodispersion`' .
98
+			' WHERE majgd_file = :gedcom_id'
99
+			)->execute(array(
100
+				'gedcom_id' => $this->tree->getTreeId()
101
+			))->fetchOne();
102
+	}
103 103
     
104
-    /**
105
-     * Get a geographical analysis by its ID.
106
-     * The function can only search for only enabled analysis, or all.
107
-     * 
108
-     * @param int $id geodispersion analysis ID
109
-     * @param bool $only_enabled Search for only enabled geodispersion analysis
110
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL
111
-     */
112
-    public function getGeoAnalysis($id, $only_enabled = true) {
113
-        $args = array (
114
-            'gedcom_id' => $this->tree->getTreeId(),
115
-            'ga_id' => $id
116
-        );
104
+	/**
105
+	 * Get a geographical analysis by its ID.
106
+	 * The function can only search for only enabled analysis, or all.
107
+	 * 
108
+	 * @param int $id geodispersion analysis ID
109
+	 * @param bool $only_enabled Search for only enabled geodispersion analysis
110
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL
111
+	 */
112
+	public function getGeoAnalysis($id, $only_enabled = true) {
113
+		$args = array (
114
+			'gedcom_id' => $this->tree->getTreeId(),
115
+			'ga_id' => $id
116
+		);
117 117
         
118
-        $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
119
-            ' FROM `##maj_geodispersion`' .
120
-            ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id';
121
-        if($only_enabled) {
122
-            $sql .= ' AND majgd_status = :status';
123
-            $args['status'] = 'enabled';
124
-        }
125
-        $sql .= ' ORDER BY majgd_descr';
118
+		$sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
119
+			' FROM `##maj_geodispersion`' .
120
+			' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id';
121
+		if($only_enabled) {
122
+			$sql .= ' AND majgd_status = :status';
123
+			$args['status'] = 'enabled';
124
+		}
125
+		$sql .= ' ORDER BY majgd_descr';
126 126
         
127
-        $ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
127
+		$ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
128 128
         
129
-        if($ga_array) {
130
-            return $this->loadGeoAnalysisFromRow($ga_array);
131
-        }
129
+		if($ga_array) {
130
+			return $this->loadGeoAnalysisFromRow($ga_array);
131
+		}
132 132
         
133
-        return null;            
134
-    }
133
+		return null;            
134
+	}
135 135
     
136
-    /**
137
-     * Add a new geodispersion analysis in the database, in a transactional manner.
138
-     * When successful, eturns the newly created GeoAnalysis object.
139
-     * 
140
-     * @param string $description geodispersion analysis title
141
-     * @param int $analysis_level Analysis level
142
-     * @param string $map_file Filename of the map
143
-     * @param int $map_top_level Parent level of the map
144
-     * @param bool $use_flags Use flag in the place display
145
-     * @param int $gen_details Number of top places to display
146
-     * @return GeoAnalysis
147
-     */
136
+	/**
137
+	 * Add a new geodispersion analysis in the database, in a transactional manner.
138
+	 * When successful, eturns the newly created GeoAnalysis object.
139
+	 * 
140
+	 * @param string $description geodispersion analysis title
141
+	 * @param int $analysis_level Analysis level
142
+	 * @param string $map_file Filename of the map
143
+	 * @param int $map_top_level Parent level of the map
144
+	 * @param bool $use_flags Use flag in the place display
145
+	 * @param int $gen_details Number of top places to display
146
+	 * @return GeoAnalysis
147
+	 */
148 148
 	public function createGeoAnalysis($description, $analysis_level, $map_file, $map_top_level, $use_flags, $gen_details) {
149 149
 		try{
150 150
 			Database::beginTransaction();
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
 			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());
175 175
 		}
176 176
 		return $ga;
177
-    }
177
+	}
178 178
 	
179
-    /**
180
-     * Update a geodispersion analysis in the database, in transactional manner.
181
-     * When successful, returns the updated GeoAnalysis object
182
-     *  
183
-     * @param GeoAnalysis $ga
184
-     * @return GeoAnalysis
185
-     */
186
-    public function updateGeoAnalysis(GeoAnalysis $ga) {
187
-        try {
179
+	/**
180
+	 * Update a geodispersion analysis in the database, in transactional manner.
181
+	 * When successful, returns the updated GeoAnalysis object
182
+	 *  
183
+	 * @param GeoAnalysis $ga
184
+	 * @return GeoAnalysis
185
+	 */
186
+	public function updateGeoAnalysis(GeoAnalysis $ga) {
187
+		try {
188 188
 			Database::beginTransaction();
189 189
 		
190 190
 			Database::prepare(
@@ -217,236 +217,236 @@  discard block
 block discarded – undo
217 217
 			$ga = null;
218 218
 		}
219 219
 		return $ga;
220
-    }
220
+	}
221 221
     
222
-    /**
223
-     * Set the status of a specific analysis.
224
-     * The status can be enabled (true), or disabled (false).
225
-     * 
226
-     * @param GeoAnalysis $ga
227
-     * @param bool $status
228
-     */
229
-    public function setGeoAnalysisStatus(GeoAnalysis $ga, $status) {
230
-        Database::prepare(
231
-            'UPDATE `##maj_geodispersion`'.
232
-            ' SET majgd_status = :status'.
233
-            ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
234
-        )->execute(array(
235
-                'gedcom_id' => $this->tree->getTreeId(),
236
-                'status' => $status ? 'enabled' : 'disabled',
237
-                'ga_id' => $ga->getId()
238
-        ));
239
-    }
222
+	/**
223
+	 * Set the status of a specific analysis.
224
+	 * The status can be enabled (true), or disabled (false).
225
+	 * 
226
+	 * @param GeoAnalysis $ga
227
+	 * @param bool $status
228
+	 */
229
+	public function setGeoAnalysisStatus(GeoAnalysis $ga, $status) {
230
+		Database::prepare(
231
+			'UPDATE `##maj_geodispersion`'.
232
+			' SET majgd_status = :status'.
233
+			' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
234
+		)->execute(array(
235
+				'gedcom_id' => $this->tree->getTreeId(),
236
+				'status' => $status ? 'enabled' : 'disabled',
237
+				'ga_id' => $ga->getId()
238
+		));
239
+	}
240 240
     
241
-    /**
242
-     * Delete a geodispersion analysis from the database.
243
-     * 
244
-     * @param GeoAnalysis $ga
245
-     */
246
-    public function deleteGeoAnalysis(GeoAnalysis $ga) {
247
-        Database::prepare(
248
-            'DELETE FROM `##maj_geodispersion`'.
249
-            ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
250
-            )->execute(array(
251
-                'gedcom_id' => $this->tree->getTreeId(),
252
-                'ga_id' => $ga->getId()
253
-            ));
254
-    }
241
+	/**
242
+	 * Delete a geodispersion analysis from the database.
243
+	 * 
244
+	 * @param GeoAnalysis $ga
245
+	 */
246
+	public function deleteGeoAnalysis(GeoAnalysis $ga) {
247
+		Database::prepare(
248
+			'DELETE FROM `##maj_geodispersion`'.
249
+			' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'
250
+			)->execute(array(
251
+				'gedcom_id' => $this->tree->getTreeId(),
252
+				'ga_id' => $ga->getId()
253
+			));
254
+	}
255 255
         
256
-    /**
257
-     * Return the list of geodispersion analysis recorded and enabled for a specific GEDCOM
258
-     *
259
-     * @return array List of enabled maps
260
-     */
261
-    public function getGeoAnalysisList(){
262
-        $res = array();
256
+	/**
257
+	 * Return the list of geodispersion analysis recorded and enabled for a specific GEDCOM
258
+	 *
259
+	 * @return array List of enabled maps
260
+	 */
261
+	public function getGeoAnalysisList(){
262
+		$res = array();
263 263
         
264
-        $list = Database::prepare(
265
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' .
266
-            ' FROM `##maj_geodispersion`' .
267
-            ' WHERE majgd_file = :gedcom_id AND majgd_status = :status'.
268
-            ' ORDER BY majgd_descr'
269
-        )->execute(array(
270
-            'gedcom_id' => $this->tree->getTreeId(),
271
-            'status' => 'enabled'
272
-        ))->fetchAll(\PDO::FETCH_ASSOC);
264
+		$list = Database::prepare(
265
+			'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' .
266
+			' FROM `##maj_geodispersion`' .
267
+			' WHERE majgd_file = :gedcom_id AND majgd_status = :status'.
268
+			' ORDER BY majgd_descr'
269
+		)->execute(array(
270
+			'gedcom_id' => $this->tree->getTreeId(),
271
+			'status' => 'enabled'
272
+		))->fetchAll(\PDO::FETCH_ASSOC);
273 273
         
274
-        foreach($list as $ga) {
275
-           $res[] = $this->loadGeoAnalysisFromRow($ga);
276
-        }
274
+		foreach($list as $ga) {
275
+		   $res[] = $this->loadGeoAnalysisFromRow($ga);
276
+		}
277 277
         
278
-        return $res;
279
-    }
278
+		return $res;
279
+	}
280 280
     
281
-    /**
282
-     * Return the list of geodispersion analysis matching specified criterias.
283
-     * 
284
-     * @param string $search Search criteria in analysis description
285
-     * @param array $order_by Columns to order by
286
-     * @param int $start Offset to start with (for pagination)
287
-     * @param int|null $limit Max number of items to return (for pagination)
288
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
289
-     */
290
-    public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){
291
-        $res = array();
281
+	/**
282
+	 * Return the list of geodispersion analysis matching specified criterias.
283
+	 * 
284
+	 * @param string $search Search criteria in analysis description
285
+	 * @param array $order_by Columns to order by
286
+	 * @param int $start Offset to start with (for pagination)
287
+	 * @param int|null $limit Max number of items to return (for pagination)
288
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[]
289
+	 */
290
+	public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){
291
+		$res = array();
292 292
             
293
-        $sql = 
294
-            'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
295
-            ' FROM `##maj_geodispersion`' .
296
-            ' WHERE majgd_file = :gedcom_id';
293
+		$sql = 
294
+			'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' .
295
+			' FROM `##maj_geodispersion`' .
296
+			' WHERE majgd_file = :gedcom_id';
297 297
         
298
-        $args = array('gedcom_id'=> $this->tree->getTreeId());
298
+		$args = array('gedcom_id'=> $this->tree->getTreeId());
299 299
         
300
-        if($search) {
301
-            $sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')';
302
-            $args['search'] = $search;
303
-        }
300
+		if($search) {
301
+			$sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')';
302
+			$args['search'] = $search;
303
+		}
304 304
         
305
-        if ($order_by) {
306
-            $sql .= ' ORDER BY ';
307
-            foreach ($order_by as $key => $value) {
308
-                if ($key > 0) {
309
-                    $sql .= ',';
310
-                }
305
+		if ($order_by) {
306
+			$sql .= ' ORDER BY ';
307
+			foreach ($order_by as $key => $value) {
308
+				if ($key > 0) {
309
+					$sql .= ',';
310
+				}
311 311
                 
312
-                switch ($value['dir']) {
313
-                    case 'asc':
314
-                        $sql .= $value['column'] . ' ASC ';
315
-                        break;
316
-                    case 'desc':
317
-                        $sql .= $value['column'] . ' DESC ';
318
-                        break;
319
-                }
320
-            }
321
-        } else {
322
-            $sql .= ' ORDER BY majgd_descr ASC';
323
-        }
312
+				switch ($value['dir']) {
313
+					case 'asc':
314
+						$sql .= $value['column'] . ' ASC ';
315
+						break;
316
+					case 'desc':
317
+						$sql .= $value['column'] . ' DESC ';
318
+						break;
319
+				}
320
+			}
321
+		} else {
322
+			$sql .= ' ORDER BY majgd_descr ASC';
323
+		}
324 324
         
325
-        if ($limit) {
326
-            $sql .= " LIMIT :limit OFFSET :offset";
327
-            $args['limit']  = $limit;
328
-            $args['offset'] = $start;
329
-        }
325
+		if ($limit) {
326
+			$sql .= " LIMIT :limit OFFSET :offset";
327
+			$args['limit']  = $limit;
328
+			$args['offset'] = $start;
329
+		}
330 330
             
331
-        $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
331
+		$data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
332 332
 
333
-        foreach($data as $ga) {
334
-            $res[] = $this->loadGeoAnalysisFromRow($ga);
335
-        }
333
+		foreach($data as $ga) {
334
+			$res[] = $this->loadGeoAnalysisFromRow($ga);
335
+		}
336 336
         
337
-        return $res;
338
-    }
337
+		return $res;
338
+	}
339 339
             
340
-    /**
341
-     * Returns the infered place hierarchy, determined from the Gedcom data.
342
-     * Depending on the data, it can be based on the Gedcom Header description, or from a place example.
343
-     * This is returned as an associative array:
344
-     *      - type:    describe the source of the data (<em>header<em> / <em>data</em>)
345
-     *      - hierarchy: an array of the place hierarchy (in reverse order of the gedcom)
346
-     *      
347
-     * @return array
348
-     */
349
-    public function getPlacesHierarchy() {
350
-        if(!$this->place_hierarchy) {
351
-            if($place_structure = $this->getPlacesHierarchyFromHeader()) {
352
-                $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353
-            }
354
-            else {
355
-                $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData());
356
-            }            
357
-        }
358
-        return $this->place_hierarchy;        
359
-    }
340
+	/**
341
+	 * Returns the infered place hierarchy, determined from the Gedcom data.
342
+	 * Depending on the data, it can be based on the Gedcom Header description, or from a place example.
343
+	 * This is returned as an associative array:
344
+	 *      - type:    describe the source of the data (<em>header<em> / <em>data</em>)
345
+	 *      - hierarchy: an array of the place hierarchy (in reverse order of the gedcom)
346
+	 *      
347
+	 * @return array
348
+	 */
349
+	public function getPlacesHierarchy() {
350
+		if(!$this->place_hierarchy) {
351
+			if($place_structure = $this->getPlacesHierarchyFromHeader()) {
352
+				$this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure);
353
+			}
354
+			else {
355
+				$this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData());
356
+			}            
357
+		}
358
+		return $this->place_hierarchy;        
359
+	}
360 360
     
361
-    /**
362
-     * Returns an array of the place hierarchy, as defined in the GEDCOM header.
363
-     * The places are reversed compared to normal GEDCOM structure.
364
-     * 
365
-     * @return array|null
366
-     */
367
-    protected function getPlacesHierarchyFromHeader() {
368
-        $head = GedcomRecord::getInstance('HEAD', $this->tree);
369
-        $head_place = $head->getFirstFact('PLAC');
370
-        if($head_place && $head_place_value = $head_place->getAttribute('FORM')){
371
-            return array_reverse(array_map('trim',explode(',', $head_place_value)));
372
-        }
373
-        return null;
374
-    }
361
+	/**
362
+	 * Returns an array of the place hierarchy, as defined in the GEDCOM header.
363
+	 * The places are reversed compared to normal GEDCOM structure.
364
+	 * 
365
+	 * @return array|null
366
+	 */
367
+	protected function getPlacesHierarchyFromHeader() {
368
+		$head = GedcomRecord::getInstance('HEAD', $this->tree);
369
+		$head_place = $head->getFirstFact('PLAC');
370
+		if($head_place && $head_place_value = $head_place->getAttribute('FORM')){
371
+			return array_reverse(array_map('trim',explode(',', $head_place_value)));
372
+		}
373
+		return null;
374
+	}
375 375
     
376
-    /**
377
-     * Returns an array of the place hierarchy, based on a random example of place within the GEDCOM.
378
-     * It will look for the longest hierarchy in the tree.
379
-     * The places are reversed compared to normal GEDCOM structure.
380
-     * 
381
-     * @return array
382
-     */
383
-    protected function getPlacesHierarchyFromData() {
384
-        $nb_levels = 0;
376
+	/**
377
+	 * Returns an array of the place hierarchy, based on a random example of place within the GEDCOM.
378
+	 * It will look for the longest hierarchy in the tree.
379
+	 * The places are reversed compared to normal GEDCOM structure.
380
+	 * 
381
+	 * @return array
382
+	 */
383
+	protected function getPlacesHierarchyFromData() {
384
+		$nb_levels = 0;
385 385
         
386
-        //Select all '2 PLAC ' tags in the file and create array
387
-        $places_list=array();
388
-        $ged_data = Database::prepare(
389
-            'SELECT i_gedcom AS gedcom'.
390
-            ' FROM `##individuals`'.
391
-            ' WHERE i_gedcom LIKE :gedcom AND i_file = :gedcom_id'.
392
-            ' UNION ALL'.
393
-            'SELECT f_gedcom AS gedcom'.
394
-            ' FROM `##families`'.
395
-            ' WHERE f_gedcom LIKE :gedcom AND f_file = :gedcom_id'
396
-        )->execute(array(
397
-            'gedcom' => '%\n2 PLAC %',
398
-            'gedcom_id' => $this->tree->getTreeId()            
399
-        ))->fetchOneColumn();
400
-        foreach ($ged_data as $ged_datum) {
401
-            $matches = null;
402
-            preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
403
-            foreach ($matches[1] as $match) {
404
-                $places_list[$match]=true;
405
-            }
406
-        }
386
+		//Select all '2 PLAC ' tags in the file and create array
387
+		$places_list=array();
388
+		$ged_data = Database::prepare(
389
+			'SELECT i_gedcom AS gedcom'.
390
+			' FROM `##individuals`'.
391
+			' WHERE i_gedcom LIKE :gedcom AND i_file = :gedcom_id'.
392
+			' UNION ALL'.
393
+			'SELECT f_gedcom AS gedcom'.
394
+			' FROM `##families`'.
395
+			' WHERE f_gedcom LIKE :gedcom AND f_file = :gedcom_id'
396
+		)->execute(array(
397
+			'gedcom' => '%\n2 PLAC %',
398
+			'gedcom_id' => $this->tree->getTreeId()            
399
+		))->fetchOneColumn();
400
+		foreach ($ged_data as $ged_datum) {
401
+			$matches = null;
402
+			preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
403
+			foreach ($matches[1] as $match) {
404
+				$places_list[$match]=true;
405
+			}
406
+		}
407 407
         
408
-        // Unique list of places
409
-        $places_list=array_keys($places_list);
408
+		// Unique list of places
409
+		$places_list=array_keys($places_list);
410 410
         
411
-        //sort the array, limit to unique values, and count them
412
-        usort($places_list, array('I18N', 'strcasecmp'));
411
+		//sort the array, limit to unique values, and count them
412
+		usort($places_list, array('I18N', 'strcasecmp'));
413 413
         
414
-        //calculate maximum no. of levels to display
415
-        $has_found_good_example = false;
416
-        foreach($places_list as $place){
417
-            $levels = explode(",", $place);
418
-            $parts = count($levels);
419
-            if ($parts >= $nb_levels){
420
-                $nb_levels = $parts;
421
-                if(!$has_found_good_example){
422
-                    $random_place = $place;
423
-                    if(min(array_map('strlen', $levels)) > 0){
424
-                        $has_found_good_example = true;
425
-                    }
426
-                }
427
-            }
428
-        }
414
+		//calculate maximum no. of levels to display
415
+		$has_found_good_example = false;
416
+		foreach($places_list as $place){
417
+			$levels = explode(",", $place);
418
+			$parts = count($levels);
419
+			if ($parts >= $nb_levels){
420
+				$nb_levels = $parts;
421
+				if(!$has_found_good_example){
422
+					$random_place = $place;
423
+					if(min(array_map('strlen', $levels)) > 0){
424
+						$has_found_good_example = true;
425
+					}
426
+				}
427
+			}
428
+		}
429 429
         
430
-        return array_reverse(array_map('trim',explode(',', $random_place)));
431
-    }
430
+		return array_reverse(array_map('trim',explode(',', $random_place)));
431
+	}
432 432
     
433
-    /**
434
-     * Returns the list of geodispersion maps available within the maps folder.
435
-     * 
436
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMap[]
437
-     */
438
-    public function getOutlineMapsList() {
439
-        $res = array();
440
-        $root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/';
441
-        if(is_dir($root_path)){
442
-            $dir = opendir($root_path);
443
-            while (($file=readdir($dir))!== false) {
444
-                if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) {
445
-                    $res[base64_encode($file)] = new OutlineMap($file, true);
446
-                }
447
-            }
448
-        }
449
-        return $res;
450
-    }
433
+	/**
434
+	 * Returns the list of geodispersion maps available within the maps folder.
435
+	 * 
436
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMap[]
437
+	 */
438
+	public function getOutlineMapsList() {
439
+		$res = array();
440
+		$root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/';
441
+		if(is_dir($root_path)){
442
+			$dir = opendir($root_path);
443
+			while (($file=readdir($dir))!== false) {
444
+				if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) {
445
+					$res[base64_encode($file)] = new OutlineMap($file, true);
446
+				}
447
+			}
448
+		}
449
+		return $res;
450
+	}
451 451
 }
452 452
  
453 453
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoAnalysis.php 1 patch
Indentation   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -24,64 +24,64 @@  discard block
 block discarded – undo
24 24
 	 * Geo Analysis ID
25 25
 	 * @var int $id
26 26
 	 */
27
-    protected $id;
27
+	protected $id;
28 28
     
29 29
 	/**
30 30
 	 * Geo Analysis Title
31 31
 	 * @var string $title
32 32
 	 */
33
-    protected $title;
33
+	protected $title;
34 34
     
35 35
 	/**
36 36
 	 * Level of the Gedcom hierarchy for the analysis
37 37
 	 * @var int $analysis_level
38 38
 	 */
39
-    protected $analysis_level;
39
+	protected $analysis_level;
40 40
     
41
-    /**
42
-     * Display options
43
-     * @var GeoDisplayOptions $options
44
-     */
45
-    protected $options;
41
+	/**
42
+	 * Display options
43
+	 * @var GeoDisplayOptions $options
44
+	 */
45
+	protected $options;
46 46
     
47
-    /**
48
-     * Reference tree
49
-     * @var Tree $tree
50
-     */
51
-    protected $tree;
47
+	/**
48
+	 * Reference tree
49
+	 * @var Tree $tree
50
+	 */
51
+	protected $tree;
52 52
     
53
-    /**
54
-     * Is the analysis enabled
55
-     * @var bool $enabled
56
-     */
57
-    protected $enabled;
53
+	/**
54
+	 * Is the analysis enabled
55
+	 * @var bool $enabled
56
+	 */
57
+	protected $enabled;
58 58
     
59
-    /**
60
-     * Constructor for GeoAnalysis.
61
-     *
62
-     * @param Tree $tree Reference tree
59
+	/**
60
+	 * Constructor for GeoAnalysis.
61
+	 *
62
+	 * @param Tree $tree Reference tree
63 63
 	 * @param int $id GeoAnalysis ID
64 64
 	 * @param string $title GeoAnalysis title
65 65
 	 * @param int $analysis_level Analysis level
66 66
 	 * @param (GeoDisplayOptions|null) $options Display options
67 67
 	 * @param bool $enabled Is analysis enabled
68
-     */
69
-    public function __construct(Tree $tree, $id, $title, $analysis_level, GeoDisplayOptions $options = null, $enabled = true) {
70
-        $this->tree = $tree;
71
-        $this->id = $id;
72
-        $this->title = $title;
73
-        $this->analysis_level = $analysis_level;
74
-        $this->options = $options;
75
-        $this->enabled = $enabled;
76
-    }
68
+	 */
69
+	public function __construct(Tree $tree, $id, $title, $analysis_level, GeoDisplayOptions $options = null, $enabled = true) {
70
+		$this->tree = $tree;
71
+		$this->id = $id;
72
+		$this->title = $title;
73
+		$this->analysis_level = $analysis_level;
74
+		$this->options = $options;
75
+		$this->enabled = $enabled;
76
+	}
77 77
     
78 78
 	/**
79 79
 	 * Get the analysis title
80 80
 	 * @return string
81 81
 	 */
82
-    public function getTitle() {
83
-        return $this->title;
84
-    }
82
+	public function getTitle() {
83
+		return $this->title;
84
+	}
85 85
     
86 86
 	/**
87 87
 	 * Set the analysis title
@@ -89,53 +89,53 @@  discard block
 block discarded – undo
89 89
 	 * @param string $title
90 90
 	 * @return self Enable method-chaining
91 91
 	 */
92
-    public function setTitle($title) {
93
-        $this->title = $title;
94
-        return $this;
95
-    }
92
+	public function setTitle($title) {
93
+		$this->title = $title;
94
+		return $this;
95
+	}
96 96
     
97 97
 	/**
98 98
 	 * Get the analysis ID
99 99
 	 * @return int
100 100
 	 */
101
-    public function getId() {
102
-        return $this->id;
103
-    }
101
+	public function getId() {
102
+		return $this->id;
103
+	}
104 104
     
105 105
 	/**
106 106
 	 * Get the analysis status (enabled/disabled)
107 107
 	 * @return bool
108 108
 	 */
109
-    public function isEnabled() {
110
-        return $this->enabled;
111
-    }
109
+	public function isEnabled() {
110
+		return $this->enabled;
111
+	}
112 112
     
113
-    /**
114
-     * Get analysis options
115
-     * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoDisplayOptions
116
-     */
117
-    public function getOptions() {
118
-        return $this->options;
119
-    }
113
+	/**
114
+	 * Get analysis options
115
+	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoDisplayOptions
116
+	 */
117
+	public function getOptions() {
118
+		return $this->options;
119
+	}
120 120
     
121 121
 	/**
122
-     * Set analysis options
122
+	 * Set analysis options
123 123
 	 *
124
-     * @param \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoDisplayOptions $options
124
+	 * @param \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoDisplayOptions $options
125 125
 	 * @return self Enable method-chaining
126
-     */
127
-    public function setOptions(GeoDisplayOptions $options) {
128
-        $this->options = $options;
129
-        return $this;
130
-    }
126
+	 */
127
+	public function setOptions(GeoDisplayOptions $options) {
128
+		$this->options = $options;
129
+		return $this;
130
+	}
131 131
     
132 132
 	/**
133 133
 	 * Get analysis level
134 134
 	 * @return int
135 135
 	 */
136
-    public function getAnalysisLevel() {
137
-        return $this->analysis_level;
138
-    }
136
+	public function getAnalysisLevel() {
137
+		return $this->analysis_level;
138
+	}
139 139
     
140 140
 	/**
141 141
 	 * Get analysis level
@@ -143,19 +143,19 @@  discard block
 block discarded – undo
143 143
 	 * @param int $analysis_level
144 144
 	 * @return self Enable method-chaining
145 145
 	 */
146
-    public function setAnalysisLevel($analysis_level) {
147
-        $this->analysis_level = $analysis_level;
148
-        return $this;
149
-    }
146
+	public function setAnalysisLevel($analysis_level) {
147
+		$this->analysis_level = $analysis_level;
148
+		return $this;
149
+	}
150 150
     
151 151
 	/**
152 152
 	 * Check whether the analysis has a linked map
153 153
 	 *
154 154
 	 * @return bool
155 155
 	 */
156
-    public function hasMap() {
157
-        return $this->options && $this->options->getMap();
158
-    }
156
+	public function hasMap() {
157
+		return $this->options && $this->options->getMap();
158
+	}
159 159
     
160 160
 	/**
161 161
 	 * Get the URL for the GeoAnalysis.
@@ -163,120 +163,120 @@  discard block
 block discarded – undo
163 163
 	 * @return string
164 164
 	 */
165 165
 	 public function getHtmlUrl() {
166
-        return 'module.php?mod='. Constants::MODULE_MAJ_GEODISP_NAME . '&mod_action=GeoAnalysis&ga_id=' . $this->getId() . '&ged=' . $this->tree->getNameUrl();
167
-    }
166
+		return 'module.php?mod='. Constants::MODULE_MAJ_GEODISP_NAME . '&mod_action=GeoAnalysis&ga_id=' . $this->getId() . '&ged=' . $this->tree->getNameUrl();
167
+	}
168 168
     
169
-    /**
170
-     * Return the dispersion analysis tables.
171
-     * Two arrays are returned :
172
-     * 	- the General analysis, which returns the number of ancestors for each place found, plus 4 additional indicators :
173
-     * 		- knownsum : Number of known places
174
-     * 		- unknown : Number of unknown places
175
-     * 		- max : Maximum count of ancestors within a place
176
-     * 		- other : Other places (not in the top level area)
177
-     * - the Generations analysis, which returns the number of ancestors for each place found for each generation, plus 3 additional indicators within each generation :
178
-     * 		- sum : Number of known places
179
-     * 		- unknown : Number of unknown places
180
-     * 		- other : Other places (not in the top level area)
181
-     *
182
-     * @param array $sosalist List of all sosas
183
-     * @return array Array of the general and generations table
184
-     */
185
-    public function getAnalysisResults($sosalist) {
186
-        $placesDispGeneral = null;
187
-        $placesDispGenerations = null;
169
+	/**
170
+	 * Return the dispersion analysis tables.
171
+	 * Two arrays are returned :
172
+	 * 	- the General analysis, which returns the number of ancestors for each place found, plus 4 additional indicators :
173
+	 * 		- knownsum : Number of known places
174
+	 * 		- unknown : Number of unknown places
175
+	 * 		- max : Maximum count of ancestors within a place
176
+	 * 		- other : Other places (not in the top level area)
177
+	 * - the Generations analysis, which returns the number of ancestors for each place found for each generation, plus 3 additional indicators within each generation :
178
+	 * 		- sum : Number of known places
179
+	 * 		- unknown : Number of unknown places
180
+	 * 		- other : Other places (not in the top level area)
181
+	 *
182
+	 * @param array $sosalist List of all sosas
183
+	 * @return array Array of the general and generations table
184
+	 */
185
+	public function getAnalysisResults($sosalist) {
186
+		$placesDispGeneral = null;
187
+		$placesDispGenerations = null;
188 188
         
189
-        if($sosalist && count($sosalist) > 0) {
190
-            $placesDispGeneral['knownsum'] = 0;
191
-            $placesDispGeneral['unknown'] = 0;
192
-            $placesDispGeneral['max'] = 0;
193
-            $placesDispGeneral['places'] = array();
194
-            foreach($sosalist as $sosaid => $gens) {
195
-                $sosa = Individual::getIntance($sosaid, $this->tree);
196
-                $place =$sosa->getSignificantPlace();
197
-                $genstab = explode(',', $gens);
198
-                $isUnknown=true;
199
-                if($sosa->getDerivedRecord()->canShow() && !is_null($place)){
200
-                    $levels = array_reverse(array_map('trim',explode(',', $place)));
201
-                    if(count($levels)>= $this->analysis_level){                        
202
-                        $toplevelvalues = array();
203
-                        if($this->hasMap()
204
-                            && $this->options->getMap()->isLoaded()
205
-                            && $toplevelvalue = $this->options->getMap()->getTopLevelName()
206
-                        ) {
207
-                            $toplevelvalues = array_map('trim',explode(',', strtolower($toplevelvalue)));
208
-                        }
209
-                        if(!$this->hasMap() 
210
-                            || is_null($this->options->getMapLevel()) 
211
-                            || ( $this->options->getMap()->isLoaded() && $this->options->getMap()->getTopLevelName() == '*') 
212
-                            || (
213
-                                $this->options->getMapLevel() <= $this->analysis_level 
214
-                                && $this->options->getMapLevel() > 0
215
-                                && count($levels) >= $this->options->getMapLevel()
216
-                                && in_array(strtolower($levels[$this->options->getMapLevel()-1]), $toplevelvalues)
217
-                            )
218
-                        ) {
219
-                            $placest = implode(I18N::$list_separator, array_slice($levels, 0, $this->analysis_level));
220
-                            if(isset($placesDispGeneral['places'][$placest])) {
221
-                                $placesDispGeneral['places'][$placest] += 1;
222
-                            }
223
-                            else { 
224
-                                $placesDispGeneral['places'][$placest] = 1;
225
-                            }
226
-                            if($placesDispGeneral['places'][$placest]>$placesDispGeneral['max'])
227
-                                $placesDispGeneral['max'] = $placesDispGeneral['places'][$placest];
228
-                            foreach($genstab as $gen) {
229
-                                if(isset($placesDispGenerations[$gen]['places'][$placest])) {
230
-                                    $placesDispGenerations[$gen]['places'][$placest] += 1;
231
-                                }
232
-                                else { 
233
-                                    $placesDispGenerations[$gen]['places'][$placest] = 1;
234
-                                }
235
-                                if(isset($placesDispGenerations[$gen]['sum'])) {
236
-                                    $placesDispGenerations[$gen]['sum'] += 1;
237
-                                }
238
-                                else { 
239
-                                    $placesDispGenerations[$gen]['sum'] = 1;
240
-                                }
241
-                            }
242
-                        }
243
-                        else{
244
-                            if(isset($placesDispGeneral['other'])) {
245
-                                $placesDispGeneral['other'] += 1;
246
-                            }
247
-                            else { 
248
-                                $placesDispGeneral['other'] = 1;
249
-                            }
250
-                            foreach($genstab as $gen) {
251
-                                if(isset($placesDispGenerations[$gen]['other'])) {
252
-                                    $placesDispGenerations[$gen]['other'] += 1;
253
-                                }
254
-                                else { 
255
-                                    $placesDispGenerations[$gen]['other'] = 1;
256
-                                }
257
-                            }
258
-                        }
259
-                        $placesDispGeneral['knownsum'] += 1;
260
-                        $isUnknown = false;
261
-                    }
262
-                }
263
-                if($isUnknown){
264
-                    $placesDispGeneral['unknown'] += 1;
265
-                    foreach($genstab as $gen) {
266
-                        if(isset($placesDispGenerations[$gen]['unknown'])) { 
267
-                            $placesDispGenerations[$gen]['unknown'] += 1;
268
-                        }
269
-                        else { 
270
-                            $placesDispGenerations[$gen]['unknown'] = 1; 
271
-                        }
272
-                    }
273
-                }
274
-            }
189
+		if($sosalist && count($sosalist) > 0) {
190
+			$placesDispGeneral['knownsum'] = 0;
191
+			$placesDispGeneral['unknown'] = 0;
192
+			$placesDispGeneral['max'] = 0;
193
+			$placesDispGeneral['places'] = array();
194
+			foreach($sosalist as $sosaid => $gens) {
195
+				$sosa = Individual::getIntance($sosaid, $this->tree);
196
+				$place =$sosa->getSignificantPlace();
197
+				$genstab = explode(',', $gens);
198
+				$isUnknown=true;
199
+				if($sosa->getDerivedRecord()->canShow() && !is_null($place)){
200
+					$levels = array_reverse(array_map('trim',explode(',', $place)));
201
+					if(count($levels)>= $this->analysis_level){                        
202
+						$toplevelvalues = array();
203
+						if($this->hasMap()
204
+							&& $this->options->getMap()->isLoaded()
205
+							&& $toplevelvalue = $this->options->getMap()->getTopLevelName()
206
+						) {
207
+							$toplevelvalues = array_map('trim',explode(',', strtolower($toplevelvalue)));
208
+						}
209
+						if(!$this->hasMap() 
210
+							|| is_null($this->options->getMapLevel()) 
211
+							|| ( $this->options->getMap()->isLoaded() && $this->options->getMap()->getTopLevelName() == '*') 
212
+							|| (
213
+								$this->options->getMapLevel() <= $this->analysis_level 
214
+								&& $this->options->getMapLevel() > 0
215
+								&& count($levels) >= $this->options->getMapLevel()
216
+								&& in_array(strtolower($levels[$this->options->getMapLevel()-1]), $toplevelvalues)
217
+							)
218
+						) {
219
+							$placest = implode(I18N::$list_separator, array_slice($levels, 0, $this->analysis_level));
220
+							if(isset($placesDispGeneral['places'][$placest])) {
221
+								$placesDispGeneral['places'][$placest] += 1;
222
+							}
223
+							else { 
224
+								$placesDispGeneral['places'][$placest] = 1;
225
+							}
226
+							if($placesDispGeneral['places'][$placest]>$placesDispGeneral['max'])
227
+								$placesDispGeneral['max'] = $placesDispGeneral['places'][$placest];
228
+							foreach($genstab as $gen) {
229
+								if(isset($placesDispGenerations[$gen]['places'][$placest])) {
230
+									$placesDispGenerations[$gen]['places'][$placest] += 1;
231
+								}
232
+								else { 
233
+									$placesDispGenerations[$gen]['places'][$placest] = 1;
234
+								}
235
+								if(isset($placesDispGenerations[$gen]['sum'])) {
236
+									$placesDispGenerations[$gen]['sum'] += 1;
237
+								}
238
+								else { 
239
+									$placesDispGenerations[$gen]['sum'] = 1;
240
+								}
241
+							}
242
+						}
243
+						else{
244
+							if(isset($placesDispGeneral['other'])) {
245
+								$placesDispGeneral['other'] += 1;
246
+							}
247
+							else { 
248
+								$placesDispGeneral['other'] = 1;
249
+							}
250
+							foreach($genstab as $gen) {
251
+								if(isset($placesDispGenerations[$gen]['other'])) {
252
+									$placesDispGenerations[$gen]['other'] += 1;
253
+								}
254
+								else { 
255
+									$placesDispGenerations[$gen]['other'] = 1;
256
+								}
257
+							}
258
+						}
259
+						$placesDispGeneral['knownsum'] += 1;
260
+						$isUnknown = false;
261
+					}
262
+				}
263
+				if($isUnknown){
264
+					$placesDispGeneral['unknown'] += 1;
265
+					foreach($genstab as $gen) {
266
+						if(isset($placesDispGenerations[$gen]['unknown'])) { 
267
+							$placesDispGenerations[$gen]['unknown'] += 1;
268
+						}
269
+						else { 
270
+							$placesDispGenerations[$gen]['unknown'] = 1; 
271
+						}
272
+					}
273
+				}
274
+			}
275 275
            
276
-        }        
276
+		}        
277 277
         
278
-        return array($placesDispGeneral, $placesDispGenerations);        
279
-    }
278
+		return array($placesDispGeneral, $placesDispGenerations);        
279
+	}
280 280
     
281 281
                    
282 282
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Views/GeoAnalysisTabGeneralMapView.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -25,24 +25,24 @@  discard block
 block discarded – undo
25 25
 	 * {@inheritDoc}
26 26
 	 * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisTabGeneralView::htmlAnalysisData()
27 27
 	 */
28
-    protected function htmlAnalysisData() {
28
+	protected function htmlAnalysisData() {
29 29
         
30
-        /** @var OutlineMap $map */
31
-        $map = $this->data->get('map');
30
+		/** @var OutlineMap $map */
31
+		$map = $this->data->get('map');
32 32
         
33
-        if($map === null) {
34
-            return '<p class="warning">' .
35
-                I18N::translate('The map could not be loaded.') . 
36
-            '</p>';
37
-        }
33
+		if($map === null) {
34
+			return '<p class="warning">' .
35
+				I18N::translate('The map could not be loaded.') . 
36
+			'</p>';
37
+		}
38 38
         
39
-        $canvas = $map->getCanvas();
40
-        $subdvisions_results = $this->data->get('results_by_subdivisions');
39
+		$canvas = $map->getCanvas();
40
+		$subdvisions_results = $this->data->get('results_by_subdivisions');
41 41
         
42
-        $nb_found = $this->data->get('stats_gen_nb_found');
43
-        $nb_other = $this->data->get('stats_gen_nb_other');
42
+		$nb_found = $this->data->get('stats_gen_nb_found');
43
+		$nb_other = $this->data->get('stats_gen_nb_other');
44 44
         
45
-        $html = '<script>
45
+		$html = '<script>
46 46
 			var tip = null;
47 47
 			var tipText = "";
48 48
 			var over = false;
@@ -89,29 +89,29 @@  discard block
 block discarded – undo
89 89
 				var map = {};
90 90
 		';
91 91
         
92
-        foreach($subdvisions_results as $name => $location){
93
-            $html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);';
94
-            if(isset($location['transparency'])) {
95
-                $textToolTip = '<strong>'.$location['displayname'].'</strong><br/>';
96
-                if($this->data->get('use_flags') && $location['flag'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>';
97
-                $textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1);
98
-                $html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");';
99
-                $html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });';
100
-                $html.= 'map.area'.$location['id'].'.mouseover(function () {'.
101
-                    'map.area'.$location['id'].'.stop().animate({"fill" : "'. $canvas->hover_color .'", "fill-opacity" : 1}, 100, "linear");'.
102
-                    '});'.
103
-                    'map.area'.$location['id'].'.mouseout(function () {'.
104
-                    'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].'}, 100, "linear");'.
105
-                    '});';
106
-            }
107
-        }
108
-        $html .= '});
92
+		foreach($subdvisions_results as $name => $location){
93
+			$html.= 'map.area'.$location['id'].' = paper.path("'.$location['coord'].'").attr(attr);';
94
+			if(isset($location['transparency'])) {
95
+				$textToolTip = '<strong>'.$location['displayname'].'</strong><br/>';
96
+				if($this->data->get('use_flags') && $location['flag'] != '') $textToolTip .= '<span class="geodispersion_flag">'.FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']).'</span><br/>';
97
+				$textToolTip .= I18N::translate('%d individuals', $location['count']).'<br/>'.I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1);
98
+				$html.= 'addTip(map.area'.$location['id'].'.node, "'.Filter::escapeJs($textToolTip).'");';
99
+				$html.= 'map.area'.$location['id'].'.attr({"fill" : "'. $canvas->max_color .'", "fill-opacity" : '.$location['transparency'].' });';
100
+				$html.= 'map.area'.$location['id'].'.mouseover(function () {'.
101
+					'map.area'.$location['id'].'.stop().animate({"fill" : "'. $canvas->hover_color .'", "fill-opacity" : 1}, 100, "linear");'.
102
+					'});'.
103
+					'map.area'.$location['id'].'.mouseout(function () {'.
104
+					'map.area'.$location['id'].'.stop().animate({"fill" : "'.$canvas->max_color.'", "fill-opacity" : '.$location['transparency'].'}, 100, "linear");'.
105
+					'});';
106
+			}
107
+		}
108
+		$html .= '});
109 109
             </script>
110 110
             
111 111
             <div id="geodispersion_map"></div>
112 112
     	   <div id="geodispersion_tip"></div>';
113 113
         
114
-        return $html;
115
-    }
114
+		return $html;
115
+	}
116 116
     
117 117
 } 
118 118
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/AdminConfigController.php 1 patch
Indentation   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -36,58 +36,58 @@  discard block
 block discarded – undo
36 36
  */
37 37
 class AdminConfigController extends MvcController
38 38
 {    
39
-    /**
40
-     * GeoAnalysis Provider
41
-     * @var GeoAnalysisProvider $provider
42
-     */
43
-    protected $provider;    
39
+	/**
40
+	 * GeoAnalysis Provider
41
+	 * @var GeoAnalysisProvider $provider
42
+	 */
43
+	protected $provider;    
44 44
     
45
-    /**
46
-     * Constructor for Admin Config controller
47
-     * @param AbstractModule $module
48
-     */
49
-    public function __construct(AbstractModule $module) {
50
-        parent::__construct($module);
45
+	/**
46
+	 * Constructor for Admin Config controller
47
+	 * @param AbstractModule $module
48
+	 */
49
+	public function __construct(AbstractModule $module) {
50
+		parent::__construct($module);
51 51
         
52
-        $this->provider = $this->module->getProvider();
53
-    }    
52
+		$this->provider = $this->module->getProvider();
53
+	}    
54 54
     
55
-    /**
56
-     * Pages
57
-     */
55
+	/**
56
+	 * Pages
57
+	 */
58 58
         
59
-    /**
60
-     * AdminConfig@index
61
-     */
62
-    public function index() {
63
-        $wt_tree = Globals::getTree();
64
-        Theme::theme(new AdministrationTheme)->init($wt_tree);
65
-        $controller = new PageController();
66
-        $controller
67
-            ->restrictAccess(Auth::isManager($wt_tree))
68
-            ->setPageTitle($this->module->getTitle());
59
+	/**
60
+	 * AdminConfig@index
61
+	 */
62
+	public function index() {
63
+		$wt_tree = Globals::getTree();
64
+		Theme::theme(new AdministrationTheme)->init($wt_tree);
65
+		$controller = new PageController();
66
+		$controller
67
+			->restrictAccess(Auth::isManager($wt_tree))
68
+			->setPageTitle($this->module->getTitle());
69 69
         
70
-        $data = new ViewBag();
71
-        $data->set('title', $controller->getPageTitle());
72
-        $data->set('tree', $wt_tree);
70
+		$data = new ViewBag();
71
+		$data->set('title', $controller->getPageTitle());
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();
77
-        $data->set('table_id', $table_id);
76
+		$table_id = 'table-geoanalysis-' . Uuid::uuid4();
77
+		$data->set('table_id', $table_id);
78 78
         
79
-        $other_trees = array();
80
-        foreach (Tree::getAll() as $tree) {
81
-            if($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree;
82
-        }      
83
-        $data->set('other_trees', $other_trees);
79
+		$other_trees = array();
80
+		foreach (Tree::getAll() as $tree) {
81
+			if($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree;
82
+		}      
83
+		$data->set('other_trees', $other_trees);
84 84
         
85
-        $data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
85
+		$data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
86 86
         
87
-        $controller
88
-            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
89
-            ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
90
-            ->addInlineJavascript('
87
+		$controller
88
+			->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
89
+			->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
90
+			->addInlineJavascript('
91 91
 				jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc;
92 92
 				jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc;
93 93
                 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 				});
120 120
                 
121 121
                 ')
122
-                ->addInlineJavascript('				
122
+				->addInlineJavascript('				
123 123
                     function set_geoanalysis_status(ga_id, status, gedcom) {
124 124
                 		jQuery.ajax({
125 125
                             url: "module.php", 
@@ -163,54 +163,54 @@  discard block
 block discarded – undo
163 163
                 ');
164 164
         
165 165
         
166
-        ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
167
-    }
166
+		ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
167
+	}
168 168
 
169
-    /**
170
-     * AdminConfig@jsonGeoAnalysisList
171
-     */
172
-    public function jsonGeoAnalysisList() {
173
-        $wt_tree = Globals::getTree();
174
-        $controller = new JsonController();
175
-        $controller
176
-            ->restrictAccess(Auth::isManager($wt_tree));
169
+	/**
170
+	 * AdminConfig@jsonGeoAnalysisList
171
+	 */
172
+	public function jsonGeoAnalysisList() {
173
+		$wt_tree = Globals::getTree();
174
+		$controller = new JsonController();
175
+		$controller
176
+			->restrictAccess(Auth::isManager($wt_tree));
177 177
         
178
-        // Generate an AJAX/JSON response for datatables to load a block of rows
179
-        $search = Filter::postArray('search');
180
-        if($search) $search = $search['value'];
181
-        $start  = Filter::postInteger('start');
182
-        $length = Filter::postInteger('length');
183
-        $order  = Filter::postArray('order');
178
+		// Generate an AJAX/JSON response for datatables to load a block of rows
179
+		$search = Filter::postArray('search');
180
+		if($search) $search = $search['value'];
181
+		$start  = Filter::postInteger('start');
182
+		$length = Filter::postInteger('length');
183
+		$order  = Filter::postArray('order');
184 184
         
185
-        foreach($order as $key => &$value) {
186
-            switch($value['column']) {
187
-                case 3:
188
-                    $value['column'] = 'majgd_descr';
189
-                    break;
190
-                case 5;
191
-                    $value['column'] = 'majgd_sublevel';
192
-                    break;
193
-                default:
194
-                    unset($order[$key]);
195
-            }
196
-        }
185
+		foreach($order as $key => &$value) {
186
+			switch($value['column']) {
187
+				case 3:
188
+					$value['column'] = 'majgd_descr';
189
+					break;
190
+				case 5;
191
+					$value['column'] = 'majgd_sublevel';
192
+					break;
193
+				default:
194
+					unset($order[$key]);
195
+			}
196
+		}
197 197
         
198
-        /** @var GeoAnalysisProvider $provider */
199
-        $provider = $this->module->getProvider();
198
+		/** @var GeoAnalysisProvider $provider */
199
+		$provider = $this->module->getProvider();
200 200
         
201
-        $list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length);
202
-        $recordsFiltered = count($list);
203
-        $recordsTotal = $this->provider->getGeoAnalysisCount();
201
+		$list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length);
202
+		$recordsFiltered = count($list);
203
+		$recordsTotal = $this->provider->getGeoAnalysisCount();
204 204
         
205
-        $data = array();
206
-        $place_hierarchy = $this->provider->getPlacesHierarchy();
207
-        foreach($list as $ga) {
208
-            /** @var GeoAnalysis $ga */
205
+		$data = array();
206
+		$place_hierarchy = $this->provider->getPlacesHierarchy();
207
+		foreach($list as $ga) {
208
+			/** @var GeoAnalysis $ga */
209 209
             
210
-            $datum = array();
211
-            $options= $ga->getOptions();
210
+			$datum = array();
211
+			$options= $ga->getOptions();
212 212
             
213
-            $datum[0] = '
213
+			$datum[0] = '
214 214
                 <div class="btn-group">
215 215
                     <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
216 216
                         <i class="fa fa-pencil"></i><span class="caret"></span>
@@ -234,112 +234,112 @@  discard block
 block discarded – undo
234 234
                        </li>
235 235
                     </ul>
236 236
                 </div>';
237
-		    $datum[1] = $ga->getId();
238
-		    $datum[2] = $ga->isEnabled() ? 
237
+			$datum[1] = $ga->getId();
238
+			$datum[2] = $ga->isEnabled() ? 
239 239
 				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : 
240 240
 				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
241
-		    $datum[3] = $ga->getTitle();
242
-		    $analysis_level = $ga->getAnalysisLevel();
243
-		    if($place_hierarchy['type'] == 'header') {
244
-		        $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1];
245
-		    } else {
246
-		        $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')';
247
-		    }
248
-		    $datum[5] = $ga->getAnalysisLevel();
249
-		    $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
250
-		    $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
251
-		    if($ga->hasMap()) {
252
-		        if($options->getMap()->isLoaded()) {
253
-    		        $datum[6] = $options->getMap()->getDescription();
254
-    		        $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />';
255
-    		        $top_level = $options->getMapLevel();
256
-    		        if($place_hierarchy['type'] == 'header') {
257
-    		            $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1];
258
-    		        } else {
259
-    		            $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')';
260
-    		        }
261
-    		        $datum[7] .= '</span>';
262
-		        }
263
-		        else {
264
-		            $datum[6] = I18N::translate('Error when loading map.');
265
-		        }
266
-		    }
267
-		    $datum[8] = $options->isUsingFlags() ? 
241
+			$datum[3] = $ga->getTitle();
242
+			$analysis_level = $ga->getAnalysisLevel();
243
+			if($place_hierarchy['type'] == 'header') {
244
+				$datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1];
245
+			} else {
246
+				$datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')';
247
+			}
248
+			$datum[5] = $ga->getAnalysisLevel();
249
+			$datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
250
+			$datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>';
251
+			if($ga->hasMap()) {
252
+				if($options->getMap()->isLoaded()) {
253
+					$datum[6] = $options->getMap()->getDescription();
254
+					$datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />';
255
+					$top_level = $options->getMapLevel();
256
+					if($place_hierarchy['type'] == 'header') {
257
+						$datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1];
258
+					} else {
259
+						$datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')';
260
+					}
261
+					$datum[7] .= '</span>';
262
+				}
263
+				else {
264
+					$datum[6] = I18N::translate('Error when loading map.');
265
+				}
266
+			}
267
+			$datum[8] = $options->isUsingFlags() ? 
268 268
 				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : 
269 269
 				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
270
-		    $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All');
270
+			$datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All');
271 271
 		    
272
-		    $data[] = $datum;
273
-        }
272
+			$data[] = $datum;
273
+		}
274 274
         
275
-        $controller->pageHeader();
275
+		$controller->pageHeader();
276 276
         
277
-        $controller->encode(array(
278
-            'draw'            => Filter::getInteger('draw'),
279
-            'recordsTotal'    => $recordsTotal,
280
-            'recordsFiltered' => $recordsFiltered,
281
-            'data'            => $data
282
-        ));
277
+		$controller->encode(array(
278
+			'draw'            => Filter::getInteger('draw'),
279
+			'recordsTotal'    => $recordsTotal,
280
+			'recordsFiltered' => $recordsFiltered,
281
+			'data'            => $data
282
+		));
283 283
         
284
-    }
284
+	}
285 285
 
286
-    /**
287
-     * AdminConfig@edit
288
-     */
289
-    public function edit() {
290
-        $ga_id = Filter::getInteger('ga_id');
291
-        $ga = $this->provider->getGeoAnalysis($ga_id, false);
286
+	/**
287
+	 * AdminConfig@edit
288
+	 */
289
+	public function edit() {
290
+		$ga_id = Filter::getInteger('ga_id');
291
+		$ga = $this->provider->getGeoAnalysis($ga_id, false);
292 292
         
293
-        $this->renderEdit($ga);
294
-    }
293
+		$this->renderEdit($ga);
294
+	}
295 295
     
296
-    /**
297
-     * AdminConfig@add
298
-     */
299
-    public function add() {
300
-        $this->renderEdit(null);
301
-    }
296
+	/**
297
+	 * AdminConfig@add
298
+	 */
299
+	public function add() {
300
+		$this->renderEdit(null);
301
+	}
302 302
     
303
-    /**
304
-     * AdminConfig@save
305
-     */
306
-    public function save() {
307
-        $wt_tree = Globals::getTree();
308
-        $tmp_contrl = new PageController();
309
-        $tmp_contrl->restrictAccess(
310
-            Auth::isManager($wt_tree) 
311
-            && Filter::checkCsrf()
312
-         );
303
+	/**
304
+	 * AdminConfig@save
305
+	 */
306
+	public function save() {
307
+		$wt_tree = Globals::getTree();
308
+		$tmp_contrl = new PageController();
309
+		$tmp_contrl->restrictAccess(
310
+			Auth::isManager($wt_tree) 
311
+			&& Filter::checkCsrf()
312
+		 );
313 313
         
314
-        $ga_id          = Filter::postInteger('ga_id');
315
-        $description    = Filter::post('description');
316
-        $analysislevel  = Filter::postInteger('analysislevel');
317
-        $use_map        = Filter::postBool('use_map');
318
-        if($use_map) {
319
-            $map_file   = base64_decode(Filter::post('map_file'));
320
-            $map_top_level   = Filter::postInteger('map_top_level');
321
-        }
322
-        $use_flags      = Filter::postBool('use_flags');
323
-        $gen_details    = Filter::postInteger('gen_details');
314
+		$ga_id          = Filter::postInteger('ga_id');
315
+		$description    = Filter::post('description');
316
+		$analysislevel  = Filter::postInteger('analysislevel');
317
+		$use_map        = Filter::postBool('use_map');
318
+		if($use_map) {
319
+			$map_file   = base64_decode(Filter::post('map_file'));
320
+			$map_top_level   = Filter::postInteger('map_top_level');
321
+		}
322
+		$use_flags      = Filter::postBool('use_flags');
323
+		$gen_details    = Filter::postInteger('gen_details');
324 324
         
325
-        $success = false; 
326
-        if($ga_id) {
327
-            $ga = $this->provider->getGeoAnalysis($ga_id, false);
328
-            if($ga) {
329
-                $ga->setTitle($description);
330
-                $ga->setAnalysisLevel($analysislevel + 1);
331
-                $options = $ga->getOptions();
332
-                if($options) {
333
-                    $options->setUsingFlags($use_flags);
334
-                    $options->setMaxDetailsInGen($gen_details);
335
-                    if($use_map) {
336
-                        $options->setMap(new OutlineMap($map_file));
337
-                        $options->setMapLevel($map_top_level + 1);
338
-                    }
339
-                    else {
340
-                        $options->setMap(null);
341
-                    }
342
-                }
325
+		$success = false; 
326
+		if($ga_id) {
327
+			$ga = $this->provider->getGeoAnalysis($ga_id, false);
328
+			if($ga) {
329
+				$ga->setTitle($description);
330
+				$ga->setAnalysisLevel($analysislevel + 1);
331
+				$options = $ga->getOptions();
332
+				if($options) {
333
+					$options->setUsingFlags($use_flags);
334
+					$options->setMaxDetailsInGen($gen_details);
335
+					if($use_map) {
336
+						$options->setMap(new OutlineMap($map_file));
337
+						$options->setMapLevel($map_top_level + 1);
338
+					}
339
+					else {
340
+						$options->setMap(null);
341
+					}
342
+				}
343 343
 				
344 344
 				$res = $this->provider->updateGeoAnalysis($ga);
345 345
 				if($res) {
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
 					FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger');
353 353
 					Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.');
354 354
 				}
355
-            }
356
-        } else {
355
+			}
356
+		} else {
357 357
 			$ga = $this->provider->createGeoAnalysis(
358 358
 				$description,
359 359
 				$analysislevel + 1,
@@ -371,33 +371,33 @@  discard block
 block discarded – undo
371 371
 				FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger');
372 372
 				Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.');
373 373
 			}
374
-        }
374
+		}
375 375
         
376
-        $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $wt_tree->getNameUrl();
377
-        if(!$success) {			
378
-            if($ga) {
379
-                $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $wt_tree->getNameUrl();
380
-            }
381
-            else {
382
-                $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $wt_tree->getNameUrl();
383
-            }
384
-        }        
385
-        header('Location: ' . WT_BASE_URL . $redirection_url);
376
+		$redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $wt_tree->getNameUrl();
377
+		if(!$success) {			
378
+			if($ga) {
379
+				$redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $wt_tree->getNameUrl();
380
+			}
381
+			else {
382
+				$redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $wt_tree->getNameUrl();
383
+			}
384
+		}        
385
+		header('Location: ' . WT_BASE_URL . $redirection_url);
386 386
         
387
-    }
387
+	}
388 388
      
389 389
 	/**
390 390
 	 * Renders the edit form, whether it is an edition of an existing GeoAnalysis, or the addition of a new one.
391 391
 	 * 
392 392
 	 * @param (GeoAnalysis!null) $ga GeoAnalysis to edit
393 393
 	 */
394
-    protected function renderEdit(GeoAnalysis $ga = null) {
395
-        $wt_tree = Globals::getTree();
396
-        Theme::theme(new AdministrationTheme)->init($wt_tree);
397
-        $controller = new PageController();        
398
-        $controller
399
-            ->restrictAccess(Auth::isManager($wt_tree))
400
-            ->addInlineJavascript('
394
+	protected function renderEdit(GeoAnalysis $ga = null) {
395
+		$wt_tree = Globals::getTree();
396
+		Theme::theme(new AdministrationTheme)->init($wt_tree);
397
+		$controller = new PageController();        
398
+		$controller
399
+			->restrictAccess(Auth::isManager($wt_tree))
400
+			->addInlineJavascript('
401 401
                 function toggleMapOptions() {
402 402
                     if($("input:radio[name=\'use_map\']:checked").val() == 1) {
403 403
                         $("#map_options").show();
@@ -411,34 +411,34 @@  discard block
 block discarded – undo
411 411
                 toggleMapOptions();
412 412
             ');
413 413
         
414
-        $data = new ViewBag();
415
-        if($ga) {
416
-            $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis'));
417
-            $data->set('geo_analysis', $ga);
418
-        } else {
419
-            $controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis'));
420
-        }
414
+		$data = new ViewBag();
415
+		if($ga) {
416
+			$controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis'));
417
+			$data->set('geo_analysis', $ga);
418
+		} else {
419
+			$controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis'));
420
+		}
421 421
         
422
-        $data->set('title', $controller->getPageTitle());
423
-        $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $wt_tree->getNameUrl());
424
-        $data->set('module_title', $this->module->getTitle());
425
-        $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $wt_tree->getNameUrl());
426
-        $data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
422
+		$data->set('title', $controller->getPageTitle());
423
+		$data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $wt_tree->getNameUrl());
424
+		$data->set('module_title', $this->module->getTitle());
425
+		$data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $wt_tree->getNameUrl());
426
+		$data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
427 427
     
428
-        $map_list = array_map(
429
-            function(OutlineMap $map) {
430
-                return $map->getDescription();
431
-            },
432
-            $this->provider->getOutlineMapsList()
433
-            );
434
-        asort($map_list);
435
-        $data->set('map_list', $map_list);
428
+		$map_list = array_map(
429
+			function(OutlineMap $map) {
430
+				return $map->getDescription();
431
+			},
432
+			$this->provider->getOutlineMapsList()
433
+			);
434
+		asort($map_list);
435
+		$data->set('map_list', $map_list);
436 436
     
437
-        $gen_details = array(0 => I18N::translate('All'));
438
-        for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i;
439
-        $data->set('generation_details', $gen_details);
437
+		$gen_details = array(0 => I18N::translate('All'));
438
+		for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i;
439
+		$data->set('generation_details', $gen_details);
440 440
     
441
-        ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render();
442
-    }
441
+		ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render();
442
+	}
443 443
     
444 444
 }
445 445
\ No newline at end of file
Please login to merge, or discard this patch.