xref: /webtrees/resources/views/modules/recent_changes/changes-table.phtml (revision 05b764633d4f737ee233802880357c79dd65bce3)
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;
12use Illuminate\Support\Collection;
13
14/**
15 * @var int                  $limit_high
16 * @var int                  $limit_low
17 * @var Collection<stdClass> $rows
18 * @var bool                 $show_user
19 */
20?>
21
22<div class="table-responsive">
23    <table
24        class="table table-sm wt-table-changes datatables d-none"
25        <?= view('lists/datatables-attributes') ?>
26        <?php if ($rows->count() < e($limit_high)) : ?>
27            data-paging="false"
28        <?php endif ?>
29        data-filter="false"
30        data-info="false"
31        data-length-change="false"
32        data-page-length="<?= e($limit_low) ?>"
33    >
34        <thead>
35            <tr>
36                <th class="wt-side-block-optional">
37                <span class="sr-only">
38                    <?= I18N::translate('Type') ?>
39                </span>
40                </th>
41                <th>
42                    <?= I18N::translate('Record') ?>
43                </th>
44                <th>
45                    <?= I18N::translate('Last change') ?>
46                </th>
47                <?php if ($show_user) : ?>
48                    <th>
49                        <?= I18N::translate('User') ?>
50                    </th>
51                <?php endif ?>
52            </tr>
53        </thead>
54        <tbody>
55            <?php foreach ($rows as $row) : ?>
56                <tr>
57                    <td data-sort="<?= $row->record::RECORD_TYPE ?>" class="text-centre wt-side-block-optional">
58                        <?php if ($row->record::RECORD_TYPE === Individual::RECORD_TYPE) : ?>
59                            <?= view('icons/individual') ?>
60                            <span class="sr-only"><?= I18N::translate('Individual') ?></span>
61                        <?php elseif ($row->record::RECORD_TYPE === Family::RECORD_TYPE) : ?>
62                            <?= view('icons/family') ?>
63                            <span class="sr-only"><?= I18N::translate('Family') ?></span>
64                        <?php elseif ($row->record::RECORD_TYPE === Media::RECORD_TYPE) : ?>
65                            <?= view('icons/media') ?>
66                            <span class="sr-only"><?= I18N::translate('Media') ?></span>
67                        <?php elseif ($row->record::RECORD_TYPE === Note::RECORD_TYPE) : ?>
68                            <?= view('icons/note') ?>
69                            <span class="sr-only"><?= I18N::translate('Note') ?></span>
70                        <?php elseif ($row->record::RECORD_TYPE === Source::RECORD_TYPE) : ?>
71                            <?= view('icons/source') ?>
72                            <span class="sr-only"><?= I18N::translate('Source') ?></span>
73                        <?php elseif ($row->record::RECORD_TYPE === Submitter::RECORD_TYPE) : ?>
74                            <?= view('icons/submitter') ?>
75                            <span class="sr-only"><?= I18N::translate('Submitter') ?></span>
76                        <?php elseif ($row->record::RECORD_TYPE === Repository::RECORD_TYPE) : ?>
77                            <?= view('icons/repository') ?>
78                            <span class="sr-only"><?= I18N::translate('Repository') ?></span>
79                        <?php endif ?>
80                    </td>
81
82                    <td data-sort="<?= e($row->record->sortName()) ?>">
83                        <a href="<?= e($row->record->url()) ?>"><?= $row->record->fullName() ?></a>
84                    </td>
85
86                    <td data-sort="<?= $row->time->timestamp ?>">
87                        <?= view('components/datetime', ['timestamp' => $row->time]) ?>
88                    </td>
89
90                    <?php if ($show_user) : ?>
91                        <td>
92                            <?= e($row->user->userName()) ?>
93                        </td>
94                    <?php endif ?>
95                </tr>
96            <?php endforeach ?>
97        </tbody>
98    </table>
99</div>
100
101<?php View::push('javascript') ?>
102<script>
103  $(".wt-table-changes").dataTable().removeClass("d-none");
104</script>
105<?php View::endpush() ?>
106