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