xref: /webtrees/resources/views/admin/map-import-form.phtml (revision 96c67f5bdfb60e88a566a040ada330e78e9215fa)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4use Fisharebest\Webtrees\Http\RequestHandlers\MapDataImportAction;
5use Fisharebest\Webtrees\Http\RequestHandlers\MapDataList;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\View;
8
9/**
10 * @var array<string> $files
11 * @var string        $folder
12 * @var string        $title
13 */
14
15?>
16
17<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(MapDataList::class)  => I18N::translate('Geographic data'), $title]]) ?>
18
19<h3><?= $title ?></h3>
20
21<form method="post" action="<?= e(route(MapDataImportAction::class)) ?>" id="upload_form" enctype="multipart/form-data">
22    <?= csrf_field() ?>
23
24    <!-- Server file -->
25    <div class="row form-group">
26        <label class="col-form-label col-sm-4" for="serverfile">
27            <?= I18N::translate('A file on the server') ?>
28        </label>
29        <div class="col-sm-8">
30            <div class="input-group" dir="ltr">
31                <span class="input-group-text">
32                    <?= e($folder) ?>
33                </span>
34
35                <select id="serverfile" name="serverfile" class="form-control">
36                    <option selected value=""></option>
37                    <?php foreach ($files as $file) : ?>
38                        <option value="<?= e($file) ?>">
39                            <?= e($file) ?>
40                        </option>
41                    <?php endforeach ?>
42                </select>
43            </div>
44        </div>
45    </div>
46
47    <!-- local file -->
48    <div class="row form-group">
49        <label class="col-form-label col-sm-4" for="localfile">
50            <?= I18N::translate('A file on your computer') ?>
51        </label>
52        <div class="col-sm-8">
53            <input id="localfile" type="file" name="localfile" class="form-control-file">
54        </div>
55    </div>
56
57    <!-- Import options -->
58    <fieldset class="row form-group">
59        <legend class="col-form-label col-sm-4">
60            <?= I18N::translate('Import') ?>
61        </legend>
62        <div class="col-sm-8">
63            <?= view('components/select', ['name' => 'import-options', 'selected' => '', 'options' => ['update' => I18N::translate('Only update existing records'), 'add' => I18N::translate('Only add new records'), 'addupdate' => I18N::translate('Add new, and update existing records')]]) ?>
64        </div>
65    </fieldset>
66
67    <!-- SAVE BUTTON -->
68    <div class="row form-group">
69        <div class="offset-sm-4 col-sm-8">
70            <button type="submit" class="btn btn-primary">
71                <?= view('icons/save') ?>
72                <?= I18N::translate('continue') ?>
73            </button>
74            <a href="<?= e(route(MapDataList::class)) ?>">
75                <?= view('icons/cancel') ?>
76                <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
77            </a>
78        </div>
79    </div>
80</form>
81