xref: /webtrees/resources/views/lists/surnames-column-list.phtml (revision 62e53f80eeac6a5772f46673847f5a2a8af316b1)
1cd1ec0d0SGreg Roach<?php
2cd1ec0d0SGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
5cd1ec0d0SGreg Roachuse Fisharebest\Webtrees\I18N;
652288ec7SGreg Roachuse Fisharebest\Webtrees\Individual;
7cd1ec0d0SGreg Roachuse Fisharebest\Webtrees\Module\IndividualListModule;
8cd1ec0d0SGreg Roachuse Fisharebest\Webtrees\Module\ModuleListInterface;
9cd1ec0d0SGreg Roachuse Fisharebest\Webtrees\Tree;
10cd1ec0d0SGreg Roach
11cd1ec0d0SGreg Roach/**
12cd1ec0d0SGreg Roach * @var IndividualListModule|null $module
137a3804a2SGreg Roach * @var array<string,string>      $params
1452288ec7SGreg Roach * @var array<array<int>>         $surnames
15cd1ec0d0SGreg Roach * @var bool                      $totals
16cd1ec0d0SGreg Roach * @var Tree                      $tree
17cd1ec0d0SGreg Roach */
18cd1ec0d0SGreg Roach
19cd1ec0d0SGreg Roach?>
20cd1ec0d0SGreg Roach
21cd1ec0d0SGreg Roach<div class="wt-surnames-column-list px-3" style="columns: 15rem; column-rule: solid thin gray; border: solid thin gray;">
22cd1ec0d0SGreg Roach    <?php foreach ($surnames as $surn => $surns) : ?>
2352288ec7SGreg Roach        <?php foreach ($surns as $surname => $count) : ?>
24cd1ec0d0SGreg Roach            <?php
25*62e53f80SGreg Roach            if ($surname === Individual::NOMEN_NESCIO) {
2652288ec7SGreg Roach                $label = I18N::translateContext('Unknown surname', '…');
27*62e53f80SGreg Roach                $url   = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['alpha' => '@'] + $params) : '';
2852288ec7SGreg Roach            } elseif ($surname === '') {
2952288ec7SGreg Roach                $label = e($surn);
30*62e53f80SGreg Roach                $url   = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['surname' => $surn] + $params) : '';
3152288ec7SGreg Roach            } else {
3252288ec7SGreg Roach                $label = e($surname);
33*62e53f80SGreg Roach                $url   = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['surname' => $surn] + $params) : '';
3452288ec7SGreg Roach            }
35214be48cSGreg Roach
36214be48cSGreg Roach            if ($totals) {
3752288ec7SGreg Roach                $item = I18N::translate('%1$s (%2$s)', '<span class="ut">' . $label . '</span>', I18N::number($count));
38214be48cSGreg Roach            } else {
3952288ec7SGreg Roach                $item = '<span class="ut">' . $label . '</span>';
40214be48cSGreg Roach            }
41cd1ec0d0SGreg Roach            ?>
4252288ec7SGreg Roach            <div class="wt-surnames-column-list-item ut">
4352288ec7SGreg Roach                <?php if ($url !== '') : ?>
4452288ec7SGreg Roach                    <a href="<?= e($url) ?>"><?= $item ?></a>
45cd1ec0d0SGreg Roach                <?php else : ?>
46214be48cSGreg Roach                    <?= $item ?>
47cd1ec0d0SGreg Roach                <?php endif ?>
48cd1ec0d0SGreg Roach            </div>
49cd1ec0d0SGreg Roach        <?php endforeach ?>
50cd1ec0d0SGreg Roach    <?php endforeach ?>
51cd1ec0d0SGreg Roach</div>
52