xref: /webtrees/resources/views/lists/surnames-column-list.phtml (revision d3f966cc3d8b3007d6335281eae81905c58008ac)
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 ($surname === Individual::NOMEN_NESCIO) {
26                $label = I18N::translateContext('Unknown surname', '…');
27                $url   = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['alpha' => '@'] + $params) : '';
28            } elseif ($surname === '') {
29                $label = e($surn);
30                $url   = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['surname' => $surn] + $params) : '';
31            } else {
32                $label = e($surname);
33                $url   = $module instanceof ModuleListInterface ? $module->listUrl($tree, ['surname' => $surn] + $params) : '';
34            }
35
36            if ($totals) {
37                $item = I18N::translate('%1$s (%2$s)', '<span class="ut">' . $label . '</span>', I18N::number($count));
38            } else {
39                $item = '<span class="ut">' . $label . '</span>';
40            }
41            ?>
42            <div class="wt-surnames-column-list-item ut">
43                <?php if ($url !== '') : ?>
44                    <a href="<?= e($url) ?>"><?= $item ?></a>
45                <?php else : ?>
46                    <?= $item ?>
47                <?php endif ?>
48            </div>
49        <?php endforeach ?>
50    <?php endforeach ?>
51</div>
52