xref: /webtrees/resources/views/modules/media/tab.phtml (revision 4e54fb47ea2fc584c07c0c135853d49a85735c1a)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
57c2c99faSGreg Roachuse Fisharebest\Webtrees\Fact;
67c2c99faSGreg Roachuse Fisharebest\Webtrees\I18N;
77c2c99faSGreg Roachuse Fisharebest\Webtrees\Individual;
87c2c99faSGreg Roachuse Illuminate\Support\Collection;
97c2c99faSGreg Roach
107c2c99faSGreg Roach/**
117c2c99faSGreg Roach * @var bool                 $can_edit
1236779af1SGreg Roach * @var Collection<int,Fact> $clipboard_facts
1336779af1SGreg Roach * @var Collection<int,Fact> $facts
147c2c99faSGreg Roach * @var Individual           $individual
157c2c99faSGreg Roach */
16d70512abSGreg Roach
17d70512abSGreg Roach?>
18*4e54fb47SGreg Roach<div class="wt-tab-media">
19dd6b2bfcSGreg Roach    <table class="table wt-facts-table">
20b315f3e1SGreg Roach        <tr>
21b315f3e1SGreg Roach            <td colspan="2">
22b315f3e1SGreg Roach                <label>
230363a7fdSDavid Drury                    <input id="show-level-2-media" type="checkbox" data-bs-toggle="collapse" data-bs-target=".wt-level-two-media" data-wt-persist="level-two-media" autocomplete="off">
24b315f3e1SGreg Roach                    <?= I18N::translate('Show all media') ?>
25b315f3e1SGreg Roach                </label>
26b315f3e1SGreg Roach            </td>
27b315f3e1SGreg Roach        </tr>
28b315f3e1SGreg Roach
29dd6b2bfcSGreg Roach        <?php foreach ($facts as $fact) : ?>
30b315f3e1SGreg Roach            <?php if (str_ends_with($fact->tag(), ':OBJE')) : ?>
31b315f3e1SGreg Roach                <?= view('fact', ['fact' => $fact, 'record' => $individual]) ?>
32b315f3e1SGreg Roach            <?php else : ?>
33b315f3e1SGreg Roach                <?php
34b315f3e1SGreg Roach                if ($fact->isPendingAddition()) {
35b315f3e1SGreg Roach                    $styleadd = 'wt-new ';
36b315f3e1SGreg Roach                } elseif ($fact->isPendingDeletion()) {
37b315f3e1SGreg Roach                    $styleadd = 'wt-old ';
38b315f3e1SGreg Roach                } else {
39b315f3e1SGreg Roach                    $styleadd = '';
40b315f3e1SGreg Roach                }
41b315f3e1SGreg Roach                ?>
42b315f3e1SGreg Roach
43b315f3e1SGreg Roach                <tr class="wt-level-two-media collapse">
44b315f3e1SGreg Roach                    <th scope="row" class="rela <?= $styleadd ?>">
45b315f3e1SGreg Roach                        <?= $fact->label() ?>
46b315f3e1SGreg Roach                        <?= view('fact-edit-links', ['fact' => $fact, 'url' => $fact->record()->url() . '#tab-media']) ?>
47b315f3e1SGreg Roach                    </th>
48b315f3e1SGreg Roach
49b315f3e1SGreg Roach                    <td class="<?= $styleadd ?>">
50b315f3e1SGreg Roach                        <?php if (preg_match_all('/\n([2-4] OBJE .*)/', $fact->gedcom(), $matches, PREG_SET_ORDER) > 0) : ?>
51b315f3e1SGreg Roach                            <?php foreach ($matches as $match) : ?>
52b315f3e1SGreg Roach                                <?= view('fact-gedcom-fields', ['gedcom' => $match[1], 'parent' => $fact->tag(), 'tree' => $fact->record()->tree()]) ?>
53b315f3e1SGreg Roach                            <?php endforeach ?>
54b315f3e1SGreg Roach                        <?php endif ?>
55b315f3e1SGreg Roach                    </td>
56b315f3e1SGreg Roach                </tr>
57b315f3e1SGreg Roach            <?php endif ?>
58dd6b2bfcSGreg Roach        <?php endforeach ?>
59dd6b2bfcSGreg Roach
60075d1a05SGreg Roach        <?php if ($facts->isEmpty()) : ?>
61dd6b2bfcSGreg Roach            <tr>
62dd6b2bfcSGreg Roach                <td colspan="2">
63dd6b2bfcSGreg Roach                    <?= I18N::translate('There are no media objects for this individual.') ?>
64dd6b2bfcSGreg Roach                </td>
65dd6b2bfcSGreg Roach            </tr>
66dd6b2bfcSGreg Roach        <?php endif ?>
67dd6b2bfcSGreg Roach    </table>
68dd6b2bfcSGreg Roach</div>
69