xref: /webtrees/resources/views/modules/sources_tab/tab.phtml (revision a052b5c627807c42c2daf5c1237144d6c4ef29c9)
1<?php use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; ?>
2<?php use Fisharebest\Webtrees\I18N; ?>
3<?php use Fisharebest\Webtrees\View; ?>
4
5<div class="wt-sources-tab py-4">
6    <table class="table wt-facts-table">
7        <tr>
8            <td colspan="2">
9                <label>
10                    <input id="show-level-2-sources" type="checkbox" data-toggle="collapse" data-target=".wt-level-two-source">
11                    <?= I18N::translate('Show all sources') ?>
12                </label>
13            </td>
14        </tr>
15
16        <?php foreach ($facts as $fact) : ?>
17            <?php FunctionsPrintFacts::printMainSources($fact, 1) ?>
18            <?php FunctionsPrintFacts::printMainSources($fact, 2) ?>
19        <?php endforeach ?>
20
21        <?php if (empty($facts)) : ?>
22            <tr>
23                <td colspan="2">
24                    <?= I18N::translate('There are no source citations for this individual.') ?>
25                    </td>
26            </tr>
27        <?php endif ?>
28
29        <?php if ($can_edit) : ?>
30            <tr>
31                <th scope="row">
32                    <?= I18N::translate('Source') ?>
33                </th>
34                <td>
35                    <a href="<?= e(route('add-fact', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'SOUR'])) ?>">
36                        <?= I18N::translate('Add a source citation') ?>
37                    </a>
38                </td>
39            </tr>
40        <?php endif ?>
41    </table>
42</div>
43
44<?php View::push('javascript') ?>
45<script>
46  'use strict';
47
48  persistent_toggle("show-level-2-sources");
49</script>
50<?php View::endpush() ?>
51