xref: /webtrees/resources/views/modules/recent_changes/changes-table.phtml (revision 9c2569b5b5f2aeac55b2e3f374c9b43ef6ad79ef)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
5ac107fcfSGreg Roachuse Fisharebest\Webtrees\Family;
6d70512abSGreg Roachuse Fisharebest\Webtrees\I18N;
7ac107fcfSGreg Roachuse Fisharebest\Webtrees\Individual;
8*9c2569b5SHerzScheisseuse Fisharebest\Webtrees\Location;
9ac107fcfSGreg Roachuse Fisharebest\Webtrees\Media;
10ac107fcfSGreg Roachuse Fisharebest\Webtrees\Note;
11ac107fcfSGreg Roachuse Fisharebest\Webtrees\Repository;
12ac107fcfSGreg Roachuse Fisharebest\Webtrees\Source;
13ac107fcfSGreg Roachuse Fisharebest\Webtrees\Submitter;
14ac107fcfSGreg Roachuse Fisharebest\Webtrees\View;
15bd77bf38SGreg Roachuse Illuminate\Support\Collection;
16d70512abSGreg Roach
17bd77bf38SGreg Roach/**
1801221f27SGreg Roach * @var int                      $limit_high
1901221f27SGreg Roach * @var int                      $limit_low
20c9128110SGreg Roach * @var array<array<int,string>> $order
2136779af1SGreg Roach * @var Collection<int,object>   $rows
22501bc70dSGreg Roach * @var bool                     $show_date
23e24053e5SGreg Roach * @var bool                     $show_user
24bd77bf38SGreg Roach */
25d70512abSGreg Roach?>
26dd6b2bfcSGreg Roach
2737d6169bSGreg Roach<div class="table-responsive">
28b4139381SGreg Roach    <table
29b4139381SGreg Roach        class="table table-sm wt-table-changes datatables d-none"
30b4139381SGreg Roach        <?= view('lists/datatables-attributes') ?>
31dc270d8cSGreg Roach        data-paging="<?= $rows->count() >= $limit_high ? 'true' : 'false' ?>"
32b4139381SGreg Roach        data-filter="false"
33b4139381SGreg Roach        data-info="false"
34e24053e5SGreg Roach        data-length-change="false"
35728c8c27SGreg Roach        data-order="<?= e(json_encode($order, JSON_THROW_ON_ERROR)) ?>"
3601221f27SGreg Roach        data-page-length="<?= e($limit_low) ?>"
37b4139381SGreg Roach    >
38dd6b2bfcSGreg Roach        <thead>
39dd6b2bfcSGreg Roach            <tr>
4037d6169bSGreg Roach                <th class="wt-side-block-optional">
41315eb316SGreg Roach                <span class="visually-hidden">
42dd6b2bfcSGreg Roach                    <?= I18N::translate('Type') ?>
43dd6b2bfcSGreg Roach                </span>
44dd6b2bfcSGreg Roach                </th>
45dd6b2bfcSGreg Roach                <th>
46dd6b2bfcSGreg Roach                    <?= I18N::translate('Record') ?>
47dd6b2bfcSGreg Roach                </th>
48501bc70dSGreg Roach                <th class="<?= $show_date ? '' : 'd-none' ?>">
49dd6b2bfcSGreg Roach                    <?= I18N::translate('Last change') ?>
50dd6b2bfcSGreg Roach                </th>
51501bc70dSGreg Roach                <th class="<?= $show_user ? '' : 'd-none' ?>">
527524d819SGreg Roach                    <?= I18N::translate('Editor') ?>
53dd6b2bfcSGreg Roach                </th>
54dd6b2bfcSGreg Roach            </tr>
55dd6b2bfcSGreg Roach        </thead>
56dd6b2bfcSGreg Roach        <tbody>
57bd77bf38SGreg Roach            <?php foreach ($rows as $row) : ?>
58dd6b2bfcSGreg Roach                <tr>
5902467d32SGreg Roach                    <td data-sort="<?= $row->record->tag() ?>" class="text-centre wt-side-block-optional">
6002467d32SGreg Roach                        <?php if ($row->record->tag() === Individual::RECORD_TYPE) : ?>
616a83cfe8SGreg Roach                            <?= view('icons/individual') ?>
62315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Individual') ?></span>
6302467d32SGreg Roach                        <?php elseif ($row->record->tag() === Family::RECORD_TYPE) : ?>
646a83cfe8SGreg Roach                            <?= view('icons/family') ?>
65315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Family') ?></span>
6602467d32SGreg Roach                        <?php elseif ($row->record->tag() === Media::RECORD_TYPE) : ?>
676a83cfe8SGreg Roach                            <?= view('icons/media') ?>
68315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Media') ?></span>
6902467d32SGreg Roach                        <?php elseif ($row->record->tag() === Note::RECORD_TYPE) : ?>
706a83cfe8SGreg Roach                            <?= view('icons/note') ?>
71315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Note') ?></span>
7202467d32SGreg Roach                        <?php elseif ($row->record->tag() === Source::RECORD_TYPE) : ?>
736a83cfe8SGreg Roach                            <?= view('icons/source') ?>
74315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Source') ?></span>
7502467d32SGreg Roach                        <?php elseif ($row->record->tag() === Submitter::RECORD_TYPE) : ?>
766a83cfe8SGreg Roach                            <?= view('icons/submitter') ?>
77315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Submitter') ?></span>
7802467d32SGreg Roach                        <?php elseif ($row->record->tag() === Repository::RECORD_TYPE) : ?>
796a83cfe8SGreg Roach                            <?= view('icons/repository') ?>
80315eb316SGreg Roach                            <span class="visually-hidden"><?= I18N::translate('Repository') ?></span>
81*9c2569b5SHerzScheisse                        <?php elseif ($row->record->tag() === Location::RECORD_TYPE) : ?>
82*9c2569b5SHerzScheisse                            <?= view('icons/location') ?>
83*9c2569b5SHerzScheisse                            <span class="visually-hidden"><?= I18N::translate('Location') ?></span>
84dd6b2bfcSGreg Roach                        <?php endif ?>
85dd6b2bfcSGreg Roach                    </td>
866a83cfe8SGreg Roach
87bd77bf38SGreg Roach                    <td data-sort="<?= e($row->record->sortName()) ?>">
88bd77bf38SGreg Roach                        <a href="<?= e($row->record->url()) ?>"><?= $row->record->fullName() ?></a>
89dd6b2bfcSGreg Roach                    </td>
906a83cfe8SGreg Roach
91d97083feSGreg Roach                    <td data-sort="<?= $row->time->timestamp() ?>" class="<?= $show_date ? '' : 'd-none' ?>">
92bd77bf38SGreg Roach                        <?= view('components/datetime', ['timestamp' => $row->time]) ?>
93dd6b2bfcSGreg Roach                    </td>
946a83cfe8SGreg Roach
95501bc70dSGreg Roach                    <td class="<?= $show_user ? '' : 'd-none' ?>">
96e10e1dc9SGreg Roach                        <?= e($row->user->userName()) ?>
97dd6b2bfcSGreg Roach                    </td>
98dd6b2bfcSGreg Roach                </tr>
99dd6b2bfcSGreg Roach            <?php endforeach ?>
100dd6b2bfcSGreg Roach        </tbody>
101dd6b2bfcSGreg Roach    </table>
10237d6169bSGreg Roach</div>
103dd6b2bfcSGreg Roach
104dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
105dd6b2bfcSGreg Roach<script>
106419ce18fSGreg Roach  $(".wt-table-changes").dataTable().removeClass("d-none");
107dd6b2bfcSGreg Roach</script>
108dd6b2bfcSGreg Roach<?php View::endpush() ?>
109