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