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