xref: /webtrees/resources/views/modules/recent_changes/changes-table.phtml (revision fbd9d3f808723b42df498a5ad14beee72185097b)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
3ac107fcfSGreg Roachuse Fisharebest\Webtrees\Family;
4d70512abSGreg Roachuse Fisharebest\Webtrees\I18N;
5ac107fcfSGreg Roachuse Fisharebest\Webtrees\Individual;
6ac107fcfSGreg Roachuse Fisharebest\Webtrees\Media;
7ac107fcfSGreg Roachuse Fisharebest\Webtrees\Note;
8ac107fcfSGreg Roachuse Fisharebest\Webtrees\Repository;
9ac107fcfSGreg Roachuse Fisharebest\Webtrees\Source;
10ac107fcfSGreg Roachuse Fisharebest\Webtrees\Submitter;
11ac107fcfSGreg Roachuse Fisharebest\Webtrees\View;
12bd77bf38SGreg Roachuse Illuminate\Support\Collection;
13d70512abSGreg Roach
14bd77bf38SGreg Roach/**
1501221f27SGreg Roach * @var int                  $limit_high
1601221f27SGreg Roach * @var int                  $limit_low
17*fbd9d3f8SGreg Roach * @var array<array<mixed>>  $order
18bd77bf38SGreg Roach * @var Collection<stdClass> $rows
19e24053e5SGreg Roach * @var bool                 $show_user
20bd77bf38SGreg Roach */
21d70512abSGreg Roach?>
22dd6b2bfcSGreg Roach
2337d6169bSGreg Roach<div class="table-responsive">
24b4139381SGreg Roach    <table
25b4139381SGreg Roach        class="table table-sm wt-table-changes datatables d-none"
26b4139381SGreg Roach        <?= view('lists/datatables-attributes') ?>
2701221f27SGreg Roach        <?php if ($rows->count() < e($limit_high)) : ?>
28e24053e5SGreg Roach            data-paging="false"
29e24053e5SGreg Roach        <?php endif ?>
30b4139381SGreg Roach        data-filter="false"
31b4139381SGreg Roach        data-info="false"
32e24053e5SGreg Roach        data-length-change="false"
33*fbd9d3f8SGreg Roach        data-order="<?= e(json_encode($order)) ?>"
3401221f27SGreg Roach        data-page-length="<?= e($limit_low) ?>"
35b4139381SGreg Roach    >
36dd6b2bfcSGreg Roach        <thead>
37dd6b2bfcSGreg Roach            <tr>
3837d6169bSGreg Roach                <th class="wt-side-block-optional">
39dd6b2bfcSGreg Roach                <span class="sr-only">
40dd6b2bfcSGreg Roach                    <?= I18N::translate('Type') ?>
41dd6b2bfcSGreg Roach                </span>
42dd6b2bfcSGreg Roach                </th>
43dd6b2bfcSGreg Roach                <th>
44dd6b2bfcSGreg Roach                    <?= I18N::translate('Record') ?>
45dd6b2bfcSGreg Roach                </th>
46dd6b2bfcSGreg Roach                <th>
47dd6b2bfcSGreg Roach                    <?= I18N::translate('Last change') ?>
48dd6b2bfcSGreg Roach                </th>
49dd6b2bfcSGreg Roach                <?php if ($show_user) : ?>
50dd6b2bfcSGreg Roach                    <th>
51dd6b2bfcSGreg Roach                        <?= I18N::translate('User') ?>
52dd6b2bfcSGreg Roach                    </th>
53dd6b2bfcSGreg Roach                <?php endif ?>
54dd6b2bfcSGreg Roach            </tr>
55dd6b2bfcSGreg Roach        </thead>
56dd6b2bfcSGreg Roach        <tbody>
57bd77bf38SGreg Roach            <?php foreach ($rows as $row) : ?>
58dd6b2bfcSGreg Roach                <tr>
59bd77bf38SGreg Roach                    <td data-sort="<?= $row->record::RECORD_TYPE ?>" class="text-centre wt-side-block-optional">
60bd77bf38SGreg Roach                        <?php if ($row->record::RECORD_TYPE === Individual::RECORD_TYPE) : ?>
616a83cfe8SGreg Roach                            <?= view('icons/individual') ?>
626a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Individual') ?></span>
63bd77bf38SGreg Roach                        <?php elseif ($row->record::RECORD_TYPE === Family::RECORD_TYPE) : ?>
646a83cfe8SGreg Roach                            <?= view('icons/family') ?>
656a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Family') ?></span>
66bd77bf38SGreg Roach                        <?php elseif ($row->record::RECORD_TYPE === Media::RECORD_TYPE) : ?>
676a83cfe8SGreg Roach                            <?= view('icons/media') ?>
686a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Media') ?></span>
69bd77bf38SGreg Roach                        <?php elseif ($row->record::RECORD_TYPE === Note::RECORD_TYPE) : ?>
706a83cfe8SGreg Roach                            <?= view('icons/note') ?>
716a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Note') ?></span>
72bd77bf38SGreg Roach                        <?php elseif ($row->record::RECORD_TYPE === Source::RECORD_TYPE) : ?>
736a83cfe8SGreg Roach                            <?= view('icons/source') ?>
746a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Source') ?></span>
75bd77bf38SGreg Roach                        <?php elseif ($row->record::RECORD_TYPE === Submitter::RECORD_TYPE) : ?>
766a83cfe8SGreg Roach                            <?= view('icons/submitter') ?>
776a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Submitter') ?></span>
78bd77bf38SGreg Roach                        <?php elseif ($row->record::RECORD_TYPE === Repository::RECORD_TYPE) : ?>
796a83cfe8SGreg Roach                            <?= view('icons/repository') ?>
806a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Repository') ?></span>
81dd6b2bfcSGreg Roach                        <?php endif ?>
82dd6b2bfcSGreg Roach                    </td>
836a83cfe8SGreg Roach
84bd77bf38SGreg Roach                    <td data-sort="<?= e($row->record->sortName()) ?>">
85bd77bf38SGreg Roach                        <a href="<?= e($row->record->url()) ?>"><?= $row->record->fullName() ?></a>
86dd6b2bfcSGreg Roach                    </td>
876a83cfe8SGreg Roach
88bd77bf38SGreg Roach                    <td data-sort="<?= $row->time->timestamp ?>">
89bd77bf38SGreg Roach                        <?= view('components/datetime', ['timestamp' => $row->time]) ?>
90dd6b2bfcSGreg Roach                    </td>
916a83cfe8SGreg Roach
92dd6b2bfcSGreg Roach                    <?php if ($show_user) : ?>
93dd6b2bfcSGreg Roach                        <td>
94bd77bf38SGreg Roach                            <?= e($row->user->userName()) ?>
95dd6b2bfcSGreg Roach                        </td>
96dd6b2bfcSGreg Roach                    <?php endif ?>
97dd6b2bfcSGreg Roach                </tr>
98dd6b2bfcSGreg Roach            <?php endforeach ?>
99dd6b2bfcSGreg Roach        </tbody>
100dd6b2bfcSGreg Roach    </table>
10137d6169bSGreg Roach</div>
102dd6b2bfcSGreg Roach
103dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
104dd6b2bfcSGreg Roach<script>
105419ce18fSGreg Roach  $(".wt-table-changes").dataTable().removeClass("d-none");
106dd6b2bfcSGreg Roach</script>
107dd6b2bfcSGreg Roach<?php View::endpush() ?>
108