xref: /webtrees/resources/views/lists/surnames-column-list.phtml (revision 6f4ec3cadc983f0a7294108c634bef48846b4311)
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?>
20
21<div class="wt-surnames-column-list px-3" style="columns: 15rem; column-rule: solid thin gray; border: solid thin gray;">
22    <?php foreach ($surnames as $surn => $surns) : ?>
23        <?php foreach ($surns as $surname => $count) : ?>
24            <?php
25            if ($surn === Individual::NOMEN_NESCIO) {
26                $label = I18N::translateContext('Unknown surname', '…');
27                $url   = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['surname' => $surname] + $params) : '';
28            } elseif ($surname === '') {
29                if ($surn === '') {
30                    $label = I18N::translate('No surname');
31                } else {
32                    $label = e($surn);
33                }
34                $url = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['surname' => $surname] + $params) : '';
35            } else {
36                $label = e($surname);
37                $url   = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['surname' => $surname] + $params) : '';
38            }
39
40            if ($totals) {
41                $item = I18N::translate('%1$s (%2$s)', '<span class="ut">' . $label . '</span>', I18N::number($count));
42            } else {
43                $item = '<span class="ut">' . $label . '</span>';
44            }
45            ?>
46            <div class="wt-surnames-column-list-item ut">
47                <?php if ($url !== '') : ?>
48                    <a href="<?= e($url) ?>"><?= $item ?></a>
49                <?php else : ?>
50                    <?= $item ?>
51                <?php endif ?>
52            </div>
53        <?php endforeach ?>
54    <?php endforeach ?>
55</div>
56