This repository has been archived by the owner on Sep 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
surnames-table.php
66 lines (62 loc) · 1.99 KB
/
surnames-table.php
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
<?php
/**
* Change: datatable attributes
* Themes: all themes
*
*/
?>
<?php use Fisharebest\Webtrees\I18N; ?>
<table class="table table-bordered table-sm datatables wt-table-surname" data-page-length="50" 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 ($route == 'family-list'):?>
<?= 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 ($spfxsurn): ?>
<?php if ($surn !== ''): ?>
<a href="<?= route($route, ['surname' => $surn, 'ged' => $tree->getName()]) ?>" dir="auto">
<?= e($spfxsurn) ?>
</a>
<?php else: ?>
<a href="<?= route($route, ['alpha' => ',', 'ged' => $tree->getName()]) ?>" 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="<?= route($route, ['surname' => $surn, 'ged' => $tree->getName()]) ?>" dir="auto"><?= e($surn) ?></a>
<?php endif ?>
<br>
<?php endforeach ?>
</td>
<td class="text-center" data-sort="<?= array_sum(array_map(function(array $x) { return count($x); }, $surns)) ?>">
<?php foreach ($surns as $indis): ?>
<?= I18N::number(count($indis)) ?>
<br>
<?php endforeach ?>
<?php if (count($surns) > 1): ?>
<?= I18N::number(array_sum(array_map(function(array $x) { return count($x); }, $surns))) ?>
<?php endif ?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>