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