11e653452SGreg Roach<?php 21e653452SGreg Roach 394e35917SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataDelete; 494e35917SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MapDataList; 51e653452SGreg Roachuse Fisharebest\Webtrees\I18N; 694e35917SGreg Roachuse Fisharebest\Webtrees\Module\PlaceHierarchyListModule; 7*ed612bd3SGreg Roachuse Fisharebest\Webtrees\Tree; 8d2dac12aSGreg Roachuse Fisharebest\Webtrees\View; 91e653452SGreg Roachuse Fisharebest\Webtrees\Webtrees; 10*ed612bd3SGreg Roachuse Illuminate\Support\Collection; 111e653452SGreg Roach 1294e35917SGreg Roach/** 1394e35917SGreg Roach * @var array<stdClass> $active 14*ed612bd3SGreg Roach * @var Collection<Tree> $all_trees 1594e35917SGreg Roach * @var array<string,string> $breadcrumbs 1694e35917SGreg Roach * @var int $parent_id 1794e35917SGreg Roach * @var array<mixed> $placelist 18*ed612bd3SGreg Roach * @var PlaceHierarchyListModule|null $list_module 1994e35917SGreg Roach * @var string $title 2094e35917SGreg Roach */ 2194e35917SGreg Roach 221e653452SGreg Roach?> 23dd6b2bfcSGreg Roach 24dd6b2bfcSGreg Roach<?= view('components/breadcrumbs', ['links' => $breadcrumbs]) ?> 25dd6b2bfcSGreg Roach 26dd6b2bfcSGreg Roach<h1><?= $title ?></h1> 27dd6b2bfcSGreg Roach 28d2dac12aSGreg Roach<p> 29d2dac12aSGreg Roach <label> 30d2dac12aSGreg Roach <input id="hide-unused-locations" type="checkbox" data-toggle="collapse" data-target=".unused-location"> 31d2dac12aSGreg Roach <?= I18N::translate('Hide unused locations') ?> 32d2dac12aSGreg Roach </label> 33d2dac12aSGreg Roach</p> 34d2dac12aSGreg Roach 35d2dac12aSGreg Roach<table class="table table-bordered table-striped table-sm table-hover wt-table-locations"> 36dd6b2bfcSGreg Roach <thead class="thead-dark"> 37dd6b2bfcSGreg Roach <tr> 38dd6b2bfcSGreg Roach <th><?= I18N::translate('Place') ?></th> 39dd6b2bfcSGreg Roach <th><?= I18N::translate('Latitude') ?></th> 40dd6b2bfcSGreg Roach <th><?= I18N::translate('Longitude') ?></th> 41e340fe65SGreg Roach <!-- 42dd6b2bfcSGreg Roach <th><?= I18N::translate('Flag') ?> </th> 43e340fe65SGreg Roach --> 44dd6b2bfcSGreg Roach <th><?= I18N::translate('Edit') ?></th> 4594e35917SGreg Roach <th><?= I18N::translate('Facts and events') ?></th> 46dd6b2bfcSGreg Roach <th><?= I18N::translate('Delete') ?></th> 47dd6b2bfcSGreg Roach </tr> 48dd6b2bfcSGreg Roach </thead> 49dd6b2bfcSGreg Roach 507039fd97SGreg Roach <tbody> 51dd6b2bfcSGreg Roach <?php foreach ($placelist as $place) : ?> 52d2dac12aSGreg Roach <tr class="<?= $active[$place->pl_place] ?? null ? '' : 'unused-location collapse show' ?>"> 53dd6b2bfcSGreg Roach <th scope="row"> 5494e35917SGreg Roach <a href="<?= e(route(MapDataList::class, ['parent_id' => $place->pl_id])) ?>"> 55dd6b2bfcSGreg Roach <?= e($place->pl_place) ?> 5694e35917SGreg Roach <?php if ($place->no_coord > 0): ?> 5794e35917SGreg Roach <span class="badge badge-pill badge-secondary"> 5894e35917SGreg Roach <?= view('icons/warning') ?> 5994e35917SGreg Roach <?= I18N::number($place->no_coord) ?> 6094e35917SGreg Roach / 61dd6b2bfcSGreg Roach <?= I18N::number($place->child_count) ?> 62dd6b2bfcSGreg Roach </span> 6394e35917SGreg Roach <?php elseif ($place->child_count > 0): ?> 6494e35917SGreg Roach <span class="badge badge-pill badge-secondary"> 6594e35917SGreg Roach <?= I18N::number($place->child_count) ?> 6694e35917SGreg Roach </span> 6794e35917SGreg Roach <?php endif ?> 68dd6b2bfcSGreg Roach </a> 69dd6b2bfcSGreg Roach </th> 70d993d560SGreg Roach 710e7a2d23SGreg Roach <td dir="ltr"> 7235661a57SGreg Roach <?php if ((string) $place->pl_lati === '') : ?> 73d993d560SGreg Roach <?= view('icons/warning') ?> 74d993d560SGreg Roach <?php else : ?> 75d993d560SGreg Roach <?= strtr($place->pl_lati, ['N' => '', 'S' => '-', ',' => '.']) ?> 76d993d560SGreg Roach <?php endif ?> 77dd6b2bfcSGreg Roach </td> 78d993d560SGreg Roach 790e7a2d23SGreg Roach <td dir="ltr"> 8035661a57SGreg Roach <?php if ((string) $place->pl_long === '') : ?> 81d993d560SGreg Roach <?= view('icons/warning') ?> 82d993d560SGreg Roach <?php else : ?> 83d993d560SGreg Roach <?= strtr($place->pl_long, ['E' => '', 'W' => '-', ',' => '.']) ?> 84d993d560SGreg Roach <?php endif ?> 85dd6b2bfcSGreg Roach </td> 86d993d560SGreg Roach 87e340fe65SGreg Roach <!-- 88dd6b2bfcSGreg Roach <td> 898d0ebef0SGreg Roach <?php if (is_file(Webtrees::MODULES_PATH . 'openstreetmap/' . $place->pl_icon)) : ?> 90b2c011d7SGreg Roach <img src="<?= e(Webtrees::MODULES_PATH . 'openstreetmap/' . $place->pl_icon) ?>" width="25" height="15" alt="<?= I18N::translate('Flag of %s', $place->pl_place) ?>"> 91dd6b2bfcSGreg Roach <?php endif ?> 92dd6b2bfcSGreg Roach </td> 93e340fe65SGreg Roach --> 94d993d560SGreg Roach 95dd6b2bfcSGreg Roach <td> 9639b853a7SGreg 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') ?>"> 9739b853a7SGreg Roach <?= view('icons/edit') ?> 9839b853a7SGreg Roach <span class="sr-only"> 9939b853a7SGreg Roach <?= I18N::translate('Edit') ?> 10039b853a7SGreg Roach </span> 10139b853a7SGreg Roach </a> 102dd6b2bfcSGreg Roach </td> 103d993d560SGreg Roach 104dd6b2bfcSGreg Roach <td> 105*ed612bd3SGreg Roach <?php if (($list_module !== null) && array_key_exists($place->pl_place, $active)): ?> 10694e35917SGreg Roach <?php if (count($active[$place->pl_place]) === 1): ?> 107*ed612bd3SGreg Roach <a class="btn btn-link" href="<?= e($list_module->listUrl($all_trees->get($active[$place->pl_place][0]->tree_name), ['place_id' => $active[$place->pl_place][0]->p_id, 'action2' => 'hierarchy-e'])) ?>"> 10894e35917SGreg Roach <?= e($active[$place->pl_place][0]->tree_title) ?> 10994e35917SGreg Roach </a> 11094e35917SGreg Roach <?php else: ?> 11194e35917SGreg Roach <div class="dropdown"> 11294e35917SGreg Roach <a class="btn btn-link dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 113341c7ed2SGreg Roach <?= I18N::plural('%s family tree', '%s family trees', count($active[$place->pl_place]), I18N::number(count($active[$place->pl_place]))) ?> 11494e35917SGreg Roach </a> 11594e35917SGreg Roach 11694e35917SGreg Roach <div class="dropdown-menu" aria-labelledby="dropdownMenuLink"> 11794e35917SGreg Roach <?php foreach ($active[$place->pl_place] as $link): ?> 118*ed612bd3SGreg Roach <a class="dropdown-item" href="<?= e($list_module->listUrl($all_trees->get($active[$place->pl_place][0]->tree_name), ['place_id' => $link->p_id])) ?>"> 11994e35917SGreg Roach <?= e($link->tree_title) ?> 12094e35917SGreg Roach </a> 12194e35917SGreg Roach <?php endforeach ?> 12294e35917SGreg Roach </div> 12394e35917SGreg Roach </div> 12494e35917SGreg Roach <?php endif ?> 12594e35917SGreg Roach <?php endif ?> 12694e35917SGreg Roach </td> 12794e35917SGreg Roach 12894e35917SGreg Roach <td> 12994e35917SGreg Roach <?php if (!array_key_exists($place->pl_place, $active)): ?> 13094e35917SGreg Roach <form method="post" action="<?= e(route(MapDataDelete::class, ['place_id' => $place->pl_id])) ?>"> 131dd6b2bfcSGreg Roach <?= csrf_field() ?> 13294e35917SGreg Roach <button type="submit" class="btn btn-danger" aria-label="<?= I18N::translate('delete') ?>" data-confirm="<?= I18N::translate('Remove this location?') ?>"> 1336a83cfe8SGreg Roach <?= view('icons/delete') ?> 134dd6b2bfcSGreg Roach </button> 135dd6b2bfcSGreg Roach </form> 136dd6b2bfcSGreg Roach <?php endif ?> 137dd6b2bfcSGreg Roach </td> 138dd6b2bfcSGreg Roach </tr> 139dd6b2bfcSGreg Roach <?php endforeach ?> 140dd6b2bfcSGreg Roach </tbody> 1417039fd97SGreg Roach 142dd6b2bfcSGreg Roach <tfoot> 143dd6b2bfcSGreg Roach <tr> 144dd6b2bfcSGreg Roach <td colspan="7"> 14556a34df1SGreg Roach <a class="btn btn-primary" href="<?= e(route('map-data-edit', ['place_id' => '0', 'parent_id' => $parent_id])) ?>"> 146d993d560SGreg Roach <?= view('icons/add') ?> 147dd6b2bfcSGreg Roach <?= /* I18N: A button label. */ 148dd6b2bfcSGreg Roach I18N::translate('add place') ?> 149dd6b2bfcSGreg Roach </a> 150dd6b2bfcSGreg Roach <button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" 151dd6b2bfcSGreg Roach data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 152d993d560SGreg Roach <?= view('icons/download') ?> 153dd6b2bfcSGreg Roach <?= /* I18N: A button label. */ 154dd6b2bfcSGreg Roach I18N::translate('export file') ?> 155dd6b2bfcSGreg Roach </button> 156dd6b2bfcSGreg Roach <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> 157dd6b2bfcSGreg Roach <a class="dropdown-item" href="<?= e(route('locations-export', ['parent_id' => $parent_id, 'format' => 'csv'])) ?>"> 158dd6b2bfcSGreg Roach csv 159dd6b2bfcSGreg Roach </a> 160dd6b2bfcSGreg Roach <a class="dropdown-item" href="<?= e(route('locations-export', ['parent_id' => $parent_id, 'format' => 'geojson'])) ?>"> 161dd6b2bfcSGreg Roach geoJSON 162dd6b2bfcSGreg Roach </a> 163dd6b2bfcSGreg Roach </div> 164dd6b2bfcSGreg Roach <a class="btn btn-primary" href="<?= e(route('locations-import', ['parent_id' => $parent_id])) ?>"> 165d993d560SGreg Roach <?= view('icons/upload') ?> 166dd6b2bfcSGreg Roach <?= /* I18N: A button label. */ 167dd6b2bfcSGreg Roach I18N::translate('import file') ?> 168dd6b2bfcSGreg Roach </a> 169dd6b2bfcSGreg Roach </td> 170dd6b2bfcSGreg Roach </tr> 171dd6b2bfcSGreg Roach </tfoot> 172dd6b2bfcSGreg Roach</table> 173d2dac12aSGreg Roach 174d2dac12aSGreg Roach<?php View::push('javascript') ?> 175d2dac12aSGreg Roach<script> 176d2dac12aSGreg Roach 'use strict'; 177d2dac12aSGreg Roach 178d2dac12aSGreg Roach webtrees.persistentToggle("hide-unused-locations"); 179d2dac12aSGreg Roach</script> 180d2dac12aSGreg Roach<?php View::endpush() ?> 181