You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.0 KiB
PHTML

<?php
/**
* Gibt zwischengespeicherte Fehlermeldungen zurück und löscht den Zwischenspeicher
*/
8 years ago
function msg()
{
8 years ago
if (!isset($_SESSION['msg'])) {
8 years ago
return "";
}
$msg = $_SESSION['msg'];
$_SESSION['msg'] = "";
return $msg;
}
/**
* Rendert eine Information
*/
8 years ago
function info($msg, $immediatly = false)
{
return alert('info', $msg, $immediatly);
}
/**
* Rendert eine Fehlermeldung
*/
8 years ago
function error($msg, $immediatly = false)
{
return alert('danger', $msg, $immediatly);
}
/**
* Rendert eine Erfolgsmeldung
*/
8 years ago
function success($msg, $immediatly = false)
{
return alert('success', $msg, $immediatly);
}
/**
* Renders an alert with given alert-* class.
*/
8 years ago
function alert($class, $msg, $immediatly = false)
{
if ($immediatly) {
if ($msg == "") {
return "";
}
return '<div class="alert alert-' . $class . '">' . $msg . '</div>';
}
8 years ago
if (!isset($_SESSION['msg'])) {
8 years ago
$_SESSION['msg'] = "";
}
$_SESSION['msg'] .= alert($class, $msg, true);
}