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