xref: /webtrees/resources/views/lists/individuals-table.phtml (revision 4ca7e03c48ab545219e9f91c7860d56cae5e1f09)
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; ?>
7*4ca7e03cSGreg 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
20*4ca7e03cSGreg 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>
211dd6b2bfcSGreg Roach                    <i class="icon-reminder" title="<?= I18N::translate('Anniversary') ?>"></i>
212dd6b2bfcSGreg Roach                </th>
213dd6b2bfcSGreg Roach                <th><?= I18N::translate('Place') ?></th>
214dd6b2bfcSGreg Roach                <th>
215dd6b2bfcSGreg Roach                    <i class="icon-children" title="<?= I18N::translate('Children') ?>"></i>
216dd6b2bfcSGreg Roach                </th>
217dd6b2bfcSGreg Roach                <th><?= I18N::translate('Death') ?></th>
218dd6b2bfcSGreg Roach                <th>
219dd6b2bfcSGreg Roach                    <i class="icon-reminder" title="<?= I18N::translate('Anniversary') ?>"></i>
220dd6b2bfcSGreg Roach                </th>
221dd6b2bfcSGreg Roach                <th><?= I18N::translate('Age') ?></th>
222dd6b2bfcSGreg Roach                <th><?= I18N::translate('Place') ?></th>
223dd6b2bfcSGreg Roach                <th><?= I18N::translate('Last change') ?></th>
224dd6b2bfcSGreg Roach                <th hidden></th>
225dd6b2bfcSGreg Roach                <th hidden></th>
226dd6b2bfcSGreg Roach                <th hidden></th>
227dd6b2bfcSGreg Roach                <th hidden></th>
228dd6b2bfcSGreg Roach            </tr>
229dd6b2bfcSGreg Roach        </thead>
230dd6b2bfcSGreg Roach        <tfoot>
231dd6b2bfcSGreg Roach            <tr>
232dd6b2bfcSGreg Roach                <th colspan="16">
233dd6b2bfcSGreg Roach                    <div class="btn-toolbar">
234dd6b2bfcSGreg Roach                        <div class="btn-group">
235dd6b2bfcSGreg Roach                            <button class="ui-state-default btn-toggle-parents">
236dd6b2bfcSGreg Roach                                <?= I18N::translate('Show parents') ?>
237dd6b2bfcSGreg Roach                            </button>
238dd6b2bfcSGreg Roach                            <button class="ui-state-default btn-toggle-statistics">
239dd6b2bfcSGreg Roach                                <?= I18N::translate('Show statistics charts') ?>
240dd6b2bfcSGreg Roach                            </button>
241dd6b2bfcSGreg Roach                        </div>
242dd6b2bfcSGreg Roach                    </div>
243dd6b2bfcSGreg Roach                </th>
244dd6b2bfcSGreg Roach            </tr>
245dd6b2bfcSGreg Roach        </tfoot>
246dd6b2bfcSGreg Roach
247dd6b2bfcSGreg Roach        <tbody>
248dd6b2bfcSGreg Roach            <?php foreach ($individuals as $key => $individual) : ?>
249dd6b2bfcSGreg Roach            <tr class="<?= $individual->isPendingDeletion() ? 'old' : ($individual->isPendingAddition() ? 'new' : '') ?>">
250dd6b2bfcSGreg Roach                <td colspan="2" data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', implode(',', array_reverse(explode(',', $individual->getSortName()))))) ?>">
251dd6b2bfcSGreg Roach                    <?php foreach ($individual->getAllNames() as $num => $name) : ?>
252dd6b2bfcSGreg Roach                        <a title="<?= $name['type'] === 'NAME' ? '' : GedcomTag::getLabel($name['type'], $individual) ?>" href="<?= e($individual->url()) ?>" class="<?= $num === $individual->getPrimaryName() ? 'name2' : '' ?>">
253dd6b2bfcSGreg Roach                            <?= $name['full'] ?>
254dd6b2bfcSGreg Roach                        </a>
255dd6b2bfcSGreg Roach                        <?php if ($num === $individual->getPrimaryName()) : ?>
256dd6b2bfcSGreg Roach                            <?= $individual->getSexImage() ?>
257dd6b2bfcSGreg Roach                        <?php endif ?>
258dd6b2bfcSGreg Roach                        <br>
259dd6b2bfcSGreg Roach                    <?php endforeach ?>
260dd6b2bfcSGreg Roach                    <?= $individual->getPrimaryParentsNames('parents details1', 'none') ?>
261dd6b2bfcSGreg Roach                </td>
262dd6b2bfcSGreg Roach
263dd6b2bfcSGreg Roach                <td hidden data-sort="<?= e(str_replace([',', '@P.N.', '@N.N.'], 'AAAA', $individual->getSortName())) ?>"></td>
264dd6b2bfcSGreg Roach
265dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= $key ?>">
266dd6b2bfcSGreg Roach                    <?php if ($sosa) : ?>
26784b37362SGreg Roach                        <?php if ($module instanceof RelationshipsChartModule) : ?>
26884b37362SGreg Roach                            <a href="<?= e($module->chartUrl($individuals[1], ['xref2' => $individual->xref()])) ?>" rel="nofollow" title="<?= I18N::translate('Relationships') ?>" rel="nofollow">
269dd6b2bfcSGreg Roach                                <?= I18N::number($key) ?>
270dd6b2bfcSGreg Roach                            </a>
27184b37362SGreg Roach                        <?php else : ?>
27284b37362SGreg Roach                            <?= I18N::number($key) ?>
27384b37362SGreg Roach                        <?php endif ?>
274dd6b2bfcSGreg Roach                    <?php endif ?>
275dd6b2bfcSGreg Roach                </td>
276dd6b2bfcSGreg Roach
277dd6b2bfcSGreg Roach                <!-- Birth date -->
278dd6b2bfcSGreg Roach                <td data-sort="<?= $individual->getEstimatedBirthDate()->julianDay() ?>">
279dd6b2bfcSGreg Roach                    <?php $birth_dates = $individual->getAllBirthDates(); ?>
280dd6b2bfcSGreg Roach
281dd6b2bfcSGreg Roach                    <?php foreach ($birth_dates as $n => $birth_date) : ?>
282dd6b2bfcSGreg Roach                        <?= $birth_date->display(true) ?>
283dd6b2bfcSGreg Roach                        <br>
284dd6b2bfcSGreg Roach                    <?php endforeach ?>
285dd6b2bfcSGreg Roach                </td>
286dd6b2bfcSGreg Roach
287dd6b2bfcSGreg Roach                <!-- Birth anniversary -->
288dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= -$individual->getEstimatedBirthDate()->julianDay() ?>">
289c0935879SGreg Roach                    <?php if (isset($birth_dates[0]) && $birth_dates[0]->gregorianYear() >= 1550 && $birth_dates[0]->gregorianYear() < 2030 && !isset($unique_indis[$individual->xref()])) : ?>
290dd6b2bfcSGreg Roach                        <?php $birt_by_decade[(int) ($birth_dates[0]->gregorianYear() / 10) * 10] .= $individual->getSex() ?>
291dd6b2bfcSGreg Roach                        <?= Date::getAge($birth_dates[0], null) ?>
292dd6b2bfcSGreg Roach                    <?php endif ?>
293dd6b2bfcSGreg Roach                </td>
294dd6b2bfcSGreg Roach
295dd6b2bfcSGreg Roach                <!-- Birth place -->
296dd6b2bfcSGreg Roach                <td>
297dd6b2bfcSGreg Roach                    <?php foreach ($individual->getAllBirthPlaces() as $n => $birth_place) : ?>
298392561bbSGreg Roach                        <?= $birth_place->shortName(true) ?>
299dd6b2bfcSGreg Roach                        <br>
300dd6b2bfcSGreg Roach                    <?php endforeach ?>
301dd6b2bfcSGreg Roach                </td>
302dd6b2bfcSGreg Roach
303dd6b2bfcSGreg Roach                <!-- Number of children -->
304dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= $individual->getNumberOfChildren() ?>">
305dd6b2bfcSGreg Roach                    <?= I18N::number($individual->getNumberOfChildren()) ?>
306dd6b2bfcSGreg Roach                </td>
307dd6b2bfcSGreg Roach
308dd6b2bfcSGreg Roach                <!--    Death date -->
309dd6b2bfcSGreg Roach                <?php $death_dates = $individual->getAllDeathDates() ?>
310dd6b2bfcSGreg Roach                <td data-sort="<?= $individual->getEstimatedDeathDate()->julianDay() ?>">
311dd6b2bfcSGreg Roach                    <?php foreach ($death_dates as $num => $death_date) : ?>
312dd6b2bfcSGreg Roach                        <?= $death_date->display(true) ?>
313dd6b2bfcSGreg Roach                    <br>
314dd6b2bfcSGreg Roach                    <?php endforeach ?>
315dd6b2bfcSGreg Roach                </td>
316dd6b2bfcSGreg Roach
317dd6b2bfcSGreg Roach                <!-- Death anniversary -->
318dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= -$individual->getEstimatedDeathDate()->julianDay() ?>">
319c0935879SGreg Roach                    <?php if (isset($death_dates[0]) && $death_dates[0]->gregorianYear() >= 1550 && $death_dates[0]->gregorianYear() < 2030 && !isset($unique_indis[$individual->xref()])) : ?>
320dd6b2bfcSGreg Roach                        <?php $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $individual->getSex() ?>
321dd6b2bfcSGreg Roach                        <?= Date::getAge($death_dates[0], null) ?>
322dd6b2bfcSGreg Roach                    <?php endif ?>
323dd6b2bfcSGreg Roach                </td>
324dd6b2bfcSGreg Roach
325dd6b2bfcSGreg Roach                <!-- Age at death -->
326dd6b2bfcSGreg Roach                <?php if (isset($birth_dates[0]) && isset($death_dates[0])) : ?>
327dd6b2bfcSGreg Roach                    <?php $age_at_death = I18N::number((int) Date::getAgeYears($birth_dates[0], $death_dates[0])); ?>
328dd6b2bfcSGreg Roach                    <?php $age_at_death_sort = Date::getAge($birth_dates[0], $death_dates[0]); ?>
329c0935879SGreg Roach                    <?php if (!isset($unique_indis[$individual->xref()]) && $age_at_death >= 0 && $age_at_death <= $max_age) : ?>
330dd6b2bfcSGreg Roach                        <?php $deat_by_age[$age_at_death] .= $individual->getSex(); ?>
331dd6b2bfcSGreg Roach                    <?php endif ?>
332dd6b2bfcSGreg Roach                <?php else : ?>
333dd6b2bfcSGreg Roach                    <?php $age_at_death = ''; ?>
334dd6b2bfcSGreg Roach                    <?php $age_at_death_sort = PHP_INT_MAX; ?>
335dd6b2bfcSGreg Roach                <?php endif ?>
336dd6b2bfcSGreg Roach                <td class="center" data-sort="<?= e($age_at_death_sort) ?>">
337dd6b2bfcSGreg Roach                    <?= e($age_at_death) ?>
338dd6b2bfcSGreg Roach                </td>
339dd6b2bfcSGreg Roach
340dd6b2bfcSGreg Roach                <!-- Death place -->
341dd6b2bfcSGreg Roach                <td>
342dd6b2bfcSGreg Roach                    <?php foreach ($individual->getAllDeathPlaces() as $n => $death_place) : ?>
343392561bbSGreg Roach                        <?= $death_place->shortName(true) ?>
344dd6b2bfcSGreg Roach                        <br>
345dd6b2bfcSGreg Roach                    <?php endforeach ?>
346dd6b2bfcSGreg Roach                </td>
347dd6b2bfcSGreg Roach
348dd6b2bfcSGreg Roach                <!-- Last change -->
349dd6b2bfcSGreg Roach                <td data-sort="<?= $individual->lastChangeTimestamp(true) ?>">
350dd6b2bfcSGreg Roach                    <?= $individual->lastChangeTimestamp() ?>
351dd6b2bfcSGreg Roach                </td>
352dd6b2bfcSGreg Roach
353dd6b2bfcSGreg Roach                <!-- Filter by sex -->
354dd6b2bfcSGreg Roach                <td hidden>
355dd6b2bfcSGreg Roach                    <?= $individual->getSex() ?>
356dd6b2bfcSGreg Roach                </td>
357dd6b2bfcSGreg Roach
358dd6b2bfcSGreg Roach                <!-- Filter by birth date -->
359dd6b2bfcSGreg Roach                <td hidden>
360dd6b2bfcSGreg Roach                    <?php if (!$individual->canShow() || Date::compare($individual->getEstimatedBirthDate(), $hundred_years_ago) > 0) : ?>
361dd6b2bfcSGreg Roach                        Y100
362dd6b2bfcSGreg Roach                    <?php else : ?>
363dd6b2bfcSGreg Roach                        YES
364dd6b2bfcSGreg Roach                    <?php endif ?>
365dd6b2bfcSGreg Roach                </td>
366dd6b2bfcSGreg Roach
367dd6b2bfcSGreg Roach                <!-- Filter by death date -->
368dd6b2bfcSGreg Roach                <td hidden>
369dd6b2bfcSGreg Roach                    <?php if (isset($death_dates[0]) && Date::compare($death_dates[0], $hundred_years_ago) > 0) : ?>
370dd6b2bfcSGreg Roach                        Y100
371dd6b2bfcSGreg Roach                    <?php elseif ($individual->isDead()) : ?>
372dd6b2bfcSGreg Roach                        YES
373dd6b2bfcSGreg Roach                    <?php else : ?>
374dd6b2bfcSGreg Roach                        N
375dd6b2bfcSGreg Roach                    <?php endif ?>
376dd6b2bfcSGreg Roach                </td>
377dd6b2bfcSGreg Roach
378dd6b2bfcSGreg Roach                <!-- Filter by roots/leaves -->
379dd6b2bfcSGreg Roach                <td hidden>
380dd6b2bfcSGreg Roach                    <?php if (!$individual->getChildFamilies()) : ?>
381dd6b2bfcSGreg Roach                        R
382dd6b2bfcSGreg Roach                    <?php elseif (!$individual->isDead() && $individual->getNumberOfChildren() < 1) : ?>
383dd6b2bfcSGreg Roach                        L
384dd6b2bfcSGreg Roach                    <?php endif ?>
385dd6b2bfcSGreg Roach                </td>
386dd6b2bfcSGreg Roach            </tr>
387dd6b2bfcSGreg Roach
388c0935879SGreg Roach                <?php $unique_indis[$individual->xref()] = true ?>
389dd6b2bfcSGreg Roach            <?php endforeach ?>
390dd6b2bfcSGreg Roach        </tbody>
391dd6b2bfcSGreg Roach    </table>
392dd6b2bfcSGreg Roach
393dd6b2bfcSGreg Roach    <div id="individual-charts-<?= e($table_id) ?>" style="display:none">
394dd6b2bfcSGreg Roach        <table class="list-charts">
395dd6b2bfcSGreg Roach            <tr>
396dd6b2bfcSGreg Roach                <td>
397dd6b2bfcSGreg Roach                    <?= view('lists/chart-by-decade', ['data' => $birt_by_decade, 'title' => I18N::translate('Decade of birth')]) ?>
398dd6b2bfcSGreg Roach                </td>
399dd6b2bfcSGreg Roach                <td>
400dd6b2bfcSGreg Roach                    <?= view('lists/chart-by-decade', ['data' => $deat_by_decade, 'title' => I18N::translate('Decade of death')]) ?>
401dd6b2bfcSGreg Roach                </td>
402dd6b2bfcSGreg Roach            </tr>
403dd6b2bfcSGreg Roach            <tr>
404dd6b2bfcSGreg Roach                <td colspan="2">
405dd6b2bfcSGreg Roach                    <?= view('lists/chart-by-age', ['data' => $deat_by_age, 'title' => I18N::translate('Age related to death year')]) ?>
406dd6b2bfcSGreg Roach                </td>
407dd6b2bfcSGreg Roach            </tr>
408dd6b2bfcSGreg Roach        </table>
409dd6b2bfcSGreg Roach    </div>
410dd6b2bfcSGreg Roach</div>
411