summaryrefslogtreecommitdiff
path: root/includes/desktop/components
diff options
context:
space:
mode:
authorJonas Kohl <git@jonaskohl.de>2024-09-06 17:01:01 +0200
committerJonas Kohl <git@jonaskohl.de>2024-09-06 17:01:01 +0200
commit3d22cc3333e1265a222425a4ede9c464234e3632 (patch)
tree7acd1379c752913f12168cc75583e68b14278288 /includes/desktop/components
parent0540e04c77864186ce48193456634b897a11f5aa (diff)
Small fixes; Add component system
Diffstat (limited to 'includes/desktop/components')
-rw-r--r--includes/desktop/components/alert.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/includes/desktop/components/alert.php b/includes/desktop/components/alert.php
new file mode 100644
index 0000000..fce6376
--- /dev/null
+++ b/includes/desktop/components/alert.php
@@ -0,0 +1,27 @@
+<?php
+function c_alert(string $html_message, string $type, ?string $icon = null): void {
+ $type_colors = [
+ "warning" => ["olive","yellow"],
+ "success" => ["green","lime"],
+ ][$type] ?? ["gray","white"];
+ if ($icon !== null)
+ $icon = [
+ "warning-sign" => "warn16",
+ ][$icon] ?? $icon;
+?>
+<center>
+<table bgcolor="<?= htmlentities($type_colors[0]) ?>" cellspacing="0" cellpadding="2"><tr><td>
+<table bgcolor="<?= htmlentities($type_colors[1]) ?>" cellspacing="0" cellpadding="12"><tr><td>
+<?php if ($icon !== null): ?>
+<table bgcolor="<?= htmlentities($type_colors[1]) ?>" cellspacing="0" cellpadding="0"><tr><td>
+<nobr><img src="../images/<?= htmlentities(rawurlencode($icon)) ?>.gif">&nbsp;</nobr>
+</td><td width="100%">
+<?php endif; ?>
+<font color="black"><?= $html_message ?></font>
+<?php if ($icon !== null): ?>
+</td></tr></table>
+<?php endif; ?>
+</td></tr></table>
+</td></tr></table>
+</center>
+<?php }