1dd6b2bfcSGreg Roach<?php 2d70512abSGreg Roach 31b860509SRico Sonntagdeclare(strict_types=1); 41b860509SRico Sonntag 55373aac2SGreg Roachuse Fisharebest\Webtrees\Carbon; 61b860509SRico Sonntaguse Fisharebest\Webtrees\Date; 71b860509SRico Sonntaguse Fisharebest\Webtrees\Gedcom; 81b860509SRico Sonntaguse Fisharebest\Webtrees\GedcomTag; 91b860509SRico Sonntaguse Fisharebest\Webtrees\I18N; 101b860509SRico Sonntaguse Fisharebest\Webtrees\Individual; 111b860509SRico Sonntaguse Fisharebest\Webtrees\View; 121b860509SRico Sonntaguse Ramsey\Uuid\Uuid; 131b860509SRico Sonntag 14dd6b2bfcSGreg Roach$table_id = 'table-fam-' . Uuid::uuid4()->toString(); // lists requires a unique ID in case there are multiple lists per page 151b860509SRico Sonntag 16b9597e06SGreg Roach$today_jd = Carbon::now()->julianDay(); 175373aac2SGreg Roach$hundred_years_ago = Carbon::now()->subYears(100)->julianDay(); 185373aac2SGreg Roach 19dd6b2bfcSGreg Roach?> 20dd6b2bfcSGreg Roach 21dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 22dd6b2bfcSGreg Roach<script> 2332a5dd8dSGreg Roach$("#<?= e($table_id) ?> > .wt-table-family").dataTable({ 24dd6b2bfcSGreg Roach processing: true, 25dd6b2bfcSGreg Roach retrieve: true, 26dd6b2bfcSGreg Roach columns: [ 27dd6b2bfcSGreg Roach /* Given names */ { type: "text" }, 28dd6b2bfcSGreg Roach /* Surnames */ { type: "text" }, 29dd6b2bfcSGreg Roach /* Age */ { type: "num" }, 30dd6b2bfcSGreg Roach /* Given names */ { type: "text" }, 31dd6b2bfcSGreg Roach /* Surnames */ { type: "text" }, 32dd6b2bfcSGreg Roach /* Age */ { type: "num" }, 33dd6b2bfcSGreg Roach /* Marriage date */ { type: "num" }, 34dd6b2bfcSGreg Roach /* Anniversary */ { type: "num" }, 35dd6b2bfcSGreg Roach /* Marriage place */ { type: "text" }, 36dd6b2bfcSGreg Roach /* Children */ { type: "num" }, 37dd6b2bfcSGreg Roach /* Last change */ { visible: <?= json_encode((bool) $tree->getPreference('SHOW_LAST_CHANGE')) ?> }, 38dd6b2bfcSGreg Roach /* Filter marriage */ { sortable: false }, 39dd6b2bfcSGreg Roach /* Filter alive/dead */ { sortable: false }, 40dd6b2bfcSGreg Roach /* Filter tree */ { sortable: false } 41dd6b2bfcSGreg Roach ], 421b860509SRico Sonntag sorting: [ 431b860509SRico Sonntag [1, "asc"] 44b6c326d8SGreg Roach ] 451b860509SRico Sonntag}); 461b860509SRico Sonntag 471b860509SRico Sonntag$("#<?= e($table_id) ?>") 48dd6b2bfcSGreg Roach /* Hide/show parents */ 494843b94fSGreg Roach .on("click", "#btn-toggle-parents", function() { 505e6816beSGreg Roach $(".wt-individual-list-parents").slideToggle(); 51dd6b2bfcSGreg Roach }) 52dd6b2bfcSGreg Roach /* Hide/show statistics */ 534843b94fSGreg Roach .on("click", "#btn-toggle-statistics", function() { 541b860509SRico Sonntag $("#family-charts-<?= e($table_id) ?>").slideToggle({ 551b860509SRico Sonntag complete: function () { 561b860509SRico Sonntag // Trigger resize to redraw the chart 571b860509SRico Sonntag $('div[id^="google-chart-"]').resize(); 581b860509SRico Sonntag } 591b860509SRico Sonntag }); 60dd6b2bfcSGreg Roach }) 61dd6b2bfcSGreg Roach /* Filter buttons in table header */ 62604bfd4bSGreg Roach .on("click", "input[data-filter-column]", function() { 63604bfd4bSGreg Roach let checkbox = $(this); 64604bfd4bSGreg Roach let siblings = checkbox.parent().siblings(); 651b860509SRico Sonntag 66604bfd4bSGreg Roach // Deselect other options 67604bfd4bSGreg Roach siblings.children().prop("checked", false).removeAttr("checked"); 68604bfd4bSGreg Roach siblings.removeClass('active'); 69604bfd4bSGreg Roach 70604bfd4bSGreg Roach // Apply (or clear) this filter 71604bfd4bSGreg Roach let checked = checkbox.prop("checked"); 72604bfd4bSGreg Roach let filter = checked ? checkbox.data("filter-value") : ""; 7332a5dd8dSGreg Roach let column = $("#<?= e($table_id) ?> .wt-table-family").DataTable().column(checkbox.data("filter-column")); 74604bfd4bSGreg Roach column.search(filter).draw(); 75604bfd4bSGreg Roach }); 76dd6b2bfcSGreg Roach</script> 77dd6b2bfcSGreg Roach<?php View::endpush() ?> 78dd6b2bfcSGreg Roach 79dd6b2bfcSGreg Roach<?php 80dd6b2bfcSGreg Roach$max_age = (int) $tree->getPreference('MAX_ALIVE_AGE'); 81dd6b2bfcSGreg Roach 82dd6b2bfcSGreg Roach// init chart data 83dd6b2bfcSGreg Roach$marr_by_age = []; 84dd6b2bfcSGreg Roachfor ($age = 0; $age <= $max_age; $age++) { 851b860509SRico Sonntag $marr_by_age[$age]['M'] = 0; 861b860509SRico Sonntag $marr_by_age[$age]['F'] = 0; 871b860509SRico Sonntag $marr_by_age[$age]['U'] = 0; 88dd6b2bfcSGreg Roach} 89dd6b2bfcSGreg Roach$birt_by_decade = []; 90dd6b2bfcSGreg Roach$marr_by_decade = []; 911b860509SRico Sonntagfor ($year = 1400; $year < 2050; $year += 10) { 921b860509SRico Sonntag $birt_by_decade[$year]['M'] = 0; 931b860509SRico Sonntag $birt_by_decade[$year]['F'] = 0; 941b860509SRico Sonntag $birt_by_decade[$year]['U'] = 0; 951b860509SRico Sonntag $marr_by_decade[$year]['M'] = 0; 961b860509SRico Sonntag $marr_by_decade[$year]['F'] = 0; 971b860509SRico Sonntag $marr_by_decade[$year]['U'] = 0; 98dd6b2bfcSGreg Roach} 991b860509SRico Sonntag 1001b860509SRico Sonntag$birthData = [ 1011b860509SRico Sonntag [ 1021b860509SRico Sonntag [ 1031b860509SRico Sonntag 'label' => I18N::translate('Century'), 1041b860509SRico Sonntag 'type' => 'date', 1051b860509SRico Sonntag ], [ 1061b860509SRico Sonntag 'label' => I18N::translate('Males'), 1071b860509SRico Sonntag 'type' => 'number', 1081b860509SRico Sonntag ], [ 1091b860509SRico Sonntag 'label' => I18N::translate('Females'), 1101b860509SRico Sonntag 'type' => 'number', 1111b860509SRico Sonntag ], 1121b860509SRico Sonntag ] 1131b860509SRico Sonntag]; 1141b860509SRico Sonntag 1151b860509SRico Sonntag$marriageData = [ 1161b860509SRico Sonntag [ 1171b860509SRico Sonntag [ 1181b860509SRico Sonntag 'label' => I18N::translate('Century'), 1191b860509SRico Sonntag 'type' => 'date', 1201b860509SRico Sonntag ], [ 1211b860509SRico Sonntag 'label' => I18N::translate('Males'), 1221b860509SRico Sonntag 'type' => 'number', 1231b860509SRico Sonntag ], [ 1241b860509SRico Sonntag 'label' => I18N::translate('Females'), 1251b860509SRico Sonntag 'type' => 'number', 1261b860509SRico Sonntag ], 1271b860509SRico Sonntag ] 1281b860509SRico Sonntag]; 1291b860509SRico Sonntag 1301b860509SRico Sonntag$marriageAgeData = [ 1311b860509SRico Sonntag [ 1321b860509SRico Sonntag I18N::translate('Age'), 1331b860509SRico Sonntag I18N::translate('Males'), 1341b860509SRico Sonntag I18N::translate('Females'), 1351b860509SRico Sonntag I18N::translate('Average age'), 1361b860509SRico Sonntag ] 1371b860509SRico Sonntag]; 1381b860509SRico Sonntag 139dd6b2bfcSGreg Roach?> 140dd6b2bfcSGreg Roach 14132a5dd8dSGreg Roach<div id="<?= e($table_id) ?>"> 14232a5dd8dSGreg Roach <table class="table table-bordered table-sm wt-table-family" 143b6c326d8SGreg Roach <?= view('lists/datatables-attributes') ?> 144b6c326d8SGreg Roach > 145dd6b2bfcSGreg Roach <thead> 146dd6b2bfcSGreg Roach <tr> 147dd6b2bfcSGreg Roach <th colspan="14"> 148dd6b2bfcSGreg Roach <div class="btn-toolbar d-flex justify-content-between mb-2"> 149604bfd4bSGreg Roach <div class="btn-group btn-group-toggle btn-group-sm" data-toggle="buttons"> 150*af8b52f0SGreg Roach <label class="btn btn-outline-secondary btn-sm" title="' . I18N::translate('Show individuals who are alive or couples where both partners are alive.') ?>"> 151604bfd4bSGreg Roach <input type="checkbox" data-filter-column="12" data-filter-value="N"> 152dd6b2bfcSGreg Roach <?= I18N::translate('Both alive') ?> 153604bfd4bSGreg Roach </label> 154*af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show couples where only the female partner is dead.') ?>"> 155604bfd4bSGreg Roach <input type="checkbox" data-filter-column="12" data-filter-value="W"> 156dd6b2bfcSGreg Roach <?= I18N::translate('Widower') ?> 157604bfd4bSGreg Roach </label> 158*af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show couples where only the male partner is dead.') ?>"> 159604bfd4bSGreg Roach <input type="checkbox" data-filter-column="12" data-filter-value="H"> 160dd6b2bfcSGreg Roach <?= I18N::translate('Widow') ?> 161604bfd4bSGreg Roach </label> 162*af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals who are dead or couples where both partners are dead.') ?>"> 163604bfd4bSGreg Roach <input type="checkbox" data-filter-column="12" data-filter-value="Y"> 164dd6b2bfcSGreg Roach <?= I18N::translate('Both dead') ?> 165604bfd4bSGreg Roach </label> 166dd6b2bfcSGreg Roach </div> 167604bfd4bSGreg Roach 168604bfd4bSGreg Roach <div class="btn-group btn-group-toggle btn-group-sm" data-toggle="buttons"> 169*af8b52f0SGreg 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.') ?>"> 170604bfd4bSGreg Roach <input type="checkbox" data-filter-column="13" data-filter-value="R"> 171dd6b2bfcSGreg Roach <?= I18N::translate('Roots') ?> 172604bfd4bSGreg Roach </label> 173*af8b52f0SGreg 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.') ?>"> 174604bfd4bSGreg Roach <input type="checkbox" data-filter-column="13" data-filter-value="L"> 175dd6b2bfcSGreg Roach <?= I18N::translate('Leaves') ?> 176604bfd4bSGreg Roach </label> 177dd6b2bfcSGreg Roach </div> 178604bfd4bSGreg Roach 179604bfd4bSGreg Roach <div class="btn-group btn-group-toggle btn-group-sm" data-toggle="buttons"> 180*af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show couples with an unknown marriage date.') ?>"> 181604bfd4bSGreg Roach <input type="checkbox" data-filter-column="11" data-filter-value="U"> 182b9597e06SGreg Roach <?= I18N::translate('Not married') ?> 183604bfd4bSGreg Roach </label> 184*af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show couples who married more than 100 years ago.') ?>"> 185604bfd4bSGreg Roach <input type="checkbox" data-filter-column="11" data-filter-value="YES"> 186dd6b2bfcSGreg Roach <?= I18N::translate('Marriage') ?>>100 187604bfd4bSGreg Roach </label> 188*af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show couples who married within the last 100 years.') ?>"> 189604bfd4bSGreg Roach <input type="checkbox" data-filter-column="11" data-filter-value="Y100"> 190dd6b2bfcSGreg Roach <?= I18N::translate('Marriage') ?><=100 191604bfd4bSGreg Roach </label> 192*af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show divorced couples.') ?>"> 193604bfd4bSGreg Roach <input type="checkbox" data-filter-column="11" data-filter-value="D"> 194dd6b2bfcSGreg Roach <?= I18N::translate('Divorce') ?> 195604bfd4bSGreg Roach </label> 196*af8b52f0SGreg Roach <label class="btn btn-outline-secondary" title="<?= I18N::translate('Show couples where either partner married more than once.') ?>"> 197604bfd4bSGreg Roach <input type="checkbox" data-filter-column="11" data-filter-value="M"> 198dd6b2bfcSGreg Roach <?= I18N::translate('Multiple marriages') ?> 199604bfd4bSGreg Roach </label> 200dd6b2bfcSGreg Roach </div> 201dd6b2bfcSGreg Roach </div> 202dd6b2bfcSGreg Roach </th> 203dd6b2bfcSGreg Roach </tr> 204dd6b2bfcSGreg Roach <tr> 205dd6b2bfcSGreg Roach <th><?= I18N::translate('Given names') ?></th> 206dd6b2bfcSGreg Roach <th><?= I18N::translate('Surname') ?></th> 207dd6b2bfcSGreg Roach <th><?= I18N::translate('Age') ?></th> 208dd6b2bfcSGreg Roach <th><?= I18N::translate('Given names') ?></th> 209dd6b2bfcSGreg Roach <th><?= I18N::translate('Surname') ?></th> 210dd6b2bfcSGreg Roach <th><?= I18N::translate('Age') ?></th> 211dd6b2bfcSGreg Roach <th><?= I18N::translate('Marriage') ?></th> 212e39fd5c6SGreg Roach <th> 213e39fd5c6SGreg Roach <span title="<?= I18N::translate('Anniversary') ?>"> 214e39fd5c6SGreg Roach <?= view('icons/anniversary') ?> 215e39fd5c6SGreg Roach </span> 216e39fd5c6SGreg Roach </th> 217dd6b2bfcSGreg Roach <th><?= I18N::translate('Place') ?></th> 218dd6b2bfcSGreg Roach <th><i class="icon-children" title="<?= I18N::translate('Children') ?>"></i></th> 219dd6b2bfcSGreg Roach <th><?= I18N::translate('Last change') ?></th> 220dd6b2bfcSGreg Roach <th hidden></th> 221dd6b2bfcSGreg Roach <th hidden></th> 222dd6b2bfcSGreg Roach <th hidden></th> 223dd6b2bfcSGreg Roach </tr> 224dd6b2bfcSGreg Roach </thead> 225dd6b2bfcSGreg Roach 226dd6b2bfcSGreg Roach <tbody> 227dd6b2bfcSGreg Roach <?php foreach ($families as $family) : ?> 22839ca88baSGreg Roach <?php $husb = $family->husband() ?? new Individual('H', '0 @H@ INDI', null, $family->tree()) ?> 22939ca88baSGreg Roach <?php $wife = $family->wife() ?? new Individual('W', '0 @W@ INDI', null, $family->tree()) ?> 230dd6b2bfcSGreg Roach 23117dd427eSGreg Roach <tr class="<?= $family->isPendingDeletion() ? 'wt-old' : ($family->isPendingAddition() ? 'wt-new' : '') ?>"> 232dd6b2bfcSGreg Roach <!-- Husband name --> 23339ca88baSGreg Roach <td colspan="2" data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', implode(',', array_reverse(explode(',', $husb->sortName()))))) ?>"> 234dd6b2bfcSGreg Roach <?php foreach ($husb->getAllNames() as $num => $name) : ?> 23522d65e5aSGreg Roach <?php if ($name['type'] !== '_MARNM' || $num == $husb->getPrimaryName()) : ?> 236e840bf40SGreg Roach <a title="<?= $name['type'] === 'NAME' ? '' : strip_tags(GedcomTag::getLabel($name['type'], $husb)) ?>" href="<?= e($family->url()) ?>" class="<?= $num === $husb->getPrimaryName() ? 'name2' : '' ?>"> 237dd6b2bfcSGreg Roach <?= $name['full'] ?> 238dd6b2bfcSGreg Roach </a> 239dd6b2bfcSGreg Roach <?php if ($num === $husb->getPrimaryName()) : ?> 24008362db4SGreg Roach <small><?= view('icons/sex', ['sex' => $husb->sex()]) ?></small> 241dd6b2bfcSGreg Roach <?php endif ?> 242dd6b2bfcSGreg Roach <br> 243dd6b2bfcSGreg Roach <?php endif ?> 244dd6b2bfcSGreg Roach <?php endforeach ?> 2455e6816beSGreg Roach <?= view('lists/individual-table-parents', ['individual' => $husb]) ?> 246dd6b2bfcSGreg Roach </td> 247dd6b2bfcSGreg Roach 24839ca88baSGreg Roach <td hidden data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', $husb->sortName())) ?>"></td> 249dd6b2bfcSGreg Roach 250dd6b2bfcSGreg Roach <!-- Husband age --> 251dd6b2bfcSGreg Roach <?php 252dd6b2bfcSGreg Roach $mdate = $family->getMarriageDate(); 253dd6b2bfcSGreg Roach $hdate = $husb->getBirthDate(); 254dd6b2bfcSGreg Roach if ($hdate->isOK() && $mdate->isOK()) { 255dd6b2bfcSGreg Roach if ($hdate->gregorianYear() >= 1550 && $hdate->gregorianYear() < 2030) { 2561b860509SRico Sonntag ++$birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10][$husb->sex()]; 257dd6b2bfcSGreg Roach } 258dd6b2bfcSGreg Roach $hage = Date::getAgeYears($hdate, $mdate); 259dd6b2bfcSGreg Roach if ($hage >= 0 && $hage <= $max_age) { 2601b860509SRico Sonntag ++$marr_by_age[$hage][$husb->sex()]; 261dd6b2bfcSGreg Roach } 262dd6b2bfcSGreg Roach } 263dd6b2bfcSGreg Roach ?> 264242a7862SGreg Roach <td class="text-center" data-sort="<?= Date::getAgeDays($hdate, $mdate) ?>"> 265dd6b2bfcSGreg Roach <?= Date::getAge($hdate, $mdate) ?> 266dd6b2bfcSGreg Roach </td> 267dd6b2bfcSGreg Roach 268dd6b2bfcSGreg Roach <!-- Wife name --> 26939ca88baSGreg Roach <td colspan="2" data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', implode(',', array_reverse(explode(',', $wife->sortName()))))) ?>"> 270dd6b2bfcSGreg Roach <?php foreach ($wife->getAllNames() as $num => $name) : ?> 27122d65e5aSGreg Roach <?php if ($name['type'] !== '_MARNM' || $num == $wife->getPrimaryName()) : ?> 272e840bf40SGreg Roach <a title="<?= $name['type'] === 'NAME' ? '' : strip_tags(GedcomTag::getLabel($name['type'], $wife)) ?>" href="<?= e($family->url()) ?>" class="<?= $num === $wife->getPrimaryName() ? 'name2' : '' ?>"> 273dd6b2bfcSGreg Roach <?= $name['full'] ?> 274dd6b2bfcSGreg Roach </a> 275dd6b2bfcSGreg Roach <?php if ($num === $wife->getPrimaryName()) : ?> 27608362db4SGreg Roach <small><?= view('icons/sex', ['sex' => $wife->sex()]) ?></small> 277dd6b2bfcSGreg Roach <?php endif ?> 278dd6b2bfcSGreg Roach <br> 279dd6b2bfcSGreg Roach <?php endif ?> 280dd6b2bfcSGreg Roach <?php endforeach ?> 2815e6816beSGreg Roach <?= view('lists/individual-table-parents', ['individual' => $wife]) ?> 282dd6b2bfcSGreg Roach </td> 283dd6b2bfcSGreg Roach 28439ca88baSGreg Roach <td hidden data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', $wife->sortName())) ?>"></td> 285dd6b2bfcSGreg Roach 286dd6b2bfcSGreg Roach <!-- Wife age --> 287dd6b2bfcSGreg Roach <?php 288dd6b2bfcSGreg Roach $wdate = $wife->getBirthDate(); 289dd6b2bfcSGreg Roach if ($wdate->isOK() && $mdate->isOK()) { 290dd6b2bfcSGreg Roach if ($wdate->gregorianYear() >= 1550 && $wdate->gregorianYear() < 2030) { 2911b860509SRico Sonntag ++$birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10][$wife->sex()]; 292dd6b2bfcSGreg Roach } 293dd6b2bfcSGreg Roach $wage = Date::getAgeYears($wdate, $mdate); 294dd6b2bfcSGreg Roach if ($wage >= 0 && $wage <= $max_age) { 2951b860509SRico Sonntag ++$marr_by_age[$wage][$wife->sex()]; 296dd6b2bfcSGreg Roach } 297dd6b2bfcSGreg Roach } 298dd6b2bfcSGreg Roach ?> 299dd6b2bfcSGreg Roach 300242a7862SGreg Roach <td class="text-center" data-sort="<?= Date::getAgeDays($wdate, $mdate) ?>"> 301dd6b2bfcSGreg Roach <?= Date::getAge($wdate, $mdate) ?> 302dd6b2bfcSGreg Roach </td> 303dd6b2bfcSGreg Roach 304dd6b2bfcSGreg Roach <!-- Marriage date --> 305dd6b2bfcSGreg Roach <td data-sort="<?= $family->getMarriageDate()->julianDay() ?>"> 306dd6b2bfcSGreg Roach <?php if ($marriage_dates = $family->getAllMarriageDates()) : ?> 307dd6b2bfcSGreg Roach <?php foreach ($marriage_dates as $n => $marriage_date) : ?> 308dd6b2bfcSGreg Roach <div><?= $marriage_date->display(true) ?></div> 309dd6b2bfcSGreg Roach <?php endforeach ?> 310dd6b2bfcSGreg Roach <?php if ($marriage_dates[0]->gregorianYear() >= 1550 && $marriage_dates[0]->gregorianYear() < 2030) : ?> 3111b860509SRico Sonntag <?php 3121b860509SRico Sonntag ++$marr_by_decade[(int) ($marriage_dates[0]->gregorianYear() / 10) * 10][$husb->sex()]; 3131b860509SRico Sonntag ++$marr_by_decade[(int) ($marriage_dates[0]->gregorianYear() / 10) * 10][$wife->sex()]; 3141b860509SRico Sonntag ?> 315dd6b2bfcSGreg Roach <?php endif ?> 31639ca88baSGreg Roach <?php elseif ($family->facts(['_NMR'])->isNotEmpty()) : ?> 317dd6b2bfcSGreg Roach <?= I18N::translate('no') ?> 31839ca88baSGreg Roach <?php elseif ($family->facts(['MARR'])->isNotEmpty()) : ?> 319dd6b2bfcSGreg Roach <?= I18N::translate('yes') ?> 320dd6b2bfcSGreg Roach <?php endif ?> 321dd6b2bfcSGreg Roach </td> 322dd6b2bfcSGreg Roach 323dd6b2bfcSGreg Roach <!-- Marriage anniversary --> 324242a7862SGreg Roach <td class="text-center" data-sort="<?= - $family->getMarriageDate()->julianDay() ?>"> 325dd6b2bfcSGreg Roach <?= Date::getAge($family->getMarriageDate(), null) ?> 326dd6b2bfcSGreg Roach </td> 327dd6b2bfcSGreg Roach 328dd6b2bfcSGreg Roach <!-- Marriage place --> 329dd6b2bfcSGreg Roach <td> 330dd6b2bfcSGreg Roach <?php foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) : ?> 331392561bbSGreg Roach <?= $marriage_place->shortName(true) ?> 332dd6b2bfcSGreg Roach <br> 333dd6b2bfcSGreg Roach <?php endforeach ?> 334dd6b2bfcSGreg Roach </td> 335dd6b2bfcSGreg Roach 336dd6b2bfcSGreg Roach <!-- Number of children --> 33739ca88baSGreg Roach <td class="text-center" data-sort="<?= $family->numberOfChildren() ?>"> 33839ca88baSGreg Roach <?= I18N::number($family->numberOfChildren()) ?> 339dd6b2bfcSGreg Roach </td> 340dd6b2bfcSGreg Roach 341dd6b2bfcSGreg Roach <!-- Last change --> 3424459dc9aSGreg Roach <td data-sort="<?= $family->lastChangeTimestamp()->unix() ?>"> 3434459dc9aSGreg Roach <?= view('components/datetime', ['timestamp' => $family->lastChangeTimestamp()]) ?> 344dd6b2bfcSGreg Roach </td> 345dd6b2bfcSGreg Roach 346dd6b2bfcSGreg Roach <!-- Filter by marriage date --> 347dd6b2bfcSGreg Roach <td hidden> 348b9597e06SGreg Roach <?php if ($mdate->maximumJulianDay() > $hundred_years_ago && $mdate->maximumJulianDay() <= $today_jd) : ?> 349dd6b2bfcSGreg Roach Y100 350b9597e06SGreg Roach <?php elseif ($family->facts(['MARR'])->isNotEmpty()) : ?> 351dd6b2bfcSGreg Roach YES 352b9597e06SGreg Roach <?php else : ?> 353b9597e06SGreg Roach U 354dd6b2bfcSGreg Roach <?php endif ?> 355b9597e06SGreg Roach <?php if ($family->facts(['DIV'])->isNotEmpty()) : ?> 356dd6b2bfcSGreg Roach D 357dd6b2bfcSGreg Roach <?php endif ?> 35839ca88baSGreg Roach <?php if (count($husb->spouseFamilies()) > 1 || count($wife->spouseFamilies()) > 1) : ?> 359dd6b2bfcSGreg Roach M 360dd6b2bfcSGreg Roach <?php endif ?> 361dd6b2bfcSGreg Roach </td> 362dd6b2bfcSGreg Roach 363dd6b2bfcSGreg Roach <!-- Filter by alive/dead --> 364dd6b2bfcSGreg Roach <td hidden> 365dd6b2bfcSGreg Roach <?php if ($husb->isDead() && $wife->isDead()) : ?> 366dd6b2bfcSGreg Roach Y 367dd6b2bfcSGreg Roach <?php endif ?> 368dd6b2bfcSGreg Roach <?php if ($husb->isDead() && !$wife->isDead()) : ?> 36922d65e5aSGreg Roach <?php if ($wife->sex() === 'F') : ?> 370dd6b2bfcSGreg Roach H 371dd6b2bfcSGreg Roach <?php endif ?> 37222d65e5aSGreg Roach <?php if ($wife->sex() === 'M') : ?> 373dd6b2bfcSGreg Roach W 374dd6b2bfcSGreg Roach <?php endif ?> 375dd6b2bfcSGreg Roach <?php endif ?> 376dd6b2bfcSGreg Roach <?php if (!$husb->isDead() && $wife->isDead()) : ?> 37722d65e5aSGreg Roach <?php if ($husb->sex() === 'M') : ?> 378dd6b2bfcSGreg Roach W 379dd6b2bfcSGreg Roach <?php endif ?> 38022d65e5aSGreg Roach <?php if ($husb->sex() === 'F') : ?> 381dd6b2bfcSGreg Roach H 382dd6b2bfcSGreg Roach <?php endif ?> 383dd6b2bfcSGreg Roach <?php endif ?> 384dd6b2bfcSGreg Roach <?php if (!$husb->isDead() && !$wife->isDead()) : ?> 385dd6b2bfcSGreg Roach N 386dd6b2bfcSGreg Roach <?php endif ?> 387dd6b2bfcSGreg Roach </td> 388dd6b2bfcSGreg Roach 389dd6b2bfcSGreg Roach <!-- Filter by roots/leaves --> 390dd6b2bfcSGreg Roach <td hidden> 39139ca88baSGreg Roach <?php if (!$husb->childFamilies() && !$wife->childFamilies()) : ?> 392dd6b2bfcSGreg Roach R 39339ca88baSGreg Roach <?php elseif (!$husb->isDead() && !$wife->isDead() && $family->numberOfChildren() === 0) : ?> 394dd6b2bfcSGreg Roach L 395dd6b2bfcSGreg Roach <?php endif ?> 396dd6b2bfcSGreg Roach </td> 397dd6b2bfcSGreg Roach </tr> 398dd6b2bfcSGreg Roach <?php endforeach ?> 399dd6b2bfcSGreg Roach </tbody> 4007039fd97SGreg Roach 4017039fd97SGreg Roach <tfoot> 4027039fd97SGreg Roach <tr> 4037039fd97SGreg Roach <th colspan="14"> 404604bfd4bSGreg Roach <div class="btn-group btn-group-sm"> 405*af8b52f0SGreg Roach <button id="btn-toggle-parents" class="btn btn-outline-secondary" data-toggle="button" data-persist="show-parents"> 4067039fd97SGreg Roach <?= I18N::translate('Show parents') ?> 4077039fd97SGreg Roach </button> 408*af8b52f0SGreg Roach <button id="btn-toggle-statistics" class="btn btn-outline-secondary" data-toggle="button" data-persist="show-statistics"> 4097039fd97SGreg Roach <?= I18N::translate('Show statistics charts') ?> 4107039fd97SGreg Roach </button> 4117039fd97SGreg Roach </div> 4127039fd97SGreg Roach </th> 4137039fd97SGreg Roach </tr> 4147039fd97SGreg Roach </tfoot> 415dd6b2bfcSGreg Roach </table> 4161b860509SRico Sonntag</div> 417dd6b2bfcSGreg Roach 4181b860509SRico Sonntag<div id="family-charts-<?= e($table_id) ?>" style="display: none;"> 4191b860509SRico Sonntag <div class="mb-3"> 4201b860509SRico Sonntag <div class="card-deck"> 4211b860509SRico Sonntag <div class="col-lg-12 col-md-12 mb-3"> 4221b860509SRico Sonntag <div class="card m-0"> 4231b860509SRico Sonntag <div class="card-header"> 4241b860509SRico Sonntag <?= I18N::translate('Decade of birth') ?> 4251b860509SRico Sonntag </div><div class="card-body"> 4261b860509SRico Sonntag <?php 4271b860509SRico Sonntag foreach ($birt_by_decade as $century => $values) { 4281b860509SRico Sonntag if (($values['M'] + $values['F']) > 0) { 4291b860509SRico Sonntag $birthData[] = [ 4301b860509SRico Sonntag [ 4311b860509SRico Sonntag 'v' => 'Date(' . $century . ', 0, 1)', 4321b860509SRico Sonntag 'f' => $century, 4331b860509SRico Sonntag ], 4341b860509SRico Sonntag $values['M'], 4351b860509SRico Sonntag $values['F'], 4361b860509SRico Sonntag ]; 4371b860509SRico Sonntag } 4381b860509SRico Sonntag } 4391b860509SRico Sonntag ?> 4401b860509SRico Sonntag <?= view('lists/chart-by-decade', ['data' => $birthData, 'title' => I18N::translate('Decade of birth')]) ?> 4411b860509SRico Sonntag </div> 4421b860509SRico Sonntag </div> 4431b860509SRico Sonntag </div> 4441b860509SRico Sonntag </div> 4451b860509SRico Sonntag <div class="card-deck"> 4461b860509SRico Sonntag <div class="col-lg-12 col-md-12 mb-3"> 4471b860509SRico Sonntag <div class="card m-0"> 4481b860509SRico Sonntag <div class="card-header"> 4491b860509SRico Sonntag <?= I18N::translate('Decade of marriage') ?> 4501b860509SRico Sonntag </div><div class="card-body"> 4511b860509SRico Sonntag <?php 4521b860509SRico Sonntag foreach ($marr_by_decade as $century => $values) { 4531b860509SRico Sonntag if (($values['M'] + $values['F']) > 0) { 4541b860509SRico Sonntag $marriageData[] = [ 4551b860509SRico Sonntag [ 4561b860509SRico Sonntag 'v' => 'Date(' . $century . ', 0, 1)', 4571b860509SRico Sonntag 'f' => $century, 4581b860509SRico Sonntag ], 4591b860509SRico Sonntag $values['M'], 4601b860509SRico Sonntag $values['F'], 4611b860509SRico Sonntag ]; 4621b860509SRico Sonntag } 4631b860509SRico Sonntag } 4641b860509SRico Sonntag ?> 4651b860509SRico Sonntag <?= view('lists/chart-by-decade', ['data' => $marriageData, 'title' => I18N::translate('Decade of marriage')]) ?> 4661b860509SRico Sonntag </div> 4671b860509SRico Sonntag </div> 4681b860509SRico Sonntag </div> 4691b860509SRico Sonntag </div> 4701b860509SRico Sonntag <div class="card-deck"> 4711b860509SRico Sonntag <div class="col-lg-12 col-md-12 mb-3"> 4721b860509SRico Sonntag <div class="card m-0"> 4731b860509SRico Sonntag <div class="card-header"> 4741b860509SRico Sonntag <?= I18N::translate('Age in year of marriage') ?> 4751b860509SRico Sonntag </div> 4761b860509SRico Sonntag <div class="card-body"> 4771b860509SRico Sonntag <?php 4781b860509SRico Sonntag $totalAge = 0; 4791b860509SRico Sonntag $totalSum = 0; 4801b860509SRico Sonntag $max = 0; 4811b860509SRico Sonntag 4821b860509SRico Sonntag foreach ($marr_by_age as $age => $values) { 4831b860509SRico Sonntag if (($values['M'] + $values['F']) > 0) { 4841b860509SRico Sonntag if (($values['M'] + $values['F']) > $max) { 4851b860509SRico Sonntag $max = $values['M'] + $values['F']; 4861b860509SRico Sonntag } 4871b860509SRico Sonntag 4881b860509SRico Sonntag $totalAge += $age * ($values['M'] + $values['F']); 4891b860509SRico Sonntag $totalSum += $values['M'] + $values['F']; 4901b860509SRico Sonntag 4911b860509SRico Sonntag $marriageAgeData[] = [ 4921b860509SRico Sonntag $age, 4931b860509SRico Sonntag $values['M'], 4941b860509SRico Sonntag $values['F'], 4951b860509SRico Sonntag null, 4961b860509SRico Sonntag ]; 4971b860509SRico Sonntag } 4981b860509SRico Sonntag } 4991b860509SRico Sonntag 5001b860509SRico Sonntag if ($totalSum > 0) { 5011b860509SRico Sonntag $marriageAgeData[] = [ 5021b860509SRico Sonntag round($totalAge / $totalSum, 1), 5031b860509SRico Sonntag null, 5041b860509SRico Sonntag null, 5051b860509SRico Sonntag 0, 5061b860509SRico Sonntag ]; 5071b860509SRico Sonntag 5081b860509SRico Sonntag $marriageAgeData[] = [ 5091b860509SRico Sonntag round($totalAge / $totalSum, 1), 5101b860509SRico Sonntag null, 5111b860509SRico Sonntag null, 5121b860509SRico Sonntag $max, 5131b860509SRico Sonntag ]; 5141b860509SRico Sonntag } 5151b860509SRico Sonntag ?> 5161b860509SRico Sonntag <?= view('lists/chart-by-age', ['data' => $marriageAgeData, 'title' => I18N::translate('Age in year of marriage')]) ?> 5171b860509SRico Sonntag </div> 5181b860509SRico Sonntag </div> 5191b860509SRico Sonntag </div> 5201b860509SRico Sonntag </div> 521dd6b2bfcSGreg Roach </div> 522dd6b2bfcSGreg Roach</div> 523