xref: /webtrees/resources/views/admin/site-logs.phtml (revision 1792ff1cf1956b41f3e3c853cfb279a803a71ed2)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsData;
5use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDelete;
6use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDownload;
7use Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsPage;
8use Fisharebest\Webtrees\I18N;
9use Fisharebest\Webtrees\View;
10
11?>
12
13<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
14
15<h1><?= $title ?></h1>
16
17<form method="post" class="form" name="logs">
18    <?= csrf_field() ?>
19
20    <div class="row">
21        <div class="form-group col-sm-6 col-sm-3">
22            <label for="from">
23                <?= I18N::translateContext('Start of date range', 'From') ?>
24            </label>
25            <input type="date" class="form-control" id="from" max="<?= e($latest) ?>" min="<?= e($earliest) ?>" name="from" value="<?= e($from) ?>" required>
26        </div>
27
28        <div class="form-group col-sm-6 col-sm-3">
29            <label for="to">
30                <?= I18N::translateContext('End of date range', 'To') ?>
31            </label>
32            <input type="date" class="form-control" id="to" max="<?= e($latest) ?>" min="<?= e($earliest) ?>" name="to" value="<?= e($to) ?>" required>
33        </div>
34
35        <div class="form-group col-sm-6 col-sm-2">
36            <label for="type">
37                <?= I18N::translate('Type') ?>
38            </label>
39            <?= view('components/select', ['name' => 'type', 'selected' => $type, 'options' => ['' => '', 'auth' => 'auth', 'config' => 'config', 'debug' => 'debug', 'edit' => 'edit', 'error' => 'error', 'media' => 'media', 'search' => 'search']]) ?>
40        </div>
41
42        <div class="form-group col-sm-6 col-sm-4">
43            <label for="ip">
44                <?= I18N::translate('IP address') ?>
45            </label>
46            <input class="form-control" type="text" id="ip" name="ip" value="<?= e($ip) ?>">
47        </div>
48    </div>
49
50    <div class="row">
51        <div class="form-group col-sm-4">
52            <label for="text">
53                <?= I18N::translate('Message') ?>
54            </label>
55            <input class="form-control" type="text" id="text" name="text" value="<?= e($text) ?>">
56        </div>
57
58        <div class="form-group col-sm-4">
59            <label for="username">
60                <?= I18N::translate('User') ?>
61            </label>
62            <?= view('components/select', ['name' => 'username', 'selected' => $username, 'options' => $user_options]) ?>
63        </div>
64
65        <div class="form-group col-sm-4">
66            <label for="tree">
67                <?= I18N::translate('Family tree') ?>
68            </label>
69            <?= view('components/select', ['name' => 'tree', 'selected' => $tree, 'options' => $tree_options]) ?>
70        </div>
71    </div>
72
73    <div class="text-center">
74        <button type="submit" class="btn btn-primary">
75        <?= view('icons/search') ?>
76            <?= /* I18N: A button label. */ I18N::translate('search') ?>
77        </button>
78
79        <a href="<?= e(route(SiteLogsPage::class)) ?>" type="submit" class="btn btn-secondary">
80            <?= view('icons/cancel') ?>
81            <?= /* I18N: A button label. */ I18N::translate('reset') ?>
82        </a>
83
84        <a href="<?= e(route(SiteLogsDownload::class, ['from' => $from, 'to' => $to, 'type' => $type, 'text' => $text, 'ip' => $ip, 'username' => $username, 'tree' => $tree])) ?>" class="btn btn-secondary">
85        <?= view('icons/download') ?>
86            <?= /* I18N: A button label. */ I18N::translate('download') ?>
87        </a>
88
89        <a href="#" class="btn btn-danger" data-confirm="<?= I18N::translate('Permanently delete these records?') ?>" data-post-url="<?= e(route(SiteLogsDelete::class, ['from' => $from, 'to' => $to, 'type' => $type, 'text' => $text, 'ip' => $ip, 'username' => $username, 'tree' => $tree])) ?>">
90        <?= view('icons/delete') ?>
91            <?= /* I18N: A button label. */ I18N::translate('delete') ?>
92        </a>
93    </div>
94</form>
95
96<table
97    class="table table-bordered table-sm table-hover table-site-logs"
98    <?= view('lists/datatables-attributes') ?>
99    data-ajax="<?= e(route(SiteLogsData::class, ['from' => $from, 'to' => $to, 'type' => $type, 'text' => $text, 'ip' => $ip, 'username' => $username, 'tree' => $tree])) ?>"
100    data-server-side="true"
101    data-filter="false"
102>
103    <thead>
104        <tr>
105            <th></th>
106            <th><?= I18N::translate('Timestamp') ?></th>
107            <th><?= I18N::translate('Type') ?></th>
108            <th><?= I18N::translate('Message') ?></th>
109            <th><?= I18N::translate('IP address') ?></th>
110            <th><?= I18N::translate('User') ?></th>
111            <th><?= I18N::translate('Family tree') ?></th>
112        </tr>
113    </thead>
114</table>
115
116<?php View::push('javascript') ?>
117<script>
118  $(".table-site-logs").dataTable( {
119    processing: true,
120    sorting: [[ 0, "desc" ]],
121    columns: [
122      /* log_id      */ { visible: false },
123      /* Timestamp   */ { sort: 0 },
124      /* Type        */ { },
125      /* message     */ { },
126      /* IP address  */ { },
127      /* User        */ { },
128      /* Family tree */ { }
129    ]
130  });
131</script>
132<?php View::endpush() ?>
133