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