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