diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/admin/overview_page.php | 4 | ||||
| -rw-r--r-- | templates/admin/sql_console_form.php | 45 | ||||
| -rw-r--r-- | templates/admin/sql_console_page.php | 4 |
3 files changed, 53 insertions, 0 deletions
diff --git a/templates/admin/overview_page.php b/templates/admin/overview_page.php index d3325ef..6906e3c 100644 --- a/templates/admin/overview_page.php +++ b/templates/admin/overview_page.php @@ -8,6 +8,10 @@ 'icon' => 'extension-outline', 'label' => __('admin.plugins.pageTitle'), 'href' => '/admin/plugins' + ], [ + 'icon' => 'database-search-outline', + 'label' => __('admin.sqlConsole.pageTitle'), + 'href' => '/admin/sql-console' ] ]]); });
\ No newline at end of file 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 diff --git a/templates/admin/sql_console_page.php b/templates/admin/sql_console_page.php new file mode 100644 index 0000000..110e3ab --- /dev/null +++ b/templates/admin/sql_console_page.php @@ -0,0 +1,4 @@ +<?php call_template('skeleton', ['pageTitle' => __('admin.sqlConsole.pageTitle')], function () { + call_template('alertbox', ['variety' => 'info', 'message' => __('admin.sqlConsole.info')]); + call_template('admin/sql_console_form'); +});
\ No newline at end of file |
