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