xref: /webtrees/resources/views/admin/locations.phtml (revision 64490ee2cf1227b259fc0526dbbad602c63faeed)
1<?php use Fisharebest\Webtrees\Bootstrap4; ?>
2<?php use Fisharebest\Webtrees\FontAwesome; ?>
3<?php use Fisharebest\Webtrees\I18N; ?>
4<?php use Fisharebest\Webtrees\Tree; ?>
5<?php use Fisharebest\Webtrees\Webtrees; ?>
6
7<?= view('components/breadcrumbs', ['links' => $breadcrumbs]) ?>
8
9<h1><?= $title ?></h1>
10
11<table class="table table-bordered table-striped table-sm table-hover">
12    <thead class="thead-dark">
13    <tr>
14        <th><?= I18N::translate('Place') ?></th>
15        <th><?= I18N::translate('Latitude') ?></th>
16        <th><?= I18N::translate('Longitude') ?></th>
17        <th><?= I18N::translate('Zoom level') ?></th>
18        <th><?= I18N::translate('Flag') ?> </th>
19        <th><?= I18N::translate('Edit') ?></th>
20        <th><?= I18N::translate('Delete') ?></th>
21    </tr>
22    </thead>
23    <tbody>
24
25    <?php foreach ($placelist as $place) : ?>
26        <tr>
27            <th scope="row">
28                <a href="<?= e(route('map-data', ['parent_id' => $place->pl_id])) ?>">
29                    <?= e($place->pl_place) ?>
30                    <span class="badge badge-pill badge-<?= $place->badge ?>">
31                        <?= I18N::number($place->child_count) ?>
32                    </span>
33                </a>
34            </th>
35            <td dir="ltr">
36                <?= ($place->pl_lati === null) ? FontAwesome::decorativeIcon('warning') : strtr($place->pl_lati, ['N' => '', 'S' => '-', ',' => '.']) ?>
37            </td>
38            <td dir="ltr">
39                <?= ($place->pl_long === null) ? FontAwesome::decorativeIcon('warning') : strtr($place->pl_long, ['E' => '', 'W' => '-', ',' => '.']) ?>
40            </td>
41            <td>
42                <?= $place->pl_long === null ? FontAwesome::decorativeIcon('warning') : $place->pl_zoom ?>
43            </td>
44            <td>
45                <?php if (is_file(Webtrees::MODULES_PATH . 'openstreetmap/' . $place->pl_icon)) : ?>
46                    <img src="<?= e(Webtrees::MODULES_PATH . 'openstreetmap/' . $place->pl_icon) ?>" width="25" height="15" alt="<?= I18N::translate("Flag of %s", $place->pl_place) ?>">
47                <?php endif ?>
48            </td>
49            <td>
50                <?= FontAwesome::linkIcon('edit', I18N::translate('Edit'), ['href' => route('map-data-edit', ['place_id'  => $place->pl_id, 'parent_id' => $place->pl_parent_id]), 'class' => 'btn btn-primary']) ?>
51            </td>
52            <td>
53                <?php if ($place->child_count === 0) : ?>
54                    <form method="POST" action="<?= e(route('map-data-delete', ['parent_id' => $parent_id, 'place_id' => $place->pl_id])) ?>"
55                          data-confirm="<?= I18N::translate('Remove this location?') ?>"
56                          onsubmit="return confirm(this.dataset.confirm)">
57                        <?= csrf_field() ?>
58                        <button type="submit" class="btn btn-danger">
59                            <?= FontAwesome::semanticIcon('delete', I18N::translate('delete')) ?>
60                        </button>
61                    </form>
62                <?php else : ?>
63                    <button type="button" class="btn btn-danger" disabled>
64                        <?= FontAwesome::decorativeIcon('delete') ?>
65                    </button>
66                <?php endif ?>
67            </td>
68        </tr>
69    <?php endforeach ?>
70    </tbody>
71    <tfoot>
72    <tr>
73        <td colspan="7">
74            <a class="btn btn-primary" href="<?= e(route('map-data', ['parent_id' => $parent_id])) ?>">
75                <?= FontAwesome::decorativeIcon('add') ?>
76                <?= /* I18N: A button label. */
77                I18N::translate('add place') ?>
78            </a>
79            <button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton"
80                    data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
81                <?= FontAwesome::decorativeIcon('download') ?>
82                <?= /* I18N: A button label. */
83                I18N::translate('export file') ?>
84            </button>
85            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
86                <a class="dropdown-item" href="<?= e(route('locations-export', ['parent_id' => $parent_id, 'format' => 'csv'])) ?>">
87                    csv
88                </a>
89                <a class="dropdown-item" href="<?= e(route('locations-export', ['parent_id' => $parent_id, 'format' => 'geojson'])) ?>">
90                    geoJSON
91                </a>
92            </div>
93            <a class="btn btn-primary" href="<?= e(route('locations-import', ['parent_id' => $parent_id])) ?>">
94                <?= FontAwesome::decorativeIcon('upload') ?>
95                <?= /* I18N: A button label. */
96                I18N::translate('import file') ?>
97            </a>
98        </td>
99    </tr>
100    </tfoot>
101</table>
102
103<form method="POST" action="<?= e(route('locations-import-from-tree')) ?>">
104    <?= csrf_field() ?>
105
106    <div class="form-group row">
107        <label class="form-control-plaintext col-sm-4" for="ged">
108            <?= I18N::translate('Import all places from a family tree') ?>
109        </label>
110        <div class="col-sm-6">
111            <?= Bootstrap4::select(
112                Tree::getNameList(),
113                '',
114                ['id' => 'ged', 'name' => 'ged']
115            ) ?>
116        </div>
117        <div class="col-sm-2">
118            <button type="submit" class="btn btn-primary">
119                <?= view('icons/upload') ?>
120                <?= /* I18N: A button label. */
121                I18N::translate('import') ?>
122            </button>
123        </div>
124    </div>
125</form>
126