1<?php 2 3declare(strict_types=1); 4 5use Fisharebest\Webtrees\I18N; 6use Fisharebest\Webtrees\Module\IndividualListModule; 7use Fisharebest\Webtrees\Tree; 8 9/** 10 * @var bool $families 11 * @var IndividualListModule|null $module 12 * @var array<array<int,string>> $order 13 * @var array<string,array<string,string>> $surnames 14 * @var Tree $tree 15 */ 16 17?> 18 19<table 20 class="table table-bordered table-sm wt-table-surname datatables d-none" 21 <?= view('lists/datatables-attributes') ?> 22 data-info="false" 23 data-paging="false" 24 data-searching="false" 25 data-order="<?= e(json_encode($order, JSON_THROW_ON_ERROR)) ?>" 26> 27 <caption class="visually-hidden"> 28 <?= I18N::translate('Surnames') ?> 29 </caption> 30 <thead> 31 <tr> 32 <th> 33 <?= I18N::translate('Surname') ?> 34 </th> 35 <th> 36 <?php if ($families) :?> 37 <?= I18N::translate('Spouses') ?> 38 <?php else : ?> 39 <?= I18N::translate('Individuals') ?> 40 <?php endif ?> 41 </th> 42 </tr> 43 </thead> 44 45 <tbody> 46 <?php foreach ($surnames as $surn => $surns) : ?> 47 <tr> 48 <td data-sort="<?= $n = 1 + ($n ?? 0) ?>"> 49 <!-- Multiple surname variants, e.g. von Groot, van Groot, van der Groot, etc. --> 50 <?php foreach ($surns as $spfxsurn => $indis) : ?> 51 <?php if ($module instanceof IndividualListModule) : ?> 52 <?php if ($spfxsurn) : ?> 53 <?php if ($surn !== '') : ?> 54 <a href="<?= $module->listUrl($tree, ['surname' => $surn]) ?>" dir="auto"> 55 <?= e($spfxsurn) ?> 56 </a> 57 <?php else : ?> 58 <a href="<?= $module->listUrl($tree, ['alpha' => ',']) ?>" dir="auto"> 59 <?= e($spfxsurn) ?> 60 </a> 61 <?php endif ?> 62 <?php else : ?> 63 <!-- No surname, but a value from "2 SURN"? A common workaround for toponyms, etc. --> 64 <a href="<?= $module->listUrl($tree, ['surname' => $surn]) ?>" dir="auto"><?= I18N::translate('No surname') ?></a> 65 <?php endif ?> 66 <?php else : ?> 67 <?php if ($spfxsurn) : ?> 68 <bdi><?= e($spfxsurn) ?></bdi> 69 <?php else : ?> 70 <!-- No surname, but a value from "2 SURN"? A common workaround for toponyms, etc. --> 71 <bdi><?= e($surn) ?></bdi> 72 <?php endif ?> 73 <?php endif ?> 74 <br> 75 <?php endforeach ?> 76 </td> 77 78 <td class="text-center" data-sort="<?= array_sum($surns) ?>"> 79 <?php foreach ($surns as $indis) : ?> 80 <?= I18N::number($indis) ?> 81 <br> 82 <?php endforeach ?> 83 84 <?php if (count($surns) > 1) : ?> 85 <?= I18N::number(array_sum($surns)) ?> 86 <?php endif ?> 87 </td> 88 </tr> 89 <?php endforeach ?> 90 </tbody> 91</table> 92