1dd6b2bfcSGreg Roach<?php 2d70512abSGreg Roach 31b860509SRico Sonntagdeclare(strict_types=1); 41b860509SRico Sonntag 5054771e9SGreg Roachuse Fisharebest\Webtrees\Age; 61b860509SRico Sonntaguse Fisharebest\Webtrees\Auth; 75373aac2SGreg Roachuse Fisharebest\Webtrees\Carbon; 81b860509SRico Sonntaguse Fisharebest\Webtrees\Date; 91b860509SRico Sonntaguse Fisharebest\Webtrees\I18N; 10054771e9SGreg Roachuse Fisharebest\Webtrees\Individual; 1187cca37cSGreg Roachuse Fisharebest\Webtrees\Module\ModuleChartInterface; 121b860509SRico Sonntaguse Fisharebest\Webtrees\Module\ModuleInterface; 131b860509SRico Sonntaguse Fisharebest\Webtrees\Module\RelationshipsChartModule; 141b860509SRico Sonntaguse Fisharebest\Webtrees\Services\ModuleService; 15b9597e06SGreg Roachuse Fisharebest\Webtrees\Tree; 161b860509SRico Sonntaguse Fisharebest\Webtrees\View; 17054771e9SGreg Roachuse Illuminate\Support\Collection; 181b860509SRico Sonntaguse Ramsey\Uuid\Uuid; 191b860509SRico Sonntag 20b9597e06SGreg Roach/** 21054771e9SGreg Roach * @var Collection<Individual> $individuals 22054771e9SGreg Roach * @var bool $sosa 23b9597e06SGreg Roach * @var Tree $tree 24b9597e06SGreg Roach */ 25b9597e06SGreg Roach 26dd6b2bfcSGreg Roach// lists requires a unique ID in case there are multiple lists per page 27dd6b2bfcSGreg Roach$table_id = 'table-indi-' . Uuid::uuid4()->toString(); 28dd6b2bfcSGreg Roach 29b9597e06SGreg Roach$today_jd = Carbon::now()->julianDay(); 305373aac2SGreg Roach$hundred_years_ago = Carbon::now()->subYears(100)->julianDay(); 311b860509SRico Sonntag 32dd6b2bfcSGreg Roach$unique_indis = []; // Don't double-count indis with multiple names. 3384b37362SGreg Roach 34b2a8cedfSGreg Roach$show_estimated_dates = (bool) $tree->getPreference('SHOW_EST_LIST_DATES'); 35b2a8cedfSGreg Roach 36054771e9SGreg Roach$today = new Date(strtoupper(date('d M Y'))); 37054771e9SGreg Roach 381b860509SRico Sonntag$module = app(ModuleService::class) 3987cca37cSGreg Roach ->findByComponent(ModuleChartInterface::class, $tree, Auth::user()) 400b5fd0a6SGreg Roach ->first(static function (ModuleInterface $module) { 4190d97cc8SGreg Roach return $module instanceof RelationshipsChartModule; 4290d97cc8SGreg Roach }); 43dd6b2bfcSGreg Roach?> 44dd6b2bfcSGreg Roach 45dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 46dd6b2bfcSGreg Roach<script> 4732a5dd8dSGreg Roach$("#<?= e($table_id) ?> > .wt-table-individual").dataTable({ 48dd6b2bfcSGreg Roach processing: true, 49dd6b2bfcSGreg Roach retrieve: true, 50dd6b2bfcSGreg Roach columns: [ 51dd6b2bfcSGreg Roach /* Given names */ { type: "text" }, 52dd6b2bfcSGreg Roach /* Surnames */ { type: "text" }, 5332a5dd8dSGreg Roach /* SOSA number */ { type: "num", visible: <?= json_encode($sosa) ?> }, 54dd6b2bfcSGreg Roach /* Birth date */ { type: "num" }, 55dd6b2bfcSGreg Roach /* Anniversary */ { type: "num" }, 56dd6b2bfcSGreg Roach /* Birthplace */ { type: "text" }, 57dd6b2bfcSGreg Roach /* Children */ { type: "num" }, 58dd6b2bfcSGreg Roach /* Deate date */ { type: "num" }, 59dd6b2bfcSGreg Roach /* Anniversary */ { type: "num" }, 60dd6b2bfcSGreg Roach /* Age */ { type: "num" }, 61dd6b2bfcSGreg Roach /* Death place */ { type: "text" }, 62dd6b2bfcSGreg Roach /* Last change */ { visible: <?= json_encode($tree->getPreference('SHOW_LAST_CHANGE')) ?> }, 63dd6b2bfcSGreg Roach /* Filter sex */ { sortable: false }, 64dd6b2bfcSGreg Roach /* Filter birth */ { sortable: false }, 65dd6b2bfcSGreg Roach /* Filter death */ { sortable: false }, 66dd6b2bfcSGreg Roach /* Filter tree */ { sortable: false } 67dd6b2bfcSGreg Roach ], 68b2c011d7SGreg Roach sorting: <?= json_encode($sosa ? [[4, 'asc']] : [[1, 'asc']]) ?> 69dd6b2bfcSGreg Roach}); 70dd6b2bfcSGreg Roach 71dd6b2bfcSGreg Roach$("#<?= e($table_id) ?>") 72dd6b2bfcSGreg Roach /* Hide/show parents */ 734843b94fSGreg Roach .on("click", "#btn-toggle-parents", function() { 745e6816beSGreg Roach $(".wt-individual-list-parents").slideToggle(); 75dd6b2bfcSGreg Roach }) 76dd6b2bfcSGreg Roach /* Hide/show statistics */ 774843b94fSGreg Roach .on("click", "#btn-toggle-statistics", function() { 781b860509SRico Sonntag $("#individual-charts-<?= e($table_id) ?>").slideToggle({ 791b860509SRico Sonntag complete: function () { 801b860509SRico Sonntag // Trigger resize to redraw the chart 811b860509SRico Sonntag $('div[id^="google-chart-"]').resize(); 821b860509SRico Sonntag } 831b860509SRico Sonntag }); 84dd6b2bfcSGreg Roach }) 85dd6b2bfcSGreg Roach /* Filter buttons in table header */ 86604bfd4bSGreg Roach .on("click", "input[data-filter-column]", function() { 87604bfd4bSGreg Roach let checkbox = $(this); 88604bfd4bSGreg Roach let siblings = checkbox.parent().siblings(); 891b860509SRico Sonntag 90604bfd4bSGreg Roach // Deselect other options 91604bfd4bSGreg Roach siblings.children().prop("checked", false).removeAttr("checked"); 92604bfd4bSGreg Roach siblings.removeClass('active'); 93604bfd4bSGreg Roach 94604bfd4bSGreg Roach // Apply (or clear) this filter 95604bfd4bSGreg Roach let checked = checkbox.prop("checked"); 96604bfd4bSGreg Roach let filter = checked ? checkbox.data("filter-value") : ""; 9732a5dd8dSGreg Roach let column = $("#<?= e($table_id) ?> .wt-table-individual").DataTable().column(checkbox.data("filter-column")); 98604bfd4bSGreg Roach column.search(filter).draw(); 99604bfd4bSGreg Roach }); 100dd6b2bfcSGreg Roach</script> 101dd6b2bfcSGreg Roach<?php View::endpush() ?> 102dd6b2bfcSGreg Roach 103dd6b2bfcSGreg Roach<?php 104dd6b2bfcSGreg Roach$max_age = (int) $tree->getPreference('MAX_ALIVE_AGE'); 105dd6b2bfcSGreg Roach 10697bf1559SGreg Roach// Initialise chart data 107dd6b2bfcSGreg Roach$deat_by_age = []; 108dd6b2bfcSGreg Roachfor ($age = 0; $age <= $max_age; $age++) { 1091b860509SRico Sonntag $deat_by_age[$age]['M'] = 0; 1101b860509SRico Sonntag $deat_by_age[$age]['F'] = 0; 1111b860509SRico Sonntag $deat_by_age[$age]['U'] = 0; 112dd6b2bfcSGreg Roach} 113dd6b2bfcSGreg Roach$birt_by_decade = []; 114dd6b2bfcSGreg Roach$deat_by_decade = []; 1151b860509SRico Sonntagfor ($year = 1400; $year < 2050; $year += 10) { 1161b860509SRico Sonntag $birt_by_decade[$year]['M'] = 0; 1171b860509SRico Sonntag $birt_by_decade[$year]['F'] = 0; 1181b860509SRico Sonntag $birt_by_decade[$year]['U'] = 0; 1191b860509SRico Sonntag $deat_by_decade[$year]['M'] = 0; 1201b860509SRico Sonntag $deat_by_decade[$year]['F'] = 0; 1211b860509SRico Sonntag $deat_by_decade[$year]['U'] = 0; 122dd6b2bfcSGreg Roach} 1231b860509SRico Sonntag 1241b860509SRico Sonntag$birthData = [ 1251b860509SRico Sonntag [ 1261b860509SRico Sonntag [ 1271b860509SRico Sonntag 'label' => I18N::translate('Century'), 1281b860509SRico Sonntag 'type' => 'date', 1291b860509SRico Sonntag ], [ 1301b860509SRico Sonntag 'label' => I18N::translate('Males'), 1311b860509SRico Sonntag 'type' => 'number', 1321b860509SRico Sonntag ], [ 1331b860509SRico Sonntag 'label' => I18N::translate('Females'), 1341b860509SRico Sonntag 'type' => 'number', 1351b860509SRico Sonntag ], 1361b860509SRico Sonntag ] 1371b860509SRico Sonntag]; 1381b860509SRico Sonntag 1391b860509SRico Sonntag$deathData = [ 1401b860509SRico Sonntag [ 1411b860509SRico Sonntag [ 1421b860509SRico Sonntag 'label' => I18N::translate('Century'), 1431b860509SRico Sonntag 'type' => 'date', 1441b860509SRico Sonntag ], [ 1451b860509SRico Sonntag 'label' => I18N::translate('Males'), 1461b860509SRico Sonntag 'type' => 'number', 1471b860509SRico Sonntag ], [ 1481b860509SRico Sonntag 'label' => I18N::translate('Females'), 1491b860509SRico Sonntag 'type' => 'number', 1501b860509SRico Sonntag ], 1511b860509SRico Sonntag ] 1521b860509SRico Sonntag]; 1531b860509SRico Sonntag 1541b860509SRico Sonntag$deathAgeData = [ 1551b860509SRico Sonntag [ 1561b860509SRico Sonntag I18N::translate('Age'), 1571b860509SRico Sonntag I18N::translate('Males'), 1581b860509SRico Sonntag I18N::translate('Females'), 1591b860509SRico Sonntag I18N::translate('Average age'), 1601b860509SRico Sonntag ] 1611b860509SRico Sonntag]; 1621b860509SRico Sonntag 163dd6b2bfcSGreg Roach?> 164dd6b2bfcSGreg Roach 16532a5dd8dSGreg Roach<div id="<?= e($table_id) ?>"> 16632a5dd8dSGreg Roach <table class="table table-bordered table-sm wt-table-individual" 167b6c326d8SGreg Roach <?= view('lists/datatables-attributes') ?> 168b6c326d8SGreg Roach > 169dd6b2bfcSGreg Roach <thead> 170dd6b2bfcSGreg Roach <tr> 171dd6b2bfcSGreg Roach <th colspan="16"> 172dd6b2bfcSGreg Roach <div class="btn-toolbar d-flex justify-content-between mb-2" role="toolbar"> 173*315eb316SGreg Roach <div class="btn-group btn-group-toggle btn-group-sm" data-bs-toggle="buttons"> 174af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show only males.') ?>"> 17597bf1559SGreg Roach <input type="checkbox" data-filter-column="12" data-filter-value="M" autocomplete="off"> 17608362db4SGreg Roach <?= view('icons/sex', ['sex' => 'M']) ?> 177604bfd4bSGreg Roach </label> 178af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show only females.') ?>"> 17997bf1559SGreg Roach <input type="checkbox" data-filter-column="12" data-filter-value="F" autocomplete="off"> 18008362db4SGreg Roach <?= view('icons/sex', ['sex' => 'F']) ?> 181604bfd4bSGreg Roach </label> 182af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show only individuals for whom the gender is not known.') ?>"> 18397bf1559SGreg Roach <input type="checkbox" data-filter-column="12" data-filter-value="U" autocomplete="off"> 18408362db4SGreg Roach <?= view('icons/sex', ['sex' => 'U']) ?> 185604bfd4bSGreg Roach </label> 186dd6b2bfcSGreg Roach </div> 187604bfd4bSGreg Roach 188*315eb316SGreg Roach <div class="btn-group btn-group-toggle btn-group-sm" data-bs-toggle="buttons"> 189af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals who are alive or couples where both partners are alive.') ?>"> 19097bf1559SGreg Roach <input type="checkbox" data-filter-column="14" data-filter-value="N" autocomplete="off"> 191dd6b2bfcSGreg Roach <?= I18N::translate('Alive') ?> 192604bfd4bSGreg Roach </label> 193af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals who are dead or couples where both partners are dead.') ?>"> 19497bf1559SGreg Roach <input type="checkbox" data-filter-column="14" data-filter-value="Y" autocomplete="off"> 195dd6b2bfcSGreg Roach <?= I18N::translate('Dead') ?> 196604bfd4bSGreg Roach </label> 197af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals who died more than 100 years ago.') ?>"> 19897bf1559SGreg Roach <input type="checkbox" data-filter-column="14" data-filter-value="YES" autocomplete="off"> 199dd6b2bfcSGreg Roach <?= I18N::translate('Death') ?>>100 200604bfd4bSGreg Roach </label> 201af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals who died within the last 100 years.') ?>"> 20297bf1559SGreg Roach <input type="checkbox" data-filter-column="14" data-filter-value="Y100" autocomplete="off"> 203392561bbSGreg Roach <?= I18N::translate('Death') ?><=100 204604bfd4bSGreg Roach </label> 205dd6b2bfcSGreg Roach </div> 206604bfd4bSGreg Roach 207*315eb316SGreg Roach <div class="btn-group btn-group-toggle btn-group-sm" data-bs-toggle="buttons"> 208af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals born more than 100 years ago.') ?>"> 20997bf1559SGreg Roach <input type="checkbox" data-filter-column="13" data-filter-value="YES" autocomplete="off"> 210dd6b2bfcSGreg Roach <?= I18N::translate('Birth') ?>>100 211604bfd4bSGreg Roach </label> 212af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals born within the last 100 years.') ?>"> 21397bf1559SGreg Roach <input type="checkbox" data-filter-column="13" data-filter-value="Y100" autocomplete="off"> 214dd6b2bfcSGreg Roach <?= I18N::translate('Birth') ?><=100 215604bfd4bSGreg Roach </label> 216dd6b2bfcSGreg Roach </div> 217604bfd4bSGreg Roach 218*315eb316SGreg Roach <div class="btn-group btn-group-toggle btn-group-sm" data-bs-toggle="buttons"> 219af8b52f0SGreg Roach <label class="btn btn-outline-secondary" 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.') ?>"> 22097bf1559SGreg Roach <input type="checkbox" data-filter-column="15" data-filter-value="R" autocomplete="off"> 221dd6b2bfcSGreg Roach <?= I18N::translate('Roots') ?> 222604bfd4bSGreg Roach </label> 223af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show “leaves” couples or individuals. These are individuals who are alive but have no children recorded in the database.') ?>"> 22497bf1559SGreg Roach <input type="checkbox" data-filter-column="15" data-filter-value="L" autocomplete="off"> 225dd6b2bfcSGreg Roach <?= I18N::translate('Leaves') ?> 226604bfd4bSGreg Roach </label> 227dd6b2bfcSGreg Roach </div> 228dd6b2bfcSGreg Roach </div> 229dd6b2bfcSGreg Roach </th> 230dd6b2bfcSGreg Roach </tr> 231dd6b2bfcSGreg Roach <tr> 232dd6b2bfcSGreg Roach <th><?= I18N::translate('Given names') ?></th> 233dd6b2bfcSGreg Roach <th><?= I18N::translate('Surname') ?></th> 234dd6b2bfcSGreg Roach <th><?= /* I18N: Abbreviation for “Sosa-Stradonitz number”. This is an individual’s surname, so may need transliterating into non-latin alphabets. */ 235dd6b2bfcSGreg Roach I18N::translate('Sosa') ?></th> 236dd6b2bfcSGreg Roach <th><?= I18N::translate('Birth') ?></th> 237dd6b2bfcSGreg Roach <th> 238e39fd5c6SGreg Roach <span title="<?= I18N::translate('Anniversary') ?>"> 239e39fd5c6SGreg Roach <?= view('icons/anniversary') ?> 240e39fd5c6SGreg Roach </span> 241dd6b2bfcSGreg Roach </th> 242dd6b2bfcSGreg Roach <th><?= I18N::translate('Place') ?></th> 243dd6b2bfcSGreg Roach <th> 244dd6b2bfcSGreg Roach <i class="icon-children" title="<?= I18N::translate('Children') ?>"></i> 245dd6b2bfcSGreg Roach </th> 246dd6b2bfcSGreg Roach <th><?= I18N::translate('Death') ?></th> 247dd6b2bfcSGreg Roach <th> 248e39fd5c6SGreg Roach <span title="<?= I18N::translate('Anniversary') ?>"> 249e39fd5c6SGreg Roach <?= view('icons/anniversary') ?> 250e39fd5c6SGreg Roach </span> 251dd6b2bfcSGreg Roach </th> 252dd6b2bfcSGreg Roach <th><?= I18N::translate('Age') ?></th> 253dd6b2bfcSGreg Roach <th><?= I18N::translate('Place') ?></th> 254dd6b2bfcSGreg Roach <th><?= I18N::translate('Last change') ?></th> 255dd6b2bfcSGreg Roach <th hidden></th> 256dd6b2bfcSGreg Roach <th hidden></th> 257dd6b2bfcSGreg Roach <th hidden></th> 258dd6b2bfcSGreg Roach <th hidden></th> 259dd6b2bfcSGreg Roach </tr> 260dd6b2bfcSGreg Roach </thead> 261dd6b2bfcSGreg Roach 262dd6b2bfcSGreg Roach <tbody> 263dd6b2bfcSGreg Roach <?php foreach ($individuals as $key => $individual) : ?> 264b16bf9d4SGreg Roach <tr class="<?= $individual->isPendingAddition() ? 'wt-new' : '' ?> <?= $individual->isPendingDeletion() ? 'wt-old' : '' ?>"> 2658fb4e87cSGreg Roach <td colspan="2" data-sort="<?= e(str_replace([',', Individual::PRAENOMEN_NESCIO, Individual::NOMEN_NESCIO], 'AAAA', implode(',', array_reverse(explode(',', $individual->sortName()))))) ?>"> 266dd6b2bfcSGreg Roach <?php foreach ($individual->getAllNames() as $num => $name) : ?> 2678d25f0dbSGreg Roach <a title="<?= $name['type'] === '_MARNM' ? I18N::translate('Married name') : '' ?>" href="<?= e($individual->url()) ?>" class="<?= $num === $individual->getPrimaryName() ? 'name2' : '' ?>"> 268dd6b2bfcSGreg Roach <?= $name['full'] ?> 269dd6b2bfcSGreg Roach </a> 270dd6b2bfcSGreg Roach <?php if ($num === $individual->getPrimaryName()) : ?> 27108362db4SGreg Roach <small><?= view('icons/sex', ['sex' => $individual->sex()]) ?></small> 272dd6b2bfcSGreg Roach <?php endif ?> 273dd6b2bfcSGreg Roach <br> 274dd6b2bfcSGreg Roach <?php endforeach ?> 2755e6816beSGreg Roach <?= view('lists/individual-table-parents', ['individual' => $individual]) ?> 276dd6b2bfcSGreg Roach </td> 277dd6b2bfcSGreg Roach 2788fb4e87cSGreg Roach <td hidden data-sort="<?= e(str_replace([',', Individual::PRAENOMEN_NESCIO, Individual::NOMEN_NESCIO], 'AAAA', $individual->sortName())) ?>"></td> 279dd6b2bfcSGreg Roach 280242a7862SGreg Roach <td class="text-center" data-sort="<?= $key ?>"> 281dd6b2bfcSGreg Roach <?php if ($sosa) : ?> 28284b37362SGreg Roach <?php if ($module instanceof RelationshipsChartModule) : ?> 28384b37362SGreg Roach <a href="<?= e($module->chartUrl($individuals[1], ['xref2' => $individual->xref()])) ?>" rel="nofollow" title="<?= I18N::translate('Relationships') ?>" rel="nofollow"> 284dd6b2bfcSGreg Roach <?= I18N::number($key) ?> 285dd6b2bfcSGreg Roach </a> 28684b37362SGreg Roach <?php else : ?> 28784b37362SGreg Roach <?= I18N::number($key) ?> 28884b37362SGreg Roach <?php endif ?> 289dd6b2bfcSGreg Roach <?php endif ?> 290dd6b2bfcSGreg Roach </td> 291dd6b2bfcSGreg Roach 292dd6b2bfcSGreg Roach <!-- Birth date --> 293054771e9SGreg Roach <?php $estimated_birth_date = $individual->getEstimatedBirthDate(); ?> 294054771e9SGreg Roach 295054771e9SGreg Roach <td data-sort="<?= $estimated_birth_date->julianDay() ?>"> 296dd6b2bfcSGreg Roach <?php $birth_dates = $individual->getAllBirthDates(); ?> 297dd6b2bfcSGreg Roach 298dd6b2bfcSGreg Roach <?php foreach ($birth_dates as $n => $birth_date) : ?> 299dd6b2bfcSGreg Roach <?= $birth_date->display(true) ?> 300dd6b2bfcSGreg Roach <br> 301dd6b2bfcSGreg Roach <?php endforeach ?> 30214147f6fSGreg Roach 303b2a8cedfSGreg Roach <?php if (empty($birth_dates) && $show_estimated_dates) : ?> 304054771e9SGreg Roach <?= $estimated_birth_date->display(true) ?> 30514147f6fSGreg Roach <?php endif ?> 306dd6b2bfcSGreg Roach </td> 307dd6b2bfcSGreg Roach 308dd6b2bfcSGreg Roach <!-- Birth anniversary --> 309c0935879SGreg Roach <?php if (isset($birth_dates[0]) && $birth_dates[0]->gregorianYear() >= 1550 && $birth_dates[0]->gregorianYear() < 2030 && !isset($unique_indis[$individual->xref()])) : ?> 3101b860509SRico Sonntag <?php 3111b860509SRico Sonntag ++$birt_by_decade[(int) ($birth_dates[0]->gregorianYear() / 10) * 10][$individual->sex()]; 3121b860509SRico Sonntag ?> 313dd6b2bfcSGreg Roach <?php endif ?> 31453432476SGreg Roach <td class="text-center" data-sort="<?= - $estimated_birth_date->julianDay() ?>"> 31553432476SGreg Roach <?= (new Age($birth_dates[0] ?? new Date(''), $today))->ageYearsString() ?> 316dd6b2bfcSGreg Roach </td> 317dd6b2bfcSGreg Roach 318dd6b2bfcSGreg Roach <!-- Birth place --> 3198c0ff4ddSGreg Roach <td data-sort="<?= e($individual->getBirthPlace()->gedcomName()) ?>"> 320dd6b2bfcSGreg Roach <?php foreach ($individual->getAllBirthPlaces() as $n => $birth_place) : ?> 321392561bbSGreg Roach <?= $birth_place->shortName(true) ?> 322dd6b2bfcSGreg Roach <br> 323dd6b2bfcSGreg Roach <?php endforeach ?> 324dd6b2bfcSGreg Roach </td> 325dd6b2bfcSGreg Roach 326dd6b2bfcSGreg Roach <!-- Number of children --> 32739ca88baSGreg Roach <td class="text-center" data-sort="<?= $individual->numberOfChildren() ?>"> 32839ca88baSGreg Roach <?= I18N::number($individual->numberOfChildren()) ?> 329dd6b2bfcSGreg Roach </td> 330dd6b2bfcSGreg Roach 331dd6b2bfcSGreg Roach <!-- Death date --> 332dd6b2bfcSGreg Roach <?php $death_dates = $individual->getAllDeathDates() ?> 333dd6b2bfcSGreg Roach <td data-sort="<?= $individual->getEstimatedDeathDate()->julianDay() ?>"> 334dd6b2bfcSGreg Roach <?php foreach ($death_dates as $num => $death_date) : ?> 335dd6b2bfcSGreg Roach <?= $death_date->display(true) ?> 336dd6b2bfcSGreg Roach <br> 337dd6b2bfcSGreg Roach <?php endforeach ?> 33814147f6fSGreg Roach 339b2a8cedfSGreg Roach <?php if (empty($death_dates) && $show_estimated_dates && $individual->getEstimatedDeathDate()->minimumDate()->minimumJulianDay() < $today_jd) : ?> 34014147f6fSGreg Roach <?= $individual->getEstimatedDeathDate()->display(true) ?> 34114147f6fSGreg Roach <?php endif ?> 342dd6b2bfcSGreg Roach </td> 343dd6b2bfcSGreg Roach 344dd6b2bfcSGreg Roach <!-- Death anniversary --> 345c0935879SGreg Roach <?php if (isset($death_dates[0]) && $death_dates[0]->gregorianYear() >= 1550 && $death_dates[0]->gregorianYear() < 2030 && !isset($unique_indis[$individual->xref()])) : ?> 3461b860509SRico Sonntag <?php 3471b860509SRico Sonntag ++$deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10][$individual->sex()]; 3481b860509SRico Sonntag ?> 349dd6b2bfcSGreg Roach <?php endif ?> 35053432476SGreg Roach <td class="text-center" data-sort="<?= - $individual->getEstimatedDeathDate()->julianDay() ?>"> 35153432476SGreg Roach <?= (new Age($death_dates[0] ?? new Date(''), $today))->ageYearsString() ?> 352dd6b2bfcSGreg Roach </td> 353dd6b2bfcSGreg Roach 354dd6b2bfcSGreg Roach <!-- Age at death --> 35553432476SGreg Roach <?php $age = new Age($birth_dates[0] ?? new Date(''), $death_dates[0] ?? new Date('')) ?> 35653432476SGreg Roach <?php if (!isset($unique_indis[$individual->xref()]) && $age->ageYears() >= 0 && $age->ageYears() <= $max_age) : ?> 35753432476SGreg Roach <?php ++$deat_by_age[$age->ageYears()][$individual->sex()] ?> 358dd6b2bfcSGreg Roach <?php endif ?> 35953432476SGreg Roach <td class="text-center" data-sort="<?= $age->ageDays() ?>"> 36053432476SGreg Roach <?= $age->ageYearsString() ?> 361dd6b2bfcSGreg Roach </td> 362dd6b2bfcSGreg Roach 363dd6b2bfcSGreg Roach <!-- Death place --> 3648c0ff4ddSGreg Roach <td data-sort="<?= e($individual->getDeathPlace()->gedcomName()) ?>"> 365dd6b2bfcSGreg Roach <?php foreach ($individual->getAllDeathPlaces() as $n => $death_place) : ?> 366392561bbSGreg Roach <?= $death_place->shortName(true) ?> 367dd6b2bfcSGreg Roach <br> 368dd6b2bfcSGreg Roach <?php endforeach ?> 369dd6b2bfcSGreg Roach </td> 370dd6b2bfcSGreg Roach 371dd6b2bfcSGreg Roach <!-- Last change --> 3724459dc9aSGreg Roach <td data-sort="<?= $individual->lastChangeTimestamp()->unix() ?>"> 3734459dc9aSGreg Roach <?= view('components/datetime', ['timestamp' => $individual->lastChangeTimestamp()]) ?> 374dd6b2bfcSGreg Roach </td> 375dd6b2bfcSGreg Roach 376dd6b2bfcSGreg Roach <!-- Filter by sex --> 377dd6b2bfcSGreg Roach <td hidden> 37839ca88baSGreg Roach <?= $individual->sex() ?> 379dd6b2bfcSGreg Roach </td> 380dd6b2bfcSGreg Roach 381dd6b2bfcSGreg Roach <!-- Filter by birth date --> 382dd6b2bfcSGreg Roach <td hidden> 383054771e9SGreg Roach <?php if ($estimated_birth_date->maximumJulianDay() > $hundred_years_ago && $estimated_birth_date->maximumJulianDay() <= $today_jd) : ?> 384dd6b2bfcSGreg Roach Y100 385dd6b2bfcSGreg Roach <?php else : ?> 386dd6b2bfcSGreg Roach YES 387dd6b2bfcSGreg Roach <?php endif ?> 388dd6b2bfcSGreg Roach </td> 389dd6b2bfcSGreg Roach 390dd6b2bfcSGreg Roach <!-- Filter by death date --> 391dd6b2bfcSGreg Roach <td hidden> 392b9597e06SGreg Roach <?php if ($individual->getEstimatedDeathDate()->maximumJulianDay() > $hundred_years_ago && $individual->getEstimatedDeathDate()->maximumJulianDay() <= $today_jd) : ?> 393dd6b2bfcSGreg Roach Y100 394dd6b2bfcSGreg Roach <?php elseif ($individual->isDead()) : ?> 395dd6b2bfcSGreg Roach YES 396dd6b2bfcSGreg Roach <?php else : ?> 397dd6b2bfcSGreg Roach N 398dd6b2bfcSGreg Roach <?php endif ?> 399dd6b2bfcSGreg Roach </td> 400dd6b2bfcSGreg Roach 401dd6b2bfcSGreg Roach <!-- Filter by roots/leaves --> 402dd6b2bfcSGreg Roach <td hidden> 40308662657SGreg Roach <?php if ($individual->childFamilies()->isEmpty()) : ?> 404dd6b2bfcSGreg Roach R 40539ca88baSGreg Roach <?php elseif (!$individual->isDead() && $individual->numberOfChildren() < 1) : ?> 406dd6b2bfcSGreg Roach L 407dd6b2bfcSGreg Roach <?php endif ?> 408dd6b2bfcSGreg Roach </td> 409dd6b2bfcSGreg Roach </tr> 410dd6b2bfcSGreg Roach 411c0935879SGreg Roach <?php $unique_indis[$individual->xref()] = true ?> 412dd6b2bfcSGreg Roach <?php endforeach ?> 413dd6b2bfcSGreg Roach </tbody> 4147039fd97SGreg Roach 4157039fd97SGreg Roach <tfoot> 4167039fd97SGreg Roach <tr> 4177039fd97SGreg Roach <th colspan="16"> 418604bfd4bSGreg Roach <div class="btn-group btn-group-sm"> 419*315eb316SGreg Roach <button id="btn-toggle-parents" class="btn btn-outline-secondary" data-bs-toggle="button" data-persist="show-parents"> 4207039fd97SGreg Roach <?= I18N::translate('Show parents') ?> 4217039fd97SGreg Roach </button> 422*315eb316SGreg Roach <button id="btn-toggle-statistics" class="btn btn-outline-secondary" data-bs-toggle="button" data-persist="show-statistics"> 4237039fd97SGreg Roach <?= I18N::translate('Show statistics charts') ?> 4247039fd97SGreg Roach </button> 4257039fd97SGreg Roach </div> 4267039fd97SGreg Roach </th> 4277039fd97SGreg Roach </tr> 4287039fd97SGreg Roach </tfoot> 429dd6b2bfcSGreg Roach </table> 4301b860509SRico Sonntag</div> 431dd6b2bfcSGreg Roach 4321b860509SRico Sonntag<div id="individual-charts-<?= e($table_id) ?>" style="display: none;"> 4331b860509SRico Sonntag <div class="mb-3"> 4341b860509SRico Sonntag <div class="card-deck"> 4351b860509SRico Sonntag <div class="col-lg-12 col-md-12 mb-3"> 4361b860509SRico Sonntag <div class="card m-0"> 4371b860509SRico Sonntag <div class="card-header"> 4381b860509SRico Sonntag <?= I18N::translate('Decade of birth') ?> 4391b860509SRico Sonntag </div> 4401b860509SRico Sonntag <div class="card-body"> 4411b860509SRico Sonntag <?php 4421b860509SRico Sonntag foreach ($birt_by_decade as $century => $values) { 4431b860509SRico Sonntag if (($values['M'] + $values['F']) > 0) { 4441b860509SRico Sonntag $birthData[] = [ 4451b860509SRico Sonntag [ 4461b860509SRico Sonntag 'v' => 'Date(' . $century . ', 0, 1)', 4471b860509SRico Sonntag 'f' => $century, 4481b860509SRico Sonntag ], 4491b860509SRico Sonntag $values['M'], 4501b860509SRico Sonntag $values['F'], 4511b860509SRico Sonntag ]; 4521b860509SRico Sonntag } 4531b860509SRico Sonntag } 4541b860509SRico Sonntag ?> 4551b860509SRico Sonntag <?= view('lists/chart-by-decade', ['data' => $birthData, 'title' => I18N::translate('Decade of birth')]) ?> 4561b860509SRico Sonntag </div> 4571b860509SRico Sonntag </div> 4581b860509SRico Sonntag </div> 4591b860509SRico Sonntag </div> 4601b860509SRico Sonntag <div class="card-deck"> 4611b860509SRico Sonntag <div class="col-lg-12 col-md-12 mb-3"> 4621b860509SRico Sonntag <div class="card m-0"> 4631b860509SRico Sonntag <div class="card-header"> 4641b860509SRico Sonntag <?= I18N::translate('Decade of death') ?> 4651b860509SRico Sonntag </div> 4661b860509SRico Sonntag <div class="card-body"> 4671b860509SRico Sonntag <?php 4681b860509SRico Sonntag foreach ($deat_by_decade as $century => $values) { 4691b860509SRico Sonntag if (($values['M'] + $values['F']) > 0) { 4701b860509SRico Sonntag $deathData[] = [ 4711b860509SRico Sonntag [ 4721b860509SRico Sonntag 'v' => 'Date(' . $century . ', 0, 1)', 4731b860509SRico Sonntag 'f' => $century, 4741b860509SRico Sonntag ], 4751b860509SRico Sonntag $values['M'], 4761b860509SRico Sonntag $values['F'], 4771b860509SRico Sonntag ]; 4781b860509SRico Sonntag } 4791b860509SRico Sonntag } 4801b860509SRico Sonntag ?> 4811b860509SRico Sonntag <?= view('lists/chart-by-decade', ['data' => $deathData, 'title' => I18N::translate('Decade of death')]) ?> 4821b860509SRico Sonntag </div> 4831b860509SRico Sonntag </div> 4841b860509SRico Sonntag </div> 4851b860509SRico Sonntag </div> 4861b860509SRico Sonntag <div class="card-deck"> 4871b860509SRico Sonntag <div class="col-lg-12 col-md-12 mb-3"> 4881b860509SRico Sonntag <div class="card m-0"> 4891b860509SRico Sonntag <div class="card-header"> 4901b860509SRico Sonntag <?= I18N::translate('Age related to death year') ?> 4911b860509SRico Sonntag </div> 4921b860509SRico Sonntag <div class="card-body"> 4931b860509SRico Sonntag <?php 4941b860509SRico Sonntag $totalAge = 0; 4951b860509SRico Sonntag $totalSum = 0; 4961b860509SRico Sonntag $max = 0; 4971b860509SRico Sonntag 4981b860509SRico Sonntag foreach ($deat_by_age as $age => $values) { 4991b860509SRico Sonntag if (($values['M'] + $values['F']) > 0) { 5001b860509SRico Sonntag if (($values['M'] + $values['F']) > $max) { 5011b860509SRico Sonntag $max = $values['M'] + $values['F']; 5021b860509SRico Sonntag } 5031b860509SRico Sonntag 5041b860509SRico Sonntag $totalAge += $age * ($values['M'] + $values['F']); 5051b860509SRico Sonntag $totalSum += $values['M'] + $values['F']; 5061b860509SRico Sonntag 5071b860509SRico Sonntag $deathAgeData[] = [ 5081b860509SRico Sonntag $age, 5091b860509SRico Sonntag $values['M'], 5101b860509SRico Sonntag $values['F'], 5111b860509SRico Sonntag null, 5121b860509SRico Sonntag ]; 5131b860509SRico Sonntag } 5141b860509SRico Sonntag } 5151b860509SRico Sonntag 5161b860509SRico Sonntag if ($totalSum > 0) { 5171b860509SRico Sonntag $deathAgeData[] = [ 5181b860509SRico Sonntag round($totalAge / $totalSum, 1), 5191b860509SRico Sonntag null, 5201b860509SRico Sonntag null, 5211b860509SRico Sonntag 0, 5221b860509SRico Sonntag ]; 5231b860509SRico Sonntag 5241b860509SRico Sonntag $deathAgeData[] = [ 5251b860509SRico Sonntag round($totalAge / $totalSum, 1), 5261b860509SRico Sonntag null, 5271b860509SRico Sonntag null, 5281b860509SRico Sonntag $max, 5291b860509SRico Sonntag ]; 5301b860509SRico Sonntag } 5311b860509SRico Sonntag ?> 5321b860509SRico Sonntag <?= view('lists/chart-by-age', ['data' => $deathAgeData, 'title' => I18N::translate('Age related to death year')]) ?> 5331b860509SRico Sonntag </div> 5341b860509SRico Sonntag </div> 5351b860509SRico Sonntag </div> 5361b860509SRico Sonntag </div> 537dd6b2bfcSGreg Roach </div> 538dd6b2bfcSGreg Roach</div> 539