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