summaryrefslogtreecommitdiff
path: root/includes/desktop/components/alert.php
blob: fce6376fdd585707918e170e0ea4c2dc469a7328 (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
<?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 }