summaryrefslogtreecommitdiff
path: root/resources/views/lists/surnames-table.phtml
blob: 2fa3405f6d48392a1a9a90c4b139a5d5f9084f18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php use Fisharebest\Webtrees\I18N; ?>
<?php use Fisharebest\Webtrees\Module\IndividualListModule; ?>

<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']])) ?>">
    <caption class="sr-only">
        <?= I18N::translate('Surnames') ?>
    </caption>
    <thead>
        <tr>
            <th>
                <?= I18N::translate('Surname') ?>
            </th>
            <th>
                <?php if ($families) :?>
                    <?= I18N::translate('Spouses') ?>
                <?php else : ?>
                    <?= I18N::translate('Individuals') ?>
                <?php endif ?>
            </th>
        </tr>
    </thead>

    <tbody>
        <?php foreach ($surnames as $surn => $surns) : ?>
            <tr>
                <td data-sort="<?= e($surn) ?>">
                    <!-- Multiple surname variants, e.g. von Groot, van Groot, van der Groot, etc. -->
                    <?php foreach ($surns as $spfxsurn => $indis) : ?>
                        <?php if ($module instanceof IndividualListModule) : ?>
                            <?php if ($spfxsurn) : ?>
                                <?php if ($surn !== '') : ?>
                                    <a href="<?= $module->listUrl($tree, ['surname' => $surn]) ?>" dir="auto">
                                        <?= e($spfxsurn) ?>
                                    </a>
                                <?php else : ?>
                                    <a href="<?= $module->listUrl($tree, ['alpha' => ',']) ?>" dir="auto">
                                        <?= e($spfxsurn) ?>
                                    </a>
                                <?php endif ?>
                            <?php else : ?>
                                <!-- No surname, but a value from "2 SURN"? A common workaround for toponyms, etc. -->
                                <a href="<?= $module->listUrl($tree, ['surname' => $surn]) ?>" dir="auto"><?= e($surn) ?></a>
                            <?php endif ?>
                        <?php else : ?>
                            <?php if ($spfxsurn) : ?>
                                <span dir="auto"><?= e($spfxsurn) ?></span>
                            <?php else : ?>
                                <!-- No surname, but a value from "2 SURN"? A common workaround for toponyms, etc. -->
                                <span dir="auto"><?= e($surn) ?></span>
                            <?php endif ?>    
                        <?php endif ?>
                        <br>
                    <?php endforeach ?>
                </td>

                <td class="text-center" data-sort="<?= array_sum($surns) ?>">
                    <?php foreach ($surns as $indis) : ?>
                        <?= I18N::number($indis) ?>
                        <br>
                    <?php endforeach ?>

                    <?php if (count($surns) > 1) : ?>
                        <?= I18N::number(array_sum($surns)) ?>
                    <?php endif ?>
                </td>
            </tr>
        <?php endforeach ?>
    </tbody>
</table>