xref: /webtrees/resources/views/lists/surnames-table.phtml (revision 214be48c32e57df34e154cd8ec7bc3bf7fa4615a)
153b246c5SGreg Roach<?php
253b246c5SGreg Roach
353b246c5SGreg Roachuse Fisharebest\Webtrees\I18N;
453b246c5SGreg Roachuse Fisharebest\Webtrees\Module\IndividualListModule;
5dc270d8cSGreg Roachuse Fisharebest\Webtrees\Tree;
6dc270d8cSGreg Roach
7dc270d8cSGreg Roach/**
8dc270d8cSGreg Roach * @var bool                               $families
9dc270d8cSGreg Roach * @var IndividualListModule|null          $module
10c9128110SGreg Roach * @var array<array<int,string>>           $order
11dc270d8cSGreg Roach * @var array<string,array<string,string>> $surnames
12dc270d8cSGreg Roach * @var Tree                               $tree
13dc270d8cSGreg Roach */
1453b246c5SGreg Roach
1553b246c5SGreg Roach?>
16dd6b2bfcSGreg Roach
17b4139381SGreg Roach<table
18b4139381SGreg Roach    class="table table-bordered table-sm wt-table-surname datatables d-none"
19b4139381SGreg Roach    <?= view('lists/datatables-attributes') ?>
20b4139381SGreg Roach    data-info="false"
21b4139381SGreg Roach    data-paging="false"
22b4139381SGreg Roach    data-searching="false"
23c9128110SGreg Roach    data-order="<?= e(json_encode($order, JSON_THROW_ON_ERROR)) ?>"
24b4139381SGreg Roach>
25315eb316SGreg Roach    <caption class="visually-hidden">
26dd6b2bfcSGreg Roach        <?= I18N::translate('Surnames') ?>
27dd6b2bfcSGreg Roach    </caption>
28dd6b2bfcSGreg Roach    <thead>
29dd6b2bfcSGreg Roach        <tr>
30dd6b2bfcSGreg Roach            <th>
31dd6b2bfcSGreg Roach                <?= I18N::translate('Surname') ?>
32dd6b2bfcSGreg Roach            </th>
33dd6b2bfcSGreg Roach            <th>
3467992b6aSRichard Cissee                <?php if ($families) :?>
35dd6b2bfcSGreg Roach                    <?= I18N::translate('Spouses') ?>
36dd6b2bfcSGreg Roach                <?php else : ?>
37dd6b2bfcSGreg Roach                    <?= I18N::translate('Individuals') ?>
38dd6b2bfcSGreg Roach                <?php endif ?>
39dd6b2bfcSGreg Roach            </th>
40dd6b2bfcSGreg Roach        </tr>
41dd6b2bfcSGreg Roach    </thead>
42dd6b2bfcSGreg Roach
43dd6b2bfcSGreg Roach    <tbody>
44dd6b2bfcSGreg Roach        <?php foreach ($surnames as $surn => $surns) : ?>
45dd6b2bfcSGreg Roach            <tr>
46dd6b2bfcSGreg Roach                <td data-sort="<?= e($surn) ?>">
47dd6b2bfcSGreg Roach                    <!-- Multiple surname variants, e.g. von Groot, van Groot, van der Groot, etc. -->
48dd6b2bfcSGreg Roach                    <?php foreach ($surns as $spfxsurn => $indis) : ?>
49dc270d8cSGreg Roach                        <?php if ($module instanceof IndividualListModule) : ?>
50dd6b2bfcSGreg Roach                            <?php if ($spfxsurn) : ?>
51dd6b2bfcSGreg Roach                                <?php if ($surn !== '') : ?>
5267992b6aSRichard Cissee                                    <a href="<?= $module->listUrl($tree, ['surname' => $surn]) ?>" dir="auto">
53dd6b2bfcSGreg Roach                                        <?= e($spfxsurn) ?>
54dd6b2bfcSGreg Roach                                    </a>
55dd6b2bfcSGreg Roach                                <?php else : ?>
5667992b6aSRichard Cissee                                    <a href="<?= $module->listUrl($tree, ['alpha' => ',']) ?>" dir="auto">
57dd6b2bfcSGreg Roach                                        <?= e($spfxsurn) ?>
58dd6b2bfcSGreg Roach                                    </a>
59dd6b2bfcSGreg Roach                                <?php endif ?>
60dd6b2bfcSGreg Roach                            <?php else : ?>
61dd6b2bfcSGreg Roach                                <!-- No surname, but a value from "2 SURN"? A common workaround for toponyms, etc. -->
62*214be48cSGreg Roach                                <a href="<?= $module->listUrl($tree, ['surname' => $surn]) ?>" dir="auto"><?= I18N::translate('No surname') ?></a>
6367992b6aSRichard Cissee                            <?php endif ?>
6467992b6aSRichard Cissee                        <?php else : ?>
6567992b6aSRichard Cissee                            <?php if ($spfxsurn) : ?>
66315eb316SGreg Roach                                <bdi><?= e($spfxsurn) ?></bdi>
6767992b6aSRichard Cissee                            <?php else : ?>
6867992b6aSRichard Cissee                                <!-- No surname, but a value from "2 SURN"? A common workaround for toponyms, etc. -->
69315eb316SGreg Roach                                <bdi><?= e($surn) ?></bdi>
7067992b6aSRichard Cissee                            <?php endif ?>
71dd6b2bfcSGreg Roach                        <?php endif ?>
72dd6b2bfcSGreg Roach                        <br>
73dd6b2bfcSGreg Roach                    <?php endforeach ?>
74dd6b2bfcSGreg Roach                </td>
75dd6b2bfcSGreg Roach
76dd6b2bfcSGreg Roach                <td class="text-center" data-sort="<?= array_sum($surns) ?>">
77dd6b2bfcSGreg Roach                    <?php foreach ($surns as $indis) : ?>
78dd6b2bfcSGreg Roach                        <?= I18N::number($indis) ?>
79dd6b2bfcSGreg Roach                        <br>
80dd6b2bfcSGreg Roach                    <?php endforeach ?>
81dd6b2bfcSGreg Roach
82dd6b2bfcSGreg Roach                    <?php if (count($surns) > 1) : ?>
83dd6b2bfcSGreg Roach                        <?= I18N::number(array_sum($surns)) ?>
84dd6b2bfcSGreg Roach                    <?php endif ?>
85dd6b2bfcSGreg Roach                </td>
86dd6b2bfcSGreg Roach            </tr>
87dd6b2bfcSGreg Roach        <?php endforeach ?>
88dd6b2bfcSGreg Roach    </tbody>
89dd6b2bfcSGreg Roach</table>
90