@@ -36,70 +36,70 @@ discard block |
||
36 | 36 | */ |
37 | 37 | class SosaListController extends MvcController |
38 | 38 | { |
39 | - /** |
|
40 | - * Sosa Provider for the controller |
|
41 | - * @var SosaProvider $sosa_provider |
|
42 | - */ |
|
43 | - protected $sosa_provider; |
|
39 | + /** |
|
40 | + * Sosa Provider for the controller |
|
41 | + * @var SosaProvider $sosa_provider |
|
42 | + */ |
|
43 | + protected $sosa_provider; |
|
44 | 44 | |
45 | - /** |
|
46 | - * Generation used for the controller |
|
47 | - * @var int $generation |
|
48 | - */ |
|
49 | - protected $generation; |
|
45 | + /** |
|
46 | + * Generation used for the controller |
|
47 | + * @var int $generation |
|
48 | + */ |
|
49 | + protected $generation; |
|
50 | 50 | |
51 | - /** |
|
52 | - * ViewBag to hold data for the controller |
|
53 | - * @var ViewBag $view_bag |
|
54 | - */ |
|
55 | - protected $view_bag; |
|
51 | + /** |
|
52 | + * ViewBag to hold data for the controller |
|
53 | + * @var ViewBag $view_bag |
|
54 | + */ |
|
55 | + protected $view_bag; |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
60 | - */ |
|
61 | - public function __construct(AbstractModule $module) { |
|
62 | - global $WT_TREE; |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
60 | + */ |
|
61 | + public function __construct(AbstractModule $module) { |
|
62 | + global $WT_TREE; |
|
63 | 63 | |
64 | - parent::__construct($module); |
|
64 | + parent::__construct($module); |
|
65 | 65 | |
66 | - $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
66 | + $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
67 | 67 | |
68 | - $this->generation = Filter::getInteger('gen'); |
|
68 | + $this->generation = Filter::getInteger('gen'); |
|
69 | 69 | |
70 | - $this->view_bag = new ViewBag(); |
|
71 | - $this->view_bag->set('generation', $this->generation); |
|
72 | - $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
|
73 | - $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
70 | + $this->view_bag = new ViewBag(); |
|
71 | + $this->view_bag->set('generation', $this->generation); |
|
72 | + $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
|
73 | + $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
74 | 74 | |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * Pages |
|
80 | - */ |
|
78 | + /** |
|
79 | + * Pages |
|
80 | + */ |
|
81 | 81 | |
82 | - /** |
|
83 | - * SosaList@index |
|
84 | - */ |
|
85 | - public function index() { |
|
86 | - global $WT_TREE; |
|
82 | + /** |
|
83 | + * SosaList@index |
|
84 | + */ |
|
85 | + public function index() { |
|
86 | + global $WT_TREE; |
|
87 | 87 | |
88 | - $controller = new PageController(); |
|
89 | - $controller |
|
90 | - ->setPageTitle(I18N::translate('Sosa Ancestors')); |
|
88 | + $controller = new PageController(); |
|
89 | + $controller |
|
90 | + ->setPageTitle(I18N::translate('Sosa Ancestors')); |
|
91 | 91 | |
92 | - $this->view_bag->set('title', $controller->getPageTitle()); |
|
92 | + $this->view_bag->set('title', $controller->getPageTitle()); |
|
93 | 93 | |
94 | - if($this->view_bag->get('is_setup', false)) { |
|
95 | - $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
|
96 | - $this->view_bag->set('url_module', $this->module->getName()); |
|
97 | - $this->view_bag->set('url_action', 'SosaList'); |
|
98 | - $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
99 | - $this->view_bag->set('min_gen', 1); |
|
94 | + if($this->view_bag->get('is_setup', false)) { |
|
95 | + $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
|
96 | + $this->view_bag->set('url_module', $this->module->getName()); |
|
97 | + $this->view_bag->set('url_action', 'SosaList'); |
|
98 | + $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
99 | + $this->view_bag->set('min_gen', 1); |
|
100 | 100 | |
101 | - if($this->view_bag->get('has_sosa', false)) { |
|
102 | - $controller->addInlineJavascript(' |
|
101 | + if($this->view_bag->get('has_sosa', false)) { |
|
102 | + $controller->addInlineJavascript(' |
|
103 | 103 | jQuery("#sosalist-tabs").tabs(); |
104 | 104 | jQuery("#sosalist-tabs").css("visibility", "visible"); |
105 | 105 | |
@@ -153,44 +153,44 @@ discard block |
||
153 | 153 | ); |
154 | 154 | |
155 | 155 | '); |
156 | - } |
|
157 | - } |
|
156 | + } |
|
157 | + } |
|
158 | 158 | |
159 | - ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render(); |
|
160 | - } |
|
159 | + ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render(); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | |
163 | - /** |
|
164 | - * SosaList@missing |
|
165 | - */ |
|
166 | - public function missing() { |
|
167 | - global $WT_TREE; |
|
163 | + /** |
|
164 | + * SosaList@missing |
|
165 | + */ |
|
166 | + public function missing() { |
|
167 | + global $WT_TREE; |
|
168 | 168 | |
169 | - $controller = new PageController(); |
|
170 | - $controller |
|
171 | - ->setPageTitle(I18N::translate('Missing Ancestors')); |
|
169 | + $controller = new PageController(); |
|
170 | + $controller |
|
171 | + ->setPageTitle(I18N::translate('Missing Ancestors')); |
|
172 | 172 | |
173 | - $this->view_bag->set('title', $controller->getPageTitle()); |
|
173 | + $this->view_bag->set('title', $controller->getPageTitle()); |
|
174 | 174 | |
175 | - if($this->view_bag->get('is_setup', false)) { |
|
176 | - $this->view_bag->set('url_module', $this->module->getName()); |
|
177 | - $this->view_bag->set('url_action', 'SosaList@missing'); |
|
178 | - $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
179 | - $this->view_bag->set('min_gen', 2); |
|
175 | + if($this->view_bag->get('is_setup', false)) { |
|
176 | + $this->view_bag->set('url_module', $this->module->getName()); |
|
177 | + $this->view_bag->set('url_action', 'SosaList@missing'); |
|
178 | + $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
179 | + $this->view_bag->set('min_gen', 2); |
|
180 | 180 | |
181 | - $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
|
182 | - $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
|
181 | + $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
|
182 | + $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
|
183 | 183 | |
184 | - $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
185 | - $this->view_bag->set('perc_sosa', $perc_sosa); |
|
184 | + $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
185 | + $this->view_bag->set('perc_sosa', $perc_sosa); |
|
186 | 186 | |
187 | - if($this->view_bag->get('has_missing', false)) { |
|
188 | - $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
189 | - $this->view_bag->set('table_id', $table_id); |
|
187 | + if($this->view_bag->get('has_missing', false)) { |
|
188 | + $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
189 | + $this->view_bag->set('table_id', $table_id); |
|
190 | 190 | |
191 | - $controller |
|
192 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
193 | - ->addInlineJavascript(' |
|
191 | + $controller |
|
192 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
193 | + ->addInlineJavascript(' |
|
194 | 194 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
195 | 195 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
196 | 196 | |
@@ -242,77 +242,77 @@ discard block |
||
242 | 242 | jQuery(".loading-image").css("display", "none"); |
243 | 243 | '); |
244 | 244 | |
245 | - $unique_indis = array(); |
|
246 | - $sum_missing_different = 0; |
|
247 | - $sum_missing_different_without_hidden = 0; |
|
248 | - foreach($missing_list as $num => $missing_tab) { |
|
249 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
250 | - unset($missing_list[$num]); |
|
251 | - continue; |
|
252 | - } |
|
253 | - $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
254 | - $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); |
|
255 | - if (!$person || !$person->canShowName()) { |
|
256 | - unset($missing_list[$num]); |
|
257 | - continue; |
|
258 | - } |
|
259 | - $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
260 | - $unique_indis[$person->getXref()] = true; |
|
261 | - $missing_tab['indi'] = $person; |
|
262 | - $missing_list[$num] = $missing_tab; |
|
263 | - } |
|
264 | - $this->view_bag->set('missing_list', $missing_list); |
|
265 | - $this->view_bag->set('missing_diff_count', $sum_missing_different); |
|
266 | - $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
|
267 | - $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
268 | - $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
|
269 | - } |
|
270 | - } |
|
245 | + $unique_indis = array(); |
|
246 | + $sum_missing_different = 0; |
|
247 | + $sum_missing_different_without_hidden = 0; |
|
248 | + foreach($missing_list as $num => $missing_tab) { |
|
249 | + if(isset($unique_indis[$missing_tab['indi']])) { |
|
250 | + unset($missing_list[$num]); |
|
251 | + continue; |
|
252 | + } |
|
253 | + $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
254 | + $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); |
|
255 | + if (!$person || !$person->canShowName()) { |
|
256 | + unset($missing_list[$num]); |
|
257 | + continue; |
|
258 | + } |
|
259 | + $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
260 | + $unique_indis[$person->getXref()] = true; |
|
261 | + $missing_tab['indi'] = $person; |
|
262 | + $missing_list[$num] = $missing_tab; |
|
263 | + } |
|
264 | + $this->view_bag->set('missing_list', $missing_list); |
|
265 | + $this->view_bag->set('missing_diff_count', $sum_missing_different); |
|
266 | + $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
|
267 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
268 | + $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
|
269 | + } |
|
270 | + } |
|
271 | 271 | |
272 | - ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); |
|
273 | - } |
|
272 | + ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); |
|
273 | + } |
|
274 | 274 | |
275 | - /** |
|
276 | - * SosaList@sosalist |
|
277 | - */ |
|
278 | - public function sosalist() { |
|
275 | + /** |
|
276 | + * SosaList@sosalist |
|
277 | + */ |
|
278 | + public function sosalist() { |
|
279 | 279 | |
280 | - $type = Filter::get('type', 'indi|fam', null); |
|
280 | + $type = Filter::get('type', 'indi|fam', null); |
|
281 | 281 | |
282 | - $controller = new AjaxController(); |
|
283 | - $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
|
282 | + $controller = new AjaxController(); |
|
283 | + $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
|
284 | 284 | |
285 | - switch ($type){ |
|
286 | - case 'indi': |
|
287 | - $this->renderSosaListIndi($controller); |
|
288 | - break; |
|
289 | - case 'fam': |
|
290 | - $this->renderFamSosaListIndi($controller); |
|
291 | - break; |
|
292 | - default: |
|
293 | - break; |
|
294 | - } |
|
285 | + switch ($type){ |
|
286 | + case 'indi': |
|
287 | + $this->renderSosaListIndi($controller); |
|
288 | + break; |
|
289 | + case 'fam': |
|
290 | + $this->renderFamSosaListIndi($controller); |
|
291 | + break; |
|
292 | + default: |
|
293 | + break; |
|
294 | + } |
|
295 | 295 | |
296 | - } |
|
296 | + } |
|
297 | 297 | |
298 | - /** |
|
299 | - * Render the Ajax response for the sortable table of Sosa individuals |
|
300 | - * @param AjaxController $controller |
|
301 | - */ |
|
302 | - protected function renderSosaListIndi(AjaxController $controller) { |
|
303 | - global $WT_TREE; |
|
298 | + /** |
|
299 | + * Render the Ajax response for the sortable table of Sosa individuals |
|
300 | + * @param AjaxController $controller |
|
301 | + */ |
|
302 | + protected function renderSosaListIndi(AjaxController $controller) { |
|
303 | + global $WT_TREE; |
|
304 | 304 | |
305 | - $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
|
306 | - $this->view_bag->set('has_sosa', false); |
|
305 | + $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
|
306 | + $this->view_bag->set('has_sosa', false); |
|
307 | 307 | |
308 | - if(count($listSosa) > 0) { |
|
309 | - $this->view_bag->set('has_sosa', true); |
|
310 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
311 | - $this->view_bag->set('table_id', $table_id); |
|
308 | + if(count($listSosa) > 0) { |
|
309 | + $this->view_bag->set('has_sosa', true); |
|
310 | + $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
311 | + $this->view_bag->set('table_id', $table_id); |
|
312 | 312 | |
313 | - $controller |
|
314 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
315 | - ->addInlineJavascript(' |
|
313 | + $controller |
|
314 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
315 | + ->addInlineJavascript(' |
|
316 | 316 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
317 | 317 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
318 | 318 | |
@@ -379,96 +379,96 @@ discard block |
||
379 | 379 | jQuery("#btn-toggle-statistics-'.$table_id.'").click(); |
380 | 380 | '); |
381 | 381 | |
382 | - $stats = new Stats($WT_TREE); |
|
382 | + $stats = new Stats($WT_TREE); |
|
383 | 383 | |
384 | - // Bad data can cause "longest life" to be huge, blowing memory limits |
|
385 | - $max_age = min($WT_TREE->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1; |
|
386 | - // Inititialise chart data |
|
387 | - $deat_by_age = array(); |
|
388 | - for ($age = 0; $age <= $max_age; $age++) { |
|
389 | - $deat_by_age[$age] = ''; |
|
390 | - } |
|
391 | - $birt_by_decade = array(); |
|
392 | - $deat_by_decade = array(); |
|
393 | - for ($year = 1550; $year < 2030; $year += 10) { |
|
394 | - $birt_by_decade[$year] = ''; |
|
395 | - $deat_by_decade[$year] = ''; |
|
396 | - } |
|
384 | + // Bad data can cause "longest life" to be huge, blowing memory limits |
|
385 | + $max_age = min($WT_TREE->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1; |
|
386 | + // Inititialise chart data |
|
387 | + $deat_by_age = array(); |
|
388 | + for ($age = 0; $age <= $max_age; $age++) { |
|
389 | + $deat_by_age[$age] = ''; |
|
390 | + } |
|
391 | + $birt_by_decade = array(); |
|
392 | + $deat_by_decade = array(); |
|
393 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
394 | + $birt_by_decade[$year] = ''; |
|
395 | + $deat_by_decade[$year] = ''; |
|
396 | + } |
|
397 | 397 | |
398 | - $unique_indis = array(); // Don't double-count indis with multiple names. |
|
399 | - $nb_displayed = 0; |
|
398 | + $unique_indis = array(); // Don't double-count indis with multiple names. |
|
399 | + $nb_displayed = 0; |
|
400 | 400 | |
401 | - Individual::load($WT_TREE, $listSosa); |
|
402 | - foreach($listSosa as $sosa => $pid) { |
|
403 | - $person = Individual::getInstance($pid, $WT_TREE); |
|
404 | - if (!$person || !$person->canShowName()) { |
|
405 | - unset($listSosa[$sosa]); |
|
406 | - continue; |
|
407 | - } |
|
408 | - $nb_displayed++; |
|
409 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
410 | - if ( |
|
411 | - FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
|
412 | - !isset($unique_indis[$person->getXref()]) |
|
413 | - ) { |
|
414 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
415 | - } |
|
416 | - } |
|
417 | - else { |
|
418 | - $birth_dates[0]=new Date(''); |
|
419 | - } |
|
420 | - if ($death_dates = $person->getAllDeathDates()) { |
|
421 | - if ( |
|
422 | - FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
|
423 | - !isset($unique_indis[$person->getXref()]) |
|
424 | - ) { |
|
425 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
426 | - } |
|
427 | - } |
|
428 | - else { |
|
429 | - $death_dates[0] = new Date(''); |
|
430 | - } |
|
431 | - $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
432 | - if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) { |
|
433 | - $deat_by_age[$age] .= $person->getSex(); |
|
434 | - } |
|
435 | - $listSosa[$sosa] = $person; |
|
436 | - $unique_indis[$person->getXref()] = true; |
|
437 | - } |
|
438 | - $this->view_bag->set('sosa_list', $listSosa); |
|
401 | + Individual::load($WT_TREE, $listSosa); |
|
402 | + foreach($listSosa as $sosa => $pid) { |
|
403 | + $person = Individual::getInstance($pid, $WT_TREE); |
|
404 | + if (!$person || !$person->canShowName()) { |
|
405 | + unset($listSosa[$sosa]); |
|
406 | + continue; |
|
407 | + } |
|
408 | + $nb_displayed++; |
|
409 | + if ($birth_dates=$person->getAllBirthDates()) { |
|
410 | + if ( |
|
411 | + FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
|
412 | + !isset($unique_indis[$person->getXref()]) |
|
413 | + ) { |
|
414 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
415 | + } |
|
416 | + } |
|
417 | + else { |
|
418 | + $birth_dates[0]=new Date(''); |
|
419 | + } |
|
420 | + if ($death_dates = $person->getAllDeathDates()) { |
|
421 | + if ( |
|
422 | + FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
|
423 | + !isset($unique_indis[$person->getXref()]) |
|
424 | + ) { |
|
425 | + $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
426 | + } |
|
427 | + } |
|
428 | + else { |
|
429 | + $death_dates[0] = new Date(''); |
|
430 | + } |
|
431 | + $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
432 | + if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) { |
|
433 | + $deat_by_age[$age] .= $person->getSex(); |
|
434 | + } |
|
435 | + $listSosa[$sosa] = $person; |
|
436 | + $unique_indis[$person->getXref()] = true; |
|
437 | + } |
|
438 | + $this->view_bag->set('sosa_list', $listSosa); |
|
439 | 439 | |
440 | - $this->view_bag->set('sosa_count', count($listSosa)); |
|
441 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
442 | - $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
|
440 | + $this->view_bag->set('sosa_count', count($listSosa)); |
|
441 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
442 | + $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
|
443 | 443 | |
444 | - $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
|
444 | + $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
|
445 | 445 | |
446 | - $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
447 | - $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death'))); |
|
448 | - $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year'))); |
|
449 | - } |
|
446 | + $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
447 | + $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death'))); |
|
448 | + $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year'))); |
|
449 | + } |
|
450 | 450 | |
451 | - ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render(); |
|
452 | - } |
|
451 | + ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render(); |
|
452 | + } |
|
453 | 453 | |
454 | - /** |
|
455 | - * Render the Ajax response for the sortable table of Sosa family |
|
456 | - * @param AjaxController $controller |
|
457 | - */ |
|
458 | - protected function renderFamSosaListIndi(AjaxController $controller) { |
|
459 | - global $WT_TREE; |
|
454 | + /** |
|
455 | + * Render the Ajax response for the sortable table of Sosa family |
|
456 | + * @param AjaxController $controller |
|
457 | + */ |
|
458 | + protected function renderFamSosaListIndi(AjaxController $controller) { |
|
459 | + global $WT_TREE; |
|
460 | 460 | |
461 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
462 | - $this->view_bag->set('has_sosa', false); |
|
461 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
462 | + $this->view_bag->set('has_sosa', false); |
|
463 | 463 | |
464 | - if(count($listFamSosa) > 0) { |
|
465 | - $this->view_bag->set('has_sosa', true); |
|
466 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
467 | - $this->view_bag->set('table_id', $table_id); |
|
464 | + if(count($listFamSosa) > 0) { |
|
465 | + $this->view_bag->set('has_sosa', true); |
|
466 | + $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
467 | + $this->view_bag->set('table_id', $table_id); |
|
468 | 468 | |
469 | - $controller |
|
470 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
471 | - ->addInlineJavascript(' |
|
469 | + $controller |
|
470 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
471 | + ->addInlineJavascript(' |
|
472 | 472 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
473 | 473 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
474 | 474 | |
@@ -532,67 +532,67 @@ discard block |
||
532 | 532 | jQuery("#btn-toggle-statistics-'.$table_id.'").click(); |
533 | 533 | '); |
534 | 534 | |
535 | - $stats = new Stats($WT_TREE); |
|
536 | - $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; |
|
535 | + $stats = new Stats($WT_TREE); |
|
536 | + $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; |
|
537 | 537 | |
538 | - //-- init chart data |
|
539 | - $marr_by_age = array(); |
|
540 | - for ($age=0; $age<=$max_age; $age++) { |
|
541 | - $marr_by_age[$age] = ''; |
|
542 | - } |
|
543 | - $birt_by_decade = array(); |
|
544 | - $marr_by_decade = array(); |
|
545 | - for ($year=1550; $year<2030; $year+=10) { |
|
546 | - $birt_by_decade[$year] = ''; |
|
547 | - $marr_by_decade[$year] = ''; |
|
548 | - } |
|
538 | + //-- init chart data |
|
539 | + $marr_by_age = array(); |
|
540 | + for ($age=0; $age<=$max_age; $age++) { |
|
541 | + $marr_by_age[$age] = ''; |
|
542 | + } |
|
543 | + $birt_by_decade = array(); |
|
544 | + $marr_by_decade = array(); |
|
545 | + for ($year=1550; $year<2030; $year+=10) { |
|
546 | + $birt_by_decade[$year] = ''; |
|
547 | + $marr_by_decade[$year] = ''; |
|
548 | + } |
|
549 | 549 | |
550 | - foreach($listFamSosa as $sosa => $fid) { |
|
551 | - $sfamily = Family::getInstance($fid, $WT_TREE); |
|
552 | - if(!$sfamily || !$sfamily->canShow()) { |
|
553 | - unset($listFamSosa[$sosa]); |
|
554 | - continue; |
|
555 | - } |
|
556 | - $mdate=$sfamily->getMarriageDate(); |
|
550 | + foreach($listFamSosa as $sosa => $fid) { |
|
551 | + $sfamily = Family::getInstance($fid, $WT_TREE); |
|
552 | + if(!$sfamily || !$sfamily->canShow()) { |
|
553 | + unset($listFamSosa[$sosa]); |
|
554 | + continue; |
|
555 | + } |
|
556 | + $mdate=$sfamily->getMarriageDate(); |
|
557 | 557 | |
558 | - if( ($husb = $sfamily->getHusband()) && |
|
559 | - ($hdate = $husb->getBirthDate()) && |
|
560 | - $hdate->isOK() && $mdate->isOK()) { |
|
561 | - if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
|
562 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
563 | - } |
|
564 | - $hage = Date::getAge($hdate, $mdate, 0); |
|
565 | - if ($hage >= 0 && $hage <= $max_age) { |
|
566 | - $marr_by_age[$hage] .= $husb->getSex(); |
|
567 | - } |
|
568 | - } |
|
558 | + if( ($husb = $sfamily->getHusband()) && |
|
559 | + ($hdate = $husb->getBirthDate()) && |
|
560 | + $hdate->isOK() && $mdate->isOK()) { |
|
561 | + if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
|
562 | + $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
563 | + } |
|
564 | + $hage = Date::getAge($hdate, $mdate, 0); |
|
565 | + if ($hage >= 0 && $hage <= $max_age) { |
|
566 | + $marr_by_age[$hage] .= $husb->getSex(); |
|
567 | + } |
|
568 | + } |
|
569 | 569 | |
570 | - if(($wife = $sfamily->getWife()) && |
|
571 | - ($wdate=$wife->getBirthDate()) && |
|
572 | - $wdate->isOK() && $mdate->isOK()) { |
|
573 | - if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
|
574 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
575 | - } |
|
576 | - $wage = Date::getAge($wdate, $mdate, 0); |
|
577 | - if ($wage >= 0 && $wage <= $max_age) { |
|
578 | - $marr_by_age[$wage] .= $wife->getSex(); |
|
579 | - } |
|
580 | - } |
|
570 | + if(($wife = $sfamily->getWife()) && |
|
571 | + ($wdate=$wife->getBirthDate()) && |
|
572 | + $wdate->isOK() && $mdate->isOK()) { |
|
573 | + if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
|
574 | + $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
575 | + } |
|
576 | + $wage = Date::getAge($wdate, $mdate, 0); |
|
577 | + if ($wage >= 0 && $wage <= $max_age) { |
|
578 | + $marr_by_age[$wage] .= $wife->getSex(); |
|
579 | + } |
|
580 | + } |
|
581 | 581 | |
582 | - if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
|
583 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
584 | - } |
|
582 | + if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
|
583 | + $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
584 | + } |
|
585 | 585 | |
586 | - $listFamSosa[$sosa] = $sfamily; |
|
587 | - } |
|
588 | - $this->view_bag->set('sosa_list', $listFamSosa); |
|
586 | + $listFamSosa[$sosa] = $sfamily; |
|
587 | + } |
|
588 | + $this->view_bag->set('sosa_list', $listFamSosa); |
|
589 | 589 | |
590 | - $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
591 | - $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage'))); |
|
592 | - $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage'))); |
|
593 | - } |
|
590 | + $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
591 | + $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage'))); |
|
592 | + $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage'))); |
|
593 | + } |
|
594 | 594 | |
595 | - ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render(); |
|
596 | - } |
|
595 | + ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render(); |
|
596 | + } |
|
597 | 597 | |
598 | 598 | } |
599 | 599 | \ No newline at end of file |