xref: /webtrees/resources/views/modules/recent_changes/changes-table.phtml (revision c9128110bcca4171a925498361ed99962b624554)
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*c9128110SGreg Roach * @var array<array<int,string>> $order
18f70bcff5SGreg Roach * @var Collection<object>       $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') ?>
28dc270d8cSGreg 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"
32728c8c27SGreg Roach        data-order="<?= e(json_encode($order, JSON_THROW_ON_ERROR)) ?>"
3301221f27SGreg Roach        data-page-length="<?= e($limit_low) ?>"
34b4139381SGreg Roach    >
35dd6b2bfcSGreg Roach        <thead>
36dd6b2bfcSGreg Roach            <tr>
3737d6169bSGreg Roach                <th class="wt-side-block-optional">
38315eb316SGreg Roach                <span class="visually-hidden">
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') ?>
59315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Individual') ?></span>
6002467d32SGreg Roach                        <?php elseif ($row->record->tag() === Family::RECORD_TYPE) : ?>
616a83cfe8SGreg Roach                            <?= view('icons/family') ?>
62315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Family') ?></span>
6302467d32SGreg Roach                        <?php elseif ($row->record->tag() === Media::RECORD_TYPE) : ?>
646a83cfe8SGreg Roach                            <?= view('icons/media') ?>
65315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Media') ?></span>
6602467d32SGreg Roach                        <?php elseif ($row->record->tag() === Note::RECORD_TYPE) : ?>
676a83cfe8SGreg Roach                            <?= view('icons/note') ?>
68315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Note') ?></span>
6902467d32SGreg Roach                        <?php elseif ($row->record->tag() === Source::RECORD_TYPE) : ?>
706a83cfe8SGreg Roach                            <?= view('icons/source') ?>
71315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Source') ?></span>
7202467d32SGreg Roach                        <?php elseif ($row->record->tag() === Submitter::RECORD_TYPE) : ?>
736a83cfe8SGreg Roach                            <?= view('icons/submitter') ?>
74315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Submitter') ?></span>
7502467d32SGreg Roach                        <?php elseif ($row->record->tag() === Repository::RECORD_TYPE) : ?>
766a83cfe8SGreg Roach                            <?= view('icons/repository') ?>
77315eb316SGreg Roach                            <span class="visually-hidden"><?= 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