e949/front/notifications.php

40 lines
776 B
PHP
Raw Permalink Normal View History

<?php
// Notifications
// Notices queue
$NTFY_NoticesQueue = array();
// Add new notice with selected type
function NTFY_AddNotice (string $text, string $type = "fail") {
global $NTFY_NoticesQueue;
switch ($type) {
case "fail":
$NTFY_NoticesQueue[] = "<div class=\"notification_fail\"><p>$text</p></div>";
break;
case "warning":
$NTFY_NoticesQueue[] = "<div class=\"notification_warning\"><p>$text</p></div>";
break;
case "success":
$NTFY_NoticesQueue[] = "<div class=\"notification_success\"><p>$text</p></div>";
break;
default:
die("invalid notification type: $type");
}
}
// Echo all notifications
function NTFY_EchoAllNotices () {
global $NTFY_NoticesQueue;
foreach ($NTFY_NoticesQueue as $notice) {
echo "$notice\n";
}
}
?>