xref: /webtrees/resources/views/modules/recent_changes/changes-table.phtml (revision e3c147d0d53873311b7c137c41b4439e01d4189e)
1<?php
2
3use Fisharebest\Webtrees\Family;
4use Fisharebest\Webtrees\I18N;
5use Fisharebest\Webtrees\Individual;
6use Fisharebest\Webtrees\Media;
7use Fisharebest\Webtrees\Note;
8use Fisharebest\Webtrees\Repository;
9use Fisharebest\Webtrees\Source;
10use Fisharebest\Webtrees\Submitter;
11use Fisharebest\Webtrees\View;
12
13?>
14
15<div class="table-responsive">
16    <table
17        class="table table-sm wt-table-changes datatables d-none"
18        <?= view('lists/datatables-attributes') ?>
19        data-filter="false"
20        data-info="false"
21        data-paging="false"
22    >
23        <thead>
24            <tr>
25                <th class="wt-side-block-optional">
26                <span class="sr-only">
27                    <?= I18N::translate('Type') ?>
28                </span>
29                </th>
30                <th>
31                    <?= I18N::translate('Record') ?>
32                </th>
33                <th>
34                    <?= I18N::translate('Last change') ?>
35                </th>
36                <?php if ($show_user) : ?>
37                    <th>
38                        <?= I18N::translate('User') ?>
39                    </th>
40                <?php endif ?>
41            </tr>
42        </thead>
43        <tbody>
44            <?php foreach ($records as $record) : ?>
45                <tr>
46                    <td data-sort="<?= $record::RECORD_TYPE ?>" class="text-centre wt-side-block-optional">
47                        <?php if ($record::RECORD_TYPE === Individual::RECORD_TYPE) : ?>
48                            <?= view('icons/individual') ?>
49                            <span class="sr-only"><?= I18N::translate('Individual') ?></span>
50                        <?php elseif ($record::RECORD_TYPE === Family::RECORD_TYPE) : ?>
51                            <?= view('icons/family') ?>
52                            <span class="sr-only"><?= I18N::translate('Family') ?></span>
53                        <?php elseif ($record::RECORD_TYPE === Media::RECORD_TYPE) : ?>
54                            <?= view('icons/media') ?>
55                            <span class="sr-only"><?= I18N::translate('Media') ?></span>
56                        <?php elseif ($record::RECORD_TYPE === Note::RECORD_TYPE) : ?>
57                            <?= view('icons/note') ?>
58                            <span class="sr-only"><?= I18N::translate('Note') ?></span>
59                        <?php elseif ($record::RECORD_TYPE === Source::RECORD_TYPE) : ?>
60                            <?= view('icons/source') ?>
61                            <span class="sr-only"><?= I18N::translate('Source') ?></span>
62                        <?php elseif ($record::RECORD_TYPE === Submitter::RECORD_TYPE) : ?>
63                            <?= view('icons/submitter') ?>
64                            <span class="sr-only"><?= I18N::translate('Submitter') ?></span>
65                        <?php elseif ($record::RECORD_TYPE === Repository::RECORD_TYPE) : ?>
66                            <?= view('icons/repository') ?>
67                            <span class="sr-only"><?= I18N::translate('Repository') ?></span>
68                        <?php endif ?>
69                    </td>
70
71                    <td data-sort="<?= e($record->sortName()) ?>">
72                        <a href="<?= e($record->url()) ?>"><?= $record->fullName() ?></a>
73                    </td>
74
75                    <td data-sort="<?= $record->lastChangeTimestamp()->unix() ?>">
76                        <?= view('components/datetime', ['timestamp' => $record->lastChangeTimestamp()]) ?>
77                    </td>
78
79                    <?php if ($show_user) : ?>
80                        <td>
81                            <?= e($record->lastChangeUser()) ?>
82                        </td>
83                    <?php endif ?>
84                </tr>
85            <?php endforeach ?>
86        </tbody>
87    </table>
88</div>
89
90<?php View::push('javascript') ?>
91<script>
92  $(".wt-table-changes").dataTable().removeClass("d-none");
93</script>
94<?php View::endpush() ?>
95