<?php
function showNotifications($msg = '', $class = '', $fadeout = true) {
global $Translation;
if($error_message = strip_tags($_REQUEST['error_message']))
$error_message = '<div class="text-bold">' . $error_message . '</div>';
if(!$msg) { // if no msg, use url to detect message to display
if($_REQUEST['record-added-ok'] != '') {
$msg = $Translation['new record saved'];
$class = 'success';
} elseif($_REQUEST['record-added-error'] != '') {
$msg = $Translation['Couldn\'t save the new record'] . $error_message;
$class = 'error';
$fadeout = false;
} elseif($_REQUEST['record-updated-ok'] != '') {
$msg = $Translation['record updated'];
$class = 'success';
} elseif($_REQUEST['record-updated-error'] != '') {
$msg = $Translation['Couldn\'t save changes to the record'] . $error_message;
$class = 'error';
$fadeout = false;
} elseif($_REQUEST['record-deleted-ok'] != '') {
$msg = $Translation['The record has been deleted successfully'];
$class = 'success';
} elseif($_REQUEST['record-deleted-error'] != '') {
$msg = $Translation['Couldn\'t delete this record'] . $error_message;
$class = 'error';
$fadeout = false;
} else {
return '';
}
}
$id = 'notification-' . rand();
// notification template
?>
<script type="text/javascript">swal("<?php echo $alerttitle = ($class=="success") ? "Congrats!" : "Oops!" ; ?>", "<?php echo $msg ?>", "<?php echo $class ?>");</script>
<?php
return $out;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}