1cd1ec0d0SGreg Roach<?php 2cd1ec0d0SGreg Roach 3*10e06497SGreg Roachdeclare(strict_types=1); 4*10e06497SGreg Roach 5cd1ec0d0SGreg Roachuse Fisharebest\Webtrees\I18N; 6cd1ec0d0SGreg Roachuse Fisharebest\Webtrees\Module\IndividualListModule; 7cd1ec0d0SGreg Roachuse Fisharebest\Webtrees\Module\ModuleListInterface; 8cd1ec0d0SGreg Roachuse Fisharebest\Webtrees\Tree; 9cd1ec0d0SGreg Roach 10cd1ec0d0SGreg Roach/** 11cd1ec0d0SGreg Roach * @var IndividualListModule|null $module 12cd1ec0d0SGreg Roach * @var array<string,array<string,string>> $surnames 13cd1ec0d0SGreg Roach * @var bool $totals 14cd1ec0d0SGreg Roach * @var Tree $tree 15cd1ec0d0SGreg Roach */ 16cd1ec0d0SGreg Roach 17cd1ec0d0SGreg Roach$maximum = max(array_map(static fn (array $x): int => max($x), $surnames)); 18cd1ec0d0SGreg Roach$minimum = min(array_map(static fn (array $x): int => min($x), $surnames)); 19cd1ec0d0SGreg Roach 20cd1ec0d0SGreg Roach?> 21cd1ec0d0SGreg Roach 22cd1ec0d0SGreg Roach<div class="wt-surnames-column-list px-3" style="columns: 15rem; column-rule: solid thin gray; border: solid thin gray;"> 23cd1ec0d0SGreg Roach <?php foreach ($surnames as $surn => $surns) : ?> 24cd1ec0d0SGreg Roach <?php foreach ($surns as $spfxsurn => $count) : ?> 25cd1ec0d0SGreg Roach <?php 26cd1ec0d0SGreg Roach $size = 1.0 + ($maximum === $minimum ? 0 : 1.5 * ($count - $minimum) / ($maximum - $minimum)); 27214be48cSGreg Roach $label = $spfxsurn ? e($spfxsurn) : I18N::translate('No surname'); 28214be48cSGreg Roach 29214be48cSGreg Roach if ($totals) { 30214be48cSGreg Roach $item = I18N::translate('%1$s (%2$s)', '<bdi>' . $label . '</bdi>', I18N::number($count)); 31214be48cSGreg Roach } else { 32214be48cSGreg Roach $item = '<bdi>' . $label . '</bdi>'; 33214be48cSGreg Roach } 34cd1ec0d0SGreg Roach ?> 35cd1ec0d0SGreg Roach <div class="wt-surnames-column-list-item"> 36cd1ec0d0SGreg Roach <?php if ($module instanceof ModuleListInterface) : ?> 37cd1ec0d0SGreg Roach <a href="<?= e($module->listUrl($tree, ['surname' => $surn])) ?>"> 38214be48cSGreg Roach <?= $item ?> 39cd1ec0d0SGreg Roach </a> 40cd1ec0d0SGreg Roach <?php else : ?> 41214be48cSGreg Roach <?= $item ?> 42cd1ec0d0SGreg Roach <?php endif ?> 43cd1ec0d0SGreg Roach </div> 44cd1ec0d0SGreg Roach <?php endforeach ?> 45cd1ec0d0SGreg Roach <?php endforeach ?> 46cd1ec0d0SGreg Roach</div> 47