xref: /webtrees/resources/views/lists/surnames-table.phtml (revision dd6b2bfcc550270bb6d6778e11576148f71e4330)
1<?php use Fisharebest\Webtrees\I18N; ?>
2
3<table class="table table-bordered table-sm datatables wt-table-surname" data-info="false" data-paging="false" data-searching="false" data-state-save="true" data-order="<?= e(json_encode($order ?? [[1, 'desc']])) ?>">
4    <caption class="sr-only">
5        <?= I18N::translate('Surnames') ?>
6    </caption>
7    <thead>
8        <tr>
9            <th>
10                <?= I18N::translate('Surname') ?>
11            </th>
12            <th>
13                <?php if ($route == 'family-list') :?>
14                    <?= I18N::translate('Spouses') ?>
15                <?php else : ?>
16                    <?= I18N::translate('Individuals') ?>
17                <?php endif ?>
18            </th>
19        </tr>
20    </thead>
21
22    <tbody>
23        <?php foreach ($surnames as $surn => $surns) : ?>
24            <tr>
25                <td data-sort="<?= e($surn) ?>">
26                    <!-- Multiple surname variants, e.g. von Groot, van Groot, van der Groot, etc. -->
27                    <?php foreach ($surns as $spfxsurn => $indis) : ?>
28                        <?php if ($spfxsurn) : ?>
29                            <?php if ($surn !== '') : ?>
30                                <a href="<?= route($route, ['surname' => $surn, 'ged' => $tree->getName()]) ?>" dir="auto">
31                                    <?= e($spfxsurn) ?>
32                                </a>
33                            <?php else : ?>
34                                <a href="<?= route($route, ['alpha' => ',', 'ged' => $tree->getName()]) ?>" dir="auto">
35                                    <?= e($spfxsurn) ?>
36                                </a>
37                            <?php endif ?>
38                        <?php else : ?>
39                            <!-- No surname, but a value from "2 SURN"? A common workaround for toponyms, etc. -->
40                            <a href="<?= route($route, ['surname' => $surn, 'ged' => $tree->getName()]) ?>" dir="auto"><?= e($surn) ?></a>
41                        <?php endif ?>
42                        <br>
43                    <?php endforeach ?>
44                </td>
45
46                <td class="text-center" data-sort="<?= array_sum($surns) ?>">
47                    <?php foreach ($surns as $indis) : ?>
48                        <?= I18N::number($indis) ?>
49                        <br>
50                    <?php endforeach ?>
51
52                    <?php if (count($surns) > 1) : ?>
53                        <?= I18N::number(array_sum($surns)) ?>
54                    <?php endif ?>
55                </td>
56            </tr>
57        <?php endforeach ?>
58    </tbody>
59</table>
60