xref: /webtrees/resources/views/admin/site-logs.phtml (revision 0059cc9b619e0a6dead30f72e5acc978e447f514)
10c0910bfSGreg Roach<?php
2dd6b2bfcSGreg Roach
30c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
457bfa969SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsData;
557bfa969SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDelete;
657bfa969SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDownload;
757bfa969SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsPage;
80c0910bfSGreg Roachuse Fisharebest\Webtrees\I18N;
90c0910bfSGreg Roachuse Fisharebest\Webtrees\View;
100c0910bfSGreg Roach
110c0910bfSGreg Roach?>
120c0910bfSGreg Roach
130c0910bfSGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
14dd6b2bfcSGreg Roach
15dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
16dd6b2bfcSGreg Roach
1757bfa969SGreg Roach<form method="post" class="form" name="logs">
1857bfa969SGreg Roach    <?= csrf_field() ?>
19dd6b2bfcSGreg Roach
20dd6b2bfcSGreg Roach    <div class="row">
215197b5a1SGreg Roach        <div class="form-group col-sm-6 col-sm-3">
22dd6b2bfcSGreg Roach            <label for="from">
23f80607a6SGreg Roach                <?= I18N::translateContext('Start of date range', 'From') ?>
24dd6b2bfcSGreg Roach            </label>
25dd6b2bfcSGreg Roach            <input type="date" class="form-control" id="from" max="<?= e($latest) ?>" min="<?= e($earliest) ?>" name="from" value="<?= e($from) ?>" required>
26dd6b2bfcSGreg Roach        </div>
27dd6b2bfcSGreg Roach
285197b5a1SGreg Roach        <div class="form-group col-sm-6 col-sm-3">
29dd6b2bfcSGreg Roach            <label for="to">
30f80607a6SGreg Roach                <?= I18N::translateContext('End of date range', 'To') ?>
31dd6b2bfcSGreg Roach            </label>
32dd6b2bfcSGreg Roach            <input type="date" class="form-control" id="to" max="<?= e($latest) ?>" min="<?= e($earliest) ?>" name="to" value="<?= e($to) ?>" required>
33dd6b2bfcSGreg Roach        </div>
34dd6b2bfcSGreg Roach
355197b5a1SGreg Roach        <div class="form-group col-sm-6 col-sm-2">
36dd6b2bfcSGreg Roach            <label for="type">
37dd6b2bfcSGreg Roach                <?= I18N::translate('Type') ?>
38dd6b2bfcSGreg Roach            </label>
39c9e11c2aSGreg Roach            <?= view('components/select', ['name' => 'type', 'selected' => $type, 'options' => ['' => '', 'auth' => 'auth', 'config' => 'config', 'debug' => 'debug', 'edit' => 'edit', 'error' => 'error', 'media' => 'media', 'search' => 'search']]) ?>
40dd6b2bfcSGreg Roach        </div>
41dd6b2bfcSGreg Roach
425197b5a1SGreg Roach        <div class="form-group col-sm-6 col-sm-4">
43dd6b2bfcSGreg Roach            <label for="ip">
44dd6b2bfcSGreg Roach                <?= I18N::translate('IP address') ?>
45dd6b2bfcSGreg Roach            </label>
46dd6b2bfcSGreg Roach            <input class="form-control" type="text" id="ip" name="ip" value="<?= e($ip) ?>">
47dd6b2bfcSGreg Roach        </div>
48dd6b2bfcSGreg Roach    </div>
49dd6b2bfcSGreg Roach
50dd6b2bfcSGreg Roach    <div class="row">
51dd6b2bfcSGreg Roach        <div class="form-group col-sm-4">
52dd6b2bfcSGreg Roach            <label for="text">
53dd6b2bfcSGreg Roach                <?= I18N::translate('Message') ?>
54dd6b2bfcSGreg Roach            </label>
55dd6b2bfcSGreg Roach            <input class="form-control" type="text" id="text" name="text" value="<?= e($text) ?>">
56dd6b2bfcSGreg Roach        </div>
57dd6b2bfcSGreg Roach
58dd6b2bfcSGreg Roach        <div class="form-group col-sm-4">
59dd6b2bfcSGreg Roach            <label for="username">
60dd6b2bfcSGreg Roach                <?= I18N::translate('User') ?>
61dd6b2bfcSGreg Roach            </label>
62c9e11c2aSGreg Roach            <?= view('components/select', ['name' => 'username', 'selected' => $username, 'options' => $user_options]) ?>
63dd6b2bfcSGreg Roach        </div>
64dd6b2bfcSGreg Roach
65dd6b2bfcSGreg Roach        <div class="form-group col-sm-4">
6657bfa969SGreg Roach            <label for="tree">
67dd6b2bfcSGreg Roach                <?= I18N::translate('Family tree') ?>
68dd6b2bfcSGreg Roach            </label>
6957bfa969SGreg Roach            <?= view('components/select', ['name' => 'tree', 'selected' => $tree, 'options' => $tree_options]) ?>
70dd6b2bfcSGreg Roach        </div>
71dd6b2bfcSGreg Roach    </div>
72dd6b2bfcSGreg Roach
73dd6b2bfcSGreg Roach    <div class="text-center">
74dd6b2bfcSGreg Roach        <button type="submit" class="btn btn-primary">
75dd6b2bfcSGreg Roach        <?= view('icons/search') ?>
76dd6b2bfcSGreg Roach            <?= /* I18N: A button label. */ I18N::translate('search') ?>
77dd6b2bfcSGreg Roach        </button>
78dd6b2bfcSGreg Roach
7957bfa969SGreg Roach        <a href="<?= e(route(SiteLogsPage::class)) ?>" type="submit" class="btn btn-secondary">
8057bfa969SGreg Roach            <?= view('icons/cancel') ?>
8157bfa969SGreg Roach            <?= /* I18N: A button label. */ I18N::translate('reset') ?>
8257bfa969SGreg Roach        </a>
8357bfa969SGreg Roach
8457bfa969SGreg Roach        <a href="<?= e(route(SiteLogsDownload::class, ['from' => $from, 'to' => $to, 'type' => $type, 'text' => $text, 'ip' => $ip, 'username' => $username, 'tree' => $tree])) ?>" class="btn btn-secondary">
85dd6b2bfcSGreg Roach        <?= view('icons/download') ?>
86dd6b2bfcSGreg Roach            <?= /* I18N: A button label. */ I18N::translate('download') ?>
87dd6b2bfcSGreg Roach        </a>
88dd6b2bfcSGreg Roach
8957bfa969SGreg Roach        <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])) ?>">
90dd6b2bfcSGreg Roach        <?= view('icons/delete') ?>
91dd6b2bfcSGreg Roach            <?= /* I18N: A button label. */ I18N::translate('delete') ?>
92dd6b2bfcSGreg Roach        </a>
93dd6b2bfcSGreg Roach    </div>
94dd6b2bfcSGreg Roach</form>
95dd6b2bfcSGreg Roach
9657bfa969SGreg Roach<table
9757bfa969SGreg Roach    class="table table-bordered table-sm table-hover table-site-logs"
98b6c326d8SGreg Roach    <?= view('lists/datatables-attributes') ?>
9957bfa969SGreg Roach    data-ajax="<?= e(route(SiteLogsData::class, ['from' => $from, 'to' => $to, 'type' => $type, 'text' => $text, 'ip' => $ip, 'username' => $username, 'tree' => $tree])) ?>"
100b6c326d8SGreg Roach    data-server-side="true"
101*0059cc9bSGreg Roach    data-filter="false"
102b6c326d8SGreg Roach>
103dd6b2bfcSGreg Roach    <thead>
104dd6b2bfcSGreg Roach        <tr>
105dd6b2bfcSGreg Roach            <th></th>
106dd6b2bfcSGreg Roach            <th><?= I18N::translate('Timestamp') ?></th>
107dd6b2bfcSGreg Roach            <th><?= I18N::translate('Type') ?></th>
108dd6b2bfcSGreg Roach            <th><?= I18N::translate('Message') ?></th>
109dd6b2bfcSGreg Roach            <th><?= I18N::translate('IP address') ?></th>
110dd6b2bfcSGreg Roach            <th><?= I18N::translate('User') ?></th>
111dd6b2bfcSGreg Roach            <th><?= I18N::translate('Family tree') ?></th>
112dd6b2bfcSGreg Roach        </tr>
113dd6b2bfcSGreg Roach    </thead>
114dd6b2bfcSGreg Roach</table>
115dd6b2bfcSGreg Roach
116dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
117dd6b2bfcSGreg Roach<script>
118dd6b2bfcSGreg Roach  $(".table-site-logs").dataTable( {
119dd6b2bfcSGreg Roach    processing: true,
120dd6b2bfcSGreg Roach    sorting: [[ 0, "desc" ]],
121dd6b2bfcSGreg Roach    columns: [
122dd6b2bfcSGreg Roach      /* log_id      */ { visible: false },
123dd6b2bfcSGreg Roach      /* Timestamp   */ { sort: 0 },
124dd6b2bfcSGreg Roach      /* Type        */ { },
125dd6b2bfcSGreg Roach      /* message     */ { },
126dd6b2bfcSGreg Roach      /* IP address  */ { },
127dd6b2bfcSGreg Roach      /* User        */ { },
128dd6b2bfcSGreg Roach      /* Family tree */ { }
129b6c326d8SGreg Roach    ]
130dd6b2bfcSGreg Roach  });
131dd6b2bfcSGreg Roach</script>
132dd6b2bfcSGreg Roach<?php View::endpush() ?>
133