xref: /webtrees/resources/views/modules/recent_changes/changes-table.phtml (revision dc270d8cc5085ed29f3f419c99734ddd0960c624)
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
17fbd9d3f8SGreg Roach * @var array<array<mixed>>  $order
18bd77bf38SGreg Roach * @var Collection<stdClass> $rows
19501bc70dSGreg Roach * @var bool                 $show_date
20e24053e5SGreg Roach * @var bool                 $show_user
21bd77bf38SGreg Roach */
22d70512abSGreg Roach?>
23dd6b2bfcSGreg Roach
2437d6169bSGreg Roach<div class="table-responsive">
25b4139381SGreg Roach    <table
26b4139381SGreg Roach        class="table table-sm wt-table-changes datatables d-none"
27b4139381SGreg Roach        <?= view('lists/datatables-attributes') ?>
28*dc270d8cSGreg Roach        data-paging="<?= $rows->count() >= $limit_high ? 'true' : 'false' ?>"
29b4139381SGreg Roach        data-filter="false"
30b4139381SGreg Roach        data-info="false"
31e24053e5SGreg Roach        data-length-change="false"
32fbd9d3f8SGreg Roach        data-order="<?= e(json_encode($order)) ?>"
3301221f27SGreg Roach        data-page-length="<?= e($limit_low) ?>"
34b4139381SGreg Roach    >
35dd6b2bfcSGreg Roach        <thead>
36dd6b2bfcSGreg Roach            <tr>
3737d6169bSGreg Roach                <th class="wt-side-block-optional">
38dd6b2bfcSGreg Roach                <span class="sr-only">
39dd6b2bfcSGreg Roach                    <?= I18N::translate('Type') ?>
40dd6b2bfcSGreg Roach                </span>
41dd6b2bfcSGreg Roach                </th>
42dd6b2bfcSGreg Roach                <th>
43dd6b2bfcSGreg Roach                    <?= I18N::translate('Record') ?>
44dd6b2bfcSGreg Roach                </th>
45501bc70dSGreg Roach                <th class="<?= $show_date ? '' : 'd-none' ?>">
46dd6b2bfcSGreg Roach                    <?= I18N::translate('Last change') ?>
47dd6b2bfcSGreg Roach                </th>
48501bc70dSGreg Roach                <th class="<?= $show_user ? '' : 'd-none' ?>">
497524d819SGreg Roach                    <?= I18N::translate('Editor') ?>
50dd6b2bfcSGreg Roach                </th>
51dd6b2bfcSGreg Roach            </tr>
52dd6b2bfcSGreg Roach        </thead>
53dd6b2bfcSGreg Roach        <tbody>
54bd77bf38SGreg Roach            <?php foreach ($rows as $row) : ?>
55dd6b2bfcSGreg Roach                <tr>
5602467d32SGreg Roach                    <td data-sort="<?= $row->record->tag() ?>" class="text-centre wt-side-block-optional">
5702467d32SGreg Roach                        <?php if ($row->record->tag() === Individual::RECORD_TYPE) : ?>
586a83cfe8SGreg Roach                            <?= view('icons/individual') ?>
596a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Individual') ?></span>
6002467d32SGreg Roach                        <?php elseif ($row->record->tag() === Family::RECORD_TYPE) : ?>
616a83cfe8SGreg Roach                            <?= view('icons/family') ?>
626a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Family') ?></span>
6302467d32SGreg Roach                        <?php elseif ($row->record->tag() === Media::RECORD_TYPE) : ?>
646a83cfe8SGreg Roach                            <?= view('icons/media') ?>
656a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Media') ?></span>
6602467d32SGreg Roach                        <?php elseif ($row->record->tag() === Note::RECORD_TYPE) : ?>
676a83cfe8SGreg Roach                            <?= view('icons/note') ?>
686a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Note') ?></span>
6902467d32SGreg Roach                        <?php elseif ($row->record->tag() === Source::RECORD_TYPE) : ?>
706a83cfe8SGreg Roach                            <?= view('icons/source') ?>
716a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Source') ?></span>
7202467d32SGreg Roach                        <?php elseif ($row->record->tag() === Submitter::RECORD_TYPE) : ?>
736a83cfe8SGreg Roach                            <?= view('icons/submitter') ?>
746a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Submitter') ?></span>
7502467d32SGreg Roach                        <?php elseif ($row->record->tag() === Repository::RECORD_TYPE) : ?>
766a83cfe8SGreg Roach                            <?= view('icons/repository') ?>
776a83cfe8SGreg Roach                            <span class="sr-only"><?= I18N::translate('Repository') ?></span>
78dd6b2bfcSGreg Roach                        <?php endif ?>
79dd6b2bfcSGreg Roach                    </td>
806a83cfe8SGreg Roach
81bd77bf38SGreg Roach                    <td data-sort="<?= e($row->record->sortName()) ?>">
82bd77bf38SGreg Roach                        <a href="<?= e($row->record->url()) ?>"><?= $row->record->fullName() ?></a>
83dd6b2bfcSGreg Roach                    </td>
846a83cfe8SGreg Roach
85f289f086SGreg Roach                    <td data-sort="<?= $row->time->getTimestamp() ?>" class="<?= $show_date ? '' : 'd-none' ?>">
86bd77bf38SGreg Roach                        <?= view('components/datetime', ['timestamp' => $row->time]) ?>
87dd6b2bfcSGreg Roach                    </td>
886a83cfe8SGreg Roach
89501bc70dSGreg Roach                    <td class="<?= $show_user ? '' : 'd-none' ?>">
90e10e1dc9SGreg Roach                        <?= e($row->user->userName()) ?>
91dd6b2bfcSGreg Roach                    </td>
92dd6b2bfcSGreg Roach                </tr>
93dd6b2bfcSGreg Roach            <?php endforeach ?>
94dd6b2bfcSGreg Roach        </tbody>
95dd6b2bfcSGreg Roach    </table>
9637d6169bSGreg Roach</div>
97dd6b2bfcSGreg Roach
98dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
99dd6b2bfcSGreg Roach<script>
100419ce18fSGreg Roach  $(".wt-table-changes").dataTable().removeClass("d-none");
101dd6b2bfcSGreg Roach</script>
102dd6b2bfcSGreg Roach<?php View::endpush() ?>
103