xref: /webtrees/resources/views/lists/surnames-column-list.phtml (revision 1082dae98fac1db8249bca55d2b3fdce9ae0fac3)
1<?php
2
3use Fisharebest\Webtrees\I18N;
4use Fisharebest\Webtrees\Module\IndividualListModule;
5use Fisharebest\Webtrees\Module\ModuleListInterface;
6use Fisharebest\Webtrees\Tree;
7
8/**
9 * @var IndividualListModule|null          $module
10 * @var array<string,array<string,string>> $surnames
11 * @var bool                               $totals
12 * @var Tree                               $tree
13 */
14
15$maximum = max(array_map(static fn (array $x): int => max($x), $surnames));
16$minimum = min(array_map(static fn (array $x): int => min($x), $surnames));
17
18?>
19
20<div class="wt-surnames-column-list px-3" style="columns: 15rem; column-rule: solid thin gray; border: solid thin gray;">
21    <?php foreach ($surnames as $surn => $surns) : ?>
22        <?php foreach ($surns as $spfxsurn => $count) : ?>
23            <?php
24                $size = 1.0 + ($maximum === $minimum ? 0 : 1.5 * ($count - $minimum) / ($maximum - $minimum));
25                $tag_item = $totals ? I18N::translate('%1$s (%2$s)', '<bdi>' . e($spfxsurn) . '</bdi>', I18N::number($count)) : e($spfxsurn);
26            ?>
27            <div class="wt-surnames-column-list-item">
28                <?php if ($module instanceof ModuleListInterface) : ?>
29                    <a href="<?= e($module->listUrl($tree, ['surname' => $surn])) ?>">
30                        <?= $tag_item ?>
31                    </a>
32                <?php else : ?>
33                    <?= $tag_item ?>
34                <?php endif ?>
35            </div>
36        <?php endforeach ?>
37    <?php endforeach ?>
38</div>
39