1<?php 2 3use Fisharebest\Webtrees\Http\RequestHandlers\MapDataDelete; 4use Fisharebest\Webtrees\Http\RequestHandlers\MapDataList; 5use Fisharebest\Webtrees\I18N; 6use Fisharebest\Webtrees\Module\PlaceHierarchyListModule; 7use Fisharebest\Webtrees\View; 8use Fisharebest\Webtrees\Webtrees; 9 10/** 11 * @var array<stdClass> $active 12 * @var array<string,string> $breadcrumbs 13 * @var int $parent_id 14 * @var array<mixed> $placelist 15 * @var string $title 16 */ 17 18?> 19 20<?= view('components/breadcrumbs', ['links' => $breadcrumbs]) ?> 21 22<h1><?= $title ?></h1> 23 24<p> 25 <label> 26 <input id="hide-unused-locations" type="checkbox" data-toggle="collapse" data-target=".unused-location"> 27 <?= I18N::translate('Hide unused locations') ?> 28 </label> 29</p> 30 31<table class="table table-bordered table-striped table-sm table-hover wt-table-locations"> 32 <thead class="thead-dark"> 33 <tr> 34 <th><?= I18N::translate('Place') ?></th> 35 <th><?= I18N::translate('Latitude') ?></th> 36 <th><?= I18N::translate('Longitude') ?></th> 37 <!-- 38 <th><?= I18N::translate('Flag') ?> </th> 39 --> 40 <th><?= I18N::translate('Edit') ?></th> 41 <th><?= I18N::translate('Facts and events') ?></th> 42 <th><?= I18N::translate('Delete') ?></th> 43 </tr> 44 </thead> 45 46 <tbody> 47 <?php foreach ($placelist as $place) : ?> 48 <tr class="<?= $active[$place->pl_place] ?? null ? '' : 'unused-location collapse show' ?>"> 49 <th scope="row"> 50 <a href="<?= e(route(MapDataList::class, ['parent_id' => $place->pl_id])) ?>"> 51 <?= e($place->pl_place) ?> 52 <?php if ($place->no_coord > 0): ?> 53 <span class="badge badge-pill badge-secondary"> 54 <?= view('icons/warning') ?> 55 <?= I18N::number($place->no_coord) ?> 56 / 57 <?= I18N::number($place->child_count) ?> 58 </span> 59 <?php elseif ($place->child_count > 0): ?> 60 <span class="badge badge-pill badge-secondary"> 61 <?= I18N::number($place->child_count) ?> 62 </span> 63 <?php endif ?> 64 </a> 65 </th> 66 67 <td dir="ltr"> 68 <?php if ((string) $place->pl_lati === '') : ?> 69 <?= view('icons/warning') ?> 70 <?php else : ?> 71 <?= strtr($place->pl_lati, ['N' => '', 'S' => '-', ',' => '.']) ?> 72 <?php endif ?> 73 </td> 74 75 <td dir="ltr"> 76 <?php if ((string) $place->pl_long === '') : ?> 77 <?= view('icons/warning') ?> 78 <?php else : ?> 79 <?= strtr($place->pl_long, ['E' => '', 'W' => '-', ',' => '.']) ?> 80 <?php endif ?> 81 </td> 82 83 <!-- 84 <td> 85 <?php if (is_file(Webtrees::MODULES_PATH . 'openstreetmap/' . $place->pl_icon)) : ?> 86 <img src="<?= e(Webtrees::MODULES_PATH . 'openstreetmap/' . $place->pl_icon) ?>" width="25" height="15" alt="<?= I18N::translate('Flag of %s', $place->pl_place) ?>"> 87 <?php endif ?> 88 </td> 89 --> 90 91 <td> 92 <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') ?>"> 93 <?= view('icons/edit') ?> 94 <span class="sr-only"> 95 <?= I18N::translate('Edit') ?> 96 </span> 97 </a> 98 </td> 99 100 <td> 101 <?php if (array_key_exists($place->pl_place, $active)): ?> 102 <?php if (count($active[$place->pl_place]) === 1): ?> 103 <a class="btn btn-link" href="<?= e(route(PlaceHierarchyListModule::class, ['tree' => $active[$place->pl_place][0]->tree_name, 'place_id' => $active[$place->pl_place][0]->p_id, 'action2' => 'hierarchy-e'])) ?>"> 104 <?= e($active[$place->pl_place][0]->tree_title) ?> 105 </a> 106 <?php else: ?> 107 <div class="dropdown"> 108 <a class="btn btn-link dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 109 <?= I18N::plural('%s family tree', '%s family trees', count($active[$place->pl_place]), I18N::number(count($active[$place->pl_place]))) ?> 110 </a> 111 112 <div class="dropdown-menu" aria-labelledby="dropdownMenuLink"> 113 <?php foreach ($active[$place->pl_place] as $link): ?> 114 <a class="dropdown-item" href="<?= e(route(PlaceHierarchyListModule::class, ['tree' => $link->tree_name, 'place_id' => $link->p_id])) ?>"> 115 <?= e($link->tree_title) ?> 116 </a> 117 <?php endforeach ?> 118 </div> 119 </div> 120 <?php endif ?> 121 <?php endif ?> 122 </td> 123 124 <td> 125 <?php if (!array_key_exists($place->pl_place, $active)): ?> 126 <form method="post" action="<?= e(route(MapDataDelete::class, ['place_id' => $place->pl_id])) ?>"> 127 <?= csrf_field() ?> 128 <button type="submit" class="btn btn-danger" aria-label="<?= I18N::translate('delete') ?>" data-confirm="<?= I18N::translate('Remove this location?') ?>"> 129 <?= view('icons/delete') ?> 130 </button> 131 </form> 132 <?php endif ?> 133 </td> 134 </tr> 135 <?php endforeach ?> 136 </tbody> 137 138 <tfoot> 139 <tr> 140 <td colspan="7"> 141 <a class="btn btn-primary" href="<?= e(route('map-data-edit', ['place_id' => '0', 'parent_id' => $parent_id])) ?>"> 142 <?= view('icons/add') ?> 143 <?= /* I18N: A button label. */ 144 I18N::translate('add place') ?> 145 </a> 146 <button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" 147 data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 148 <?= view('icons/download') ?> 149 <?= /* I18N: A button label. */ 150 I18N::translate('export file') ?> 151 </button> 152 <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> 153 <a class="dropdown-item" href="<?= e(route('locations-export', ['parent_id' => $parent_id, 'format' => 'csv'])) ?>"> 154 csv 155 </a> 156 <a class="dropdown-item" href="<?= e(route('locations-export', ['parent_id' => $parent_id, 'format' => 'geojson'])) ?>"> 157 geoJSON 158 </a> 159 </div> 160 <a class="btn btn-primary" href="<?= e(route('locations-import', ['parent_id' => $parent_id])) ?>"> 161 <?= view('icons/upload') ?> 162 <?= /* I18N: A button label. */ 163 I18N::translate('import file') ?> 164 </a> 165 </td> 166 </tr> 167 </tfoot> 168</table> 169 170<?php View::push('javascript') ?> 171<script> 172 'use strict'; 173 174 webtrees.persistentToggle("hide-unused-locations"); 175</script> 176<?php View::endpush() ?> 177