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