1<?php 2 3use Fisharebest\Webtrees\Auth; 4use Fisharebest\Webtrees\Config; 5use Fisharebest\Webtrees\Fact; 6use Fisharebest\Webtrees\Functions\FunctionsEdit; 7use Fisharebest\Webtrees\Http\RequestHandlers\EditFactAction; 8use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactPage; 9use Fisharebest\Webtrees\I18N; 10use Fisharebest\Webtrees\Tree; 11use Ramsey\Uuid\Uuid; 12 13/** 14 * @var bool $can_edit_raw 15 * @var Fact $fact 16 * @var string $title 17 * @var Tree $tree 18 * @var string $url 19 */ 20 21?> 22 23<h2 class="wt-page-title"><?= $title ?></h2> 24 25<form method="post" action="<?= e(route(EditFactAction::class, ['tree' => $tree->name(), 'xref' => $fact->record()->xref(), 'fact_id' => $fact->id()])) ?>" class="wt-page-content"> 26 <?= csrf_field() ?> 27 <input type="hidden" name="url" value="<?= e($url) ?>"> 28 29 <?php FunctionsEdit::createEditForm($fact) ?> 30 31 <?php 32 $level1type = $fact->getTag(); 33 switch ($fact->record()->tag()) { 34 case 'SOUR': 35 if ($level1type === 'DATA') { 36 // SOUR:DATA facts may take a NOTE (but the SOUR record may not). 37 echo view('cards/add-note', [ 38 'level' => 2, 39 'tree' => $tree, 40 ]); 41 echo view('cards/add-shared-note', [ 42 'level' => 2, 43 'tree' => $tree, 44 ]); 45 // SOUR:DATA facts may also take multiple EVEN. 46 echo view('cards/add-sour-data-even', [ 47 'tree' => $tree, 48 ]); 49 } 50 break; 51 case 'FAM': 52 case 'INDI': 53 // FAM and INDI records have real facts. They can take NOTE/SOUR/OBJE/etc. 54 if ($level1type !== 'SEX' && $level1type !== 'NOTE' && $level1type !== 'ALIA') { 55 if ($level1type !== 'SOUR') { 56 echo view('cards/add-source-citation', [ 57 'level' => 2, 58 'full_citations' => $tree->getPreference('FULL_SOURCES'), 59 'tree' => $tree, 60 ]); 61 } 62 if ($level1type !== 'OBJE') { 63 if ($tree->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($tree)) { 64 echo view('cards/add-media-object', [ 65 'level' => 2, 66 'tree' => $tree, 67 ]); 68 } 69 } 70 echo view('cards/add-note', [ 71 'level' => 2, 72 'tree' => $tree, 73 ]); 74 echo view('cards/add-shared-note', [ 75 'level' => 2, 76 'tree' => $tree, 77 ]); 78 if ($level1type !== 'ASSO' && $level1type !== 'NOTE' && $level1type !== 'SOUR') { 79 echo view('cards/add-associate', [ 80 'id' => Uuid::uuid4()->toString(), 81 'level' => 2, 82 'tree' => $tree, 83 ]); 84 } 85 // allow to add godfather and godmother for CHR fact or best man and bridesmaid for MARR fact in one window 86 if (in_array($level1type, Config::twoAssociates(), true)) { 87 echo view('cards/add-associate', [ 88 'id' => Uuid::uuid4()->toString(), 89 'level' => 2, 90 'tree' => $tree, 91 ]); 92 } 93 if ($level1type !== 'SOUR') { 94 echo view('cards/add-restriction', [ 95 'level' => 2, 96 'tree' => $tree, 97 ]); 98 } 99 } 100 break; 101 default: 102 // Other types of record do not have these lower-level records 103 break; 104 } 105 106 ?> 107 108 <div class="form-group row"> 109 <label class="col-sm-3 col-form-label" for="keep_chan"> 110 <?= I18N::translate('Last change') ?> 111 </label> 112 <div class="col-sm-9"> 113 <?= view('components/checkbox-inline', ['label' => I18N::translate('Keep the existing “last change” information'), 'name' => 'keep_chan', 'checked' => (bool) $tree->getPreference('NO_UPDATE_CHAN')]) ?> 114 <div> 115 <?= I18N::translate('%1$s: %2$s', I18N::translate('Timestamp'), view('components/datetime', ['timestamp' => $fact->record()->lastChangeTimestamp()])) ?> 116 </div> 117 <div> 118 <?= I18N::translate('%1$s: %2$s', I18N::translate('Author of last change'), e($fact->record()->lastChangeUser())) ?> 119 </div> 120 </div> 121 </div> 122 123 <div class="form-group row"> 124 <div class="col-sm-3 wt-page-options-label"> 125 </div> 126 <div class="col-sm-9 wt-page-options-value"> 127 <button class="btn btn-primary" type="submit"> 128 <?= view('icons/save') ?> 129 <?= /* I18N: A button label. */ 130 I18N::translate('save') ?> 131 </button> 132 <a class="btn btn-secondary" href="<?= e($url) ?>"> 133 <?= view('icons/cancel') ?> 134 <?= /* I18N: A button label. */ 135 I18N::translate('cancel') ?> 136 </a> 137 <?php if ($can_edit_raw) : ?> 138 <a class="btn btn-link" href="<?= e(route(EditRawFactPage::class, ['xref' => $fact->record()->xref(), 'fact_id' => $fact->id(), 'tree' => $tree->name(), 'url' => $url])) ?>"> 139 <?= I18N::translate('Edit the raw GEDCOM') ?> 140 </a> 141 <?php endif; ?> 142 </div> 143 </div> 144</form> 145 146<?= view('modals/on-screen-keyboard') ?> 147<?= view('modals/ajax') ?> 148<?= view('edit/initialize-calendar-popup') ?> 149