summaryrefslogtreecommitdiff
path: root/includes/desktop/components/alert.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/desktop/components/alert.php')
-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 }