1<?php 2 3use Fisharebest\Webtrees\Auth; 4use Fisharebest\Webtrees\Http\RequestHandlers\AddUnlinkedPage; 5use Fisharebest\Webtrees\Http\RequestHandlers\CheckTree; 6use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 7use Fisharebest\Webtrees\Http\RequestHandlers\CreateMediaObjectModal; 8use Fisharebest\Webtrees\Http\RequestHandlers\CreateNoteModal; 9use Fisharebest\Webtrees\Http\RequestHandlers\CreateRepositoryModal; 10use Fisharebest\Webtrees\Http\RequestHandlers\CreateSourceModal; 11use Fisharebest\Webtrees\Http\RequestHandlers\CreateSubmitterModal; 12use Fisharebest\Webtrees\Http\RequestHandlers\DataFixChoose; 13use Fisharebest\Webtrees\Http\RequestHandlers\DeleteTreeAction; 14use Fisharebest\Webtrees\Http\RequestHandlers\FindDuplicateRecords; 15use Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomPage; 16use Fisharebest\Webtrees\Http\RequestHandlers\GedcomLoad; 17use Fisharebest\Webtrees\Http\RequestHandlers\ImportGedcomPage; 18use Fisharebest\Webtrees\Http\RequestHandlers\MergeRecordsPage; 19use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesLogPage; 20use Fisharebest\Webtrees\Http\RequestHandlers\RenumberTreePage; 21use Fisharebest\Webtrees\Http\RequestHandlers\SelectDefaultTree; 22use Fisharebest\Webtrees\Http\RequestHandlers\TreePage; 23use Fisharebest\Webtrees\Http\RequestHandlers\TreePreferencesPage; 24use Fisharebest\Webtrees\Http\RequestHandlers\TreePrivacyPage; 25use Fisharebest\Webtrees\Http\RequestHandlers\UnconnectedPage; 26use Fisharebest\Webtrees\I18N; 27use Fisharebest\Webtrees\Site; 28use Fisharebest\Webtrees\Tree; 29use Fisharebest\Webtrees\View; 30use Illuminate\Database\Capsule\Manager as DB; 31 32/** 33 * @var array<Tree> $all_trees 34 * @var string $title 35 * @var Tree $tree 36 */ 37 38?> 39 40<?php if (!empty($all_trees)) : ?> 41 <?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?> 42<?php endif ?> 43 44<h1><?= $title ?></h1> 45 46<?php if (empty($all_trees)) : ?> 47 <div class="alert alert-info"> 48 <?= I18N::translate('You need to create a family tree.') ?> 49 </div> 50<?php endif ?> 51 52<div id="accordion" aria-multiselectable="true"> 53 <?php foreach ($all_trees as $managed_tree) : ?> 54 <?php if (Auth::isManager($managed_tree)) : ?> 55 <div class="accordion-item"> 56 <div class="accordion-header" id="card-tree-header-<?= $managed_tree->id() ?>"> 57 <button class="accordion-button <?= $managed_tree->id() === $tree->id() || $managed_tree->getPreference('imported') === '0' ? ' ' : ' collapsed' ?>" type="button" data-bs-toggle="collapse" data-bs-target="#card-tree-content-<?= $managed_tree->id() ?>" aria-expanded="<?= $managed_tree->id() === $tree->id() || $managed_tree->getPreference('imported') === '0' ? 'true' : 'false' ?>" aria-controls="card-tree-content-<?= $managed_tree->id() ?>"> 58 <h2> 59 <?= view('icons/tree') ?> 60 <?= e($managed_tree->name()) ?> — <?= e($managed_tree->title()) ?> 61 </h2> 62 </button> 63 </div> 64 65 <div id="card-tree-content-<?= $managed_tree->id() ?>" class="accordion-collapse collapse<?= $managed_tree->id() === $tree->id() || $managed_tree->getPreference('imported') === '0' ? ' show' : '' ?>" aria-labelledby="panel-tree-header-<?= $managed_tree->id() ?>"> 66 <div class="accordion-body"> 67 <?php $importing = DB::table('gedcom_chunk')->where('gedcom_id', '=', $managed_tree->id())->where('imported', '=', 0)->exists() ?> 68 <?php if ($importing) : ?> 69 <div id="import<?= $managed_tree->id() ?>" class="col-12"> 70 <div class="progress"> 71 <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"> 72 <?= I18N::translate('Calculating…') ?> 73 </div> 74 </div> 75 </div> 76 <?php View::push('javascript'); ?> 77 <script> 78 $("#import<?= $managed_tree->id() ?>").load("<?= route(GedcomLoad::class, ['tree' => $managed_tree->name()]) ?>", {}); 79 </script> 80 <?php View::endpush() ?> 81 <?php endif ?> 82 <div class="row<?= $importing ? ' d-none' : '' ?>" id="actions<?= $managed_tree->id() ?>"> 83 <div class="col-sm-6 col-md-3"> 84 <h3> 85 <?= I18N::translate('Family tree') ?> 86 </h3> 87 <ul class="fa-ul mx-0"> 88 <li> 89 <span class="fa-li"><?= view('icons/tree') ?></span> 90 <a href="<?= e(route(TreePage::class, ['tree' => $managed_tree->name()])) ?>"> 91 <?= I18N::translate('Home page') ?> 92 </a> 93 </li> 94 </ul> 95 <ul class="fa-ul mx-0"> 96 <!-- PREFERENCES --> 97 <li> 98 <span class="fa-li"><?= view('icons/preferences') ?></span> 99 <a href="<?= e(route(TreePreferencesPage::class, ['tree' => $managed_tree->name()])) ?>"> 100 <?= I18N::translate('Preferences') ?> 101 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 102 </a> 103 </li> 104 <!-- PRIVACY --> 105 <li> 106 <span class="fa-li"><?= view('icons/lock') ?></span> 107 <a href="<?= e(route(TreePrivacyPage::class, ['tree' => $managed_tree->name()])) ?>"> 108 <?= I18N::translate('Privacy') ?> 109 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 110 </a> 111 </li> 112 <!-- DELETE --> 113 <?php if (count($all_trees) > 1 && Auth::isAdmin()) : ?> 114 <li> 115 <span class="fa-li"><?= view('icons/delete') ?></span> 116 <a href="#" data-wt-post-url="<?= e(route(DeleteTreeAction::class, ['tree' => $managed_tree->name()])) ?>" data-wt-reload-url="<?= e(route(ControlPanel::class)) ?>" data-wt-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($managed_tree->title())) ?>"> 117 <?= I18N::translate('Delete') ?> 118 </a> 119 </li> 120 <?php endif ?> 121 122 <!-- SET AS DEFAULT --> 123 <?php if (count($all_trees) > 1 && Auth::isAdmin()) : ?> 124 <li> 125 <span class="fa-li"><?= view('icons/favorite') ?></span> 126 <?php if ($managed_tree->name() === Site::getPreference('DEFAULT_GEDCOM')) : ?> 127 <?= I18N::translate('Default family tree') ?> 128 <?php else : ?> 129 <a href="#" onclick="document.defaultform<?= $managed_tree->id() ?>.submit();"> 130 <?= I18N::translate('Set as default') ?> 131 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 132 </a> 133 <form method="post" action="<?= route(SelectDefaultTree::class, ['tree' => $managed_tree->name()]) ?>" name="defaultform<?= $managed_tree->id() ?>"> 134 <!-- A11Y - forms need submit buttons, but they look ugly here --> 135 <button class="visually-hidden" type="submit"> 136 <?= I18N::translate('Set as default') ?> 137 </button> 138 139 <?= csrf_field() ?> 140 </form> 141 <?php endif ?> 142 </li> 143 <?php endif ?> 144 </ul> 145 146 <ul class="fa-ul mx-0"> 147 <!-- DATA FIXES --> 148 <li> 149 <span class="fa-li"><?= view('icons/data-fix') ?></span> 150 <a href="<?= e(route(DataFixChoose::class, ['tree' => $managed_tree->name()])) ?>"> 151 <?= I18N::translate('Data fixes') ?> 152 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 153 </a> 154 </li> 155 </ul> 156 </div> 157 <div class="col-sm-6 col-md-3"> 158 <h3> 159 <?= /* I18N: Individuals, sources, dates, places, etc. */ 160 I18N::translate('Genealogy data') ?> 161 </h3> 162 <ul class="fa-ul mx-0"> 163 <!-- FIND DUPLICATES --> 164 <li> 165 <span class="fa-li"><?= view('icons/copy') ?></span> 166 <a href="<?= e(route(FindDuplicateRecords::class, ['tree' => $managed_tree->name()])) ?>"> 167 <?= I18N::translate('Find duplicates') ?> 168 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 169 </a> 170 </li> 171 <!-- MERGE --> 172 <li> 173 <span class="fa-li"><?= view('icons/merge') ?></span> 174 <a href="<?= e(route(MergeRecordsPage::class, ['tree' => $managed_tree->name()])) ?>"> 175 <?= I18N::translate('Merge records') ?> 176 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 177 </a> 178 </li> 179 <!-- CHECK FOR ERRORS --> 180 <li> 181 <span class="fa-li"><?= view('icons/warning') ?></span> 182 <a href="<?= e(route(CheckTree::class, ['tree' => $managed_tree->name()])) ?>"> 183 <?= I18N::translate('Check for errors') ?> 184 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 185 </a> 186 </li> 187 <!-- UNCONNECTED INDIVIDUALS --> 188 <li> 189 <span class="fa-li"><?= view('icons/unlink') ?></span> 190 <a href="<?= e(route(UnconnectedPage::class, ['tree' => $managed_tree->name()])) ?>"> 191 <?= I18N::translate('Find unrelated individuals') ?> 192 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 193 </a> 194 </li> 195 <!-- RENUMBER --> 196 <li> 197 <span class="fa-li"><?= view('icons/sort') ?></span> 198 <a href="<?= e(route(RenumberTreePage::class, ['tree' => $managed_tree->name()])) ?>"> 199 <?= I18N::translate('Renumber XREFs') ?> 200 <span class="visually-hidden"> 201 <?= e($managed_tree->title()) ?> 202 </span> 203 </a> 204 </li> 205 <!-- CHANGES --> 206 <li> 207 <span class="fa-li"><?= view('icons/edit') ?></span> 208 <a href="<?= route(PendingChangesLogPage::class, ['tree' => $managed_tree->name()]) ?>"> 209 <?= I18N::translate('Changes log') ?> 210 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 211 </a> 212 </li> 213 </ul> 214 </div> 215 <div class="col-sm-6 col-md-3"> 216 <h3> 217 <?= I18N::translate('Add unlinked records') ?> 218 </h3> 219 <ul class="fa-ul mx-0"> 220 <!-- UNLINKED INDIVIDUAL --> 221 <li> 222 <span class="fa-li"><?= view('icons/individual') ?></span> 223 <a href="<?= e(route(AddUnlinkedPage::class, ['tree' => $managed_tree->name()])) ?>"> 224 <?= I18N::translate('Individual') ?> 225 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 226 </a> 227 </li> 228 <!-- UNLINKED SOURCE --> 229 <li> 230 <span class="fa-li"><?= view('icons/source') ?></span> 231 <a href="#" data-wt-href="<?= e(route(CreateSourceModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static"> 232 <?= I18N::translate('Source') ?> 233 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 234 </a> 235 </li> 236 <!-- UNLINKED REPOSITORY --> 237 <li> 238 <span class="fa-li"><?= view('icons/repository') ?></span> 239 <a href="#" data-wt-href="<?= e(route(CreateRepositoryModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static"> 240 <?= I18N::translate('Repository') ?> 241 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 242 </a> 243 </li> 244 <!-- UNLINKED MEDIA OBJECT --> 245 <li> 246 <span class="fa-li"><?= view('icons/media') ?></span> 247 <a href="#" data-wt-href="<?= e(route(CreateMediaObjectModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static"> 248 249 <?= I18N::translate('Media object') ?> 250 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 251 </a> 252 </li> 253 <!-- UNLINKED NOTE --> 254 <li> 255 <span class="fa-li"><?= view('icons/note') ?></span> 256 <a href="#" data-wt-href="<?= e(route(CreateNoteModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static"> 257 <?= I18N::translate('Shared note') ?> 258 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 259 </a> 260 </li> 261 <!-- UNLINKED SUBMITTER --> 262 <li> 263 <span class="fa-li"><?= view('icons/submitter') ?></span> 264 <a href="#" data-wt-href="<?= e(route(CreateSubmitterModal::class, ['tree' => $managed_tree->name()])) ?>" data-bs-target="#wt-ajax-modal" data-bs-toggle="modal" data-bs-backdrop="static"> 265 <?= I18N::translate('Submitter') ?> 266 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 267 </a> 268 </li> 269 </ul> 270 </div> 271 <div class="col-sm-6 col-md-3"> 272 <h3> 273 <?= I18N::translate('GEDCOM file') ?> 274 </h3> 275 <ul class="fa-ul mx-0"> 276 <!-- DOWNLOAD/Export --> 277 <li> 278 <span class="fa-li"><?= view('icons/download') ?></span> 279 <a href="<?= e(route(ExportGedcomPage::class, ['tree' => $managed_tree->name()])) ?>"> 280 <?= I18N::translate('Export') ?> 281 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 282 </a> 283 </li> 284 <!-- UPLOAD/IMPORT --> 285 <li> 286 <span class="fa-li"><?= view('icons/upload') ?></span> 287 <a href="<?= e(route(ImportGedcomPage::class, ['tree' => $managed_tree->name()])) ?>"> 288 <?= I18N::translate('Import') ?> 289 <span class="visually-hidden"><?= e($managed_tree->title()) ?></span> 290 </a> 291 </li> 292 </ul> 293 </div> 294 </div> 295 </div> 296 </div> 297 </div> 298 <?php endif ?> 299 <?php endforeach ?> 300</div> 301 302<?= view('modals/ajax') ?> 303