xref: /webtrees/resources/views/admin/trees-duplicates.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\GedcomRecord;
6use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
7use Fisharebest\Webtrees\Http\RequestHandlers\ManageTrees;
8use Fisharebest\Webtrees\Http\RequestHandlers\MergeFactsPage;
9use Fisharebest\Webtrees\I18N;
10use Fisharebest\Webtrees\Tree;
11
12/**
13 * @var array<string,array<int,array<int,GedcomRecord>>> $duplicates
14 * @var Tree                                             $tree
15 * @var string                                           $title
16 */
17
18?>
19
20<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ManageTrees::class, ['tree' => $tree->name()]) => I18N::translate('Manage family trees'), $title]]) ?>
21
22<h1><?= $title ?></h1>
23
24<?php foreach ($duplicates as $category => $records) : ?>
25    <h2><?= $category ?></h2>
26
27    <?php if (!empty($records)) : ?>
28        <ol>
29            <?php foreach ($records as $duplicates) : ?>
30                <li>
31                    <?= $duplicates[0]->fullName() ?>
32                    <?php foreach ($duplicates as $record) : ?>
3334                        <a href="<?= e($record->url()) ?>">
35                            <?= $record->xref() ?>
36                        </a>
37                    <?php endforeach ?>
38                    <?php if (count($duplicates) === 2) : ?>
3940                        <a href="<?= e(route(MergeFactsPage::class, ['tree' => $tree->name(), 'xref1' => $duplicates[0]->xref(), 'xref2' => $duplicates[1]->xref()])) ?>">
41                            <?= I18N::translate('Merge') ?>
42                        </a>
43                    <?php endif ?>
44                </li>
45            <?php endforeach ?>
46        </ol>
47    <?php else : ?>
48        <p><?= I18N::translate('No duplicates have been found.') ?></p>
49    <?php endif ?>
50<?php endforeach ?>
51