blob: 3b27daabe5d43a834915e41ae08e8cb75604a56b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<form class="sqlQueryForm" hx-post="/fragment/admin/sql-console/query" hx-target="this" hx-swap="outerHTML"
hx-disabled-elt="find button">
<div class="row">
<div class="column">
<label for="sqlQueryInput"><?= __('admin.sqlConsole.query.label') ?></label>
<textarea id="sqlQueryInput" name="query" class="codeEdit"
autocomplete="off"><?= $_POST['query'] ?? '' ?></textarea>
</div>
<div class="column">
<button type="submit" class="primary"><?= __('admin.sqlConsole.query.action') ?></button>
</div>
</div>
<?php if (isset($error)) {
call_template('alertbox', ['variety' => 'error', 'message' => $error->getMessage()]);
} ?>
<?php if (isset($results)): ?>
<div class="row tableContainer">
<h3><?= __f('admin.sqlConsole.results.heading', count($results)) ?></h3>
<?php if (count($results) > 0): ?>
<div class="tableContainer">
<table>
<thead>
<tr>
<?php foreach ($results[0] as $header => $_): ?>
<th><?= htmlspecialchars($header) ?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach ($results as $row): ?>
<tr>
<?php foreach ($row as $value): ?>
<td><?= htmlspecialchars($value); ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</form>
|