xref: /webtrees/resources/views/admin/site-logs.phtml (revision 66ce3d2365f7eb099897303ad7dc49a8459ceb55)
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-xs-6 col-sm-3">
22            <label for="from">
23                <?= /* I18N: label for the start of a date range (from x to y) */ I18N::translate('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-xs-6 col-sm-3">
29            <label for="to">
30                <?= /* I18N: label for the end of a date range (from x to y) */ I18N::translate('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-xs-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-xs-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>
102    <thead>
103        <tr>
104            <th></th>
105            <th><?= I18N::translate('Timestamp') ?></th>
106            <th><?= I18N::translate('Type') ?></th>
107            <th><?= I18N::translate('Message') ?></th>
108            <th><?= I18N::translate('IP address') ?></th>
109            <th><?= I18N::translate('User') ?></th>
110            <th><?= I18N::translate('Family tree') ?></th>
111        </tr>
112    </thead>
113</table>
114
115<?php View::push('javascript') ?>
116<script>
117  $(".table-site-logs").dataTable( {
118    processing: true,
119    sorting: [[ 0, "desc" ]],
120    columns: [
121      /* log_id      */ { visible: false },
122      /* Timestamp   */ { sort: 0 },
123      /* Type        */ { },
124      /* message     */ { },
125      /* IP address  */ { },
126      /* User        */ { },
127      /* Family tree */ { }
128    ]
129  });
130</script>
131<?php View::endpush() ?>
132