xref: /webtrees/resources/views/lists/families-table.phtml (revision 242a78626998a767db1568b24919e94ae4b38ac3)
1dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Date; ?>
28d0ebef0SGreg Roach<?php use Fisharebest\Webtrees\Gedcom; ?>
3dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\GedcomTag; ?>
4dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?>
5dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Individual; ?>
6dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\View; ?>
7dd6b2bfcSGreg Roach<?php use Ramsey\Uuid\Uuid; ?>
8dd6b2bfcSGreg Roach
9dd6b2bfcSGreg Roach<?php
10dd6b2bfcSGreg Roach$table_id = 'table-fam-' . Uuid::uuid4()->toString(); // lists requires a unique ID in case there are multiple lists per page
11dd6b2bfcSGreg Roach$hundred_years_ago = new Date(date('Y') - 100);
12dd6b2bfcSGreg Roach?>
13dd6b2bfcSGreg Roach
14dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
15dd6b2bfcSGreg Roach<script>
16dd6b2bfcSGreg Roach    $("#<?= e($table_id) ?>").dataTable( {
17dd6b2bfcSGreg Roachdom: '<"H"<"filtersH_<?= e($table_id) ?>"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_<?= e($table_id) ?>">>',
18dd6b2bfcSGreg Roach<?= I18N::datatablesI18N() ?>,
19dd6b2bfcSGreg RoachautoWidth: false,
20dd6b2bfcSGreg Roachprocessing: true,
21dd6b2bfcSGreg Roachretrieve: true,
22dd6b2bfcSGreg Roachcolumns: [
23dd6b2bfcSGreg Roach/* Given names         */ { type: "text" },
24dd6b2bfcSGreg Roach/* Surnames            */ { type: "text" },
25dd6b2bfcSGreg Roach/* Age                 */ { type: "num" },
26dd6b2bfcSGreg Roach/* Given names         */ { type: "text" },
27dd6b2bfcSGreg Roach/* Surnames            */ { type: "text" },
28dd6b2bfcSGreg Roach/* Age                 */ { type: "num" },
29dd6b2bfcSGreg Roach/* Marriage date       */ { type: "num" },
30dd6b2bfcSGreg Roach/* Anniversary         */ { type: "num" },
31dd6b2bfcSGreg Roach/* Marriage place      */ { type: "text" },
32dd6b2bfcSGreg Roach/* Children            */ { type: "num" },
33dd6b2bfcSGreg Roach/* Last change         */ { visible: <?= json_encode((bool) $tree->getPreference('SHOW_LAST_CHANGE')) ?> },
34dd6b2bfcSGreg Roach/* Filter marriage     */ { sortable: false },
35dd6b2bfcSGreg Roach/* Filter alive/dead   */ { sortable: false },
36dd6b2bfcSGreg Roach/* Filter tree         */ { sortable: false }
37dd6b2bfcSGreg Roach],
38dd6b2bfcSGreg Roachsorting: [[1, "asc"]],
39dd6b2bfcSGreg RoachdisplayLength: 20,
40dd6b2bfcSGreg RoachpagingType: "full_numbers"
41dd6b2bfcSGreg Roach})
42dd6b2bfcSGreg Roach/* Hide/show parents */
43dd6b2bfcSGreg Roach.on("click", ".btn-toggle-parents", function() {
44dd6b2bfcSGreg Roach$(this).toggleClass("ui-state-active");
45dd6b2bfcSGreg Roach$(".parents", $(this).closest("table").DataTable().rows().nodes()).slideToggle();
46dd6b2bfcSGreg Roach})
47dd6b2bfcSGreg Roach/* Hide/show statistics */
48dd6b2bfcSGreg Roach.on("click", ".btn-toggle-statistics", function() {
49dd6b2bfcSGreg Roach$(this).toggleClass("ui-state-active");
50dd6b2bfcSGreg Roach$("#family-charts-<?= e($table_id) ?>").slideToggle();
51dd6b2bfcSGreg Roach})
52dd6b2bfcSGreg Roach/* Filter buttons in table header */
53dd6b2bfcSGreg Roach.on("click", "button[data-filter-column]", function() {
54dd6b2bfcSGreg Roachvar btn = $(this);
55dd6b2bfcSGreg Roach// De-activate the other buttons in this button group
56dd6b2bfcSGreg Roachbtn.siblings().removeClass("active");
57dd6b2bfcSGreg Roach// Apply (or clear) this filter
58dd6b2bfcSGreg Roachvar col = $("#<?= e($table_id) ?>").DataTable().column(btn.data("filter-column"));
59dd6b2bfcSGreg Roachif (btn.hasClass("active")) {
60dd6b2bfcSGreg Roachcol.search("").draw();
61dd6b2bfcSGreg Roach} else {
62dd6b2bfcSGreg Roachcol.search(btn.data("filter-value")).draw();
63dd6b2bfcSGreg Roach}
64dd6b2bfcSGreg Roach});
65dd6b2bfcSGreg Roach</script>
66dd6b2bfcSGreg Roach<?php View::endpush() ?>
67dd6b2bfcSGreg Roach
68dd6b2bfcSGreg Roach<?php
69dd6b2bfcSGreg Roach$max_age = (int) $tree->getPreference('MAX_ALIVE_AGE');
70dd6b2bfcSGreg Roach
71dd6b2bfcSGreg Roach// init chart data
72dd6b2bfcSGreg Roach$marr_by_age = [];
73dd6b2bfcSGreg Roachfor ($age = 0; $age <= $max_age; $age++) {
74dd6b2bfcSGreg Roach    $marr_by_age[$age] = '';
75dd6b2bfcSGreg Roach}
76dd6b2bfcSGreg Roach$birt_by_decade = [];
77dd6b2bfcSGreg Roach$marr_by_decade = [];
78dd6b2bfcSGreg Roachfor ($year = 1550; $year < 2030; $year += 10) {
79dd6b2bfcSGreg Roach    $birt_by_decade[$year] = '';
80dd6b2bfcSGreg Roach    $marr_by_decade[$year] = '';
81dd6b2bfcSGreg Roach}
82dd6b2bfcSGreg Roach?>
83dd6b2bfcSGreg Roach
84dd6b2bfcSGreg Roach<div class="fam-list">
85dd6b2bfcSGreg Roach    <table id="<?= e($table_id) ?>">
86dd6b2bfcSGreg Roach        <thead>
87dd6b2bfcSGreg Roach            <tr>
88dd6b2bfcSGreg Roach                <th colspan="14">
89dd6b2bfcSGreg Roach                    <div class="btn-toolbar d-flex justify-content-between mb-2">
90dd6b2bfcSGreg Roach                        <div class="btn-group" data-toggle="buttons">
91dd6b2bfcSGreg Roach                            <button
92dd6b2bfcSGreg Roach                                class="btn btn-secondary"
93dd6b2bfcSGreg Roach                                data-filter-column="12"
94dd6b2bfcSGreg Roach                                data-filter-value="N"
95dd6b2bfcSGreg Roach                                title="' . I18N::translate('Show individuals who are alive or couples where both partners are alive.') ?>"
96dd6b2bfcSGreg Roach                            >
97dd6b2bfcSGreg Roach                                <?= I18N::translate('Both alive') ?>
98dd6b2bfcSGreg Roach                            </button>
99dd6b2bfcSGreg Roach                            <button
100dd6b2bfcSGreg Roach                                class="btn btn-secondary"
101dd6b2bfcSGreg Roach                                data-filter-column="12"
102dd6b2bfcSGreg Roach                                data-filter-value="W"
103dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show couples where only the female partner is dead.') ?>"
104dd6b2bfcSGreg Roach                            >
105dd6b2bfcSGreg Roach                                <?= I18N::translate('Widower') ?>
106dd6b2bfcSGreg Roach                            </button>
107dd6b2bfcSGreg Roach                            <button
108dd6b2bfcSGreg Roach                                class="btn btn-secondary"
109dd6b2bfcSGreg Roach                                data-filter-column="12"
110dd6b2bfcSGreg Roach                                data-filter-value="H"
111dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show couples where only the male partner is dead.') ?>"
112dd6b2bfcSGreg Roach                            >
113dd6b2bfcSGreg Roach                                <?= I18N::translate('Widow') ?>
114dd6b2bfcSGreg Roach                            </button>
115dd6b2bfcSGreg Roach                            <button
116dd6b2bfcSGreg Roach                                class="btn btn-secondary"
117dd6b2bfcSGreg Roach                                data-filter-column="12"
118dd6b2bfcSGreg Roach                                data-filter-value="Y"
119dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show individuals who are dead or couples where both partners are dead.') ?>"
120dd6b2bfcSGreg Roach                            >
121dd6b2bfcSGreg Roach                                <?= I18N::translate('Both dead') ?>
122dd6b2bfcSGreg Roach                            </button>
123dd6b2bfcSGreg Roach                        </div>
124dd6b2bfcSGreg Roach                        <div class="btn-group" data-toggle="buttons">
125dd6b2bfcSGreg Roach                            <button
126dd6b2bfcSGreg Roach                                class="btn btn-secondary"
127dd6b2bfcSGreg Roach                                data-filter-column="13"
128dd6b2bfcSGreg Roach                                data-filter-value="R"
129dd6b2bfcSGreg 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.') ?>"
130dd6b2bfcSGreg Roach                            >
131dd6b2bfcSGreg Roach                                <?= I18N::translate('Roots') ?>
132dd6b2bfcSGreg Roach                            </button>
133dd6b2bfcSGreg Roach                            <button
134dd6b2bfcSGreg Roach                                class="btn btn-secondary"
135dd6b2bfcSGreg Roach                                data-filter-column="13"
136dd6b2bfcSGreg Roach                                data-filter-value="L"
137dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show “leaves” couples or individuals. These are individuals who are alive but have no children recorded in the database.') ?>"
138dd6b2bfcSGreg Roach                            >
139dd6b2bfcSGreg Roach                                <?= I18N::translate('Leaves') ?>
140dd6b2bfcSGreg Roach                            </button>
141dd6b2bfcSGreg Roach                        </div>
142dd6b2bfcSGreg Roach                        <div class="btn-group" data-toggle="buttons">
143dd6b2bfcSGreg Roach                            <button
144dd6b2bfcSGreg Roach                                class="btn btn-secondary"
145dd6b2bfcSGreg Roach                                data-filter-column="11"
146dd6b2bfcSGreg Roach                                data-filter-value="U"
147dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show couples with an unknown marriage date.') ?>"
148dd6b2bfcSGreg Roach                            >
149dd6b2bfcSGreg Roach                                <?= I18N::translate('Marriage') ?>
150dd6b2bfcSGreg Roach                            </button>
151dd6b2bfcSGreg Roach                            <button
152dd6b2bfcSGreg Roach                                class="btn btn-secondary"
153dd6b2bfcSGreg Roach                                data-filter-column="11"
154dd6b2bfcSGreg Roach                                data-filter-value="YES"
155dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show couples who married more than 100 years ago.') ?>"
156dd6b2bfcSGreg Roach                            >
157dd6b2bfcSGreg Roach                                <?= I18N::translate('Marriage') ?>&gt;100
158dd6b2bfcSGreg Roach                            </button>
159dd6b2bfcSGreg Roach                            <button
160dd6b2bfcSGreg Roach                                class="btn btn-secondary"
161dd6b2bfcSGreg Roach                                data-filter-column="11"
162dd6b2bfcSGreg Roach                                data-filter-value="Y100"
163dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show couples who married within the last 100 years.') ?>"
164dd6b2bfcSGreg Roach                            >
165dd6b2bfcSGreg Roach                                <?= I18N::translate('Marriage') ?>&lt;=100
166dd6b2bfcSGreg Roach                            </button>
167dd6b2bfcSGreg Roach                            <button
168dd6b2bfcSGreg Roach                                class="btn btn-secondary"
169dd6b2bfcSGreg Roach                                data-filter-column="11"
170dd6b2bfcSGreg Roach                                data-filter-value="D"
171dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show divorced couples.') ?>"
172dd6b2bfcSGreg Roach                            >
173dd6b2bfcSGreg Roach                                <?= I18N::translate('Divorce') ?>
174dd6b2bfcSGreg Roach                            </button>
175dd6b2bfcSGreg Roach                            <button
176dd6b2bfcSGreg Roach                                class="btn btn-secondary"
177dd6b2bfcSGreg Roach                                data-filter-column="11"
178dd6b2bfcSGreg Roach                                data-filter-value="M"
179dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show couples where either partner married more than once.') ?>"
180dd6b2bfcSGreg Roach                            >
181dd6b2bfcSGreg Roach                                <?= I18N::translate('Multiple marriages') ?>
182dd6b2bfcSGreg Roach                            </button>
183dd6b2bfcSGreg Roach                        </div>
184dd6b2bfcSGreg Roach                    </div>
185dd6b2bfcSGreg Roach                </th>
186dd6b2bfcSGreg Roach            </tr>
187dd6b2bfcSGreg Roach            <tr>
188dd6b2bfcSGreg Roach                <th><?= I18N::translate('Given names') ?></th>
189dd6b2bfcSGreg Roach                <th><?= I18N::translate('Surname') ?></th>
190dd6b2bfcSGreg Roach                <th><?= I18N::translate('Age') ?></th>
191dd6b2bfcSGreg Roach                <th><?= I18N::translate('Given names') ?></th>
192dd6b2bfcSGreg Roach                <th><?= I18N::translate('Surname') ?></th>
193dd6b2bfcSGreg Roach                <th><?= I18N::translate('Age') ?></th>
194dd6b2bfcSGreg Roach                <th><?= I18N::translate('Marriage') ?></th>
195e39fd5c6SGreg Roach                <th>
196e39fd5c6SGreg Roach                    <span title="<?= I18N::translate('Anniversary') ?>">
197e39fd5c6SGreg Roach                        <?= view('icons/anniversary') ?>
198e39fd5c6SGreg Roach                    </span>
199e39fd5c6SGreg Roach                </th>
200dd6b2bfcSGreg Roach                <th><?= I18N::translate('Place') ?></th>
201dd6b2bfcSGreg Roach                <th><i class="icon-children" title="<?= I18N::translate('Children') ?>"></i></th>
202dd6b2bfcSGreg Roach                <th><?= I18N::translate('Last change') ?></th>
203dd6b2bfcSGreg Roach                <th hidden></th>
204dd6b2bfcSGreg Roach                <th hidden></th>
205dd6b2bfcSGreg Roach                <th hidden></th>
206dd6b2bfcSGreg Roach            </tr>
207dd6b2bfcSGreg Roach        </thead>
208dd6b2bfcSGreg Roach
209dd6b2bfcSGreg Roach        <tfoot>
210dd6b2bfcSGreg Roach            <tr>
211dd6b2bfcSGreg Roach                <th colspan="14">
212dd6b2bfcSGreg Roach                    <div class="btn-toolbar">
213dd6b2bfcSGreg Roach                        <div class="btn-group">
214dd6b2bfcSGreg Roach                            <button class="ui-state-default btn-toggle-parents">
215dd6b2bfcSGreg Roach                                <?= I18N::translate('Show parents') ?>
216dd6b2bfcSGreg Roach                            </button>
217dd6b2bfcSGreg Roach                            <button class="ui-state-default btn-toggle-statistics">
218dd6b2bfcSGreg Roach                                <?= I18N::translate('Show statistics charts') ?>
219dd6b2bfcSGreg Roach                            </button>
220dd6b2bfcSGreg Roach                        </div>
221dd6b2bfcSGreg Roach                    </div>
222dd6b2bfcSGreg Roach                </th>
223dd6b2bfcSGreg Roach            </tr>
224dd6b2bfcSGreg Roach        </tfoot>
225dd6b2bfcSGreg Roach        <tbody>
226dd6b2bfcSGreg Roach
227dd6b2bfcSGreg Roach        <?php foreach ($families as $family) : ?>
228f4afa648SGreg Roach            <?php $husb = $family->getHusband() ?? new Individual('H', '0 @H@ INDI', null, $family->tree()) ?>
229f4afa648SGreg Roach            <?php $wife = $family->getWife() ?? new Individual('W', '0 @W@ INDI', null, $family->tree()) ?>
230dd6b2bfcSGreg Roach
231dd6b2bfcSGreg Roach            <tr class="<?= $family->isPendingDeletion() ? 'old' : ($family->isPendingAddition() ? 'new' : '') ?>">
232dd6b2bfcSGreg Roach                <!-- Husband name -->
233dd6b2bfcSGreg Roach                <td colspan="2" data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', implode(',', array_reverse(explode(',', $husb->getSortName()))))) ?>">
234dd6b2bfcSGreg Roach                    <?php foreach ($husb->getAllNames() as $num => $name) : ?>
235dd6b2bfcSGreg Roach                        <?php if ($name['type'] != '_MARNM' || $num == $husb->getPrimaryName()) : ?>
236dd6b2bfcSGreg Roach                        <a title="<?= $name['type'] === 'NAME' ? '' : 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()) : ?>
240dd6b2bfcSGreg Roach                                <?= $husb->getSexImage() ?>
241dd6b2bfcSGreg Roach                            <?php endif ?>
242dd6b2bfcSGreg Roach                        <br>
243dd6b2bfcSGreg Roach                        <?php endif ?>
244dd6b2bfcSGreg Roach                    <?php endforeach ?>
245dd6b2bfcSGreg Roach                    <?= $husb->getPrimaryParentsNames('parents details1', 'none') ?>
246dd6b2bfcSGreg Roach                </td>
247dd6b2bfcSGreg Roach
248dd6b2bfcSGreg Roach                <td hidden data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', $husb->getSortName())) ?>"></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) {
256dd6b2bfcSGreg Roach                        $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex();
257dd6b2bfcSGreg Roach                    }
258dd6b2bfcSGreg Roach                    $hage = Date::getAgeYears($hdate, $mdate);
259dd6b2bfcSGreg Roach                    if ($hage >= 0 && $hage <= $max_age) {
260dd6b2bfcSGreg Roach                        $marr_by_age[$hage] .= $husb->getSex();
261dd6b2bfcSGreg Roach                    }
262dd6b2bfcSGreg Roach                }
263dd6b2bfcSGreg Roach                ?>
264*242a7862SGreg 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 -->
269dd6b2bfcSGreg Roach                <td colspan="2" data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', implode(',', array_reverse(explode(',', $wife->getSortName()))))) ?>">
270dd6b2bfcSGreg Roach                    <?php foreach ($wife->getAllNames() as $num => $name) : ?>
271dd6b2bfcSGreg Roach                        <?php if ($name['type'] != '_MARNM' || $num == $wife->getPrimaryName()) : ?>
272dd6b2bfcSGreg Roach                            <a title="<?= $name['type'] === 'NAME' ? '' : 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()) : ?>
276dd6b2bfcSGreg Roach                                <?= $wife->getSexImage() ?>
277dd6b2bfcSGreg Roach                            <?php endif ?>
278dd6b2bfcSGreg Roach                            <br>
279dd6b2bfcSGreg Roach                        <?php endif ?>
280dd6b2bfcSGreg Roach                    <?php endforeach ?>
281dd6b2bfcSGreg Roach                    <?= $wife->getPrimaryParentsNames('parents details1', 'none') ?>
282dd6b2bfcSGreg Roach                </td>
283dd6b2bfcSGreg Roach
284dd6b2bfcSGreg Roach                <td hidden data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', $wife->getSortName())) ?>"></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) {
291dd6b2bfcSGreg Roach                        $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex();
292dd6b2bfcSGreg Roach                    }
293dd6b2bfcSGreg Roach                    $wage = Date::getAgeYears($wdate, $mdate);
294dd6b2bfcSGreg Roach                    if ($wage >= 0 && $wage <= $max_age) {
295dd6b2bfcSGreg Roach                        $marr_by_age[$wage] .= $wife->getSex();
296dd6b2bfcSGreg Roach                    }
297dd6b2bfcSGreg Roach                }
298dd6b2bfcSGreg Roach                ?>
299dd6b2bfcSGreg Roach
300*242a7862SGreg 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) : ?>
311dd6b2bfcSGreg Roach                            <?php $marr_by_decade[(int) ($marriage_dates[0]->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex() ?>
312dd6b2bfcSGreg Roach                        <?php endif ?>
3138d0ebef0SGreg Roach                    <?php elseif ($family->facts(['_NMR'])) : ?>
314dd6b2bfcSGreg Roach                        <?= I18N::translate('no') ?>
3158d0ebef0SGreg Roach                    <?php elseif ($family->facts(['MARR'])) : ?>
316dd6b2bfcSGreg Roach                            <?= I18N::translate('yes') ?>
317dd6b2bfcSGreg Roach                    <?php endif ?>
318dd6b2bfcSGreg Roach                </td>
319dd6b2bfcSGreg Roach
320dd6b2bfcSGreg Roach                <!-- Marriage anniversary -->
321*242a7862SGreg Roach                <td class="text-center" data-sort="<?= -$family->getMarriageDate()->julianDay() ?>">
322dd6b2bfcSGreg Roach                    <?= Date::getAge($family->getMarriageDate(), null) ?>
323dd6b2bfcSGreg Roach                </td>
324dd6b2bfcSGreg Roach
325dd6b2bfcSGreg Roach                <!-- Marriage place -->
326dd6b2bfcSGreg Roach                <td>
327dd6b2bfcSGreg Roach                    <?php foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) : ?>
328392561bbSGreg Roach                        <?= $marriage_place->shortName(true) ?>
329dd6b2bfcSGreg Roach                        <br>
330dd6b2bfcSGreg Roach                    <?php endforeach ?>
331dd6b2bfcSGreg Roach                </td>
332dd6b2bfcSGreg Roach
333dd6b2bfcSGreg Roach                <!-- Number of children -->
334*242a7862SGreg Roach                <td class="text-center" data-sort="<?= $family->getNumberOfChildren() ?>">
335dd6b2bfcSGreg Roach                    <?= I18N::number($family->getNumberOfChildren()) ?>
336dd6b2bfcSGreg Roach                </td>
337dd6b2bfcSGreg Roach
338dd6b2bfcSGreg Roach                <!-- Last change -->
339dd6b2bfcSGreg Roach                <td data-sort="<?= $family->lastChangeTimestamp(true) ?>">
340dd6b2bfcSGreg Roach                    <?= $family->lastChangeTimestamp() ?>
341dd6b2bfcSGreg Roach                </td>
342dd6b2bfcSGreg Roach
343dd6b2bfcSGreg Roach                <!-- Filter by marriage date -->
344dd6b2bfcSGreg Roach                <td hidden>
345dd6b2bfcSGreg Roach                    <?php if (!$family->canShow() || !$mdate->isOK()) : ?>
346dd6b2bfcSGreg Roach                        U
347dd6b2bfcSGreg Roach                    <?php elseif (Date::compare($mdate, $hundred_years_ago) > 0) : ?>
348dd6b2bfcSGreg Roach                        Y100
349dd6b2bfcSGreg Roach                    <?php else : ?>
350dd6b2bfcSGreg Roach                        YES
351dd6b2bfcSGreg Roach                    <?php endif ?>
3528d0ebef0SGreg Roach                    <?php if ($family->facts(Gedcom::DIVORCE_EVENTS)) : ?>
353dd6b2bfcSGreg Roach                        D
354dd6b2bfcSGreg Roach                    <?php endif ?>
355dd6b2bfcSGreg Roach                    <?php if (count($husb->getSpouseFamilies()) > 1 || count($wife->getSpouseFamilies()) > 1) : ?>
356dd6b2bfcSGreg Roach                        M
357dd6b2bfcSGreg Roach                    <?php endif ?>
358dd6b2bfcSGreg Roach                </td>
359dd6b2bfcSGreg Roach
360dd6b2bfcSGreg Roach                <!-- Filter by alive/dead -->
361dd6b2bfcSGreg Roach                <td hidden>
362dd6b2bfcSGreg Roach                    <?php if ($husb->isDead() && $wife->isDead()) : ?>
363dd6b2bfcSGreg Roach                        Y
364dd6b2bfcSGreg Roach                    <?php endif ?>
365dd6b2bfcSGreg Roach                    <?php if ($husb->isDead() && !$wife->isDead()) : ?>
366dd6b2bfcSGreg Roach                        <?php if ($wife->getSex() == 'F') : ?>
367dd6b2bfcSGreg Roach                            H
368dd6b2bfcSGreg Roach                        <?php endif ?>
369dd6b2bfcSGreg Roach                        <?php if ($wife->getSex() == 'M') : ?>
370dd6b2bfcSGreg Roach                            W
371dd6b2bfcSGreg Roach                        <?php endif ?>
372dd6b2bfcSGreg Roach                    <?php endif ?>
373dd6b2bfcSGreg Roach                    <?php if (!$husb->isDead() && $wife->isDead()) : ?>
374dd6b2bfcSGreg Roach                        <?php if ($husb->getSex() == 'M') : ?>
375dd6b2bfcSGreg Roach                            W
376dd6b2bfcSGreg Roach                        <?php endif ?>
377dd6b2bfcSGreg Roach                        <?php if ($husb->getSex() == 'F') : ?>
378dd6b2bfcSGreg Roach                            H
379dd6b2bfcSGreg Roach                        <?php endif ?>
380dd6b2bfcSGreg Roach                    <?php endif ?>
381dd6b2bfcSGreg Roach                    <?php if (!$husb->isDead() && !$wife->isDead()) : ?>
382dd6b2bfcSGreg Roach                        N
383dd6b2bfcSGreg Roach                    <?php endif ?>
384dd6b2bfcSGreg Roach                </td>
385dd6b2bfcSGreg Roach
386dd6b2bfcSGreg Roach                <!-- Filter by roots/leaves -->
387dd6b2bfcSGreg Roach                <td hidden>
388dd6b2bfcSGreg Roach                    <?php if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) : ?>
389dd6b2bfcSGreg Roach                        R
390dd6b2bfcSGreg Roach                    <?php elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() === 0) : ?>
391dd6b2bfcSGreg Roach                        L
392dd6b2bfcSGreg Roach                    <?php endif ?>
393dd6b2bfcSGreg Roach                </td>
394dd6b2bfcSGreg Roach            </tr>
395dd6b2bfcSGreg Roach        <?php endforeach ?>
396dd6b2bfcSGreg Roach        </tbody>
397dd6b2bfcSGreg Roach    </table>
398dd6b2bfcSGreg Roach
399dd6b2bfcSGreg Roach    <div id="family-charts-<?= e($table_id) ?>" style="display:none">
400dd6b2bfcSGreg Roach        <table class="list-charts">
401dd6b2bfcSGreg Roach            <tr>
402dd6b2bfcSGreg Roach                <td>
403dd6b2bfcSGreg Roach                    <?= view('lists/chart-by-decade', ['data' => $birt_by_decade, 'title' => I18N::translate('Decade of birth')]) ?>
404dd6b2bfcSGreg Roach        </td>
405dd6b2bfcSGreg Roach        <td>
406dd6b2bfcSGreg Roach                    <?= view('lists/chart-by-decade', ['data' => $marr_by_decade, 'title' => I18N::translate('Decade of marriage')]) ?>
407dd6b2bfcSGreg Roach                </td>
408dd6b2bfcSGreg Roach            </tr>
409dd6b2bfcSGreg Roach            <tr>
410dd6b2bfcSGreg Roach                <td colspan="2">
411dd6b2bfcSGreg Roach                    <?= view('lists/chart-by-age', ['data' => $marr_by_age, 'title' => I18N::translate('Age in year of marriage')]) ?>
412dd6b2bfcSGreg Roach                </td>
413dd6b2bfcSGreg Roach            </tr>
414dd6b2bfcSGreg Roach        </table>
415dd6b2bfcSGreg Roach    </div>
416dd6b2bfcSGreg Roach</div>
417