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