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