Completed
Push — feature/code-analysis ( 92a398...85ebc7 )
by Jonathan
03:02
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.