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