xref: /webtrees/resources/views/admin/trees-merge.phtml (revision b11cdcd45131b1585d66693fab363cfeb18c51a4)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
6use Fisharebest\Webtrees\Http\RequestHandlers\MergeTreesAction;
7use Fisharebest\Webtrees\Http\RequestHandlers\RenumberTreePage;
8use Fisharebest\Webtrees\I18N;
9use Fisharebest\Webtrees\Tree;
10
11/**
12 * @var string               $title
13 * @var Tree|null            $tree1
14 * @var Tree|null            $tree2
15 * @var array<string,string> $tree_list
16 * @var int                  $xrefs
17 */
18
19?>
20
21<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
22
23<h1><?= $title ?></h1>
24
25<?php if ($xrefs > 0) : ?>
26    <p>
27        <?= I18N::translate('In a family tree, each record has an internal reference number (called an “XREF”) such as “F123” or “R14”.') ?>
28    </p>
29    <p>
30        <?= I18N::plural(/* I18N: An XREF is the identification number used in GEDCOM files. */ 'The two family trees have %1$s record which uses the same “XREF”.', 'The two family trees have %1$s records which use the same “XREF”.', $xrefs, I18N::number($xrefs)) ?>
31    </p>
32    <p>
33        <?= I18N::translate('You must renumber the records in one of the trees before you can merge them.') ?>
34    </p>
35    <p>
36        <a class="current" href="<?= e(route(RenumberTreePage::class, ['tree' => $tree1->name()])) ?>">
37            <?= I18N::translate('Renumber XREFs') ?><?= e($tree1->title()) ?>
38        </a>
39    </p>
40    <p>
41        <a class="current" href="<?= e(route(RenumberTreePage::class, ['tree' => $tree2->name()])) ?>">
42            <?= I18N::translate('Renumber XREFs') ?><?= e($tree2->title()) ?>
43        </a>
44    </p>
45<?php endif ?>
46
47<form method="post" action="<?= e(route(MergeTreesAction::class)) ?>">
48    <div>
49        <?= I18N::translate(/* I18N: Copy all the records from [family tree 1] into [family tree 2] */
50            'Copy all the records from %1$s into %2$s.',
51            view('components/select', ['name' => 'tree1_name', 'selected' => $tree1 instanceof Tree ? $tree1->name() : '', 'options' => $tree_list]),
52            view('components/select', ['name' => 'tree2_name', 'selected' => $tree2 instanceof Tree ? $tree2->name() : '', 'options' => $tree_list])
53        ) ?>
54    </div>
55
56    <div>
57        <button type="submit" class="btn btn-primary">
58            <?= view('icons/save') ?>
59            <?= I18N::translate('continue') ?>
60        </button>
61    </div>
62
63    <?= csrf_field() ?>
64</form>
65
66<?= I18N::translate('Caution! This may take a long time. Be patient.') ?>
67