diff options
| author | winter | 2025-05-11 20:25:11 +0100 |
|---|---|---|
| committer | winter | 2025-05-11 20:25:11 +0100 |
| commit | 07d1f1236c11b4261ab2b954a91278711a24901c (patch) | |
| tree | dc52072e468ec6a5980cbe6894459e8623441025 /templates/admin/sql_console_form.php | |
| parent | 5d7a4605bd0bd71949a37139eccfbf8a70d0c32e (diff) | |
sql console in admin menu + other misc
Diffstat (limited to 'templates/admin/sql_console_form.php')
| -rw-r--r-- | templates/admin/sql_console_form.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/templates/admin/sql_console_form.php b/templates/admin/sql_console_form.php new file mode 100644 index 0000000..3b27daa --- /dev/null +++ b/templates/admin/sql_console_form.php @@ -0,0 +1,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>
\ No newline at end of file |
