engelsystem/includes/helper/message_helper.php

59 lines
1.2 KiB
PHP
Raw Normal View History

<?php
/**
* Gibt zwischengespeicherte Fehlermeldungen zurück und löscht den Zwischenspeicher
*/
function msg() {
2013-10-13 00:52:44 +02:00
if (! isset($_SESSION['msg']))
return "";
$msg = $_SESSION['msg'];
$_SESSION['msg'] = "";
return $msg;
}
/**
* Rendert eine Information
*/
function info($msg, $immediatly = false) {
if ($immediatly) {
if ($msg == "")
return "";
2014-08-22 22:34:13 +02:00
return '<div class="alert alert-info">' . $msg . '</div>';
} else {
2013-10-13 00:52:44 +02:00
if (! isset($_SESSION['msg']))
$_SESSION['msg'] = "";
$_SESSION['msg'] .= info($msg, true);
}
}
/**
* Rendert eine Fehlermeldung
*/
function error($msg, $immediatly = false) {
if ($immediatly) {
if ($msg == "")
return "";
2014-08-22 22:34:13 +02:00
return '<div class="alert alert-danger">' . $msg . '</div>';
} else {
2013-10-13 00:52:44 +02:00
if (! isset($_SESSION['msg']))
$_SESSION['msg'] = "";
$_SESSION['msg'] .= error($msg, true);
}
}
/**
* Rendert eine Erfolgsmeldung
*/
function success($msg, $immediatly = false) {
if ($immediatly) {
if ($msg == "")
return "";
2014-08-22 22:34:13 +02:00
return '<div class="alert alert-success">' . $msg . '</div>';
} else {
2013-10-13 00:52:44 +02:00
if (! isset($_SESSION['msg']))
$_SESSION['msg'] = "";
$_SESSION['msg'] .= success($msg, true);
}
}
?>