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