1<?php 2 3declare(strict_types=1); 4 5use Fisharebest\Webtrees\I18N; 6use Fisharebest\Webtrees\Individual; 7use Fisharebest\Webtrees\Module\IndividualListModule; 8use Fisharebest\Webtrees\Module\ModuleListInterface; 9use Fisharebest\Webtrees\Tree; 10 11/** 12 * @var IndividualListModule|null $module 13 * @var array<string,string> $params 14 * @var array<array<int>> $surnames 15 * @var bool $totals 16 * @var Tree $tree 17 */ 18 19$maximum = max(array_map(static fn (array $x): int => max($x), $surnames)); 20$minimum = min(array_map(static fn (array $x): int => min($x), $surnames)); 21 22?> 23 24<div class="wt-surnames-column-list px-3" style="columns: 15rem; column-rule: solid thin gray; border: solid thin gray;"> 25 <?php foreach ($surnames as $surn => $surns) : ?> 26 <?php foreach ($surns as $surname => $count) : ?> 27 <?php 28 $size = 1.0 + ($maximum === $minimum ? 0 : 1.5 * ($count - $minimum) / ($maximum - $minimum)); 29 30 if ($surn === Individual::NOMEN_NESCIO) { 31 $label = I18N::translateContext('Unknown surname', '…'); 32 $url = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['surname' => $surname] + $params) : ''; 33 } elseif ($surname === '') { 34 if ($surn === '') { 35 $label = I18N::translate('No surname'); 36 } else { 37 $label = e($surn); 38 } 39 $url = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['surname' => $surname] + $params) : ''; 40 } else { 41 $label = e($surname); 42 $url = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['surname' => $surname] + $params) : ''; 43 } 44 45 if ($totals) { 46 $item = I18N::translate('%1$s (%2$s)', '<span class="ut">' . $label . '</span>', I18N::number($count)); 47 } else { 48 $item = '<span class="ut">' . $label . '</span>'; 49 } 50 ?> 51 <div class="wt-surnames-column-list-item ut"> 52 <?php if ($url !== '') : ?> 53 <a href="<?= e($url) ?>"><?= $item ?></a> 54 <?php else : ?> 55 <?= $item ?> 56 <?php endif ?> 57 </div> 58 <?php endforeach ?> 59 <?php endforeach ?> 60</div> 61