xref: /webtrees/resources/views/admin/site-logs.phtml (revision 36779af1bd0601de7819554b13a393f6edb92507)
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;
107c2c99faSGreg Roachuse Illuminate\Support\Collection;
117c2c99faSGreg Roach
127c2c99faSGreg Roach/**
137c2c99faSGreg Roach * @var string                       $earliest
147c2c99faSGreg Roach * @var string                       $from
157c2c99faSGreg Roach * @var string                       $ip
167c2c99faSGreg Roach * @var string                       $latest
177c2c99faSGreg Roach * @var string                       $title
187c2c99faSGreg Roach * @var string                       $to
197c2c99faSGreg Roach * @var string                       $text
207c2c99faSGreg Roach * @var string                       $tree
21*36779af1SGreg Roach * @var Collection<array-key,string> $tree_options
227c2c99faSGreg Roach * @var string                       $type
237c2c99faSGreg Roach * @var string                       $username
24*36779af1SGreg Roach * @var Collection<array-key,string> $user_options
257c2c99faSGreg Roach */
260c0910bfSGreg Roach
270c0910bfSGreg Roach?>
280c0910bfSGreg Roach
290c0910bfSGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
30dd6b2bfcSGreg Roach
31dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
32dd6b2bfcSGreg Roach
3357bfa969SGreg Roach<form method="post" class="form" name="logs">
3457bfa969SGreg Roach    <?= csrf_field() ?>
35dd6b2bfcSGreg Roach
36dd6b2bfcSGreg Roach    <div class="row">
375197b5a1SGreg Roach        <div class="form-group 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
445197b5a1SGreg Roach        <div class="form-group 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
515197b5a1SGreg Roach        <div class="form-group 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
585197b5a1SGreg Roach        <div class="form-group 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">
67dd6b2bfcSGreg Roach        <div class="form-group 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
74dd6b2bfcSGreg Roach        <div class="form-group 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
81dd6b2bfcSGreg Roach        <div class="form-group 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>
110dd6b2bfcSGreg Roach</form>
111dd6b2bfcSGreg Roach
11257bfa969SGreg Roach<table
11357bfa969SGreg Roach    class="table table-bordered table-sm table-hover table-site-logs"
114b6c326d8SGreg Roach    <?= view('lists/datatables-attributes') ?>
11557bfa969SGreg Roach    data-ajax="<?= e(route(SiteLogsData::class, ['from' => $from, 'to' => $to, 'type' => $type, 'text' => $text, 'ip' => $ip, 'username' => $username, 'tree' => $tree])) ?>"
116b6c326d8SGreg Roach    data-server-side="true"
1170059cc9bSGreg Roach    data-filter="false"
118b6c326d8SGreg Roach>
119dd6b2bfcSGreg Roach    <thead>
120dd6b2bfcSGreg Roach        <tr>
121dd6b2bfcSGreg Roach            <th></th>
122dd6b2bfcSGreg Roach            <th><?= I18N::translate('Timestamp') ?></th>
123dd6b2bfcSGreg Roach            <th><?= I18N::translate('Type') ?></th>
124dd6b2bfcSGreg Roach            <th><?= I18N::translate('Message') ?></th>
125dd6b2bfcSGreg Roach            <th><?= I18N::translate('IP address') ?></th>
126dd6b2bfcSGreg Roach            <th><?= I18N::translate('User') ?></th>
127dd6b2bfcSGreg Roach            <th><?= I18N::translate('Family tree') ?></th>
128dd6b2bfcSGreg Roach        </tr>
129dd6b2bfcSGreg Roach    </thead>
130dd6b2bfcSGreg Roach</table>
131dd6b2bfcSGreg Roach
132dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
133dd6b2bfcSGreg Roach<script>
134dd6b2bfcSGreg Roach  $(".table-site-logs").dataTable( {
135dd6b2bfcSGreg Roach    processing: true,
136dd6b2bfcSGreg Roach    sorting: [[ 0, "desc" ]],
137dd6b2bfcSGreg Roach    columns: [
138dd6b2bfcSGreg Roach      /* log_id      */ { visible: false },
139dd6b2bfcSGreg Roach      /* Timestamp   */ { sort: 0 },
140dd6b2bfcSGreg Roach      /* Type        */ { },
141dd6b2bfcSGreg Roach      /* message     */ { },
142dd6b2bfcSGreg Roach      /* IP address  */ { },
143dd6b2bfcSGreg Roach      /* User        */ { },
144dd6b2bfcSGreg Roach      /* Family tree */ { }
145b6c326d8SGreg Roach    ]
146dd6b2bfcSGreg Roach  });
147dd6b2bfcSGreg Roach</script>
148dd6b2bfcSGreg Roach<?php View::endpush() ?>
149