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