xref: /webtrees/resources/views/lists/individuals-table.phtml (revision e39fd5c68ce57370c7fa00e95a3edd42769acf34)
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; ?>
590d97cc8SGreg Roach<?php use Fisharebest\Webtrees\Module\ModuleInterface; ?>
684b37362SGreg Roach<?php use Fisharebest\Webtrees\Module\RelationshipsChartModule; ?>
74ca7e03cSGreg Roach<?php use Fisharebest\Webtrees\Services\ModuleService; ?>
890d97cc8SGreg Roach<?php use Fisharebest\Webtrees\Auth; ?>
9dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\View; ?>
10dd6b2bfcSGreg Roach<?php use Ramsey\Uuid\Uuid; ?>
11dd6b2bfcSGreg Roach
12dd6b2bfcSGreg Roach
13dd6b2bfcSGreg Roach<?php
14dd6b2bfcSGreg Roach// lists requires a unique ID in case there are multiple lists per page
15dd6b2bfcSGreg Roach$table_id = 'table-indi-' . Uuid::uuid4()->toString();
16dd6b2bfcSGreg Roach
17dd6b2bfcSGreg Roach$hundred_years_ago = new Date(date('Y') - 100);
18dd6b2bfcSGreg Roach$unique_indis      = []; // Don't double-count indis with multiple names.
1984b37362SGreg Roach
204ca7e03cSGreg Roach$module = app(ModuleService::class)->findByComponent('chart', $tree, Auth::user())->first(function (ModuleInterface $module) {
2190d97cc8SGreg Roach    return $module instanceof RelationshipsChartModule;
2290d97cc8SGreg Roach});
23dd6b2bfcSGreg Roach?>
24dd6b2bfcSGreg Roach
25dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
26dd6b2bfcSGreg Roach<script>
27dd6b2bfcSGreg Roach$("#<?= e($table_id) ?>").dataTable( {
28dd6b2bfcSGreg Roach    dom: '<"H"<"filtersH_<?= e($table_id) ?>">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_<?= e($table_id) ?>">>',
29dd6b2bfcSGreg Roach    <?= I18N::datatablesI18N() ?>,
30dd6b2bfcSGreg Roach    autoWidth: false,
31dd6b2bfcSGreg Roach    processing: true,
32dd6b2bfcSGreg Roach    retrieve: true,
33dd6b2bfcSGreg Roach    columns: [
34dd6b2bfcSGreg Roach        /* Given names  */ { type: "text" },
35dd6b2bfcSGreg Roach        /* Surnames     */ { type: "text" },
36dd6b2bfcSGreg Roach        /* SOSA numnber */ { type: "num", visible: <?= json_encode($sosa) ?> },
37dd6b2bfcSGreg Roach        /* Birth date   */ { type: "num" },
38dd6b2bfcSGreg Roach        /* Anniversary  */ { type: "num" },
39dd6b2bfcSGreg Roach        /* Birthplace   */ { type: "text" },
40dd6b2bfcSGreg Roach        /* Children     */ { type: "num" },
41dd6b2bfcSGreg Roach        /* Deate date   */ { type: "num" },
42dd6b2bfcSGreg Roach        /* Anniversary  */ { type: "num" },
43dd6b2bfcSGreg Roach        /* Age          */ { type: "num" },
44dd6b2bfcSGreg Roach        /* Death place  */ { type: "text" },
45dd6b2bfcSGreg Roach        /* Last change  */ { visible: <?= json_encode($tree->getPreference('SHOW_LAST_CHANGE')) ?> },
46dd6b2bfcSGreg Roach        /* Filter sex   */ { sortable: false },
47dd6b2bfcSGreg Roach        /* Filter birth */ { sortable: false },
48dd6b2bfcSGreg Roach        /* Filter death */ { sortable: false },
49dd6b2bfcSGreg Roach        /* Filter tree  */ { sortable: false }
50dd6b2bfcSGreg Roach    ],
51dd6b2bfcSGreg Roach    sorting: <?= json_encode($sosa ? [[4, "asc"]] : [[1, "asc"]]) ?>,
52dd6b2bfcSGreg Roach    displayLength: 20,
53dd6b2bfcSGreg Roach    pagingType: "full_numbers"
54dd6b2bfcSGreg Roach});
55dd6b2bfcSGreg Roach
56dd6b2bfcSGreg Roach$("#<?= e($table_id) ?>")
57dd6b2bfcSGreg Roach/* Hide/show parents */
58dd6b2bfcSGreg Roach.on("click", ".btn-toggle-parents", function() {
59dd6b2bfcSGreg Roach    $(this).toggleClass("ui-state-active");
60dd6b2bfcSGreg Roach    $(".parents", $(this).closest("table").DataTable().rows().nodes()).slideToggle();
61dd6b2bfcSGreg Roach})
62dd6b2bfcSGreg Roach/* Hide/show statistics */
63dd6b2bfcSGreg Roach.on("click", ".btn-toggle-statistics", function() {
64dd6b2bfcSGreg Roach    $(this).toggleClass("ui-state-active");
65dd6b2bfcSGreg Roach    $("#individual-charts-<?= e($table_id) ?>").slideToggle();
66dd6b2bfcSGreg Roach})
67dd6b2bfcSGreg Roach/* Filter buttons in table header */
68dd6b2bfcSGreg Roach.on("click", "button[data-filter-column]", function() {
69dd6b2bfcSGreg Roach    var btn = $(this);
70dd6b2bfcSGreg Roach    // De-activate the other buttons in this button group
71dd6b2bfcSGreg Roach    btn.siblings().removeClass("active");
72dd6b2bfcSGreg Roach    // Apply (or clear) this filter
73dd6b2bfcSGreg Roach    var col = $("#<?= e($table_id) ?>").DataTable().column(btn.data("filter-column"));
74dd6b2bfcSGreg Roach    if (btn.hasClass("active")) {
75dd6b2bfcSGreg Roach        col.search("").draw();
76dd6b2bfcSGreg Roach    } else {
77dd6b2bfcSGreg Roach        col.search(btn.data("filter-value")).draw();
78dd6b2bfcSGreg Roach    }
79dd6b2bfcSGreg Roach});
80dd6b2bfcSGreg Roach</script>
81dd6b2bfcSGreg Roach<?php View::endpush() ?>
82dd6b2bfcSGreg Roach
83dd6b2bfcSGreg Roach<?php
84dd6b2bfcSGreg Roach$max_age = (int) $tree->getPreference('MAX_ALIVE_AGE');
85dd6b2bfcSGreg Roach
86dd6b2bfcSGreg Roach// Inititialise chart data
87dd6b2bfcSGreg Roach$deat_by_age = [];
88dd6b2bfcSGreg Roachfor ($age = 0; $age <= $max_age; $age++) {
89dd6b2bfcSGreg Roach    $deat_by_age[$age] = '';
90dd6b2bfcSGreg Roach}
91dd6b2bfcSGreg Roach$birt_by_decade = [];
92dd6b2bfcSGreg Roach$deat_by_decade = [];
93dd6b2bfcSGreg Roachfor ($year = 1550; $year < 2030; $year += 10) {
94dd6b2bfcSGreg Roach    $birt_by_decade[$year] = '';
95dd6b2bfcSGreg Roach    $deat_by_decade[$year] = '';
96dd6b2bfcSGreg Roach}
97dd6b2bfcSGreg Roach?>
98dd6b2bfcSGreg Roach
99dd6b2bfcSGreg Roach<div class="indi-list">
100dd6b2bfcSGreg Roach    <table id="<?= e($table_id) ?>">
101dd6b2bfcSGreg Roach        <thead>
102dd6b2bfcSGreg Roach            <tr>
103dd6b2bfcSGreg Roach                <th colspan="16">
104dd6b2bfcSGreg Roach                    <div class="btn-toolbar d-flex justify-content-between mb-2" role="toolbar">
105dd6b2bfcSGreg Roach                        <div class="btn-group" data-toggle="buttons">
106dd6b2bfcSGreg Roach                            <button
107dd6b2bfcSGreg Roach                                class="btn btn-secondary"
108dd6b2bfcSGreg Roach                                data-filter-column="12"
109dd6b2bfcSGreg Roach                                data-filter-value="M"
110dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show only males.') ?>"
111dd6b2bfcSGreg Roach                            >
112dd6b2bfcSGreg Roach                                <?= Individual::sexImage('M', 'large') ?>
113dd6b2bfcSGreg Roach                            </button>
114dd6b2bfcSGreg Roach                            <button
115dd6b2bfcSGreg Roach                                class="btn btn-secondary"
116dd6b2bfcSGreg Roach                                data-filter-column="12"
117dd6b2bfcSGreg Roach                                data-filter-value="F"
118dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show only females.') ?>"
119dd6b2bfcSGreg Roach                            >
120dd6b2bfcSGreg Roach                                <?= Individual::sexImage('F', 'large') ?>
121dd6b2bfcSGreg Roach                            </button>
122dd6b2bfcSGreg Roach                            <button
123dd6b2bfcSGreg Roach                                class="btn btn-secondary"
124dd6b2bfcSGreg Roach                                data-filter-column="12"
125dd6b2bfcSGreg Roach                                data-filter-value="U"
126dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show only individuals for whom the gender is not known.') ?>"
127dd6b2bfcSGreg Roach                            >
128dd6b2bfcSGreg Roach                                <?= Individual::sexImage('U', 'large') ?>
129dd6b2bfcSGreg Roach                            </button>
130dd6b2bfcSGreg Roach                        </div>
131dd6b2bfcSGreg Roach                        <div class="btn-group" data-toggle="buttons">
132dd6b2bfcSGreg Roach                            <button
133dd6b2bfcSGreg Roach                                class="btn btn-secondary"
134dd6b2bfcSGreg Roach                                data-filter-column="14"
135dd6b2bfcSGreg Roach                                data-filter-value="N"
136dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show individuals who are alive or couples where both partners are alive.') ?>"
137dd6b2bfcSGreg Roach                            >
138dd6b2bfcSGreg Roach                                <?= I18N::translate('Alive') ?>
139dd6b2bfcSGreg Roach                            </button>
140dd6b2bfcSGreg Roach                            <button
141dd6b2bfcSGreg Roach                                class="btn btn-secondary"
142dd6b2bfcSGreg Roach                                data-filter-column="14"
143dd6b2bfcSGreg Roach                                data-filter-value="Y"
144dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show individuals who are dead or couples where both partners are dead.') ?>"
145dd6b2bfcSGreg Roach                            >
146dd6b2bfcSGreg Roach                                <?= I18N::translate('Dead') ?>
147dd6b2bfcSGreg Roach                            </button>
148dd6b2bfcSGreg Roach                            <button
149dd6b2bfcSGreg Roach                                class="btn btn-secondary"
150dd6b2bfcSGreg Roach                                data-filter-column="14"
151dd6b2bfcSGreg Roach                                data-filter-value="YES"
152dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show individuals who died more than 100 years ago.') ?>"
153dd6b2bfcSGreg Roach                            >
154dd6b2bfcSGreg Roach                                <?= I18N::translate('Death') ?>&gt;100
155dd6b2bfcSGreg Roach                            </button>
156dd6b2bfcSGreg Roach                            <button
157dd6b2bfcSGreg Roach                                class="btn btn-secondary"
158dd6b2bfcSGreg Roach                                data-filter-column="14"
159dd6b2bfcSGreg Roach                                data-filter-value="Y100"
160dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show individuals who died within the last 100 years.') ?>"
161dd6b2bfcSGreg Roach                            >
162392561bbSGreg Roach                                <?= I18N::translate('Death') ?>&lt;=100
163dd6b2bfcSGreg Roach                            </button>
164dd6b2bfcSGreg Roach                        </div>
165dd6b2bfcSGreg Roach                        <div class="btn-group" data-toggle="buttons">
166dd6b2bfcSGreg Roach                            <button
167dd6b2bfcSGreg Roach                                class="btn btn-secondary"
168dd6b2bfcSGreg Roach                                data-filter-column="13"
169dd6b2bfcSGreg Roach                                data-filter-value="YES"
170dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show individuals born more than 100 years ago.') ?>"
171dd6b2bfcSGreg Roach                            >
172dd6b2bfcSGreg Roach                                <?= I18N::translate('Birth') ?>&gt;100
173dd6b2bfcSGreg Roach                            </button>
174dd6b2bfcSGreg Roach                            <button
175dd6b2bfcSGreg Roach                                class="btn btn-secondary"
176dd6b2bfcSGreg Roach                                data-filter-column="13"
177dd6b2bfcSGreg Roach                                data-filter-value="Y100"
178dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show individuals born within the last 100 years.') ?>"
179dd6b2bfcSGreg Roach                            >
180dd6b2bfcSGreg Roach                                <?= I18N::translate('Birth') ?>&lt;=100
181dd6b2bfcSGreg Roach                            </button>
182dd6b2bfcSGreg Roach                        </div>
183dd6b2bfcSGreg Roach                        <div class="btn-group" data-toggle="buttons">
184dd6b2bfcSGreg Roach                            <button
185dd6b2bfcSGreg Roach                                class="btn btn-secondary"
186dd6b2bfcSGreg Roach                                data-filter-column="15"
187dd6b2bfcSGreg Roach                                data-filter-value="R"
188dd6b2bfcSGreg 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.') ?>"
189dd6b2bfcSGreg Roach                            >
190dd6b2bfcSGreg Roach                                <?= I18N::translate('Roots') ?>
191dd6b2bfcSGreg Roach                            </button>
192dd6b2bfcSGreg Roach                            <button
193dd6b2bfcSGreg Roach                                class="btn btn-secondary"
194dd6b2bfcSGreg Roach                                data-filter-column="15"
195dd6b2bfcSGreg Roach                                data-filter-value="L"
196dd6b2bfcSGreg Roach                                title="<?= I18N::translate('Show “leaves” couples or individuals. These are individuals who are alive but have no children recorded in the database.') ?>"
197dd6b2bfcSGreg Roach                            >
198dd6b2bfcSGreg Roach                                <?= I18N::translate('Leaves') ?>
199dd6b2bfcSGreg Roach                            </button>
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: Abbreviation for “Sosa-Stradonitz number”. This is an individual’s surname, so may need transliterating into non-latin alphabets. */
208dd6b2bfcSGreg Roach                    I18N::translate('Sosa') ?></th>
209dd6b2bfcSGreg Roach                <th><?= I18N::translate('Birth') ?></th>
210dd6b2bfcSGreg Roach                <th>
211*e39fd5c6SGreg Roach                    <span title="<?= I18N::translate('Anniversary') ?>">
212*e39fd5c6SGreg Roach                        <?= view('icons/anniversary') ?>
213*e39fd5c6SGreg Roach                    </span>
214dd6b2bfcSGreg Roach                </th>
215dd6b2bfcSGreg Roach                <th><?= I18N::translate('Place') ?></th>
216dd6b2bfcSGreg Roach                <th>
217dd6b2bfcSGreg Roach                    <i class="icon-children" title="<?= I18N::translate('Children') ?>"></i>
218dd6b2bfcSGreg Roach                </th>
219dd6b2bfcSGreg Roach                <th><?= I18N::translate('Death') ?></th>
220dd6b2bfcSGreg Roach                <th>
221*e39fd5c6SGreg Roach                    <span title="<?= I18N::translate('Anniversary') ?>">
222*e39fd5c6SGreg Roach                        <?= view('icons/anniversary') ?>
223*e39fd5c6SGreg Roach                    </span>
224dd6b2bfcSGreg Roach                </th>
225dd6b2bfcSGreg Roach                <th><?= I18N::translate('Age') ?></th>
226dd6b2bfcSGreg Roach                <th><?= I18N::translate('Place') ?></th>
227dd6b2bfcSGreg Roach                <th><?= I18N::translate('Last change') ?></th>
228dd6b2bfcSGreg Roach                <th hidden></th>
229dd6b2bfcSGreg Roach                <th hidden></th>
230dd6b2bfcSGreg Roach                <th hidden></th>
231dd6b2bfcSGreg Roach                <th hidden></th>
232dd6b2bfcSGreg Roach            </tr>
233dd6b2bfcSGreg Roach        </thead>
234dd6b2bfcSGreg Roach        <tfoot>
235dd6b2bfcSGreg Roach            <tr>
236dd6b2bfcSGreg Roach                <th colspan="16">
237dd6b2bfcSGreg Roach                    <div class="btn-toolbar">
238dd6b2bfcSGreg Roach                        <div class="btn-group">
239dd6b2bfcSGreg Roach                            <button class="ui-state-default btn-toggle-parents">
240dd6b2bfcSGreg Roach                                <?= I18N::translate('Show parents') ?>
241dd6b2bfcSGreg Roach                            </button>
242dd6b2bfcSGreg Roach                            <button class="ui-state-default btn-toggle-statistics">
243dd6b2bfcSGreg Roach                                <?= I18N::translate('Show statistics charts') ?>
244dd6b2bfcSGreg Roach                            </button>
245dd6b2bfcSGreg Roach                        </div>
246dd6b2bfcSGreg Roach                    </div>
247dd6b2bfcSGreg Roach                </th>
248dd6b2bfcSGreg Roach            </tr>
249dd6b2bfcSGreg Roach        </tfoot>
250dd6b2bfcSGreg Roach
251dd6b2bfcSGreg Roach        <tbody>
252dd6b2bfcSGreg Roach            <?php foreach ($individuals as $key => $individual) : ?>
253dd6b2bfcSGreg Roach            <tr class="<?= $individual->isPendingDeletion() ? 'old' : ($individual->isPendingAddition() ? 'new' : '') ?>">
254dd6b2bfcSGreg Roach                <td colspan="2" data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', implode(',', array_reverse(explode(',', $individual->getSortName()))))) ?>">
255dd6b2bfcSGreg Roach                    <?php foreach ($individual->getAllNames() as $num => $name) : ?>
256dd6b2bfcSGreg Roach                        <a title="<?= $name['type'] === 'NAME' ? '' : GedcomTag::getLabel($name['type'], $individual) ?>" href="<?= e($individual->url()) ?>" class="<?= $num === $individual->getPrimaryName() ? 'name2' : '' ?>">
257dd6b2bfcSGreg Roach                            <?= $name['full'] ?>
258dd6b2bfcSGreg Roach                        </a>
259dd6b2bfcSGreg Roach                        <?php if ($num === $individual->getPrimaryName()) : ?>
260dd6b2bfcSGreg Roach                            <?= $individual->getSexImage() ?>
261dd6b2bfcSGreg Roach                        <?php endif ?>
262dd6b2bfcSGreg Roach                        <br>
263dd6b2bfcSGreg Roach                    <?php endforeach ?>
264dd6b2bfcSGreg Roach                    <?= $individual->getPrimaryParentsNames('parents details1', 'none') ?>
265dd6b2bfcSGreg Roach                </td>
266dd6b2bfcSGreg Roach
267dd6b2bfcSGreg Roach                <td hidden data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', $individual->getSortName())) ?>"></td>
268dd6b2bfcSGreg Roach
269dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= $key ?>">
270dd6b2bfcSGreg Roach                    <?php if ($sosa) : ?>
27184b37362SGreg Roach                        <?php if ($module instanceof RelationshipsChartModule) : ?>
27284b37362SGreg Roach                            <a href="<?= e($module->chartUrl($individuals[1], ['xref2' => $individual->xref()])) ?>" rel="nofollow" title="<?= I18N::translate('Relationships') ?>" rel="nofollow">
273dd6b2bfcSGreg Roach                                <?= I18N::number($key) ?>
274dd6b2bfcSGreg Roach                            </a>
27584b37362SGreg Roach                        <?php else : ?>
27684b37362SGreg Roach                            <?= I18N::number($key) ?>
27784b37362SGreg Roach                        <?php endif ?>
278dd6b2bfcSGreg Roach                    <?php endif ?>
279dd6b2bfcSGreg Roach                </td>
280dd6b2bfcSGreg Roach
281dd6b2bfcSGreg Roach                <!-- Birth date -->
282dd6b2bfcSGreg Roach                <td data-sort="<?= $individual->getEstimatedBirthDate()->julianDay() ?>">
283dd6b2bfcSGreg Roach                    <?php $birth_dates = $individual->getAllBirthDates(); ?>
284dd6b2bfcSGreg Roach
285dd6b2bfcSGreg Roach                    <?php foreach ($birth_dates as $n => $birth_date) : ?>
286dd6b2bfcSGreg Roach                        <?= $birth_date->display(true) ?>
287dd6b2bfcSGreg Roach                        <br>
288dd6b2bfcSGreg Roach                    <?php endforeach ?>
289dd6b2bfcSGreg Roach                </td>
290dd6b2bfcSGreg Roach
291dd6b2bfcSGreg Roach                <!-- Birth anniversary -->
292dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= -$individual->getEstimatedBirthDate()->julianDay() ?>">
293c0935879SGreg Roach                    <?php if (isset($birth_dates[0]) && $birth_dates[0]->gregorianYear() >= 1550 && $birth_dates[0]->gregorianYear() < 2030 && !isset($unique_indis[$individual->xref()])) : ?>
294dd6b2bfcSGreg Roach                        <?php $birt_by_decade[(int) ($birth_dates[0]->gregorianYear() / 10) * 10] .= $individual->getSex() ?>
295dd6b2bfcSGreg Roach                        <?= Date::getAge($birth_dates[0], null) ?>
296dd6b2bfcSGreg Roach                    <?php endif ?>
297dd6b2bfcSGreg Roach                </td>
298dd6b2bfcSGreg Roach
299dd6b2bfcSGreg Roach                <!-- Birth place -->
300dd6b2bfcSGreg Roach                <td>
301dd6b2bfcSGreg Roach                    <?php foreach ($individual->getAllBirthPlaces() as $n => $birth_place) : ?>
302392561bbSGreg Roach                        <?= $birth_place->shortName(true) ?>
303dd6b2bfcSGreg Roach                        <br>
304dd6b2bfcSGreg Roach                    <?php endforeach ?>
305dd6b2bfcSGreg Roach                </td>
306dd6b2bfcSGreg Roach
307dd6b2bfcSGreg Roach                <!-- Number of children -->
308dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= $individual->getNumberOfChildren() ?>">
309dd6b2bfcSGreg Roach                    <?= I18N::number($individual->getNumberOfChildren()) ?>
310dd6b2bfcSGreg Roach                </td>
311dd6b2bfcSGreg Roach
312dd6b2bfcSGreg Roach                <!--    Death date -->
313dd6b2bfcSGreg Roach                <?php $death_dates = $individual->getAllDeathDates() ?>
314dd6b2bfcSGreg Roach                <td data-sort="<?= $individual->getEstimatedDeathDate()->julianDay() ?>">
315dd6b2bfcSGreg Roach                    <?php foreach ($death_dates as $num => $death_date) : ?>
316dd6b2bfcSGreg Roach                        <?= $death_date->display(true) ?>
317dd6b2bfcSGreg Roach                    <br>
318dd6b2bfcSGreg Roach                    <?php endforeach ?>
319dd6b2bfcSGreg Roach                </td>
320dd6b2bfcSGreg Roach
321dd6b2bfcSGreg Roach                <!-- Death anniversary -->
322dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= -$individual->getEstimatedDeathDate()->julianDay() ?>">
323c0935879SGreg Roach                    <?php if (isset($death_dates[0]) && $death_dates[0]->gregorianYear() >= 1550 && $death_dates[0]->gregorianYear() < 2030 && !isset($unique_indis[$individual->xref()])) : ?>
324dd6b2bfcSGreg Roach                        <?php $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $individual->getSex() ?>
325dd6b2bfcSGreg Roach                        <?= Date::getAge($death_dates[0], null) ?>
326dd6b2bfcSGreg Roach                    <?php endif ?>
327dd6b2bfcSGreg Roach                </td>
328dd6b2bfcSGreg Roach
329dd6b2bfcSGreg Roach                <!-- Age at death -->
330dd6b2bfcSGreg Roach                <?php if (isset($birth_dates[0]) && isset($death_dates[0])) : ?>
331dd6b2bfcSGreg Roach                    <?php $age_at_death = I18N::number((int) Date::getAgeYears($birth_dates[0], $death_dates[0])); ?>
332dd6b2bfcSGreg Roach                    <?php $age_at_death_sort = Date::getAge($birth_dates[0], $death_dates[0]); ?>
333c0935879SGreg Roach                    <?php if (!isset($unique_indis[$individual->xref()]) && $age_at_death >= 0 && $age_at_death <= $max_age) : ?>
334dd6b2bfcSGreg Roach                        <?php $deat_by_age[$age_at_death] .= $individual->getSex(); ?>
335dd6b2bfcSGreg Roach                    <?php endif ?>
336dd6b2bfcSGreg Roach                <?php else : ?>
337dd6b2bfcSGreg Roach                    <?php $age_at_death = ''; ?>
338dd6b2bfcSGreg Roach                    <?php $age_at_death_sort = PHP_INT_MAX; ?>
339dd6b2bfcSGreg Roach                <?php endif ?>
340dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= e($age_at_death_sort) ?>">
341dd6b2bfcSGreg Roach                    <?= e($age_at_death) ?>
342dd6b2bfcSGreg Roach                </td>
343dd6b2bfcSGreg Roach
344dd6b2bfcSGreg Roach                <!-- Death place -->
345dd6b2bfcSGreg Roach                <td>
346dd6b2bfcSGreg Roach                    <?php foreach ($individual->getAllDeathPlaces() as $n => $death_place) : ?>
347392561bbSGreg Roach                        <?= $death_place->shortName(true) ?>
348dd6b2bfcSGreg Roach                        <br>
349dd6b2bfcSGreg Roach                    <?php endforeach ?>
350dd6b2bfcSGreg Roach                </td>
351dd6b2bfcSGreg Roach
352dd6b2bfcSGreg Roach                <!-- Last change -->
353dd6b2bfcSGreg Roach                <td data-sort="<?= $individual->lastChangeTimestamp(true) ?>">
354dd6b2bfcSGreg Roach                    <?= $individual->lastChangeTimestamp() ?>
355dd6b2bfcSGreg Roach                </td>
356dd6b2bfcSGreg Roach
357dd6b2bfcSGreg Roach                <!-- Filter by sex -->
358dd6b2bfcSGreg Roach                <td hidden>
359dd6b2bfcSGreg Roach                    <?= $individual->getSex() ?>
360dd6b2bfcSGreg Roach                </td>
361dd6b2bfcSGreg Roach
362dd6b2bfcSGreg Roach                <!-- Filter by birth date -->
363dd6b2bfcSGreg Roach                <td hidden>
364dd6b2bfcSGreg Roach                    <?php if (!$individual->canShow() || Date::compare($individual->getEstimatedBirthDate(), $hundred_years_ago) > 0) : ?>
365dd6b2bfcSGreg Roach                        Y100
366dd6b2bfcSGreg Roach                    <?php else : ?>
367dd6b2bfcSGreg Roach                        YES
368dd6b2bfcSGreg Roach                    <?php endif ?>
369dd6b2bfcSGreg Roach                </td>
370dd6b2bfcSGreg Roach
371dd6b2bfcSGreg Roach                <!-- Filter by death date -->
372dd6b2bfcSGreg Roach                <td hidden>
373dd6b2bfcSGreg Roach                    <?php if (isset($death_dates[0]) && Date::compare($death_dates[0], $hundred_years_ago) > 0) : ?>
374dd6b2bfcSGreg Roach                        Y100
375dd6b2bfcSGreg Roach                    <?php elseif ($individual->isDead()) : ?>
376dd6b2bfcSGreg Roach                        YES
377dd6b2bfcSGreg Roach                    <?php else : ?>
378dd6b2bfcSGreg Roach                        N
379dd6b2bfcSGreg Roach                    <?php endif ?>
380dd6b2bfcSGreg Roach                </td>
381dd6b2bfcSGreg Roach
382dd6b2bfcSGreg Roach                <!-- Filter by roots/leaves -->
383dd6b2bfcSGreg Roach                <td hidden>
384dd6b2bfcSGreg Roach                    <?php if (!$individual->getChildFamilies()) : ?>
385dd6b2bfcSGreg Roach                        R
386dd6b2bfcSGreg Roach                    <?php elseif (!$individual->isDead() && $individual->getNumberOfChildren() < 1) : ?>
387dd6b2bfcSGreg Roach                        L
388dd6b2bfcSGreg Roach                    <?php endif ?>
389dd6b2bfcSGreg Roach                </td>
390dd6b2bfcSGreg Roach            </tr>
391dd6b2bfcSGreg Roach
392c0935879SGreg Roach                <?php $unique_indis[$individual->xref()] = true ?>
393dd6b2bfcSGreg Roach            <?php endforeach ?>
394dd6b2bfcSGreg Roach        </tbody>
395dd6b2bfcSGreg Roach    </table>
396dd6b2bfcSGreg Roach
397dd6b2bfcSGreg Roach    <div id="individual-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' => $deat_by_decade, 'title' => I18N::translate('Decade of death')]) ?>
405dd6b2bfcSGreg Roach                </td>
406dd6b2bfcSGreg Roach            </tr>
407dd6b2bfcSGreg Roach            <tr>
408dd6b2bfcSGreg Roach                <td colspan="2">
409dd6b2bfcSGreg Roach                    <?= view('lists/chart-by-age', ['data' => $deat_by_age, 'title' => I18N::translate('Age related to death year')]) ?>
410dd6b2bfcSGreg Roach                </td>
411dd6b2bfcSGreg Roach            </tr>
412dd6b2bfcSGreg Roach        </table>
413dd6b2bfcSGreg Roach    </div>
414dd6b2bfcSGreg Roach</div>
415