1<?php 2 3declare(strict_types=1); 4 5use Fisharebest\Webtrees\Fact; 6use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; 7use Fisharebest\Webtrees\I18N; 8use Fisharebest\Webtrees\Individual; 9use Illuminate\Support\Collection; 10 11/** 12 * @var bool $can_edit 13 * @var Collection<int,Fact> $clipboard_facts 14 * @var Collection<int,Fact> $facts 15 * @var Individual $individual 16 */ 17 18?> 19 20<div class="wt-tab-sources"> 21 <table class="table wt-facts-table"> 22 <tr> 23 <td colspan="2"> 24 <label> 25 <input id="show-level-2-sources" type="checkbox" data-bs-toggle="collapse" data-bs-target=".wt-level-two-source" data-wt-persist="level-two-sources" autocomplete="off"> 26 <?= I18N::translate('Show all sources') ?> 27 </label> 28 </td> 29 </tr> 30 31 <?php foreach ($facts as $fact) : ?> 32 <?php if (str_ends_with($fact->tag(), ':SOUR')) : ?> 33 <?= view('fact', ['fact' => $fact, 'record' => $individual]) ?> 34 <?php else : ?> 35 <?php 36 if ($fact->isPendingAddition()) { 37 $styleadd = 'wt-new '; 38 } elseif ($fact->isPendingDeletion()) { 39 $styleadd = 'wt-old '; 40 } else { 41 $styleadd = ''; 42 } 43 ?> 44 45 <tr class="wt-level-two-source collapse"> 46 <th scope="row" class="rela <?= $styleadd ?>"> 47 <?= $fact->label() ?> 48 <?= view('fact-edit-links', ['fact' => $fact, 'url' => $fact->record()->url() . '#tab-sources']) ?> 49 </th> 50 51 <td class="<?= $styleadd ?>"> 52 <?php if (preg_match_all('/\n(2 SOUR\b.*(?:\n[^2].*)*)/', $fact->gedcom(), $matches, PREG_SET_ORDER) > 0) : ?> 53 <?php foreach ($matches as $match) : ?> 54 <?= view('fact-gedcom-fields', ['gedcom' => $match[1], 'parent' => $fact->tag(), 'tree' => $fact->record()->tree()]) ?> 55 <?php endforeach ?> 56 <?php endif ?> 57 </td> 58 </tr> 59 <?php endif ?> 60 <?php endforeach ?> 61 62 <?php if ($facts->isEmpty()) : ?> 63 <tr> 64 <td colspan="2"> 65 <?= I18N::translate('There are no source citations for this individual.') ?> 66 </td> 67 </tr> 68 <?php endif ?> 69 70 <?php if ($can_edit) : ?> 71 <tr> 72 <th scope="row"> 73 <?= I18N::translate('Source') ?> 74 </th> 75 <td> 76 <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'SOUR'])) ?>"> 77 <?= I18N::translate('Add a source citation') ?> 78 </a> 79 </td> 80 </tr> 81 <?php endif ?> 82 </table> 83</div> 84