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