1dd6b2bfcSGreg Roach<?php 21b860509SRico Sonntagdeclare(strict_types=1); 31b860509SRico Sonntag 41b860509SRico Sonntaguse Fisharebest\Webtrees\Auth; 51b860509SRico Sonntaguse Fisharebest\Webtrees\Date; 61b860509SRico Sonntaguse Fisharebest\Webtrees\GedcomTag; 71b860509SRico Sonntaguse Fisharebest\Webtrees\I18N; 81b860509SRico Sonntaguse Fisharebest\Webtrees\Individual; 987cca37cSGreg Roachuse Fisharebest\Webtrees\Module\ModuleChartInterface; 101b860509SRico Sonntaguse Fisharebest\Webtrees\Module\ModuleInterface; 111b860509SRico Sonntaguse Fisharebest\Webtrees\Module\RelationshipsChartModule; 121b860509SRico Sonntaguse Fisharebest\Webtrees\Services\ModuleService; 131b860509SRico Sonntaguse Fisharebest\Webtrees\View; 141b860509SRico Sonntaguse Ramsey\Uuid\Uuid; 151b860509SRico Sonntag 16dd6b2bfcSGreg Roach// lists requires a unique ID in case there are multiple lists per page 17dd6b2bfcSGreg Roach$table_id = 'table-indi-' . Uuid::uuid4()->toString(); 18dd6b2bfcSGreg Roach 191b860509SRico Sonntag$hundred_years_ago = new DateTime(); 201b860509SRico Sonntag$hundred_years_ago->modify('-100 years'); 211b860509SRico Sonntag$hundred_years_ago = new Date($hundred_years_ago->format('Y')); 221b860509SRico Sonntag 23dd6b2bfcSGreg Roach$unique_indis = []; // Don't double-count indis with multiple names. 2484b37362SGreg Roach 25b2a8cedfSGreg Roach$today_jd = unixtojd(); 26b2a8cedfSGreg Roach$show_estimated_dates = (bool) $tree->getPreference('SHOW_EST_LIST_DATES'); 27b2a8cedfSGreg Roach 281b860509SRico Sonntag$module = app(ModuleService::class) 2987cca37cSGreg Roach ->findByComponent(ModuleChartInterface::class, $tree, Auth::user()) 300b5fd0a6SGreg Roach ->first(static function (ModuleInterface $module) { 3190d97cc8SGreg Roach return $module instanceof RelationshipsChartModule; 3290d97cc8SGreg Roach }); 33dd6b2bfcSGreg Roach?> 34dd6b2bfcSGreg Roach 35dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 36dd6b2bfcSGreg Roach<script> 371b860509SRico Sonntag 38dd6b2bfcSGreg Roach$("#<?= e($table_id) ?>").dataTable({ 39dd6b2bfcSGreg Roach dom: '<"H"<"filtersH_<?= e($table_id) ?>">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_<?= e($table_id) ?>">>', 40dd6b2bfcSGreg Roach autoWidth: false, 41dd6b2bfcSGreg Roach processing: true, 42dd6b2bfcSGreg Roach retrieve: true, 43dd6b2bfcSGreg Roach columns: [ 44dd6b2bfcSGreg Roach /* Given names */ { type: "text" }, 45dd6b2bfcSGreg Roach /* Surnames */ { type: "text" }, 46dd6b2bfcSGreg Roach /* SOSA numnber */ { type: "num", visible: <?= json_encode($sosa) ?> }, 47dd6b2bfcSGreg Roach /* Birth date */ { type: "num" }, 48dd6b2bfcSGreg Roach /* Anniversary */ { type: "num" }, 49dd6b2bfcSGreg Roach /* Birthplace */ { type: "text" }, 50dd6b2bfcSGreg Roach /* Children */ { type: "num" }, 51dd6b2bfcSGreg Roach /* Deate date */ { type: "num" }, 52dd6b2bfcSGreg Roach /* Anniversary */ { type: "num" }, 53dd6b2bfcSGreg Roach /* Age */ { type: "num" }, 54dd6b2bfcSGreg Roach /* Death place */ { type: "text" }, 55dd6b2bfcSGreg Roach /* Last change */ { visible: <?= json_encode($tree->getPreference('SHOW_LAST_CHANGE')) ?> }, 56dd6b2bfcSGreg Roach /* Filter sex */ { sortable: false }, 57dd6b2bfcSGreg Roach /* Filter birth */ { sortable: false }, 58dd6b2bfcSGreg Roach /* Filter death */ { sortable: false }, 59dd6b2bfcSGreg Roach /* Filter tree */ { sortable: false } 60dd6b2bfcSGreg Roach ], 61b2c011d7SGreg Roach sorting: <?= json_encode($sosa ? [[4, 'asc']] : [[1, 'asc']]) ?> 62dd6b2bfcSGreg Roach}); 63dd6b2bfcSGreg Roach 64dd6b2bfcSGreg Roach$("#<?= e($table_id) ?>") 65dd6b2bfcSGreg Roach /* Hide/show parents */ 66dd6b2bfcSGreg Roach .on("click", ".btn-toggle-parents", function() { 67dd6b2bfcSGreg Roach $(this).toggleClass("ui-state-active"); 68dd6b2bfcSGreg Roach $(".parents", $(this).closest("table").DataTable().rows().nodes()).slideToggle(); 69dd6b2bfcSGreg Roach }) 70dd6b2bfcSGreg Roach /* Hide/show statistics */ 71dd6b2bfcSGreg Roach .on("click", ".btn-toggle-statistics", function() { 72dd6b2bfcSGreg Roach $(this).toggleClass("ui-state-active"); 731b860509SRico Sonntag $("#individual-charts-<?= e($table_id) ?>").slideToggle({ 741b860509SRico Sonntag complete: function () { 751b860509SRico Sonntag // Trigger resize to redraw the chart 761b860509SRico Sonntag $('div[id^="google-chart-"]').resize(); 771b860509SRico Sonntag } 781b860509SRico Sonntag }); 79dd6b2bfcSGreg Roach }) 80dd6b2bfcSGreg Roach /* Filter buttons in table header */ 81dd6b2bfcSGreg Roach .on("click", "button[data-filter-column]", function() { 82dd6b2bfcSGreg Roach var btn = $(this); 83dd6b2bfcSGreg Roach // De-activate the other buttons in this button group 84dd6b2bfcSGreg Roach btn.siblings().removeClass("active"); 85dd6b2bfcSGreg Roach // Apply (or clear) this filter 86dd6b2bfcSGreg Roach var col = $("#<?= e($table_id) ?>").DataTable().column(btn.data("filter-column")); 87dd6b2bfcSGreg Roach if (btn.hasClass("active")) { 88dd6b2bfcSGreg Roach col.search("").draw(); 89dd6b2bfcSGreg Roach } else { 90dd6b2bfcSGreg Roach col.search(btn.data("filter-value")).draw(); 91dd6b2bfcSGreg Roach } 92dd6b2bfcSGreg Roach }); 931b860509SRico Sonntag 94dd6b2bfcSGreg Roach</script> 95dd6b2bfcSGreg Roach<?php View::endpush() ?> 96dd6b2bfcSGreg Roach 97dd6b2bfcSGreg Roach<?php 98dd6b2bfcSGreg Roach$max_age = (int) $tree->getPreference('MAX_ALIVE_AGE'); 99dd6b2bfcSGreg Roach 100dd6b2bfcSGreg Roach// Inititialise chart data 101dd6b2bfcSGreg Roach$deat_by_age = []; 102dd6b2bfcSGreg Roachfor ($age = 0; $age <= $max_age; $age++) { 1031b860509SRico Sonntag $deat_by_age[$age]['M'] = 0; 1041b860509SRico Sonntag $deat_by_age[$age]['F'] = 0; 1051b860509SRico Sonntag $deat_by_age[$age]['U'] = 0; 106dd6b2bfcSGreg Roach} 107dd6b2bfcSGreg Roach$birt_by_decade = []; 108dd6b2bfcSGreg Roach$deat_by_decade = []; 1091b860509SRico Sonntagfor ($year = 1400; $year < 2050; $year += 10) { 1101b860509SRico Sonntag $birt_by_decade[$year]['M'] = 0; 1111b860509SRico Sonntag $birt_by_decade[$year]['F'] = 0; 1121b860509SRico Sonntag $birt_by_decade[$year]['U'] = 0; 1131b860509SRico Sonntag $deat_by_decade[$year]['M'] = 0; 1141b860509SRico Sonntag $deat_by_decade[$year]['F'] = 0; 1151b860509SRico Sonntag $deat_by_decade[$year]['U'] = 0; 116dd6b2bfcSGreg Roach} 1171b860509SRico Sonntag 1181b860509SRico Sonntag$birthData = [ 1191b860509SRico Sonntag [ 1201b860509SRico Sonntag [ 1211b860509SRico Sonntag 'label' => I18N::translate('Century'), 1221b860509SRico Sonntag 'type' => 'date', 1231b860509SRico Sonntag ], [ 1241b860509SRico Sonntag 'label' => I18N::translate('Males'), 1251b860509SRico Sonntag 'type' => 'number', 1261b860509SRico Sonntag ], [ 1271b860509SRico Sonntag 'label' => I18N::translate('Females'), 1281b860509SRico Sonntag 'type' => 'number', 1291b860509SRico Sonntag ], 1301b860509SRico Sonntag ] 1311b860509SRico Sonntag]; 1321b860509SRico Sonntag 1331b860509SRico Sonntag$deathData = [ 1341b860509SRico Sonntag [ 1351b860509SRico Sonntag [ 1361b860509SRico Sonntag 'label' => I18N::translate('Century'), 1371b860509SRico Sonntag 'type' => 'date', 1381b860509SRico Sonntag ], [ 1391b860509SRico Sonntag 'label' => I18N::translate('Males'), 1401b860509SRico Sonntag 'type' => 'number', 1411b860509SRico Sonntag ], [ 1421b860509SRico Sonntag 'label' => I18N::translate('Females'), 1431b860509SRico Sonntag 'type' => 'number', 1441b860509SRico Sonntag ], 1451b860509SRico Sonntag ] 1461b860509SRico Sonntag]; 1471b860509SRico Sonntag 1481b860509SRico Sonntag$deathAgeData = [ 1491b860509SRico Sonntag [ 1501b860509SRico Sonntag I18N::translate('Age'), 1511b860509SRico Sonntag I18N::translate('Males'), 1521b860509SRico Sonntag I18N::translate('Females'), 1531b860509SRico Sonntag I18N::translate('Average age'), 1541b860509SRico Sonntag ] 1551b860509SRico Sonntag]; 1561b860509SRico Sonntag 157dd6b2bfcSGreg Roach?> 158dd6b2bfcSGreg Roach 159dd6b2bfcSGreg Roach<div class="indi-list"> 1605529b85eSGreg Roach <table id="<?= e($table_id) ?>" class="table-bordered" 161b6c326d8SGreg Roach <?= view('lists/datatables-attributes') ?> 162b6c326d8SGreg Roach > 163dd6b2bfcSGreg Roach <thead> 164dd6b2bfcSGreg Roach <tr> 165dd6b2bfcSGreg Roach <th colspan="16"> 166dd6b2bfcSGreg Roach <div class="btn-toolbar d-flex justify-content-between mb-2" role="toolbar"> 167dd6b2bfcSGreg Roach <div class="btn-group" data-toggle="buttons"> 168dd6b2bfcSGreg Roach <button 169dd6b2bfcSGreg Roach class="btn btn-secondary" 170dd6b2bfcSGreg Roach data-filter-column="12" 171dd6b2bfcSGreg Roach data-filter-value="M" 172dd6b2bfcSGreg Roach title="<?= I18N::translate('Show only males.') ?>" 173dd6b2bfcSGreg Roach > 174dd6b2bfcSGreg Roach <?= Individual::sexImage('M', 'large') ?> 175dd6b2bfcSGreg Roach </button> 176dd6b2bfcSGreg Roach <button 177dd6b2bfcSGreg Roach class="btn btn-secondary" 178dd6b2bfcSGreg Roach data-filter-column="12" 179dd6b2bfcSGreg Roach data-filter-value="F" 180dd6b2bfcSGreg Roach title="<?= I18N::translate('Show only females.') ?>" 181dd6b2bfcSGreg Roach > 182dd6b2bfcSGreg Roach <?= Individual::sexImage('F', 'large') ?> 183dd6b2bfcSGreg Roach </button> 184dd6b2bfcSGreg Roach <button 185dd6b2bfcSGreg Roach class="btn btn-secondary" 186dd6b2bfcSGreg Roach data-filter-column="12" 187dd6b2bfcSGreg Roach data-filter-value="U" 188dd6b2bfcSGreg Roach title="<?= I18N::translate('Show only individuals for whom the gender is not known.') ?>" 189dd6b2bfcSGreg Roach > 190dd6b2bfcSGreg Roach <?= Individual::sexImage('U', 'large') ?> 191dd6b2bfcSGreg Roach </button> 192dd6b2bfcSGreg Roach </div> 193dd6b2bfcSGreg Roach <div class="btn-group" data-toggle="buttons"> 194dd6b2bfcSGreg Roach <button 195dd6b2bfcSGreg Roach class="btn btn-secondary" 196dd6b2bfcSGreg Roach data-filter-column="14" 197dd6b2bfcSGreg Roach data-filter-value="N" 198dd6b2bfcSGreg Roach title="<?= I18N::translate('Show individuals who are alive or couples where both partners are alive.') ?>" 199dd6b2bfcSGreg Roach > 200dd6b2bfcSGreg Roach <?= I18N::translate('Alive') ?> 201dd6b2bfcSGreg Roach </button> 202dd6b2bfcSGreg Roach <button 203dd6b2bfcSGreg Roach class="btn btn-secondary" 204dd6b2bfcSGreg Roach data-filter-column="14" 205dd6b2bfcSGreg Roach data-filter-value="Y" 206dd6b2bfcSGreg Roach title="<?= I18N::translate('Show individuals who are dead or couples where both partners are dead.') ?>" 207dd6b2bfcSGreg Roach > 208dd6b2bfcSGreg Roach <?= I18N::translate('Dead') ?> 209dd6b2bfcSGreg Roach </button> 210dd6b2bfcSGreg Roach <button 211dd6b2bfcSGreg Roach class="btn btn-secondary" 212dd6b2bfcSGreg Roach data-filter-column="14" 213dd6b2bfcSGreg Roach data-filter-value="YES" 214dd6b2bfcSGreg Roach title="<?= I18N::translate('Show individuals who died more than 100 years ago.') ?>" 215dd6b2bfcSGreg Roach > 216dd6b2bfcSGreg Roach <?= I18N::translate('Death') ?>>100 217dd6b2bfcSGreg Roach </button> 218dd6b2bfcSGreg Roach <button 219dd6b2bfcSGreg Roach class="btn btn-secondary" 220dd6b2bfcSGreg Roach data-filter-column="14" 221dd6b2bfcSGreg Roach data-filter-value="Y100" 222dd6b2bfcSGreg Roach title="<?= I18N::translate('Show individuals who died within the last 100 years.') ?>" 223dd6b2bfcSGreg Roach > 224392561bbSGreg Roach <?= I18N::translate('Death') ?><=100 225dd6b2bfcSGreg Roach </button> 226dd6b2bfcSGreg Roach </div> 227dd6b2bfcSGreg Roach <div class="btn-group" data-toggle="buttons"> 228dd6b2bfcSGreg Roach <button 229dd6b2bfcSGreg Roach class="btn btn-secondary" 230dd6b2bfcSGreg Roach data-filter-column="13" 231dd6b2bfcSGreg Roach data-filter-value="YES" 232dd6b2bfcSGreg Roach title="<?= I18N::translate('Show individuals born more than 100 years ago.') ?>" 233dd6b2bfcSGreg Roach > 234dd6b2bfcSGreg Roach <?= I18N::translate('Birth') ?>>100 235dd6b2bfcSGreg Roach </button> 236dd6b2bfcSGreg Roach <button 237dd6b2bfcSGreg Roach class="btn btn-secondary" 238dd6b2bfcSGreg Roach data-filter-column="13" 239dd6b2bfcSGreg Roach data-filter-value="Y100" 240dd6b2bfcSGreg Roach title="<?= I18N::translate('Show individuals born within the last 100 years.') ?>" 241dd6b2bfcSGreg Roach > 242dd6b2bfcSGreg Roach <?= I18N::translate('Birth') ?><=100 243dd6b2bfcSGreg Roach </button> 244dd6b2bfcSGreg Roach </div> 245dd6b2bfcSGreg Roach <div class="btn-group" data-toggle="buttons"> 246dd6b2bfcSGreg Roach <button 247dd6b2bfcSGreg Roach class="btn btn-secondary" 248dd6b2bfcSGreg Roach data-filter-column="15" 249dd6b2bfcSGreg Roach data-filter-value="R" 250dd6b2bfcSGreg Roach title="<?= I18N::translate('Show “roots” couples or individuals. These individuals may also be called “patriarchs”. They are individuals who have no parents recorded in the database.') ?>" 251dd6b2bfcSGreg Roach > 252dd6b2bfcSGreg Roach <?= I18N::translate('Roots') ?> 253dd6b2bfcSGreg Roach </button> 254dd6b2bfcSGreg Roach <button 255dd6b2bfcSGreg Roach class="btn btn-secondary" 256dd6b2bfcSGreg Roach data-filter-column="15" 257dd6b2bfcSGreg Roach data-filter-value="L" 258dd6b2bfcSGreg Roach title="<?= I18N::translate('Show “leaves” couples or individuals. These are individuals who are alive but have no children recorded in the database.') ?>" 259dd6b2bfcSGreg Roach > 260dd6b2bfcSGreg Roach <?= I18N::translate('Leaves') ?> 261dd6b2bfcSGreg Roach </button> 262dd6b2bfcSGreg Roach </div> 263dd6b2bfcSGreg Roach </div> 264dd6b2bfcSGreg Roach </th> 265dd6b2bfcSGreg Roach </tr> 266dd6b2bfcSGreg Roach <tr> 267dd6b2bfcSGreg Roach <th><?= I18N::translate('Given names') ?></th> 268dd6b2bfcSGreg Roach <th><?= I18N::translate('Surname') ?></th> 269dd6b2bfcSGreg Roach <th><?= /* I18N: Abbreviation for “Sosa-Stradonitz number”. This is an individual’s surname, so may need transliterating into non-latin alphabets. */ 270dd6b2bfcSGreg Roach I18N::translate('Sosa') ?></th> 271dd6b2bfcSGreg Roach <th><?= I18N::translate('Birth') ?></th> 272dd6b2bfcSGreg Roach <th> 273e39fd5c6SGreg Roach <span title="<?= I18N::translate('Anniversary') ?>"> 274e39fd5c6SGreg Roach <?= view('icons/anniversary') ?> 275e39fd5c6SGreg Roach </span> 276dd6b2bfcSGreg Roach </th> 277dd6b2bfcSGreg Roach <th><?= I18N::translate('Place') ?></th> 278dd6b2bfcSGreg Roach <th> 279dd6b2bfcSGreg Roach <i class="icon-children" title="<?= I18N::translate('Children') ?>"></i> 280dd6b2bfcSGreg Roach </th> 281dd6b2bfcSGreg Roach <th><?= I18N::translate('Death') ?></th> 282dd6b2bfcSGreg Roach <th> 283e39fd5c6SGreg Roach <span title="<?= I18N::translate('Anniversary') ?>"> 284e39fd5c6SGreg Roach <?= view('icons/anniversary') ?> 285e39fd5c6SGreg Roach </span> 286dd6b2bfcSGreg Roach </th> 287dd6b2bfcSGreg Roach <th><?= I18N::translate('Age') ?></th> 288dd6b2bfcSGreg Roach <th><?= I18N::translate('Place') ?></th> 289dd6b2bfcSGreg Roach <th><?= I18N::translate('Last change') ?></th> 290dd6b2bfcSGreg Roach <th hidden></th> 291dd6b2bfcSGreg Roach <th hidden></th> 292dd6b2bfcSGreg Roach <th hidden></th> 293dd6b2bfcSGreg Roach <th hidden></th> 294dd6b2bfcSGreg Roach </tr> 295dd6b2bfcSGreg Roach </thead> 296dd6b2bfcSGreg Roach <tfoot> 297dd6b2bfcSGreg Roach <tr> 298dd6b2bfcSGreg Roach <th colspan="16"> 299dd6b2bfcSGreg Roach <div class="btn-toolbar"> 300dd6b2bfcSGreg Roach <div class="btn-group"> 301dd6b2bfcSGreg Roach <button class="ui-state-default btn-toggle-parents"> 302dd6b2bfcSGreg Roach <?= I18N::translate('Show parents') ?> 303dd6b2bfcSGreg Roach </button> 304dd6b2bfcSGreg Roach <button class="ui-state-default btn-toggle-statistics"> 305dd6b2bfcSGreg Roach <?= I18N::translate('Show statistics charts') ?> 306dd6b2bfcSGreg Roach </button> 307dd6b2bfcSGreg Roach </div> 308dd6b2bfcSGreg Roach </div> 309dd6b2bfcSGreg Roach </th> 310dd6b2bfcSGreg Roach </tr> 311dd6b2bfcSGreg Roach </tfoot> 312dd6b2bfcSGreg Roach 313dd6b2bfcSGreg Roach <tbody> 314dd6b2bfcSGreg Roach <?php foreach ($individuals as $key => $individual) : ?> 31517dd427eSGreg Roach <tr class="<?= $individual->isPendingDeletion() ? 'wt-old' : ($individual->isPendingAddition() ? 'wt-new' : '') ?>"> 31639ca88baSGreg Roach <td colspan="2" data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', implode(',', array_reverse(explode(',', $individual->sortName()))))) ?>"> 317dd6b2bfcSGreg Roach <?php foreach ($individual->getAllNames() as $num => $name) : ?> 318dd6b2bfcSGreg Roach <a title="<?= $name['type'] === 'NAME' ? '' : GedcomTag::getLabel($name['type'], $individual) ?>" href="<?= e($individual->url()) ?>" class="<?= $num === $individual->getPrimaryName() ? 'name2' : '' ?>"> 319dd6b2bfcSGreg Roach <?= $name['full'] ?> 320dd6b2bfcSGreg Roach </a> 321dd6b2bfcSGreg Roach <?php if ($num === $individual->getPrimaryName()) : ?> 322dd6b2bfcSGreg Roach <?= $individual->getSexImage() ?> 323dd6b2bfcSGreg Roach <?php endif ?> 324dd6b2bfcSGreg Roach <br> 325dd6b2bfcSGreg Roach <?php endforeach ?> 326dd6b2bfcSGreg Roach <?= $individual->getPrimaryParentsNames('parents details1', 'none') ?> 327dd6b2bfcSGreg Roach </td> 328dd6b2bfcSGreg Roach 32939ca88baSGreg Roach <td hidden data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', $individual->sortName())) ?>"></td> 330dd6b2bfcSGreg Roach 331242a7862SGreg Roach <td class="text-center" data-sort="<?= $key ?>"> 332dd6b2bfcSGreg Roach <?php if ($sosa) : ?> 33384b37362SGreg Roach <?php if ($module instanceof RelationshipsChartModule) : ?> 33484b37362SGreg Roach <a href="<?= e($module->chartUrl($individuals[1], ['xref2' => $individual->xref()])) ?>" rel="nofollow" title="<?= I18N::translate('Relationships') ?>" rel="nofollow"> 335dd6b2bfcSGreg Roach <?= I18N::number($key) ?> 336dd6b2bfcSGreg Roach </a> 33784b37362SGreg Roach <?php else : ?> 33884b37362SGreg Roach <?= I18N::number($key) ?> 33984b37362SGreg Roach <?php endif ?> 340dd6b2bfcSGreg Roach <?php endif ?> 341dd6b2bfcSGreg Roach </td> 342dd6b2bfcSGreg Roach 343dd6b2bfcSGreg Roach <!-- Birth date --> 344dd6b2bfcSGreg Roach <td data-sort="<?= $individual->getEstimatedBirthDate()->julianDay() ?>"> 345dd6b2bfcSGreg Roach <?php $birth_dates = $individual->getAllBirthDates(); ?> 346dd6b2bfcSGreg Roach 347dd6b2bfcSGreg Roach <?php foreach ($birth_dates as $n => $birth_date) : ?> 348dd6b2bfcSGreg Roach <?= $birth_date->display(true) ?> 349dd6b2bfcSGreg Roach <br> 350dd6b2bfcSGreg Roach <?php endforeach ?> 35114147f6fSGreg Roach 352b2a8cedfSGreg Roach <?php if (empty($birth_dates) && $show_estimated_dates): ?> 35314147f6fSGreg Roach <?= $individual->getEstimatedBirthDate()->display(true) ?> 35414147f6fSGreg Roach <?php endif ?> 355dd6b2bfcSGreg Roach </td> 356dd6b2bfcSGreg Roach 357dd6b2bfcSGreg Roach <!-- Birth anniversary --> 358242a7862SGreg Roach <td class="text-center" data-sort="<?= -$individual->getEstimatedBirthDate()->julianDay() ?>"> 359c0935879SGreg Roach <?php if (isset($birth_dates[0]) && $birth_dates[0]->gregorianYear() >= 1550 && $birth_dates[0]->gregorianYear() < 2030 && !isset($unique_indis[$individual->xref()])) : ?> 3601b860509SRico Sonntag <?php 3611b860509SRico Sonntag ++$birt_by_decade[(int) ($birth_dates[0]->gregorianYear() / 10) * 10][$individual->sex()]; 3621b860509SRico Sonntag ?> 3631b860509SRico Sonntag <?= Date::getAge($birth_dates[0]) ?> 364dd6b2bfcSGreg Roach <?php endif ?> 365dd6b2bfcSGreg Roach </td> 366dd6b2bfcSGreg Roach 367dd6b2bfcSGreg Roach <!-- Birth place --> 368dd6b2bfcSGreg Roach <td> 369dd6b2bfcSGreg Roach <?php foreach ($individual->getAllBirthPlaces() as $n => $birth_place) : ?> 370392561bbSGreg Roach <?= $birth_place->shortName(true) ?> 371dd6b2bfcSGreg Roach <br> 372dd6b2bfcSGreg Roach <?php endforeach ?> 373dd6b2bfcSGreg Roach </td> 374dd6b2bfcSGreg Roach 375dd6b2bfcSGreg Roach <!-- Number of children --> 37639ca88baSGreg Roach <td class="text-center" data-sort="<?= $individual->numberOfChildren() ?>"> 37739ca88baSGreg Roach <?= I18N::number($individual->numberOfChildren()) ?> 378dd6b2bfcSGreg Roach </td> 379dd6b2bfcSGreg Roach 380dd6b2bfcSGreg Roach <!-- Death date --> 381dd6b2bfcSGreg Roach <?php $death_dates = $individual->getAllDeathDates() ?> 382dd6b2bfcSGreg Roach <td data-sort="<?= $individual->getEstimatedDeathDate()->julianDay() ?>"> 383dd6b2bfcSGreg Roach <?php foreach ($death_dates as $num => $death_date) : ?> 384dd6b2bfcSGreg Roach <?= $death_date->display(true) ?> 385dd6b2bfcSGreg Roach <br> 386dd6b2bfcSGreg Roach <?php endforeach ?> 38714147f6fSGreg Roach 388b2a8cedfSGreg Roach <?php if (empty($death_dates) && $show_estimated_dates && $individual->getEstimatedDeathDate()->minimumDate()->minimumJulianDay() < $today_jd): ?> 38914147f6fSGreg Roach <?= $individual->getEstimatedDeathDate()->display(true) ?> 39014147f6fSGreg Roach <?php endif ?> 391dd6b2bfcSGreg Roach </td> 392dd6b2bfcSGreg Roach 393dd6b2bfcSGreg Roach <!-- Death anniversary --> 394242a7862SGreg Roach <td class="text-center" data-sort="<?= -$individual->getEstimatedDeathDate()->julianDay() ?>"> 395c0935879SGreg Roach <?php if (isset($death_dates[0]) && $death_dates[0]->gregorianYear() >= 1550 && $death_dates[0]->gregorianYear() < 2030 && !isset($unique_indis[$individual->xref()])) : ?> 3961b860509SRico Sonntag <?php 3971b860509SRico Sonntag ++$deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10][$individual->sex()]; 3981b860509SRico Sonntag ?> 3991b860509SRico Sonntag <?= Date::getAge($death_dates[0]) ?> 400dd6b2bfcSGreg Roach <?php endif ?> 401dd6b2bfcSGreg Roach </td> 402dd6b2bfcSGreg Roach 403dd6b2bfcSGreg Roach <!-- Age at death --> 404dd6b2bfcSGreg Roach <?php if (isset($birth_dates[0]) && isset($death_dates[0])) : ?> 405*4e96702fSGreg Roach <?php $age_at_death_years = (int) Date::getAgeYears($birth_dates[0], $death_dates[0]); ?> 406dd6b2bfcSGreg Roach <?php $age_at_death_sort = Date::getAge($birth_dates[0], $death_dates[0]); ?> 407*4e96702fSGreg Roach <?php $age_at_death_display = I18N::number($age_at_death_years); ?> 408*4e96702fSGreg Roach <?php if (!isset($unique_indis[$individual->xref()]) && $age_at_death_years >= 0 && $age_at_death_years <= $max_age) : ?> 4091b860509SRico Sonntag <?php 410*4e96702fSGreg Roach ++$deat_by_age[$age_at_death_years][$individual->sex()]; 4111b860509SRico Sonntag ?> 412dd6b2bfcSGreg Roach <?php endif ?> 413dd6b2bfcSGreg Roach <?php else : ?> 414*4e96702fSGreg Roach <?php $age_at_death_display = ''; ?> 415dd6b2bfcSGreg Roach <?php $age_at_death_sort = PHP_INT_MAX; ?> 416dd6b2bfcSGreg Roach <?php endif ?> 417242a7862SGreg Roach <td class="text-center" data-sort="<?= e($age_at_death_sort) ?>"> 418*4e96702fSGreg Roach <?= e($age_at_death_display) ?> 419dd6b2bfcSGreg Roach </td> 420dd6b2bfcSGreg Roach 421dd6b2bfcSGreg Roach <!-- Death place --> 422dd6b2bfcSGreg Roach <td> 423dd6b2bfcSGreg Roach <?php foreach ($individual->getAllDeathPlaces() as $n => $death_place) : ?> 424392561bbSGreg Roach <?= $death_place->shortName(true) ?> 425dd6b2bfcSGreg Roach <br> 426dd6b2bfcSGreg Roach <?php endforeach ?> 427dd6b2bfcSGreg Roach </td> 428dd6b2bfcSGreg Roach 429dd6b2bfcSGreg Roach <!-- Last change --> 4304459dc9aSGreg Roach <td data-sort="<?= $individual->lastChangeTimestamp()->unix() ?>"> 4314459dc9aSGreg Roach <?= view('components/datetime', ['timestamp' => $individual->lastChangeTimestamp()]) ?> 432dd6b2bfcSGreg Roach </td> 433dd6b2bfcSGreg Roach 434dd6b2bfcSGreg Roach <!-- Filter by sex --> 435dd6b2bfcSGreg Roach <td hidden> 43639ca88baSGreg Roach <?= $individual->sex() ?> 437dd6b2bfcSGreg Roach </td> 438dd6b2bfcSGreg Roach 439dd6b2bfcSGreg Roach <!-- Filter by birth date --> 440dd6b2bfcSGreg Roach <td hidden> 441dd6b2bfcSGreg Roach <?php if (!$individual->canShow() || Date::compare($individual->getEstimatedBirthDate(), $hundred_years_ago) > 0) : ?> 442dd6b2bfcSGreg Roach Y100 443dd6b2bfcSGreg Roach <?php else : ?> 444dd6b2bfcSGreg Roach YES 445dd6b2bfcSGreg Roach <?php endif ?> 446dd6b2bfcSGreg Roach </td> 447dd6b2bfcSGreg Roach 448dd6b2bfcSGreg Roach <!-- Filter by death date --> 449dd6b2bfcSGreg Roach <td hidden> 450dd6b2bfcSGreg Roach <?php if (isset($death_dates[0]) && Date::compare($death_dates[0], $hundred_years_ago) > 0) : ?> 451dd6b2bfcSGreg Roach Y100 452dd6b2bfcSGreg Roach <?php elseif ($individual->isDead()) : ?> 453dd6b2bfcSGreg Roach YES 454dd6b2bfcSGreg Roach <?php else : ?> 455dd6b2bfcSGreg Roach N 456dd6b2bfcSGreg Roach <?php endif ?> 457dd6b2bfcSGreg Roach </td> 458dd6b2bfcSGreg Roach 459dd6b2bfcSGreg Roach <!-- Filter by roots/leaves --> 460dd6b2bfcSGreg Roach <td hidden> 46108662657SGreg Roach <?php if ($individual->childFamilies()->isEmpty()) : ?> 462dd6b2bfcSGreg Roach R 46339ca88baSGreg Roach <?php elseif (!$individual->isDead() && $individual->numberOfChildren() < 1) : ?> 464dd6b2bfcSGreg Roach L 465dd6b2bfcSGreg Roach <?php endif ?> 466dd6b2bfcSGreg Roach </td> 467dd6b2bfcSGreg Roach </tr> 468dd6b2bfcSGreg Roach 469c0935879SGreg Roach <?php $unique_indis[$individual->xref()] = true ?> 470dd6b2bfcSGreg Roach <?php endforeach ?> 471dd6b2bfcSGreg Roach </tbody> 472dd6b2bfcSGreg Roach </table> 4731b860509SRico Sonntag</div> 474dd6b2bfcSGreg Roach 4751b860509SRico Sonntag<div id="individual-charts-<?= e($table_id) ?>" style="display: none;"> 4761b860509SRico Sonntag <div class="mb-3"> 4771b860509SRico Sonntag <div class="card-deck"> 4781b860509SRico Sonntag <div class="col-lg-12 col-md-12 mb-3"> 4791b860509SRico Sonntag <div class="card m-0"> 4801b860509SRico Sonntag <div class="card-header"> 4811b860509SRico Sonntag <?= I18N::translate('Decade of birth') ?> 4821b860509SRico Sonntag </div> 4831b860509SRico Sonntag <div class="card-body"> 4841b860509SRico Sonntag <?php 4851b860509SRico Sonntag foreach ($birt_by_decade as $century => $values) { 4861b860509SRico Sonntag if (($values['M'] + $values['F']) > 0) { 4871b860509SRico Sonntag $birthData[] = [ 4881b860509SRico Sonntag [ 4891b860509SRico Sonntag 'v' => 'Date(' . $century . ', 0, 1)', 4901b860509SRico Sonntag 'f' => $century, 4911b860509SRico Sonntag ], 4921b860509SRico Sonntag $values['M'], 4931b860509SRico Sonntag $values['F'], 4941b860509SRico Sonntag ]; 4951b860509SRico Sonntag } 4961b860509SRico Sonntag } 4971b860509SRico Sonntag ?> 4981b860509SRico Sonntag <?= view('lists/chart-by-decade', ['data' => $birthData, 'title' => I18N::translate('Decade of birth')]) ?> 4991b860509SRico Sonntag </div> 5001b860509SRico Sonntag </div> 5011b860509SRico Sonntag </div> 5021b860509SRico Sonntag </div> 5031b860509SRico Sonntag <div class="card-deck"> 5041b860509SRico Sonntag <div class="col-lg-12 col-md-12 mb-3"> 5051b860509SRico Sonntag <div class="card m-0"> 5061b860509SRico Sonntag <div class="card-header"> 5071b860509SRico Sonntag <?= I18N::translate('Decade of death') ?> 5081b860509SRico Sonntag </div> 5091b860509SRico Sonntag <div class="card-body"> 5101b860509SRico Sonntag <?php 5111b860509SRico Sonntag foreach ($deat_by_decade as $century => $values) { 5121b860509SRico Sonntag if (($values['M'] + $values['F']) > 0) { 5131b860509SRico Sonntag $deathData[] = [ 5141b860509SRico Sonntag [ 5151b860509SRico Sonntag 'v' => 'Date(' . $century . ', 0, 1)', 5161b860509SRico Sonntag 'f' => $century, 5171b860509SRico Sonntag ], 5181b860509SRico Sonntag $values['M'], 5191b860509SRico Sonntag $values['F'], 5201b860509SRico Sonntag ]; 5211b860509SRico Sonntag } 5221b860509SRico Sonntag } 5231b860509SRico Sonntag ?> 5241b860509SRico Sonntag <?= view('lists/chart-by-decade', ['data' => $deathData, 'title' => I18N::translate('Decade of death')]) ?> 5251b860509SRico Sonntag </div> 5261b860509SRico Sonntag </div> 5271b860509SRico Sonntag </div> 5281b860509SRico Sonntag </div> 5291b860509SRico Sonntag <div class="card-deck"> 5301b860509SRico Sonntag <div class="col-lg-12 col-md-12 mb-3"> 5311b860509SRico Sonntag <div class="card m-0"> 5321b860509SRico Sonntag <div class="card-header"> 5331b860509SRico Sonntag <?= I18N::translate('Age related to death year') ?> 5341b860509SRico Sonntag </div> 5351b860509SRico Sonntag <div class="card-body"> 5361b860509SRico Sonntag <?php 5371b860509SRico Sonntag $totalAge = 0; 5381b860509SRico Sonntag $totalSum = 0; 5391b860509SRico Sonntag $max = 0; 5401b860509SRico Sonntag 5411b860509SRico Sonntag foreach ($deat_by_age as $age => $values) { 5421b860509SRico Sonntag if (($values['M'] + $values['F']) > 0) { 5431b860509SRico Sonntag if (($values['M'] + $values['F']) > $max) { 5441b860509SRico Sonntag $max = $values['M'] + $values['F']; 5451b860509SRico Sonntag } 5461b860509SRico Sonntag 5471b860509SRico Sonntag $totalAge += $age * ($values['M'] + $values['F']); 5481b860509SRico Sonntag $totalSum += $values['M'] + $values['F']; 5491b860509SRico Sonntag 5501b860509SRico Sonntag $deathAgeData[] = [ 5511b860509SRico Sonntag $age, 5521b860509SRico Sonntag $values['M'], 5531b860509SRico Sonntag $values['F'], 5541b860509SRico Sonntag null, 5551b860509SRico Sonntag ]; 5561b860509SRico Sonntag } 5571b860509SRico Sonntag } 5581b860509SRico Sonntag 5591b860509SRico Sonntag if ($totalSum > 0) { 5601b860509SRico Sonntag $deathAgeData[] = [ 5611b860509SRico Sonntag round($totalAge / $totalSum, 1), 5621b860509SRico Sonntag null, 5631b860509SRico Sonntag null, 5641b860509SRico Sonntag 0, 5651b860509SRico Sonntag ]; 5661b860509SRico Sonntag 5671b860509SRico Sonntag $deathAgeData[] = [ 5681b860509SRico Sonntag round($totalAge / $totalSum, 1), 5691b860509SRico Sonntag null, 5701b860509SRico Sonntag null, 5711b860509SRico Sonntag $max, 5721b860509SRico Sonntag ]; 5731b860509SRico Sonntag } 5741b860509SRico Sonntag ?> 5751b860509SRico Sonntag <?= view('lists/chart-by-age', ['data' => $deathAgeData, 'title' => I18N::translate('Age related to death year')]) ?> 5761b860509SRico Sonntag </div> 5771b860509SRico Sonntag </div> 5781b860509SRico Sonntag </div> 5791b860509SRico Sonntag </div> 580dd6b2bfcSGreg Roach </div> 581dd6b2bfcSGreg Roach</div> 582