xref: /webtrees/resources/views/admin/trees-merge.phtml (revision cad4bddf0bafe1f7dd91c083a21c2ab1abf2ebb8)
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 family tree') ?><?= 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 family tree') ?><?= e($tree2->title()) ?>
41        </a>
42    </p>
43<?php endif ?>
44
45<form method="post" action="<?= e(route(MergeTreesAction::class)) ?>">
46    <?= csrf_field() ?>
47    <p class="form-inline">
48        <?= I18N::translate(/* I18N: Copy all the records from [family tree 1] into [family tree 2] */
49            'Copy all the records from %1$s into %2$s.',
50            view('components/select', ['name' => 'tree1_name', 'selected' => $tree1 instanceof Tree ? $tree1->name() : '', 'options' => $tree_list]),
51            view('components/select', ['name' => 'tree2_name', 'selected' => $tree2 instanceof Tree ? $tree2->name() : '', 'options' => $tree_list])
52        ) ?>
53    </p>
54
55    <button type="submit" class="btn btn-primary">
56        <?= view('icons/save') ?>
57        <?= I18N::translate('continue') ?>
58    </button>
59
60    <?= I18N::translate('Caution! This may take a long time. Be patient.') ?>
61</form>
62