1<?php 2use Fisharebest\Webtrees\Auth; 3use Fisharebest\Webtrees\Functions\FunctionsPrint; 4use Fisharebest\Webtrees\I18N; 5use Fisharebest\Webtrees\Individual; 6use Fisharebest\Webtrees\View; 7use Illuminate\Support\Collection; 8 9/** 10 * @var Individual $individual 11 * @var string $user_link 12 * @var int $count_names 13 * @var int $count_sex 14 * @var Collection $sidebars 15 * @var Collection $name_records 16 * @var Collection $sex_records 17 * @var Collection $tabs 18 */ 19?> 20 21<?php if ($individual->isPendingDeletion()) : ?> 22 <?php if (Auth::isModerator($individual->tree())) : ?> 23 <?= view('components/alert-warning-dismissible', [ 24 'alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ 25 I18N::translate('This individual has been deleted. You should review the deletion and then %1$s or %2$s it.', '<a href="#" class="alert-link" onclick="accept_changes(\'' . e($individual->xref()) . '\', \'' . e($individual->tree()->name()) . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" class="alert-link" onclick="reject_changes(\'' . e($individual->xref()) . '\', \'' . e($individual->tree()->name()) . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes'), 26 ]) ?> 27 <?php elseif (Auth::isEditor($individual->tree())) : ?> 28 <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This individual has been deleted. The deletion will need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?> 29 <?php endif ?> 30<?php elseif ($individual->isPendingAddition()) : ?> 31 <?php if (Auth::isModerator($individual->tree())) : ?> 32 <?= view('components/alert-warning-dismissible', [ 33 'alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ 34 I18N::translate('This individual has been edited. You should review the changes and then %1$s or %2$s them.', '<a href="#" class="alert-link" onclick="accept_changes(\'' . e($individual->xref()) . '\', \'' . e($individual->tree()->name()) . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" class="alert-link" onclick="reject_changes(\'' . e($individual->xref()) . '\', \'' . e($individual->tree()->name()) . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes'), 35 ]) ?> 36 <?php elseif (Auth::isEditor($individual->tree())) : ?> 37 <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This individual has been edited. The changes need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?> 38 <?php endif ?> 39<?php endif ?> 40 41<div class="d-flex mb-4"> 42 <h2 class="wt-page-title mx-auto"> 43 <?= $individual->fullName() ?><?= $user_link ?>, <?= $individual->getLifeSpan() ?> <?= $age ?> 44 </h2> 45 <?php if ($individual->canEdit()) : ?> 46 <?= view('individual-page-menu', ['individual' => $individual, 'count_names' => $count_names, 'count_sex' => $count_sex]) ?> 47 <?php endif ?> 48</div> 49 50<div class="row"> 51 <div class="<?= $sidebars->isEmpty() ? 'col-sm-12' : 'col-sm-8' ?>"> 52 <div class="row mb-4"> 53 <!-- Individual images --> 54 <div class="col-sm-3"> 55 <?php if (empty($individual_media)) : ?> 56 <i class="wt-individual-silhouette wt-individual-silhouette-<?= strtolower($individual->sex()) ?>"></i> 57 <?php elseif (count($individual_media) === 1) : ?> 58 <?= $individual_media[0]->displayImage(200, 260, 'crop', ['class' => 'img-thumbnail img-fluid w-100']) ?> 59 <?php else : ?> 60 <div id="individual-images" class="carousel slide" data-ride="carousel" data-interval="false"> 61 <div class="carousel-inner"> 62 <?php foreach ($individual_media as $n => $media_file) : ?> 63 <div class="carousel-item <?= $n === 0 ? 'active' : '' ?>"> 64 <?= $media_file->displayImage(200, 260, 'crop', ['class' => 'img-thumbnail img-fluid w-100']) ?> 65 </div> 66 <?php endforeach ?> 67 </div> 68 <a class="carousel-control-prev" href="#individual-images" role="button" data-slide="prev"> 69 <span class="carousel-control-prev-icon" aria-hidden="true"></span> 70 <span class="sr-only"><?= I18N::translate('previous') ?></span> 71 </a> 72 <a class="carousel-control-next" href="#individual-images" role="button" data-slide="next"> 73 <span class="carousel-control-next-icon" aria-hidden="true"></span> 74 <span class="sr-only"><?= I18N::translate('next') ?></span> 75 </a> 76 </div> 77 78 <?php endif ?> 79 80 <?php if (Auth::isEditor($individual->tree())) : ?> 81 <?php if ($individual->facts(['OBJE'])->count() > 1) : ?> 82 <div> 83 <a href="<?= e(route('reorder-media', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>"> 84 <?= view('icons/reorder') ?> 85 <?= I18N::translate('Re-order media') ?> 86 </a> 87 </div> 88 <?php endif ?> 89 90 <?php if ($individual->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($individual->tree())) : ?> 91 <div> 92 <a href="<?= e(route('add-fact', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'OBJE'])) ?>"> 93 <?= I18N::translate('Add a media object') ?> 94 </a> 95 </div> 96 <?php endif ?> 97 <?php endif ?> 98 </div> 99 100 <!-- Name accordion --> 101 <div class="col-sm-9" id="individual-names" role="tablist"> 102 <?php foreach ($name_records as $name_record) : ?> 103 <?= $name_record ?> 104 <?php endforeach ?> 105 106 <?php foreach ($sex_records as $sex_record) : ?> 107 <?= $sex_record ?> 108 <?php endforeach ?> 109 </div> 110 </div> 111 112 <div class="wt-tabs-individual" id="individual-tabs"> 113 <ul class="nav nav-tabs flex-wrap"> 114 <?php foreach ($tabs as $tab) : ?> 115 <li class="nav-item"> 116 <a class="nav-link<?= $tab->isGrayedOut($individual) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" data-href="<?= e(route('individual-tab', ['xref' => $individual->xref(), 'ged' => $individual->tree()->name(), 'module' => $tab->name()])) ?>" href="#<?= $tab->name() ?>"> 117 <?= $tab->tabTitle() ?> 118 </a> 119 </li> 120 <?php endforeach ?> 121 </ul> 122 <div class="tab-content"> 123 <?php foreach ($tabs as $tab) : ?> 124 <div id="<?= $tab->name() ?>" class="tab-pane fade wt-ajax-load" role="tabpanel"><?php if (!$tab->canLoadAjax()) : 125 ?><?= $tab->getTabContent($individual) ?><?php 126 endif ?></div> 127 <?php endforeach ?> 128 </div> 129 </div> 130 </div> 131 <?php if ($sidebars->isNotEmpty()) : ?> 132 <div class="col-sm-4" id="sidebar" role="tablist"> 133 <?php foreach ($sidebars as $sidebar) : ?> 134 <div class="card"> 135 <div class="card-header" role="tab" id="sidebar-header-<?= $sidebar->name() ?>"> 136 <div class="card-title mb-0"> 137 <a data-toggle="collapse" data-parent="#sidebar" href="#sidebar-content-<?= $sidebar->name() ?>" aria-expanded="<?= $sidebar->name() === 'family_nav' ? 'true' : 'false' ?>" aria-controls="sidebar-content-<?= $sidebar->name() ?>"> 138 <?= $sidebar->sidebarTitle() ?> 139 </a> 140 </div> 141 </div> 142 <div id="sidebar-content-<?= $sidebar->name() ?>" class="collapse<?= $sidebar->name() === 'family_nav' ? ' show' : '' ?>" role="tabpanel" aria-labelledby="sidebar-header-<?= $sidebar->name() ?>"> 143 <div class="card-body"> 144 <?= $sidebar->getSidebarContent($individual) ?></div> 145 </div> 146 </div> 147 <?php endforeach ?> 148 </div> 149 <?php endif ?> 150</div> 151 152<?php View::push('javascript') ?> 153<script> 154 "use strict"; 155 156 // Bootstrap tabs - load content dynamically using AJAX 157 $('a[data-toggle="tab"][data-href]').on('show.bs.tab', function () { 158 $(this.getAttribute('href') + ':empty').load($(this).data('href')); 159 }); 160 161 // If the URL contains a fragment, then activate the corresponding tab. 162 // Use a prefix on the fragment, to prevent scrolling to the element. 163 var target = window.location.hash.replace("tab-", ""); 164 var tab = $("#individual-tabs .nav-link[href='" + target + "']"); 165 // If not, then activate the first tab. 166 if (tab.length === 0) { 167 tab = $("#individual-tabs .nav-link:first"); 168 } 169 tab.tab("show"); 170 171 // If the user selects a tab, update the URL to reflect this 172 $('#individual-tabs a[data-toggle="tab"]').on('shown.bs.tab', function (e) { 173 window.location.hash = "tab-" + e.target.href.substring(e.target.href.indexOf('#') + 1); 174 }); 175</script> 176<?php View::endpush() ?> 177 178<?= view('modals/ajax') ?> 179