xref: /webtrees/resources/views/lists/families-table.phtml (revision 8d0ebef0d075981bd943e8256e2c81a3b1e92b4b)
1dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Date; ?>
2*8d0ebef0SGreg 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>
195dd6b2bfcSGreg Roach                <th><i class="icon-reminder" title="<?= I18N::translate('Anniversary') ?>"></i></th>
196dd6b2bfcSGreg Roach                <th><?= I18N::translate('Place') ?></th>
197dd6b2bfcSGreg Roach                <th><i class="icon-children" title="<?= I18N::translate('Children') ?>"></i></th>
198dd6b2bfcSGreg Roach                <th><?= I18N::translate('Last change') ?></th>
199dd6b2bfcSGreg Roach                <th hidden></th>
200dd6b2bfcSGreg Roach                <th hidden></th>
201dd6b2bfcSGreg Roach                <th hidden></th>
202dd6b2bfcSGreg Roach            </tr>
203dd6b2bfcSGreg Roach        </thead>
204dd6b2bfcSGreg Roach
205dd6b2bfcSGreg Roach        <tfoot>
206dd6b2bfcSGreg Roach            <tr>
207dd6b2bfcSGreg Roach                <th colspan="14">
208dd6b2bfcSGreg Roach                    <div class="btn-toolbar">
209dd6b2bfcSGreg Roach                        <div class="btn-group">
210dd6b2bfcSGreg Roach                            <button class="ui-state-default btn-toggle-parents">
211dd6b2bfcSGreg Roach                                <?= I18N::translate('Show parents') ?>
212dd6b2bfcSGreg Roach                            </button>
213dd6b2bfcSGreg Roach                            <button class="ui-state-default btn-toggle-statistics">
214dd6b2bfcSGreg Roach                                <?= I18N::translate('Show statistics charts') ?>
215dd6b2bfcSGreg Roach                            </button>
216dd6b2bfcSGreg Roach                        </div>
217dd6b2bfcSGreg Roach                    </div>
218dd6b2bfcSGreg Roach                </th>
219dd6b2bfcSGreg Roach            </tr>
220dd6b2bfcSGreg Roach        </tfoot>
221dd6b2bfcSGreg Roach        <tbody>
222dd6b2bfcSGreg Roach
223dd6b2bfcSGreg Roach        <?php foreach ($families as $family) : ?>
224f4afa648SGreg Roach            <?php $husb = $family->getHusband() ?? new Individual('H', '0 @H@ INDI', null, $family->tree()) ?>
225f4afa648SGreg Roach            <?php $wife = $family->getWife() ?? new Individual('W', '0 @W@ INDI', null, $family->tree()) ?>
226dd6b2bfcSGreg Roach
227dd6b2bfcSGreg Roach            <tr class="<?= $family->isPendingDeletion() ? 'old' : ($family->isPendingAddition() ? 'new' : '') ?>">
228dd6b2bfcSGreg Roach                <!-- Husband name -->
229dd6b2bfcSGreg Roach                <td colspan="2" data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', implode(',', array_reverse(explode(',', $husb->getSortName()))))) ?>">
230dd6b2bfcSGreg Roach                    <?php foreach ($husb->getAllNames() as $num => $name) : ?>
231dd6b2bfcSGreg Roach                        <?php if ($name['type'] != '_MARNM' || $num == $husb->getPrimaryName()) : ?>
232dd6b2bfcSGreg Roach                        <a title="<?= $name['type'] === 'NAME' ? '' : GedcomTag::getLabel($name['type'], $husb) ?>" href="<?= e($family->url()) ?>" class="<?= $num === $husb->getPrimaryName() ? 'name2' : '' ?>">
233dd6b2bfcSGreg Roach                            <?= $name['full'] ?>
234dd6b2bfcSGreg Roach                        </a>
235dd6b2bfcSGreg Roach                            <?php if ($num === $husb->getPrimaryName()) : ?>
236dd6b2bfcSGreg Roach                                <?= $husb->getSexImage() ?>
237dd6b2bfcSGreg Roach                            <?php endif ?>
238dd6b2bfcSGreg Roach                        <br>
239dd6b2bfcSGreg Roach                        <?php endif ?>
240dd6b2bfcSGreg Roach                    <?php endforeach ?>
241dd6b2bfcSGreg Roach                    <?= $husb->getPrimaryParentsNames('parents details1', 'none') ?>
242dd6b2bfcSGreg Roach                </td>
243dd6b2bfcSGreg Roach
244dd6b2bfcSGreg Roach                <td hidden data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', $husb->getSortName())) ?>"></td>
245dd6b2bfcSGreg Roach
246dd6b2bfcSGreg Roach                <!-- Husband age -->
247dd6b2bfcSGreg Roach                <?php
248dd6b2bfcSGreg Roach                $mdate = $family->getMarriageDate();
249dd6b2bfcSGreg Roach                $hdate = $husb->getBirthDate();
250dd6b2bfcSGreg Roach                if ($hdate->isOK() && $mdate->isOK()) {
251dd6b2bfcSGreg Roach                    if ($hdate->gregorianYear() >= 1550 && $hdate->gregorianYear() < 2030) {
252dd6b2bfcSGreg Roach                        $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex();
253dd6b2bfcSGreg Roach                    }
254dd6b2bfcSGreg Roach                    $hage = Date::getAgeYears($hdate, $mdate);
255dd6b2bfcSGreg Roach                    if ($hage >= 0 && $hage <= $max_age) {
256dd6b2bfcSGreg Roach                        $marr_by_age[$hage] .= $husb->getSex();
257dd6b2bfcSGreg Roach                    }
258dd6b2bfcSGreg Roach                }
259dd6b2bfcSGreg Roach                ?>
260dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= Date::getAgeDays($hdate, $mdate) ?>">
261dd6b2bfcSGreg Roach                    <?= Date::getAge($hdate, $mdate) ?>
262dd6b2bfcSGreg Roach                </td>
263dd6b2bfcSGreg Roach
264dd6b2bfcSGreg Roach                <!-- Wife name -->
265dd6b2bfcSGreg Roach                <td colspan="2" data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', implode(',', array_reverse(explode(',', $wife->getSortName()))))) ?>">
266dd6b2bfcSGreg Roach                    <?php foreach ($wife->getAllNames() as $num => $name) : ?>
267dd6b2bfcSGreg Roach                        <?php if ($name['type'] != '_MARNM' || $num == $wife->getPrimaryName()) : ?>
268dd6b2bfcSGreg Roach                            <a title="<?= $name['type'] === 'NAME' ? '' : GedcomTag::getLabel($name['type'], $wife) ?>" href="<?= e($family->url()) ?>" class="<?= $num === $wife->getPrimaryName() ? 'name2' : '' ?>">
269dd6b2bfcSGreg Roach                                <?= $name['full'] ?>
270dd6b2bfcSGreg Roach                            </a>
271dd6b2bfcSGreg Roach                            <?php if ($num === $wife->getPrimaryName()) : ?>
272dd6b2bfcSGreg Roach                                <?= $wife->getSexImage() ?>
273dd6b2bfcSGreg Roach                            <?php endif ?>
274dd6b2bfcSGreg Roach                            <br>
275dd6b2bfcSGreg Roach                        <?php endif ?>
276dd6b2bfcSGreg Roach                    <?php endforeach ?>
277dd6b2bfcSGreg Roach                    <?= $wife->getPrimaryParentsNames('parents details1', 'none') ?>
278dd6b2bfcSGreg Roach                </td>
279dd6b2bfcSGreg Roach
280dd6b2bfcSGreg Roach                <td hidden data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', $wife->getSortName())) ?>"></td>
281dd6b2bfcSGreg Roach
282dd6b2bfcSGreg Roach                <!-- Wife age -->
283dd6b2bfcSGreg Roach                <?php
284dd6b2bfcSGreg Roach                $wdate = $wife->getBirthDate();
285dd6b2bfcSGreg Roach                if ($wdate->isOK() && $mdate->isOK()) {
286dd6b2bfcSGreg Roach                    if ($wdate->gregorianYear() >= 1550 && $wdate->gregorianYear() < 2030) {
287dd6b2bfcSGreg Roach                        $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex();
288dd6b2bfcSGreg Roach                    }
289dd6b2bfcSGreg Roach                    $wage = Date::getAgeYears($wdate, $mdate);
290dd6b2bfcSGreg Roach                    if ($wage >= 0 && $wage <= $max_age) {
291dd6b2bfcSGreg Roach                        $marr_by_age[$wage] .= $wife->getSex();
292dd6b2bfcSGreg Roach                    }
293dd6b2bfcSGreg Roach                }
294dd6b2bfcSGreg Roach                ?>
295dd6b2bfcSGreg Roach
296dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= Date::getAgeDays($wdate, $mdate) ?>">
297dd6b2bfcSGreg Roach                    <?= Date::getAge($wdate, $mdate) ?>
298dd6b2bfcSGreg Roach                </td>
299dd6b2bfcSGreg Roach
300dd6b2bfcSGreg Roach                <!-- Marriage date -->
301dd6b2bfcSGreg Roach                <td data-sort="<?= $family->getMarriageDate()->julianDay() ?>">
302dd6b2bfcSGreg Roach                    <?php if ($marriage_dates = $family->getAllMarriageDates()) : ?>
303dd6b2bfcSGreg Roach                        <?php foreach ($marriage_dates as $n => $marriage_date) : ?>
304dd6b2bfcSGreg Roach                            <div><?= $marriage_date->display(true) ?></div>
305dd6b2bfcSGreg Roach                        <?php endforeach ?>
306dd6b2bfcSGreg Roach                        <?php if ($marriage_dates[0]->gregorianYear() >= 1550 && $marriage_dates[0]->gregorianYear() < 2030) : ?>
307dd6b2bfcSGreg Roach                            <?php $marr_by_decade[(int) ($marriage_dates[0]->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex() ?>
308dd6b2bfcSGreg Roach                        <?php endif ?>
309*8d0ebef0SGreg Roach                    <?php elseif ($family->facts(['_NMR'])) : ?>
310dd6b2bfcSGreg Roach                        <?= I18N::translate('no') ?>
311*8d0ebef0SGreg Roach                    <?php elseif ($family->facts(['MARR'])) : ?>
312dd6b2bfcSGreg Roach                            <?= I18N::translate('yes') ?>
313dd6b2bfcSGreg Roach                    <?php endif ?>
314dd6b2bfcSGreg Roach                </td>
315dd6b2bfcSGreg Roach
316dd6b2bfcSGreg Roach                <!-- Marriage anniversary -->
317dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= -$family->getMarriageDate()->julianDay() ?>">
318dd6b2bfcSGreg Roach                    <?= Date::getAge($family->getMarriageDate(), null) ?>
319dd6b2bfcSGreg Roach                </td>
320dd6b2bfcSGreg Roach
321dd6b2bfcSGreg Roach                <!-- Marriage place -->
322dd6b2bfcSGreg Roach                <td>
323dd6b2bfcSGreg Roach                    <?php foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) : ?>
324dd6b2bfcSGreg Roach                        <a href="<?= $marriage_place->getURL() ?>" title="<?= strip_tags($marriage_place->getFullName()) ?>">
325dd6b2bfcSGreg Roach                            <?= $marriage_place->getShortName() ?>
326dd6b2bfcSGreg Roach                        </a>
327dd6b2bfcSGreg Roach                        <br>
328dd6b2bfcSGreg Roach                    <?php endforeach ?>
329dd6b2bfcSGreg Roach                </td>
330dd6b2bfcSGreg Roach
331dd6b2bfcSGreg Roach                <!-- Number of children -->
332dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= $family->getNumberOfChildren() ?>">
333dd6b2bfcSGreg Roach                    <?= I18N::number($family->getNumberOfChildren()) ?>
334dd6b2bfcSGreg Roach                </td>
335dd6b2bfcSGreg Roach
336dd6b2bfcSGreg Roach                <!-- Last change -->
337dd6b2bfcSGreg Roach                <td data-sort="<?= $family->lastChangeTimestamp(true) ?>">
338dd6b2bfcSGreg Roach                    <?= $family->lastChangeTimestamp() ?>
339dd6b2bfcSGreg Roach                </td>
340dd6b2bfcSGreg Roach
341dd6b2bfcSGreg Roach                <!-- Filter by marriage date -->
342dd6b2bfcSGreg Roach                <td hidden>
343dd6b2bfcSGreg Roach                    <?php if (!$family->canShow() || !$mdate->isOK()) : ?>
344dd6b2bfcSGreg Roach                        U
345dd6b2bfcSGreg Roach                    <?php elseif (Date::compare($mdate, $hundred_years_ago) > 0) : ?>
346dd6b2bfcSGreg Roach                        Y100
347dd6b2bfcSGreg Roach                    <?php else : ?>
348dd6b2bfcSGreg Roach                        YES
349dd6b2bfcSGreg Roach                    <?php endif ?>
350*8d0ebef0SGreg Roach                    <?php if ($family->facts(Gedcom::DIVORCE_EVENTS)) : ?>
351dd6b2bfcSGreg Roach                        D
352dd6b2bfcSGreg Roach                    <?php endif ?>
353dd6b2bfcSGreg Roach                    <?php if (count($husb->getSpouseFamilies()) > 1 || count($wife->getSpouseFamilies()) > 1) : ?>
354dd6b2bfcSGreg Roach                        M
355dd6b2bfcSGreg Roach                    <?php endif ?>
356dd6b2bfcSGreg Roach                </td>
357dd6b2bfcSGreg Roach
358dd6b2bfcSGreg Roach                <!-- Filter by alive/dead -->
359dd6b2bfcSGreg Roach                <td hidden>
360dd6b2bfcSGreg Roach                    <?php if ($husb->isDead() && $wife->isDead()) : ?>
361dd6b2bfcSGreg Roach                        Y
362dd6b2bfcSGreg Roach                    <?php endif ?>
363dd6b2bfcSGreg Roach                    <?php if ($husb->isDead() && !$wife->isDead()) : ?>
364dd6b2bfcSGreg Roach                        <?php if ($wife->getSex() == 'F') : ?>
365dd6b2bfcSGreg Roach                            H
366dd6b2bfcSGreg Roach                        <?php endif ?>
367dd6b2bfcSGreg Roach                        <?php if ($wife->getSex() == 'M') : ?>
368dd6b2bfcSGreg Roach                            W
369dd6b2bfcSGreg Roach                        <?php endif ?>
370dd6b2bfcSGreg Roach                    <?php endif ?>
371dd6b2bfcSGreg Roach                    <?php if (!$husb->isDead() && $wife->isDead()) : ?>
372dd6b2bfcSGreg Roach                        <?php if ($husb->getSex() == 'M') : ?>
373dd6b2bfcSGreg Roach                            W
374dd6b2bfcSGreg Roach                        <?php endif ?>
375dd6b2bfcSGreg Roach                        <?php if ($husb->getSex() == 'F') : ?>
376dd6b2bfcSGreg Roach                            H
377dd6b2bfcSGreg Roach                        <?php endif ?>
378dd6b2bfcSGreg Roach                    <?php endif ?>
379dd6b2bfcSGreg Roach                    <?php if (!$husb->isDead() && !$wife->isDead()) : ?>
380dd6b2bfcSGreg Roach                        N
381dd6b2bfcSGreg Roach                    <?php endif ?>
382dd6b2bfcSGreg Roach                </td>
383dd6b2bfcSGreg Roach
384dd6b2bfcSGreg Roach                <!-- Filter by roots/leaves -->
385dd6b2bfcSGreg Roach                <td hidden>
386dd6b2bfcSGreg Roach                    <?php if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) : ?>
387dd6b2bfcSGreg Roach                        R
388dd6b2bfcSGreg Roach                    <?php elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() === 0) : ?>
389dd6b2bfcSGreg Roach                        L
390dd6b2bfcSGreg Roach                    <?php endif ?>
391dd6b2bfcSGreg Roach                </td>
392dd6b2bfcSGreg Roach            </tr>
393dd6b2bfcSGreg Roach        <?php endforeach ?>
394dd6b2bfcSGreg Roach        </tbody>
395dd6b2bfcSGreg Roach    </table>
396dd6b2bfcSGreg Roach
397dd6b2bfcSGreg Roach    <div id="family-charts-<?= e($table_id) ?>" style="display:none">
398dd6b2bfcSGreg Roach        <table class="list-charts">
399dd6b2bfcSGreg Roach            <tr>
400dd6b2bfcSGreg Roach                <td>
401dd6b2bfcSGreg Roach                    <?= view('lists/chart-by-decade', ['data' => $birt_by_decade, 'title' => I18N::translate('Decade of birth')]) ?>
402dd6b2bfcSGreg Roach        </td>
403dd6b2bfcSGreg Roach        <td>
404dd6b2bfcSGreg Roach                    <?= view('lists/chart-by-decade', ['data' => $marr_by_decade, 'title' => I18N::translate('Decade of marriage')]) ?>
405dd6b2bfcSGreg Roach                </td>
406dd6b2bfcSGreg Roach            </tr>
407dd6b2bfcSGreg Roach            <tr>
408dd6b2bfcSGreg Roach                <td colspan="2">
409dd6b2bfcSGreg Roach                    <?= view('lists/chart-by-age', ['data' => $marr_by_age, 'title' => I18N::translate('Age in year of marriage')]) ?>
410dd6b2bfcSGreg Roach                </td>
411dd6b2bfcSGreg Roach            </tr>
412dd6b2bfcSGreg Roach        </table>
413dd6b2bfcSGreg Roach    </div>
414dd6b2bfcSGreg Roach</div>
415