xref: /webtrees/resources/views/admin/site-logs.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
10c0910bfSGreg Roach<?php
2dd6b2bfcSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
50c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
657bfa969SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsData;
757bfa969SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDelete;
857bfa969SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsDownload;
957bfa969SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SiteLogsPage;
100c0910bfSGreg Roachuse Fisharebest\Webtrees\I18N;
110c0910bfSGreg Roachuse Fisharebest\Webtrees\View;
127c2c99faSGreg Roachuse Illuminate\Support\Collection;
137c2c99faSGreg Roach
147c2c99faSGreg Roach/**
157c2c99faSGreg Roach * @var string                       $earliest
167c2c99faSGreg Roach * @var string                       $from
177c2c99faSGreg Roach * @var string                       $ip
187c2c99faSGreg Roach * @var string                       $latest
197c2c99faSGreg Roach * @var string                       $title
207c2c99faSGreg Roach * @var string                       $to
217c2c99faSGreg Roach * @var string                       $text
227c2c99faSGreg Roach * @var string                       $tree
2336779af1SGreg Roach * @var Collection<array-key,string> $tree_options
247c2c99faSGreg Roach * @var string                       $type
257c2c99faSGreg Roach * @var string                       $username
2636779af1SGreg Roach * @var Collection<array-key,string> $user_options
277c2c99faSGreg Roach */
280c0910bfSGreg Roach
290c0910bfSGreg Roach?>
300c0910bfSGreg Roach
310c0910bfSGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
32dd6b2bfcSGreg Roach
33dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
34dd6b2bfcSGreg Roach
3557bfa969SGreg Roach<form method="post" class="form" name="logs">
36dd6b2bfcSGreg Roach    <div class="row">
379e3c2cf9SGreg Roach        <div class="col-sm-6 col-sm-3">
38dd6b2bfcSGreg Roach            <label for="from">
39f80607a6SGreg Roach                <?= I18N::translateContext('Start of date range', 'From') ?>
40dd6b2bfcSGreg Roach            </label>
417dca5265SGreg Roach            <input type="date" class="form-control" id="from" max="<?= e($latest) ?>" min="<?= e($earliest) ?>" name="from" value="<?= e($from) ?>" required="required">
42dd6b2bfcSGreg Roach        </div>
43dd6b2bfcSGreg Roach
449e3c2cf9SGreg Roach        <div class="col-sm-6 col-sm-3">
45dd6b2bfcSGreg Roach            <label for="to">
46f80607a6SGreg Roach                <?= I18N::translateContext('End of date range', 'To') ?>
47dd6b2bfcSGreg Roach            </label>
487dca5265SGreg Roach            <input type="date" class="form-control" id="to" max="<?= e($latest) ?>" min="<?= e($earliest) ?>" name="to" value="<?= e($to) ?>" required="required">
49dd6b2bfcSGreg Roach        </div>
50dd6b2bfcSGreg Roach
519e3c2cf9SGreg Roach        <div class="col-sm-6 col-sm-2">
52dd6b2bfcSGreg Roach            <label for="type">
53dd6b2bfcSGreg Roach                <?= I18N::translate('Type') ?>
54dd6b2bfcSGreg Roach            </label>
55c9e11c2aSGreg Roach            <?= view('components/select', ['name' => 'type', 'selected' => $type, 'options' => ['' => '', 'auth' => 'auth', 'config' => 'config', 'debug' => 'debug', 'edit' => 'edit', 'error' => 'error', 'media' => 'media', 'search' => 'search']]) ?>
56dd6b2bfcSGreg Roach        </div>
57dd6b2bfcSGreg Roach
589e3c2cf9SGreg Roach        <div class="col-sm-6 col-sm-4">
59dd6b2bfcSGreg Roach            <label for="ip">
60dd6b2bfcSGreg Roach                <?= I18N::translate('IP address') ?>
61dd6b2bfcSGreg Roach            </label>
62dd6b2bfcSGreg Roach            <input class="form-control" type="text" id="ip" name="ip" value="<?= e($ip) ?>">
63dd6b2bfcSGreg Roach        </div>
64dd6b2bfcSGreg Roach    </div>
65dd6b2bfcSGreg Roach
66dd6b2bfcSGreg Roach    <div class="row">
679e3c2cf9SGreg Roach        <div class="col-sm-4">
68dd6b2bfcSGreg Roach            <label for="text">
69dd6b2bfcSGreg Roach                <?= I18N::translate('Message') ?>
70dd6b2bfcSGreg Roach            </label>
71dd6b2bfcSGreg Roach            <input class="form-control" type="text" id="text" name="text" value="<?= e($text) ?>">
72dd6b2bfcSGreg Roach        </div>
73dd6b2bfcSGreg Roach
749e3c2cf9SGreg Roach        <div class="col-sm-4">
75dd6b2bfcSGreg Roach            <label for="username">
76dd6b2bfcSGreg Roach                <?= I18N::translate('User') ?>
77dd6b2bfcSGreg Roach            </label>
78c9e11c2aSGreg Roach            <?= view('components/select', ['name' => 'username', 'selected' => $username, 'options' => $user_options]) ?>
79dd6b2bfcSGreg Roach        </div>
80dd6b2bfcSGreg Roach
819e3c2cf9SGreg Roach        <div class="col-sm-4">
8257bfa969SGreg Roach            <label for="tree">
83dd6b2bfcSGreg Roach                <?= I18N::translate('Family tree') ?>
84dd6b2bfcSGreg Roach            </label>
8557bfa969SGreg Roach            <?= view('components/select', ['name' => 'tree', 'selected' => $tree, 'options' => $tree_options]) ?>
86dd6b2bfcSGreg Roach        </div>
87dd6b2bfcSGreg Roach    </div>
88dd6b2bfcSGreg Roach
89dd6b2bfcSGreg Roach    <div class="text-center">
90dd6b2bfcSGreg Roach        <button type="submit" class="btn btn-primary">
91dd6b2bfcSGreg Roach        <?= view('icons/search') ?>
92dd6b2bfcSGreg Roach            <?= /* I18N: A button label. */ I18N::translate('search') ?>
93dd6b2bfcSGreg Roach        </button>
94dd6b2bfcSGreg Roach
9557bfa969SGreg Roach        <a href="<?= e(route(SiteLogsPage::class)) ?>" type="submit" class="btn btn-secondary">
9657bfa969SGreg Roach            <?= view('icons/cancel') ?>
9757bfa969SGreg Roach            <?= /* I18N: A button label. */ I18N::translate('reset') ?>
9857bfa969SGreg Roach        </a>
9957bfa969SGreg Roach
10057bfa969SGreg 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">
101dd6b2bfcSGreg Roach        <?= view('icons/download') ?>
102dd6b2bfcSGreg Roach            <?= /* I18N: A button label. */ I18N::translate('download') ?>
103dd6b2bfcSGreg Roach        </a>
104dd6b2bfcSGreg Roach
105d4786c66SGreg Roach        <a href="#" class="btn btn-danger" data-wt-confirm="<?= I18N::translate('Permanently delete these records?') ?>" data-wt-post-url="<?= e(route(SiteLogsDelete::class, ['from' => $from, 'to' => $to, 'type' => $type, 'text' => $text, 'ip' => $ip, 'username' => $username, 'tree' => $tree])) ?>">
106dd6b2bfcSGreg Roach        <?= view('icons/delete') ?>
107dd6b2bfcSGreg Roach            <?= /* I18N: A button label. */ I18N::translate('delete') ?>
108dd6b2bfcSGreg Roach        </a>
109dd6b2bfcSGreg Roach    </div>
11081443e3cSGreg Roach
11181443e3cSGreg Roach    <?= csrf_field() ?>
112dd6b2bfcSGreg Roach</form>
113dd6b2bfcSGreg Roach
11457bfa969SGreg Roach<table
11557bfa969SGreg Roach    class="table table-bordered table-sm table-hover table-site-logs"
116b6c326d8SGreg Roach    <?= view('lists/datatables-attributes') ?>
11757bfa969SGreg Roach    data-ajax="<?= e(route(SiteLogsData::class, ['from' => $from, 'to' => $to, 'type' => $type, 'text' => $text, 'ip' => $ip, 'username' => $username, 'tree' => $tree])) ?>"
118b6c326d8SGreg Roach    data-server-side="true"
1190059cc9bSGreg Roach    data-filter="false"
120b6c326d8SGreg Roach>
121dd6b2bfcSGreg Roach    <thead>
122dd6b2bfcSGreg Roach        <tr>
123dd6b2bfcSGreg Roach            <th></th>
124dd6b2bfcSGreg Roach            <th><?= I18N::translate('Timestamp') ?></th>
125dd6b2bfcSGreg Roach            <th><?= I18N::translate('Type') ?></th>
126dd6b2bfcSGreg Roach            <th><?= I18N::translate('Message') ?></th>
127dd6b2bfcSGreg Roach            <th><?= I18N::translate('IP address') ?></th>
128dd6b2bfcSGreg Roach            <th><?= I18N::translate('User') ?></th>
129dd6b2bfcSGreg Roach            <th><?= I18N::translate('Family tree') ?></th>
130dd6b2bfcSGreg Roach        </tr>
131dd6b2bfcSGreg Roach    </thead>
132dd6b2bfcSGreg Roach</table>
133dd6b2bfcSGreg Roach
134dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
135dd6b2bfcSGreg Roach<script>
136dd6b2bfcSGreg Roach  $(".table-site-logs").dataTable( {
137dd6b2bfcSGreg Roach    processing: true,
138dd6b2bfcSGreg Roach    sorting: [[ 0, "desc" ]],
139dd6b2bfcSGreg Roach    columns: [
140dd6b2bfcSGreg Roach      /* log_id      */ { visible: false },
141dd6b2bfcSGreg Roach      /* Timestamp   */ { sort: 0 },
142dd6b2bfcSGreg Roach      /* Type        */ { },
143dd6b2bfcSGreg Roach      /* message     */ { },
144dd6b2bfcSGreg Roach      /* IP address  */ { },
145dd6b2bfcSGreg Roach      /* User        */ { },
146dd6b2bfcSGreg Roach      /* Family tree */ { }
147b6c326d8SGreg Roach    ]
148dd6b2bfcSGreg Roach  });
149dd6b2bfcSGreg Roach</script>
150dd6b2bfcSGreg Roach<?php View::endpush() ?>
151