@@ -431,8 +431,7 @@ discard block |
||
431 | 431 | ) { |
432 | 432 | $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
433 | 433 | } |
434 | - } |
|
435 | - else { |
|
434 | + } else { |
|
436 | 435 | $birth_dates[0]=new Date(''); |
437 | 436 | } |
438 | 437 | if ($death_dates = $person->getAllDeathDates()) { |
@@ -443,8 +442,7 @@ discard block |
||
443 | 442 | ) { |
444 | 443 | $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
445 | 444 | } |
446 | - } |
|
447 | - else { |
|
445 | + } else { |
|
448 | 446 | $death_dates[0] = new Date(''); |
449 | 447 | } |
450 | 448 | $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
@@ -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 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->view_bag = new ViewBag(); |
71 | 71 | $this->view_bag->set('generation', $this->generation); |
72 | 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); |
|
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 | |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | |
92 | 92 | $this->view_bag->set('title', $controller->getPageTitle()); |
93 | 93 | |
94 | - if($this->view_bag->get('is_setup', false)) { |
|
94 | + if ($this->view_bag->get('is_setup', false)) { |
|
95 | 95 | $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
96 | 96 | $this->view_bag->set('url_module', $this->module->getName()); |
97 | 97 | $this->view_bag->set('url_action', 'SosaList'); |
98 | 98 | $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
99 | 99 | $this->view_bag->set('min_gen', 1); |
100 | 100 | |
101 | - if($this->view_bag->get('has_sosa', false)) { |
|
101 | + if ($this->view_bag->get('has_sosa', false)) { |
|
102 | 102 | $controller->addInlineJavascript(' |
103 | 103 | jQuery("#sosalist-tabs").tabs(); |
104 | 104 | jQuery("#sosalist-tabs").css("visibility", "visible"); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | "mod" : "'.$this->module->getName().'", |
110 | 110 | "mod_action": "SosaList@sosalist", |
111 | - "ged" : "' . $WT_TREE->getNameUrl(). '", |
|
111 | + "ged" : "' . $WT_TREE->getNameUrl().'", |
|
112 | 112 | "type" : "indi", |
113 | 113 | "gen" : "'.$this->generation.'" |
114 | 114 | }, |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | { |
134 | 134 | "mod" : "'.$this->module->getName().'", |
135 | 135 | "mod_action": "SosaList@sosalist", |
136 | - "ged" : "' . $WT_TREE->getNameUrl(). '", |
|
136 | + "ged" : "' . $WT_TREE->getNameUrl().'", |
|
137 | 137 | "type" : "fam", |
138 | 138 | "gen" : "'.$this->generation.'" |
139 | 139 | }, |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | $this->view_bag->set('title', $controller->getPageTitle()); |
174 | 174 | |
175 | - if($this->view_bag->get('is_setup', false)) { |
|
175 | + if ($this->view_bag->get('is_setup', false)) { |
|
176 | 176 | $this->view_bag->set('url_module', $this->module->getName()); |
177 | 177 | $this->view_bag->set('url_action', 'SosaList@missing'); |
178 | 178 | $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
182 | 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)); |
|
184 | + $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation - 1)); |
|
185 | 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(); |
|
187 | + if ($this->view_bag->get('has_missing', false)) { |
|
188 | + $table_id = 'table-sosa-missing-'.Uuid::uuid4(); |
|
189 | 189 | $this->view_bag->set('table_id', $table_id); |
190 | 190 | |
191 | 191 | $controller |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
196 | 196 | |
197 | 197 | jQuery("#'.$table_id.'").dataTable( { |
198 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
198 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
199 | 199 | '.I18N::datatablesI18N().', |
200 | 200 | jQueryUI: true, |
201 | 201 | autoWidth:false, |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | pagingType: "full_numbers" |
222 | 222 | }); |
223 | 223 | |
224 | - jQuery("#' . $table_id . '") |
|
224 | + jQuery("#' . $table_id.'") |
|
225 | 225 | /* Filter buttons in table header */ |
226 | 226 | .on("click", "button[data-filter-column]", function() { |
227 | 227 | var btn = jQuery(this); |
228 | 228 | // De-activate the other buttons in this button group |
229 | 229 | btn.siblings().removeClass("ui-state-active"); |
230 | 230 | // Apply (or clear) this filter |
231 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
231 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
232 | 232 | if (btn.hasClass("ui-state-active")) { |
233 | 233 | btn.removeClass("ui-state-active"); |
234 | 234 | col.search("").draw(); |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | $unique_indis = array(); |
246 | 246 | $sum_missing_different = 0; |
247 | 247 | $sum_missing_different_without_hidden = 0; |
248 | - foreach($missing_list as $num => $missing_tab) { |
|
249 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
248 | + foreach ($missing_list as $num => $missing_tab) { |
|
249 | + if (isset($unique_indis[$missing_tab['indi']])) { |
|
250 | 250 | unset($missing_list[$num]); |
251 | 251 | continue; |
252 | 252 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $this->view_bag->set('missing_list', $missing_list); |
265 | 265 | $this->view_bag->set('missing_diff_count', $sum_missing_different); |
266 | 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)); |
|
267 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation - 2)); |
|
268 | 268 | $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
269 | 269 | } |
270 | 270 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $controller = new AjaxController(); |
283 | 283 | $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
284 | 284 | |
285 | - switch ($type){ |
|
285 | + switch ($type) { |
|
286 | 286 | case 'indi': |
287 | 287 | $this->renderSosaListIndi($controller); |
288 | 288 | break; |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
306 | 306 | $this->view_bag->set('has_sosa', false); |
307 | 307 | |
308 | - if(count($listSosa) > 0) { |
|
308 | + if (count($listSosa) > 0) { |
|
309 | 309 | $this->view_bag->set('has_sosa', true); |
310 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
310 | + $table_id = 'table-sosa-indi-'.Uuid::uuid4(); |
|
311 | 311 | $this->view_bag->set('table_id', $table_id); |
312 | 312 | |
313 | 313 | $controller |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
318 | 318 | |
319 | 319 | jQuery("#'.$table_id.'").dataTable( { |
320 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
321 | - ' . I18N::datatablesI18N() . ', |
|
320 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
321 | + ' . I18N::datatablesI18N().', |
|
322 | 322 | jQueryUI: true, |
323 | 323 | autoWidth: false, |
324 | 324 | processing: true, |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | pagingType: "full_numbers" |
348 | 348 | }); |
349 | 349 | |
350 | - jQuery("#' . $table_id . '") |
|
350 | + jQuery("#' . $table_id.'") |
|
351 | 351 | /* Hide/show parents */ |
352 | 352 | .on("click", ".btn-toggle-parents", function() { |
353 | 353 | jQuery(this).toggleClass("ui-state-active"); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | /* Hide/show statistics */ |
357 | 357 | .on("click", ".btn-toggle-statistics", function() { |
358 | 358 | jQuery(this).toggleClass("ui-state-active"); |
359 | - jQuery("#indi_list_table-charts_' . $table_id . '").slideToggle(); |
|
359 | + jQuery("#indi_list_table-charts_' . $table_id.'").slideToggle(); |
|
360 | 360 | }) |
361 | 361 | /* Filter buttons in table header */ |
362 | 362 | .on("click", "button[data-filter-column]", function() { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | // De-activate the other buttons in this button group |
365 | 365 | btn.siblings().removeClass("ui-state-active"); |
366 | 366 | // Apply (or clear) this filter |
367 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
367 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
368 | 368 | if (btn.hasClass("ui-state-active")) { |
369 | 369 | btn.removeClass("ui-state-active"); |
370 | 370 | col.search("").draw(); |
@@ -399,30 +399,30 @@ discard block |
||
399 | 399 | $nb_displayed = 0; |
400 | 400 | |
401 | 401 | Individual::load($WT_TREE, $listSosa); |
402 | - foreach($listSosa as $sosa => $pid) { |
|
402 | + foreach ($listSosa as $sosa => $pid) { |
|
403 | 403 | $person = Individual::getInstance($pid, $WT_TREE); |
404 | 404 | if (!$person || !$person->canShowName()) { |
405 | 405 | unset($listSosa[$sosa]); |
406 | 406 | continue; |
407 | 407 | } |
408 | 408 | $nb_displayed++; |
409 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
409 | + if ($birth_dates = $person->getAllBirthDates()) { |
|
410 | 410 | if ( |
411 | 411 | FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
412 | 412 | !isset($unique_indis[$person->getXref()]) |
413 | 413 | ) { |
414 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
414 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | else { |
418 | - $birth_dates[0]=new Date(''); |
|
418 | + $birth_dates[0] = new Date(''); |
|
419 | 419 | } |
420 | 420 | if ($death_dates = $person->getAllDeathDates()) { |
421 | 421 | if ( |
422 | 422 | FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
423 | 423 | !isset($unique_indis[$person->getXref()]) |
424 | 424 | ) { |
425 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
425 | + $deat_by_decade[(int)($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | else { |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $this->view_bag->set('sosa_list', $listSosa); |
439 | 439 | |
440 | 440 | $this->view_bag->set('sosa_count', count($listSosa)); |
441 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
441 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation - 1)); |
|
442 | 442 | $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
443 | 443 | |
444 | 444 | $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | protected function renderFamSosaListIndi(AjaxController $controller) { |
459 | 459 | global $WT_TREE; |
460 | 460 | |
461 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
461 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation); ; |
|
462 | 462 | $this->view_bag->set('has_sosa', false); |
463 | 463 | |
464 | - if(count($listFamSosa) > 0) { |
|
464 | + if (count($listFamSosa) > 0) { |
|
465 | 465 | $this->view_bag->set('has_sosa', true); |
466 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
466 | + $table_id = 'table-sosa-fam-'.Uuid::uuid4(); |
|
467 | 467 | $this->view_bag->set('table_id', $table_id); |
468 | 468 | |
469 | 469 | $controller |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
474 | 474 | |
475 | 475 | jQuery("#'.$table_id.'").dataTable( { |
476 | - dom: \'<"H"<"filtersH_' . $table_id . '"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
476 | + dom: \'<"H"<"filtersH_' . $table_id.'"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
477 | 477 | '.I18N::datatablesI18N(array(16, 32, 64, 128, -1)).', |
478 | 478 | jQueryUI: true, |
479 | 479 | autoWidth: false, |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | pagingType: "full_numbers" |
501 | 501 | }); |
502 | 502 | |
503 | - jQuery("#' . $table_id . '") |
|
503 | + jQuery("#' . $table_id.'") |
|
504 | 504 | /* Hide/show parents */ |
505 | 505 | .on("click", ".btn-toggle-parents", function() { |
506 | 506 | jQuery(this).toggleClass("ui-state-active"); |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | /* Hide/show statistics */ |
510 | 510 | .on("click", ".btn-toggle-statistics", function() { |
511 | 511 | jQuery(this).toggleClass("ui-state-active"); |
512 | - jQuery("#fam_list_table-charts_' . $table_id . '").slideToggle(); |
|
512 | + jQuery("#fam_list_table-charts_' . $table_id.'").slideToggle(); |
|
513 | 513 | }) |
514 | 514 | /* Filter buttons in table header */ |
515 | 515 | .on("click", "button[data-filter-column]", function() { |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | // De-activate the other buttons in this button group |
518 | 518 | btn.siblings().removeClass("ui-state-active"); |
519 | 519 | // Apply (or clear) this filter |
520 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
520 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
521 | 521 | if (btn.hasClass("ui-state-active")) { |
522 | 522 | btn.removeClass("ui-state-active"); |
523 | 523 | col.search("").draw(); |
@@ -537,29 +537,29 @@ discard block |
||
537 | 537 | |
538 | 538 | //-- init chart data |
539 | 539 | $marr_by_age = array(); |
540 | - for ($age=0; $age<=$max_age; $age++) { |
|
540 | + for ($age = 0; $age <= $max_age; $age++) { |
|
541 | 541 | $marr_by_age[$age] = ''; |
542 | 542 | } |
543 | 543 | $birt_by_decade = array(); |
544 | 544 | $marr_by_decade = array(); |
545 | - for ($year=1550; $year<2030; $year+=10) { |
|
545 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
546 | 546 | $birt_by_decade[$year] = ''; |
547 | 547 | $marr_by_decade[$year] = ''; |
548 | 548 | } |
549 | 549 | |
550 | - foreach($listFamSosa as $sosa => $fid) { |
|
550 | + foreach ($listFamSosa as $sosa => $fid) { |
|
551 | 551 | $sfamily = Family::getInstance($fid, $WT_TREE); |
552 | - if(!$sfamily || !$sfamily->canShow()) { |
|
552 | + if (!$sfamily || !$sfamily->canShow()) { |
|
553 | 553 | unset($listFamSosa[$sosa]); |
554 | 554 | continue; |
555 | 555 | } |
556 | - $mdate=$sfamily->getMarriageDate(); |
|
556 | + $mdate = $sfamily->getMarriageDate(); |
|
557 | 557 | |
558 | - if( ($husb = $sfamily->getHusband()) && |
|
558 | + if (($husb = $sfamily->getHusband()) && |
|
559 | 559 | ($hdate = $husb->getBirthDate()) && |
560 | 560 | $hdate->isOK() && $mdate->isOK()) { |
561 | 561 | if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
562 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
562 | + $birt_by_decade[(int)($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
563 | 563 | } |
564 | 564 | $hage = Date::getAge($hdate, $mdate, 0); |
565 | 565 | if ($hage >= 0 && $hage <= $max_age) { |
@@ -567,11 +567,11 @@ discard block |
||
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
570 | - if(($wife = $sfamily->getWife()) && |
|
571 | - ($wdate=$wife->getBirthDate()) && |
|
570 | + if (($wife = $sfamily->getWife()) && |
|
571 | + ($wdate = $wife->getBirthDate()) && |
|
572 | 572 | $wdate->isOK() && $mdate->isOK()) { |
573 | 573 | if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
574 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
574 | + $birt_by_decade[(int)($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
575 | 575 | } |
576 | 576 | $wage = Date::getAge($wdate, $mdate, 0); |
577 | 577 | if ($wage >= 0 && $wage <= $max_age) { |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | } |
581 | 581 | |
582 | 582 | if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
583 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
583 | + $marr_by_decade[(int)($mdate->gregorianYear() / 10) * 10] .= $husb->getSex().$wife->getSex(); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | $listFamSosa[$sosa] = $sfamily; |
@@ -22,18 +22,18 @@ |
||
22 | 22 | public function upgrade() { |
23 | 23 | |
24 | 24 | Database::exec( |
25 | - 'CREATE TABLE IF NOT EXISTS `##maj_sosa` (' . |
|
26 | - ' majs_gedcom_id INTEGER NOT NULL,' . |
|
27 | - ' majs_user_id INTEGER NOT NULL DEFAULT -1,' . |
|
28 | - ' majs_sosa BIGINT UNSIGNED NOT NULL,' . // Allow to calculate sosa on 64 generations |
|
29 | - ' majs_i_id VARCHAR(20) NOT NULL,' . |
|
30 | - ' majs_gen TINYINT NULL,' . |
|
31 | - ' majs_birth_year SMALLINT NULL,' . |
|
32 | - ' majs_death_year SMALLINT NULL,' . |
|
33 | - ' PRIMARY KEY (majs_gedcom_id, majs_user_id, majs_sosa),' . |
|
34 | - ' FOREIGN KEY `##gedcom_id_fk1` (majs_gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE,' . |
|
35 | - ' FOREIGN KEY `##user_id_fk1` (majs_user_id) REFERENCES `##user` (user_id) ON DELETE CASCADE' . |
|
36 | - ') COLLATE utf8_unicode_ci ENGINE=InnoDB' |
|
25 | + 'CREATE TABLE IF NOT EXISTS `##maj_sosa` (' . |
|
26 | + ' majs_gedcom_id INTEGER NOT NULL,' . |
|
27 | + ' majs_user_id INTEGER NOT NULL DEFAULT -1,' . |
|
28 | + ' majs_sosa BIGINT UNSIGNED NOT NULL,' . // Allow to calculate sosa on 64 generations |
|
29 | + ' majs_i_id VARCHAR(20) NOT NULL,' . |
|
30 | + ' majs_gen TINYINT NULL,' . |
|
31 | + ' majs_birth_year SMALLINT NULL,' . |
|
32 | + ' majs_death_year SMALLINT NULL,' . |
|
33 | + ' PRIMARY KEY (majs_gedcom_id, majs_user_id, majs_sosa),' . |
|
34 | + ' FOREIGN KEY `##gedcom_id_fk1` (majs_gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE,' . |
|
35 | + ' FOREIGN KEY `##user_id_fk1` (majs_user_id) REFERENCES `##user` (user_id) ON DELETE CASCADE' . |
|
36 | + ') COLLATE utf8_unicode_ci ENGINE=InnoDB' |
|
37 | 37 | ); |
38 | 38 | } |
39 | 39 | } |
@@ -22,17 +22,17 @@ |
||
22 | 22 | public function upgrade() { |
23 | 23 | |
24 | 24 | Database::exec( |
25 | - 'CREATE TABLE IF NOT EXISTS `##maj_sosa` (' . |
|
26 | - ' majs_gedcom_id INTEGER NOT NULL,' . |
|
27 | - ' majs_user_id INTEGER NOT NULL DEFAULT -1,' . |
|
28 | - ' majs_sosa BIGINT UNSIGNED NOT NULL,' . // Allow to calculate sosa on 64 generations |
|
29 | - ' majs_i_id VARCHAR(20) NOT NULL,' . |
|
30 | - ' majs_gen TINYINT NULL,' . |
|
31 | - ' majs_birth_year SMALLINT NULL,' . |
|
32 | - ' majs_death_year SMALLINT NULL,' . |
|
33 | - ' PRIMARY KEY (majs_gedcom_id, majs_user_id, majs_sosa),' . |
|
34 | - ' FOREIGN KEY `##gedcom_id_fk1` (majs_gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE,' . |
|
35 | - ' FOREIGN KEY `##user_id_fk1` (majs_user_id) REFERENCES `##user` (user_id) ON DELETE CASCADE' . |
|
25 | + 'CREATE TABLE IF NOT EXISTS `##maj_sosa` ('. |
|
26 | + ' majs_gedcom_id INTEGER NOT NULL,'. |
|
27 | + ' majs_user_id INTEGER NOT NULL DEFAULT -1,'. |
|
28 | + ' majs_sosa BIGINT UNSIGNED NOT NULL,'.// Allow to calculate sosa on 64 generations |
|
29 | + ' majs_i_id VARCHAR(20) NOT NULL,'. |
|
30 | + ' majs_gen TINYINT NULL,'. |
|
31 | + ' majs_birth_year SMALLINT NULL,'. |
|
32 | + ' majs_death_year SMALLINT NULL,'. |
|
33 | + ' PRIMARY KEY (majs_gedcom_id, majs_user_id, majs_sosa),'. |
|
34 | + ' FOREIGN KEY `##gedcom_id_fk1` (majs_gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE,'. |
|
35 | + ' FOREIGN KEY `##user_id_fk1` (majs_user_id) REFERENCES `##user` (user_id) ON DELETE CASCADE'. |
|
36 | 36 | ') COLLATE utf8_unicode_ci ENGINE=InnoDB' |
37 | 37 | ); |
38 | 38 | } |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * {@inhericDoc} |
24 | 24 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
25 | 25 | */ |
26 | - protected function renderContent() { |
|
27 | - ?> |
|
26 | + protected function renderContent() { |
|
27 | + ?> |
|
28 | 28 | <div id="maj-sosa-list-page" class="center"> |
29 | 29 | <h2><?php echo $this->data->get('title'); ?></h2> |
30 | 30 | |
31 | 31 | <?php if($this->data->get('is_setup')) { |
32 | - $selectedgen = $this->data->get('generation'); |
|
33 | - $this->renderSosaHeader(); |
|
34 | - if($this->data->get('has_sosa') ) { |
|
35 | - if($selectedgen > 0) { |
|
36 | - ?> |
|
32 | + $selectedgen = $this->data->get('generation'); |
|
33 | + $this->renderSosaHeader(); |
|
34 | + if($this->data->get('has_sosa') ) { |
|
35 | + if($selectedgen > 0) { |
|
36 | + ?> |
|
37 | 37 | <div id="sosalist-tabs"> |
38 | 38 | <ul> |
39 | 39 | <li><a href="#sosalist-indi"><?php echo I18N::translate('Individuals'); ?></a></li> |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | <?php } else { ?> |
54 | 54 | <p class="warning"><?php echo I18N::translate('No ancestor has been found for generation %d', $selectedgen); ?></p> |
55 | 55 | <?php } |
56 | - } |
|
56 | + } |
|
57 | 57 | } else { ?> |
58 | 58 | <p class="warning"><?php echo I18N::translate('The list could not be displayed. Reasons might be:'); ?><br/> |
59 | 59 | <ul> |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | <?php } ?> |
65 | 65 | </div> |
66 | 66 | <?php |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Render the common header to Sosa Lists, made of the generation selector, and the generation navigator |
|
71 | - */ |
|
72 | - protected function renderSosaHeader() { |
|
73 | - $selectedgen = $this->data->get('generation'); |
|
74 | - $max_gen = $this->data->get('max_gen'); |
|
75 | - ?> |
|
69 | + /** |
|
70 | + * Render the common header to Sosa Lists, made of the generation selector, and the generation navigator |
|
71 | + */ |
|
72 | + protected function renderSosaHeader() { |
|
73 | + $selectedgen = $this->data->get('generation'); |
|
74 | + $max_gen = $this->data->get('max_gen'); |
|
75 | + ?> |
|
76 | 76 | |
77 | 77 | <form method="get" name="setgen" action="module.php"> |
78 | 78 | <input type="hidden" name="mod" value="<?php echo $this->data->get('url_module');?>"> |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | <?php |
119 | 119 | } |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | 122 | } |
123 | 123 | |
124 | 124 | \ No newline at end of file |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | <div id="maj-sosa-list-page" class="center"> |
29 | 29 | <h2><?php echo $this->data->get('title'); ?></h2> |
30 | 30 | |
31 | - <?php if($this->data->get('is_setup')) { |
|
31 | + <?php if ($this->data->get('is_setup')) { |
|
32 | 32 | $selectedgen = $this->data->get('generation'); |
33 | 33 | $this->renderSosaHeader(); |
34 | - if($this->data->get('has_sosa') ) { |
|
35 | - if($selectedgen > 0) { |
|
34 | + if ($this->data->get('has_sosa')) { |
|
35 | + if ($selectedgen > 0) { |
|
36 | 36 | ?> |
37 | 37 | <div id="sosalist-tabs"> |
38 | 38 | <ul> |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | ?> |
76 | 76 | |
77 | 77 | <form method="get" name="setgen" action="module.php"> |
78 | - <input type="hidden" name="mod" value="<?php echo $this->data->get('url_module');?>"> |
|
79 | - <input type="hidden" name="mod_action" value="<?php echo $this->data->get('url_action');?>"> |
|
80 | - <input type="hidden" name="ged" value="<?php echo $this->data->get('url_ged');?>"> |
|
78 | + <input type="hidden" name="mod" value="<?php echo $this->data->get('url_module'); ?>"> |
|
79 | + <input type="hidden" name="mod_action" value="<?php echo $this->data->get('url_action'); ?>"> |
|
80 | + <input type="hidden" name="ged" value="<?php echo $this->data->get('url_ged'); ?>"> |
|
81 | 81 | <div class="maj-table"> |
82 | 82 | <div class="maj-row"> |
83 | 83 | <div class="label"><?php echo I18N::translate('Choose generation') ?></div> |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | <div class="maj-row"> |
86 | 86 | <div class="value"> |
87 | 87 | <select name="gen"> |
88 | - <?php for($i=$this->data->get('min_gen'); $i <= $max_gen;$i++) {?> |
|
88 | + <?php for ($i = $this->data->get('min_gen'); $i <= $max_gen; $i++) {?> |
|
89 | 89 | <option value="<?php echo $i; ?>" |
90 | - <?php if($selectedgen && $selectedgen==$i) { ?> selected="true" <?php } ?> |
|
90 | + <?php if ($selectedgen && $selectedgen == $i) { ?> selected="true" <?php } ?> |
|
91 | 91 | ><?php echo I18N::translate('Generation %d', $i); ?> |
92 | 92 | </option> |
93 | 93 | <?php } ?> |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | </div> |
96 | 96 | </div> |
97 | 97 | </div> |
98 | - <input type="submit" value="<?php echo I18N::translate('Show');?>" /> |
|
98 | + <input type="submit" value="<?php echo I18N::translate('Show'); ?>" /> |
|
99 | 99 | <br /> |
100 | 100 | </form> |
101 | - <?php if($selectedgen > 0) { ?> |
|
101 | + <?php if ($selectedgen > 0) { ?> |
|
102 | 102 | <h4> |
103 | - <?php if($selectedgen > $this->data->get('min_gen')) { ?> |
|
104 | - <a href="module.php?mod=<?php echo $this->data->get('url_module');?>&mod_action=<?php echo $this->data->get('url_action');?>&ged=<?php echo $this->data->get('url_ged');?>&gen=<?php echo $selectedgen-1; ?>"> |
|
103 | + <?php if ($selectedgen > $this->data->get('min_gen')) { ?> |
|
104 | + <a href="module.php?mod=<?php echo $this->data->get('url_module'); ?>&mod_action=<?php echo $this->data->get('url_action'); ?>&ged=<?php echo $this->data->get('url_ged'); ?>&gen=<?php echo $selectedgen - 1; ?>"> |
|
105 | 105 | <i class="icon-ldarrow" title="<?php echo I18N::translate('Previous generation'); ?>" ></i> |
106 | 106 | </a> |
107 | 107 | |
108 | 108 | <?php } ?> |
109 | 109 | <?php echo I18N::translate('Generation %d', $selectedgen); ?> |
110 | - <?php if($selectedgen < $max_gen) { ?> |
|
110 | + <?php if ($selectedgen < $max_gen) { ?> |
|
111 | 111 | |
112 | - <a href="module.php?mod=<?php echo $this->data->get('url_module');?>&mod_action=<?php echo $this->data->get('url_action');?>&ged=<?php echo $this->data->get('url_ged');?>&gen=<?php echo $selectedgen+1; ?>"> |
|
112 | + <a href="module.php?mod=<?php echo $this->data->get('url_module'); ?>&mod_action=<?php echo $this->data->get('url_action'); ?>&ged=<?php echo $this->data->get('url_ged'); ?>&gen=<?php echo $selectedgen + 1; ?>"> |
|
113 | 113 | <i class="icon-rdarrow" title="<?php echo I18N::translate('Next generation'); ?>" ></i> |
114 | 114 | </a> |
115 | 115 | <?php } ?> |
@@ -23,18 +23,18 @@ |
||
23 | 23 | * {@inhericDoc} |
24 | 24 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
25 | 25 | */ |
26 | - protected function renderContent() { |
|
26 | + protected function renderContent() { |
|
27 | 27 | |
28 | - if($this->data->get('is_success', false)) { |
|
29 | - ?> |
|
28 | + if($this->data->get('is_success', false)) { |
|
29 | + ?> |
|
30 | 30 | <i class="icon-maj-success" title="<?php echo I18N::translate('Success'); ?>"></i> |
31 | 31 | <?php echo I18N::translate('Success'); ?> |
32 | 32 | <?php } else { ?> |
33 | 33 | <i class="icon-maj-error" title="<?php echo I18N::translate('Error'); ?>"></i> |
34 | 34 | <?php echo I18N::translate('Error'); ?> |
35 | 35 | <?php if($error = $this->data->get('error')) { echo ' - ' . $error; } |
36 | - } |
|
37 | - } |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
41 | 41 | \ No newline at end of file |
@@ -25,14 +25,14 @@ |
||
25 | 25 | */ |
26 | 26 | protected function renderContent() { |
27 | 27 | |
28 | - if($this->data->get('is_success', false)) { |
|
28 | + if ($this->data->get('is_success', false)) { |
|
29 | 29 | ?> |
30 | 30 | <i class="icon-maj-success" title="<?php echo I18N::translate('Success'); ?>"></i> |
31 | 31 | <?php echo I18N::translate('Success'); ?> |
32 | 32 | <?php } else { ?> |
33 | 33 | <i class="icon-maj-error" title="<?php echo I18N::translate('Error'); ?>"></i> |
34 | 34 | <?php echo I18N::translate('Error'); ?> |
35 | - <?php if($error = $this->data->get('error')) { echo ' - ' . $error; } |
|
35 | + <?php if ($error = $this->data->get('error')) { echo ' - '.$error; } |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param Fisharebest\Webtrees\Family $fams |
58 | 58 | */ |
59 | 59 | public function addFamily(Family $fams) { |
60 | - if($fams && !isset($this->linked_fams[$fams])) { |
|
60 | + if ($fams && !isset($this->linked_fams[$fams])) { |
|
61 | 61 | $this->linked_fams[$fams] = array(); |
62 | 62 | } |
63 | 63 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param LineageNode $child |
70 | 70 | */ |
71 | 71 | public function addChild(Family $fams, LineageNode $child = null) { |
72 | - if($fams) { |
|
72 | + if ($fams) { |
|
73 | 73 | $this->addFamily($fams); |
74 | 74 | $tmp = $this->linked_fams[$fams]; |
75 | 75 | $tmp[] = $child; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return boolean |
120 | 120 | */ |
121 | 121 | public function hasFollowUpSurname() { |
122 | - return !is_null($this->alt_surname) && strlen($this->alt_surname) > 0 ; |
|
122 | + return !is_null($this->alt_surname) && strlen($this->alt_surname) > 0; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Constructor for Lineage node |
42 | 42 | * |
43 | - * @param Fisharebest\Webtrees\Individual $node_indi Main individual |
|
43 | + * @param Individual $node_indi Main individual |
|
44 | 44 | * @param LineageRootNode $root_node Node of the lineage root |
45 | 45 | * @param null|string $alt_surname Follow-up surname |
46 | 46 | */ |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * Add a spouse family to the node |
56 | 56 | * |
57 | - * @param Fisharebest\Webtrees\Family $fams |
|
57 | + * @param Family $fams |
|
58 | 58 | */ |
59 | 59 | public function addFamily(Family $fams) { |
60 | 60 | if($fams && !isset($this->linked_fams[$fams])) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | /** |
66 | 66 | * Add a child LineageNode to the node |
67 | 67 | * |
68 | - * @param Fisharebest\Webtrees\Family $fams |
|
68 | + * @param Family $fams |
|
69 | 69 | * @param LineageNode $child |
70 | 70 | */ |
71 | 71 | public function addChild(Family $fams, LineageNode $child = null) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * Returns the node individual |
82 | 82 | * |
83 | - * @return Fisharebest\Webtrees\Individual |
|
83 | + * @return \Fisharebest\Webtrees\GedcomRecord |
|
84 | 84 | */ |
85 | 85 | public function getIndividual() { |
86 | 86 | return $this->node_indi; |
@@ -37,12 +37,12 @@ |
||
37 | 37 | * @param Place $place |
38 | 38 | */ |
39 | 39 | public function addPlace(Place $place) { |
40 | - if(!is_null($place) && !$place->isEmpty()){ |
|
40 | + if (!is_null($place) && !$place->isEmpty()) { |
|
41 | 41 | $place_name = $place->getFullName(); |
42 | - if(isset($this->places[$place_name])){ |
|
43 | - $this->places[$place_name]+=1; |
|
42 | + if (isset($this->places[$place_name])) { |
|
43 | + $this->places[$place_name] += 1; |
|
44 | 44 | } |
45 | - else{ |
|
45 | + else { |
|
46 | 46 | $this->places[$place_name] = 1; |
47 | 47 | } |
48 | 48 | } |
@@ -41,8 +41,7 @@ |
||
41 | 41 | $place_name = $place->getFullName(); |
42 | 42 | if(isset($this->places[$place_name])){ |
43 | 43 | $this->places[$place_name]+=1; |
44 | - } |
|
45 | - else{ |
|
44 | + } else{ |
|
46 | 45 | $this->places[$place_name] = 1; |
47 | 46 | } |
48 | 47 | } |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params); |
56 | 56 | break; |
57 | 57 | } |
58 | - } |
|
59 | - else if ($this->data->get('islineages', false)) { |
|
58 | + } else if ($this->data->get('islineages', false)) { |
|
60 | 59 | //Link to indilist |
61 | 60 | echo '<p class="center"><strong>'. |
62 | 61 | '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
@@ -81,7 +80,9 @@ discard block |
||
81 | 80 | |
82 | 81 | foreach($lineages as $i => $lineage) { |
83 | 82 | $this->printRootLineage($lineage); |
84 | - if($i < $nb_lineages - 1) echo '<hr />'; |
|
83 | + if($i < $nb_lineages - 1) { |
|
84 | + echo '<hr />'; |
|
85 | + } |
|
85 | 86 | } |
86 | 87 | |
87 | 88 | echo '</div>'; |
@@ -156,8 +157,7 @@ discard block |
||
156 | 157 | } |
157 | 158 | } |
158 | 159 | } |
159 | - } |
|
160 | - else { |
|
160 | + } else { |
|
161 | 161 | $this->printLineage($node); |
162 | 162 | } |
163 | 163 | echo '</div>'; |
@@ -185,8 +185,7 @@ discard block |
||
185 | 185 | echo '<li>'; |
186 | 186 | if($is_first_family){ |
187 | 187 | echo FunctionsPrint::htmlIndividualForList($node_indi); |
188 | - } |
|
189 | - else{ |
|
188 | + } else{ |
|
190 | 189 | echo FunctionsPrint::htmlIndividualForList($node_indi, false); |
191 | 190 | } |
192 | 191 | //Get individual's spouse |
@@ -207,15 +206,13 @@ discard block |
||
207 | 206 | foreach($fam_nodes[$fam] as $child_node) { |
208 | 207 | if($child_node) { |
209 | 208 | $this->printLineage($child_node); |
210 | - } |
|
211 | - else { |
|
209 | + } else { |
|
212 | 210 | echo '<ul><li><strong>…</strong></li></ul>'; |
213 | 211 | } |
214 | 212 | } |
215 | 213 | $is_first_family = false; |
216 | 214 | } |
217 | - } |
|
218 | - else { |
|
215 | + } else { |
|
219 | 216 | echo '<li>'; |
220 | 217 | echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
221 | 218 | if($node->hasFollowUpSurname()) { |
@@ -31,161 +31,161 @@ discard block |
||
31 | 31 | * {@inhericDoc} |
32 | 32 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
33 | 33 | */ |
34 | - protected function renderContent() { |
|
34 | + protected function renderContent() { |
|
35 | 35 | |
36 | - /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
37 | - $tree = $this->data->get('tree'); |
|
36 | + /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
37 | + $tree = $this->data->get('tree'); |
|
38 | 38 | |
39 | - echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
40 | - echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
|
39 | + echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
40 | + echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
|
41 | 41 | |
42 | - if($this->data->get('issurnames', false)) { |
|
43 | - $surns = $this->data->get('surnameslist', array()); |
|
44 | - $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
45 | - // Show the surname list |
|
46 | - switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
|
47 | - case 'style1': |
|
42 | + if($this->data->get('issurnames', false)) { |
|
43 | + $surns = $this->data->get('surnameslist', array()); |
|
44 | + $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
45 | + // Show the surname list |
|
46 | + switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
|
47 | + case 'style1': |
|
48 | 48 | echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $tree, $extra_params); |
49 | 49 | break; |
50 | - case 'style3': |
|
51 | - echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $tree, $extra_params); |
|
52 | - break; |
|
53 | - case 'style2': |
|
54 | - default: |
|
55 | - echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params); |
|
56 | - break; |
|
57 | - } |
|
58 | - } |
|
59 | - else if ($this->data->get('islineages', false)) { |
|
60 | - //Link to indilist |
|
61 | - echo '<p class="center"><strong>'. |
|
62 | - '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
63 | - I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
|
64 | - '</a></strong></p>'; |
|
50 | + case 'style3': |
|
51 | + echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $tree, $extra_params); |
|
52 | + break; |
|
53 | + case 'style2': |
|
54 | + default: |
|
55 | + echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params); |
|
56 | + break; |
|
57 | + } |
|
58 | + } |
|
59 | + else if ($this->data->get('islineages', false)) { |
|
60 | + //Link to indilist |
|
61 | + echo '<p class="center"><strong>'. |
|
62 | + '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
63 | + I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
|
64 | + '</a></strong></p>'; |
|
65 | 65 | |
66 | - $lineages = $this->data->get('lineages', null); |
|
67 | - $nb_lineages = count($lineages); |
|
68 | - if(is_null($lineages) || $nb_lineages == 0) { |
|
69 | - echo '<p class="center"><span class="warning">', |
|
70 | - I18N::translate('No individuals with surname %s has been found. Please try another name.', |
|
71 | - '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
72 | - '</span></p>'; |
|
73 | - } else { |
|
66 | + $lineages = $this->data->get('lineages', null); |
|
67 | + $nb_lineages = count($lineages); |
|
68 | + if(is_null($lineages) || $nb_lineages == 0) { |
|
69 | + echo '<p class="center"><span class="warning">', |
|
70 | + I18N::translate('No individuals with surname %s has been found. Please try another name.', |
|
71 | + '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
72 | + '</span></p>'; |
|
73 | + } else { |
|
74 | 74 | |
75 | - echo '<div id="patronymiclineages">'. |
|
76 | - '<div class="list_label">', |
|
77 | - $this->data->get('table_title'), |
|
78 | - '</div>'; |
|
75 | + echo '<div id="patronymiclineages">'. |
|
76 | + '<div class="list_label">', |
|
77 | + $this->data->get('table_title'), |
|
78 | + '</div>'; |
|
79 | 79 | |
80 | - echo '<div class="list_value_wrap">'; |
|
80 | + echo '<div class="list_value_wrap">'; |
|
81 | 81 | |
82 | - foreach($lineages as $i => $lineage) { |
|
83 | - $this->printRootLineage($lineage); |
|
84 | - if($i < $nb_lineages - 1) echo '<hr />'; |
|
85 | - } |
|
82 | + foreach($lineages as $i => $lineage) { |
|
83 | + $this->printRootLineage($lineage); |
|
84 | + if($i < $nb_lineages - 1) echo '<hr />'; |
|
85 | + } |
|
86 | 86 | |
87 | - echo '</div>'; |
|
87 | + echo '</div>'; |
|
88 | 88 | |
89 | - echo '<div class="list_label">', |
|
90 | - I18N::translate('%s lineages found', $nb_lineages), |
|
91 | - '</div>'. |
|
92 | - '</div>'; |
|
89 | + echo '<div class="list_label">', |
|
90 | + I18N::translate('%s lineages found', $nb_lineages), |
|
91 | + '</div>'. |
|
92 | + '</div>'; |
|
93 | 93 | |
94 | - } |
|
95 | - } |
|
96 | - } |
|
94 | + } |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * Get the list of initial letters |
|
100 | - * |
|
101 | - * @return string[] |
|
102 | - */ |
|
103 | - private function getInitialLettersList() { |
|
104 | - $list = array(); |
|
105 | - /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
106 | - $tree = $this->data->get('tree'); |
|
98 | + /** |
|
99 | + * Get the list of initial letters |
|
100 | + * |
|
101 | + * @return string[] |
|
102 | + */ |
|
103 | + private function getInitialLettersList() { |
|
104 | + $list = array(); |
|
105 | + /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
106 | + $tree = $this->data->get('tree'); |
|
107 | 107 | $script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
108 | 108 | |
109 | - foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
|
110 | - switch ($letter) { |
|
111 | - case '@': |
|
112 | - $html = I18N::translateContext('Unknown surname', '…'); |
|
113 | - break; |
|
114 | - case ',': |
|
115 | - $html = I18N::translate('None'); |
|
116 | - break; |
|
117 | - default: |
|
118 | - $html = Filter::escapeHtml($letter); |
|
119 | - break; |
|
120 | - } |
|
121 | - if ($count) { |
|
122 | - if ($letter == $this->data->get('alpha')) { |
|
123 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
124 | - } else { |
|
125 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
126 | - } |
|
127 | - } else { |
|
128 | - $list[] = $html; |
|
129 | - } |
|
130 | - } |
|
109 | + foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
|
110 | + switch ($letter) { |
|
111 | + case '@': |
|
112 | + $html = I18N::translateContext('Unknown surname', '…'); |
|
113 | + break; |
|
114 | + case ',': |
|
115 | + $html = I18N::translate('None'); |
|
116 | + break; |
|
117 | + default: |
|
118 | + $html = Filter::escapeHtml($letter); |
|
119 | + break; |
|
120 | + } |
|
121 | + if ($count) { |
|
122 | + if ($letter == $this->data->get('alpha')) { |
|
123 | + $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
124 | + } else { |
|
125 | + $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
126 | + } |
|
127 | + } else { |
|
128 | + $list[] = $html; |
|
129 | + } |
|
130 | + } |
|
131 | 131 | |
132 | - // Search spiders don't get the "show all" option as the other links give them everything. |
|
133 | - if (!Auth::isSearchEngine()) { |
|
134 | - if ($this->data->get('show_all') === 'yes') { |
|
135 | - $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
136 | - } else { |
|
137 | - $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
138 | - } |
|
139 | - } |
|
132 | + // Search spiders don't get the "show all" option as the other links give them everything. |
|
133 | + if (!Auth::isSearchEngine()) { |
|
134 | + if ($this->data->get('show_all') === 'yes') { |
|
135 | + $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
136 | + } else { |
|
137 | + $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
138 | + } |
|
139 | + } |
|
140 | 140 | |
141 | - return $list; |
|
142 | - } |
|
141 | + return $list; |
|
142 | + } |
|
143 | 143 | |
144 | - /** |
|
145 | - * Print a root lineage node |
|
146 | - * @param LineageRootNode $node |
|
147 | - */ |
|
148 | - private function printRootLineage(LineageRootNode $node) { |
|
149 | - print '<div class="patrolin_tree">'; |
|
150 | - if($node->getIndividual() === null) { |
|
151 | - $fam_nodes = $node->getFamiliesNodes(); |
|
152 | - foreach($fam_nodes as $fam){ |
|
153 | - foreach($fam_nodes[$fam] as $child_node) { |
|
154 | - if($child_node) { |
|
155 | - $this->printLineage($child_node); |
|
156 | - } |
|
157 | - } |
|
158 | - } |
|
159 | - } |
|
160 | - else { |
|
161 | - $this->printLineage($node); |
|
162 | - } |
|
163 | - echo '</div>'; |
|
144 | + /** |
|
145 | + * Print a root lineage node |
|
146 | + * @param LineageRootNode $node |
|
147 | + */ |
|
148 | + private function printRootLineage(LineageRootNode $node) { |
|
149 | + print '<div class="patrolin_tree">'; |
|
150 | + if($node->getIndividual() === null) { |
|
151 | + $fam_nodes = $node->getFamiliesNodes(); |
|
152 | + foreach($fam_nodes as $fam){ |
|
153 | + foreach($fam_nodes[$fam] as $child_node) { |
|
154 | + if($child_node) { |
|
155 | + $this->printLineage($child_node); |
|
156 | + } |
|
157 | + } |
|
158 | + } |
|
159 | + } |
|
160 | + else { |
|
161 | + $this->printLineage($node); |
|
162 | + } |
|
163 | + echo '</div>'; |
|
164 | 164 | |
165 | - $places = $node->getPlaces(); |
|
166 | - if($places && count($places)>0){ |
|
167 | - echo '<div class="patrolin_places">'; |
|
168 | - echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
|
169 | - echo '</div>'; |
|
170 | - } |
|
171 | - } |
|
165 | + $places = $node->getPlaces(); |
|
166 | + if($places && count($places)>0){ |
|
167 | + echo '<div class="patrolin_places">'; |
|
168 | + echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
|
169 | + echo '</div>'; |
|
170 | + } |
|
171 | + } |
|
172 | 172 | |
173 | - /** |
|
174 | - * Print a lineage node, recursively. |
|
175 | - * @param LineageNode $node |
|
176 | - */ |
|
177 | - private function printLineage(LineageNode $node) { |
|
173 | + /** |
|
174 | + * Print a lineage node, recursively. |
|
175 | + * @param LineageNode $node |
|
176 | + */ |
|
177 | + private function printLineage(LineageNode $node) { |
|
178 | 178 | |
179 | - echo '<ul>'; |
|
180 | - $fam_nodes = $node->getFamiliesNodes(); |
|
181 | - if(count($fam_nodes) > 0) { |
|
182 | - $is_first_family = true; |
|
183 | - foreach($fam_nodes as $fam) { |
|
184 | - $node_indi = $node->getIndividual(); |
|
185 | - echo '<li>'; |
|
186 | - if($is_first_family){ |
|
187 | - echo FunctionsPrint::htmlIndividualForList($node_indi); |
|
188 | - } |
|
179 | + echo '<ul>'; |
|
180 | + $fam_nodes = $node->getFamiliesNodes(); |
|
181 | + if(count($fam_nodes) > 0) { |
|
182 | + $is_first_family = true; |
|
183 | + foreach($fam_nodes as $fam) { |
|
184 | + $node_indi = $node->getIndividual(); |
|
185 | + echo '<li>'; |
|
186 | + if($is_first_family){ |
|
187 | + echo FunctionsPrint::htmlIndividualForList($node_indi); |
|
188 | + } |
|
189 | 189 | else{ |
190 | 190 | echo FunctionsPrint::htmlIndividualForList($node_indi, false); |
191 | 191 | } |
@@ -204,32 +204,32 @@ discard block |
||
204 | 204 | echo '<span class="details1" title="'.$marrdate.'"><i class="icon-rings"></i>'.$marryear.'</span></a> '; |
205 | 205 | echo FunctionsPrint::htmlIndividualForList($spouse); |
206 | 206 | } |
207 | - foreach($fam_nodes[$fam] as $child_node) { |
|
208 | - if($child_node) { |
|
209 | - $this->printLineage($child_node); |
|
210 | - } |
|
211 | - else { |
|
212 | - echo '<ul><li><strong>…</strong></li></ul>'; |
|
213 | - } |
|
214 | - } |
|
215 | - $is_first_family = false; |
|
216 | - } |
|
217 | - } |
|
218 | - else { |
|
219 | - echo '<li>'; |
|
220 | - echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
|
221 | - if($node->hasFollowUpSurname()) { |
|
222 | - $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
223 | - echo ' '. |
|
224 | - '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
225 | - '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
|
226 | - '</a>'; |
|
227 | - } |
|
228 | - echo '</li>'; |
|
229 | - } |
|
230 | - echo '</ul>'; |
|
207 | + foreach($fam_nodes[$fam] as $child_node) { |
|
208 | + if($child_node) { |
|
209 | + $this->printLineage($child_node); |
|
210 | + } |
|
211 | + else { |
|
212 | + echo '<ul><li><strong>…</strong></li></ul>'; |
|
213 | + } |
|
214 | + } |
|
215 | + $is_first_family = false; |
|
216 | + } |
|
217 | + } |
|
218 | + else { |
|
219 | + echo '<li>'; |
|
220 | + echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
|
221 | + if($node->hasFollowUpSurname()) { |
|
222 | + $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
223 | + echo ' '. |
|
224 | + '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
225 | + '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
|
226 | + '</a>'; |
|
227 | + } |
|
228 | + echo '</li>'; |
|
229 | + } |
|
230 | + echo '</ul>'; |
|
231 | 231 | |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | |
236 | 236 | \ No newline at end of file |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | /** @var \Fisharebest\Webtrees\Tree $tree */ |
37 | 37 | $tree = $this->data->get('tree'); |
38 | 38 | |
39 | - echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
39 | + echo '<h2 class="center">', $this->data->get('title'), '</h2>'; |
|
40 | 40 | echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
41 | 41 | |
42 | - if($this->data->get('issurnames', false)) { |
|
42 | + if ($this->data->get('issurnames', false)) { |
|
43 | 43 | $surns = $this->data->get('surnameslist', array()); |
44 | - $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
44 | + $extra_params = array('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
45 | 45 | // Show the surname list |
46 | 46 | switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
47 | 47 | case 'style1': |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | else if ($this->data->get('islineages', false)) { |
60 | 60 | //Link to indilist |
61 | 61 | echo '<p class="center"><strong>'. |
62 | - '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
62 | + '<a href="indilist.php?ged='.$tree->getNameUrl().'&surname='.rawurlencode($this->data->get('surname')).'">'. |
|
63 | 63 | I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
64 | 64 | '</a></strong></p>'; |
65 | 65 | |
66 | 66 | $lineages = $this->data->get('lineages', null); |
67 | 67 | $nb_lineages = count($lineages); |
68 | - if(is_null($lineages) || $nb_lineages == 0) { |
|
68 | + if (is_null($lineages) || $nb_lineages == 0) { |
|
69 | 69 | echo '<p class="center"><span class="warning">', |
70 | 70 | I18N::translate('No individuals with surname %s has been found. Please try another name.', |
71 | - '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
71 | + '<span dir="auto">'.$this->data->get('legend').'</span>'), |
|
72 | 72 | '</span></p>'; |
73 | 73 | } else { |
74 | 74 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | |
80 | 80 | echo '<div class="list_value_wrap">'; |
81 | 81 | |
82 | - foreach($lineages as $i => $lineage) { |
|
82 | + foreach ($lineages as $i => $lineage) { |
|
83 | 83 | $this->printRootLineage($lineage); |
84 | - if($i < $nb_lineages - 1) echo '<hr />'; |
|
84 | + if ($i < $nb_lineages - 1) echo '<hr />'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | echo '</div>'; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $list = array(); |
105 | 105 | /** @var \Fisharebest\Webtrees\Tree $tree */ |
106 | 106 | $tree = $this->data->get('tree'); |
107 | - $script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
107 | + $script_base_url = WT_SCRIPT_NAME.'?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME.'&mod_action=Lineage'; |
|
108 | 108 | |
109 | 109 | foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
110 | 110 | switch ($letter) { |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | } |
121 | 121 | if ($count) { |
122 | 122 | if ($letter == $this->data->get('alpha')) { |
123 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
123 | + $list[] = '<a href="'.$script_base_url.'&alpha='.rawurlencode($letter).'&ged='.$tree->getNameUrl().'" class="warning" title="'.I18N::number($count).'">'.$html.'</a>'; |
|
124 | 124 | } else { |
125 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
125 | + $list[] = '<a href="'.$script_base_url.'&alpha='.rawurlencode($letter).'&ged='.$tree->getNameUrl().'" title="'.I18N::number($count).'">'.$html.'</a>'; |
|
126 | 126 | } |
127 | 127 | } else { |
128 | 128 | $list[] = $html; |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | // Search spiders don't get the "show all" option as the other links give them everything. |
133 | 133 | if (!Auth::isSearchEngine()) { |
134 | 134 | if ($this->data->get('show_all') === 'yes') { |
135 | - $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
135 | + $list[] = '<span class="warning">'.I18N::translate('All').'</span>'; |
|
136 | 136 | } else { |
137 | - $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
137 | + $list[] = '<a href="'.$script_base_url.'&show_all=yes'.'&ged='.$tree->getNameUrl().'">'.I18N::translate('All').'</a>'; |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | */ |
148 | 148 | private function printRootLineage(LineageRootNode $node) { |
149 | 149 | print '<div class="patrolin_tree">'; |
150 | - if($node->getIndividual() === null) { |
|
150 | + if ($node->getIndividual() === null) { |
|
151 | 151 | $fam_nodes = $node->getFamiliesNodes(); |
152 | - foreach($fam_nodes as $fam){ |
|
153 | - foreach($fam_nodes[$fam] as $child_node) { |
|
154 | - if($child_node) { |
|
152 | + foreach ($fam_nodes as $fam) { |
|
153 | + foreach ($fam_nodes[$fam] as $child_node) { |
|
154 | + if ($child_node) { |
|
155 | 155 | $this->printLineage($child_node); |
156 | 156 | } |
157 | 157 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | echo '</div>'; |
164 | 164 | |
165 | 165 | $places = $node->getPlaces(); |
166 | - if($places && count($places)>0){ |
|
166 | + if ($places && count($places) > 0) { |
|
167 | 167 | echo '<div class="patrolin_places">'; |
168 | 168 | echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
169 | 169 | echo '</div>'; |
@@ -178,34 +178,34 @@ discard block |
||
178 | 178 | |
179 | 179 | echo '<ul>'; |
180 | 180 | $fam_nodes = $node->getFamiliesNodes(); |
181 | - if(count($fam_nodes) > 0) { |
|
181 | + if (count($fam_nodes) > 0) { |
|
182 | 182 | $is_first_family = true; |
183 | - foreach($fam_nodes as $fam) { |
|
183 | + foreach ($fam_nodes as $fam) { |
|
184 | 184 | $node_indi = $node->getIndividual(); |
185 | 185 | echo '<li>'; |
186 | - if($is_first_family){ |
|
186 | + if ($is_first_family) { |
|
187 | 187 | echo FunctionsPrint::htmlIndividualForList($node_indi); |
188 | 188 | } |
189 | - else{ |
|
189 | + else { |
|
190 | 190 | echo FunctionsPrint::htmlIndividualForList($node_indi, false); |
191 | 191 | } |
192 | 192 | //Get individual's spouse |
193 | 193 | $dfam = new Family($fam); |
194 | - $spouse=$dfam->getSpouseById($node_indi); |
|
194 | + $spouse = $dfam->getSpouseById($node_indi); |
|
195 | 195 | //Print the spouse if relevant |
196 | - if($spouse){ |
|
196 | + if ($spouse) { |
|
197 | 197 | $marrdate = I18N::translate('yes'); |
198 | 198 | $marryear = ''; |
199 | 199 | echo ' <a href="'.$fam->getHtmlUrl().'">'; |
200 | - if ($fam->getMarriageYear()){ |
|
200 | + if ($fam->getMarriageYear()) { |
|
201 | 201 | $marrdate = strip_tags($fam->getMarriageDate()->Display()); |
202 | 202 | $marryear = $fam->getMarriageYear(); |
203 | 203 | } |
204 | 204 | echo '<span class="details1" title="'.$marrdate.'"><i class="icon-rings"></i>'.$marryear.'</span></a> '; |
205 | 205 | echo FunctionsPrint::htmlIndividualForList($spouse); |
206 | 206 | } |
207 | - foreach($fam_nodes[$fam] as $child_node) { |
|
208 | - if($child_node) { |
|
207 | + foreach ($fam_nodes[$fam] as $child_node) { |
|
208 | + if ($child_node) { |
|
209 | 209 | $this->printLineage($child_node); |
210 | 210 | } |
211 | 211 | else { |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | else { |
219 | 219 | echo '<li>'; |
220 | 220 | echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
221 | - if($node->hasFollowUpSurname()) { |
|
222 | - $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
221 | + if ($node->hasFollowUpSurname()) { |
|
222 | + $url_base = WT_SCRIPT_NAME.'?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME.'&mod_action=Lineage'; |
|
223 | 223 | echo ' '. |
224 | - '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
224 | + '<a href="'.$url_base.'&surname='.rawurlencode($node->getFollowUpSurname()).'&ged='.$this->data->get('tree')->getNameUrl().'">'. |
|
225 | 225 | '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
226 | 226 | '</a>'; |
227 | 227 | } |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | $this->show = 'lineage'; // SURN list makes no sense here |
93 | 93 | } elseif ($this->alpha) { |
94 | 94 | $this->show_all = 'no'; |
95 | - $this->legend = Filter::escapeHtml($this->alpha) . '…'; |
|
95 | + $this->legend = Filter::escapeHtml($this->alpha).'…'; |
|
96 | 96 | $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
97 | 97 | } else { |
98 | 98 | $this->show_all = 'no'; |
99 | 99 | $this->legend = '…'; |
100 | 100 | $this->show = 'none'; // Don't show lists until something is chosen |
101 | 101 | } |
102 | - $this->legend = '<span dir="auto">' . $this->legend . '</span>'; |
|
102 | + $this->legend = '<span dir="auto">'.$this->legend.'</span>'; |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | global $WT_TREE; |
153 | 153 | |
154 | 154 | $controller = new PageController(); |
155 | - $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); |
|
155 | + $controller->setPageTitle(I18N::translate('Patronymic Lineages').' : '.$this->legend); |
|
156 | 156 | |
157 | 157 | $view_bag = new ViewBag(); |
158 | 158 | $view_bag->set('title', $controller->getPageTitle()); |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | $view_bag->set('surname', $this->surname); |
162 | 162 | $view_bag->set('legend', $this->legend); |
163 | 163 | $view_bag->set('show_all', $this->show_all); |
164 | - if($this->isShowingSurnames()) { |
|
164 | + if ($this->isShowingSurnames()) { |
|
165 | 165 | $view_bag->set('issurnames', true); |
166 | 166 | $view_bag->set('surnameslist', $this->getSurnamesList()); |
167 | 167 | } |
168 | - if($this->isShowingLineages()) { |
|
168 | + if ($this->isShowingLineages()) { |
|
169 | 169 | $view_bag->set('islineages', true); |
170 | 170 | $view_bag->set('lineages', $this->getLineages()); |
171 | 171 | |
172 | - if ($this->show_all==='no') { |
|
172 | + if ($this->show_all === 'no') { |
|
173 | 173 | $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
174 | 174 | } |
175 | 175 | else { |
@@ -171,8 +171,7 @@ |
||
171 | 171 | |
172 | 172 | if ($this->show_all==='no') { |
173 | 173 | $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
174 | - } |
|
175 | - else { |
|
174 | + } else { |
|
176 | 175 | $view_bag->set('table_title', I18N::translate('All lineages')); |
177 | 176 | } |
178 | 177 | } |
@@ -26,166 +26,166 @@ |
||
26 | 26 | class LineageController extends MvcController |
27 | 27 | { |
28 | 28 | |
29 | - /** |
|
30 | - * Generate the patronymic lineage for this surname |
|
31 | - * @var string $surname Reference surname |
|
32 | - */ |
|
33 | - private $surname; |
|
29 | + /** |
|
30 | + * Generate the patronymic lineage for this surname |
|
31 | + * @var string $surname Reference surname |
|
32 | + */ |
|
33 | + private $surname; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Initial letter |
|
37 | - * @var string $alpha |
|
38 | - */ |
|
39 | - private $alpha; |
|
35 | + /** |
|
36 | + * Initial letter |
|
37 | + * @var string $alpha |
|
38 | + */ |
|
39 | + private $alpha; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Show all names (values: yes|no) |
|
43 | - * @var bool $show |
|
44 | - */ |
|
45 | - private $show_all; |
|
41 | + /** |
|
42 | + * Show all names (values: yes|no) |
|
43 | + * @var bool $show |
|
44 | + */ |
|
45 | + private $show_all; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Page to display (values: surn|lineage) |
|
49 | - * @var unknown $show |
|
50 | - */ |
|
51 | - private $show; |
|
47 | + /** |
|
48 | + * Page to display (values: surn|lineage) |
|
49 | + * @var unknown $show |
|
50 | + */ |
|
51 | + private $show; |
|
52 | 52 | |
53 | - /** |
|
54 | - * Page title |
|
55 | - * @var string $legend |
|
56 | - */ |
|
57 | - private $legend; |
|
53 | + /** |
|
54 | + * Page title |
|
55 | + * @var string $legend |
|
56 | + */ |
|
57 | + private $legend; |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inheritDoc} |
|
61 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
62 | - */ |
|
63 | - public function __construct(AbstractModule $module) { |
|
64 | - global $WT_TREE; |
|
59 | + /** |
|
60 | + * {@inheritDoc} |
|
61 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
62 | + */ |
|
63 | + public function __construct(AbstractModule $module) { |
|
64 | + global $WT_TREE; |
|
65 | 65 | |
66 | - parent::__construct($module); |
|
66 | + parent::__construct($module); |
|
67 | 67 | |
68 | - $this->surname = Filter::get('surname'); |
|
69 | - $this->alpha = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none |
|
70 | - $this->show_all = Filter::get('show_all', 'no|yes', 'no'); // All indis |
|
71 | - // Make sure selections are consistent. |
|
72 | - // i.e. can’t specify show_all and surname at the same time. |
|
73 | - if ($this->show_all === 'yes') { |
|
74 | - $this->alpha = ''; |
|
75 | - $this->surname = ''; |
|
76 | - $this->legend = I18N::translate('All'); |
|
77 | - $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
78 | - } elseif ($this->surname) { |
|
79 | - $this->alpha = QueryName::initialLetter($this->surname); // so we can highlight the initial letter |
|
80 | - $this->show_all = 'no'; |
|
81 | - if ($this->surname === '@N.N.') { |
|
82 | - $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
83 | - } else { |
|
84 | - $this->legend = Filter::escapeHtml($this->surname); |
|
85 | - // The surname parameter is a root/canonical form. |
|
86 | - // Display it as the actual surname |
|
87 | - foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) { |
|
88 | - $this->legend = implode('/', array_keys($details)); |
|
89 | - } |
|
90 | - } |
|
91 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
92 | - } elseif ($this->alpha === '@') { |
|
93 | - $this->show_all = 'no'; |
|
94 | - $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
95 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
96 | - } elseif ($this->alpha === ',') { |
|
97 | - $this->show_all = 'no'; |
|
98 | - $this->legend = I18N::translate('None'); |
|
99 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
100 | - } elseif ($this->alpha) { |
|
101 | - $this->show_all = 'no'; |
|
102 | - $this->legend = Filter::escapeHtml($this->alpha) . '…'; |
|
103 | - $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
104 | - } else { |
|
105 | - $this->show_all = 'no'; |
|
106 | - $this->legend = '…'; |
|
107 | - $this->show = 'none'; // Don't show lists until something is chosen |
|
108 | - } |
|
109 | - $this->legend = '<span dir="auto">' . $this->legend . '</span>'; |
|
68 | + $this->surname = Filter::get('surname'); |
|
69 | + $this->alpha = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none |
|
70 | + $this->show_all = Filter::get('show_all', 'no|yes', 'no'); // All indis |
|
71 | + // Make sure selections are consistent. |
|
72 | + // i.e. can’t specify show_all and surname at the same time. |
|
73 | + if ($this->show_all === 'yes') { |
|
74 | + $this->alpha = ''; |
|
75 | + $this->surname = ''; |
|
76 | + $this->legend = I18N::translate('All'); |
|
77 | + $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
78 | + } elseif ($this->surname) { |
|
79 | + $this->alpha = QueryName::initialLetter($this->surname); // so we can highlight the initial letter |
|
80 | + $this->show_all = 'no'; |
|
81 | + if ($this->surname === '@N.N.') { |
|
82 | + $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
83 | + } else { |
|
84 | + $this->legend = Filter::escapeHtml($this->surname); |
|
85 | + // The surname parameter is a root/canonical form. |
|
86 | + // Display it as the actual surname |
|
87 | + foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) { |
|
88 | + $this->legend = implode('/', array_keys($details)); |
|
89 | + } |
|
90 | + } |
|
91 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
92 | + } elseif ($this->alpha === '@') { |
|
93 | + $this->show_all = 'no'; |
|
94 | + $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
95 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
96 | + } elseif ($this->alpha === ',') { |
|
97 | + $this->show_all = 'no'; |
|
98 | + $this->legend = I18N::translate('None'); |
|
99 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
100 | + } elseif ($this->alpha) { |
|
101 | + $this->show_all = 'no'; |
|
102 | + $this->legend = Filter::escapeHtml($this->alpha) . '…'; |
|
103 | + $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
104 | + } else { |
|
105 | + $this->show_all = 'no'; |
|
106 | + $this->legend = '…'; |
|
107 | + $this->show = 'none'; // Don't show lists until something is chosen |
|
108 | + } |
|
109 | + $this->legend = '<span dir="auto">' . $this->legend . '</span>'; |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * Indicates whether the list of surname should be displayed |
|
115 | - * @return bool |
|
116 | - */ |
|
117 | - protected function isShowingSurnames() { |
|
118 | - return $this->show === 'surn'; |
|
119 | - } |
|
113 | + /** |
|
114 | + * Indicates whether the list of surname should be displayed |
|
115 | + * @return bool |
|
116 | + */ |
|
117 | + protected function isShowingSurnames() { |
|
118 | + return $this->show === 'surn'; |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * Indicates whether the lineages should be displayed |
|
123 | - * @return bool |
|
124 | - */ |
|
125 | - protected function isShowingLineages() { |
|
126 | - return $this->show === 'lineage'; |
|
127 | - } |
|
121 | + /** |
|
122 | + * Indicates whether the lineages should be displayed |
|
123 | + * @return bool |
|
124 | + */ |
|
125 | + protected function isShowingLineages() { |
|
126 | + return $this->show === 'lineage'; |
|
127 | + } |
|
128 | 128 | |
129 | - /** |
|
130 | - * Get list of surnames, starting with the specified initial |
|
131 | - * @return array |
|
132 | - */ |
|
133 | - protected function getSurnamesList() { |
|
134 | - global $WT_TREE; |
|
129 | + /** |
|
130 | + * Get list of surnames, starting with the specified initial |
|
131 | + * @return array |
|
132 | + */ |
|
133 | + protected function getSurnamesList() { |
|
134 | + global $WT_TREE; |
|
135 | 135 | |
136 | - return QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false); |
|
137 | - } |
|
136 | + return QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false); |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Get the lineages for the controller's specified surname |
|
141 | - */ |
|
142 | - protected function getLineages() { |
|
139 | + /** |
|
140 | + * Get the lineages for the controller's specified surname |
|
141 | + */ |
|
142 | + protected function getLineages() { |
|
143 | 143 | global $WT_TREE; |
144 | 144 | |
145 | 145 | $builder = new LineageBuilder($this->surname, $WT_TREE); |
146 | 146 | $lineages = $builder->buildLineages(); |
147 | 147 | |
148 | - return $lineages; |
|
149 | - } |
|
148 | + return $lineages; |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * Pages |
|
153 | - */ |
|
151 | + /** |
|
152 | + * Pages |
|
153 | + */ |
|
154 | 154 | |
155 | - /** |
|
156 | - * Lineage@index |
|
157 | - */ |
|
158 | - public function index() { |
|
159 | - global $WT_TREE; |
|
155 | + /** |
|
156 | + * Lineage@index |
|
157 | + */ |
|
158 | + public function index() { |
|
159 | + global $WT_TREE; |
|
160 | 160 | |
161 | - $controller = new PageController(); |
|
162 | - $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); |
|
161 | + $controller = new PageController(); |
|
162 | + $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); |
|
163 | 163 | |
164 | - $view_bag = new ViewBag(); |
|
165 | - $view_bag->set('title', $controller->getPageTitle()); |
|
166 | - $view_bag->set('tree', $WT_TREE); |
|
167 | - $view_bag->set('alpha', $this->alpha); |
|
168 | - $view_bag->set('surname', $this->surname); |
|
169 | - $view_bag->set('legend', $this->legend); |
|
170 | - $view_bag->set('show_all', $this->show_all); |
|
171 | - if($this->isShowingSurnames()) { |
|
172 | - $view_bag->set('issurnames', true); |
|
173 | - $view_bag->set('surnameslist', $this->getSurnamesList()); |
|
174 | - } |
|
175 | - if($this->isShowingLineages()) { |
|
176 | - $view_bag->set('islineages', true); |
|
177 | - $view_bag->set('lineages', $this->getLineages()); |
|
164 | + $view_bag = new ViewBag(); |
|
165 | + $view_bag->set('title', $controller->getPageTitle()); |
|
166 | + $view_bag->set('tree', $WT_TREE); |
|
167 | + $view_bag->set('alpha', $this->alpha); |
|
168 | + $view_bag->set('surname', $this->surname); |
|
169 | + $view_bag->set('legend', $this->legend); |
|
170 | + $view_bag->set('show_all', $this->show_all); |
|
171 | + if($this->isShowingSurnames()) { |
|
172 | + $view_bag->set('issurnames', true); |
|
173 | + $view_bag->set('surnameslist', $this->getSurnamesList()); |
|
174 | + } |
|
175 | + if($this->isShowingLineages()) { |
|
176 | + $view_bag->set('islineages', true); |
|
177 | + $view_bag->set('lineages', $this->getLineages()); |
|
178 | 178 | |
179 | - if ($this->show_all==='no') { |
|
180 | - $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
|
181 | - } |
|
182 | - else { |
|
183 | - $view_bag->set('table_title', I18N::translate('All lineages')); |
|
184 | - } |
|
185 | - } |
|
179 | + if ($this->show_all==='no') { |
|
180 | + $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
|
181 | + } |
|
182 | + else { |
|
183 | + $view_bag->set('table_title', I18N::translate('All lineages')); |
|
184 | + } |
|
185 | + } |
|
186 | 186 | |
187 | - ViewFactory::make('Lineage', $this, $controller, $view_bag)->render(); |
|
188 | - } |
|
187 | + ViewFactory::make('Lineage', $this, $controller, $view_bag)->render(); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | |
191 | 191 |
@@ -23,17 +23,17 @@ |
||
23 | 23 | |
24 | 24 | Database::exec( |
25 | 25 | "CREATE TABLE IF NOT EXISTS `##maj_hooks` (". |
26 | - " majh_id INTEGER AUTO_INCREMENT NOT NULL,". |
|
27 | - " majh_hook_function VARCHAR(32) NOT NULL,". |
|
26 | + " majh_id INTEGER AUTO_INCREMENT NOT NULL,". |
|
27 | + " majh_hook_function VARCHAR(32) NOT NULL,". |
|
28 | 28 | " majh_hook_context VARCHAR(32) NOT NULL DEFAULT 'all',". |
29 | - " majh_module_name VARCHAR(32) NOT NULL,". |
|
30 | - " majh_module_priority INTEGER NOT NULL DEFAULT 99,". |
|
31 | - " majh_status ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',". |
|
32 | - " PRIMARY KEY (majh_id),". |
|
33 | - " UNIQUE KEY `##maj_hooks_uk` (majh_hook_function, majh_hook_context, majh_module_name),". |
|
34 | - " FOREIGN KEY `##module_name_fk1` (majh_module_name)". |
|
29 | + " majh_module_name VARCHAR(32) NOT NULL,". |
|
30 | + " majh_module_priority INTEGER NOT NULL DEFAULT 99,". |
|
31 | + " majh_status ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',". |
|
32 | + " PRIMARY KEY (majh_id),". |
|
33 | + " UNIQUE KEY `##maj_hooks_uk` (majh_hook_function, majh_hook_context, majh_module_name),". |
|
34 | + " FOREIGN KEY `##module_name_fk1` (majh_module_name)". |
|
35 | 35 | " REFERENCES `##module` (module_name) ON DELETE CASCADE ON UPDATE CASCADE". |
36 | - ") COLLATE utf8_unicode_ci ENGINE=InnoDB" |
|
36 | + ") COLLATE utf8_unicode_ci ENGINE=InnoDB" |
|
37 | 37 | ); |
38 | 38 | } |
39 | 39 | } |