|
|
|
<?php
|
|
|
|
|
|
|
|
function response_with_click($message, $class, $script)
|
|
|
|
{
|
|
|
|
echo <<<EOF
|
|
|
|
<script>
|
|
|
|
function doClick() {
|
|
|
|
$script
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<div class="container py-5">
|
|
|
|
<div class="alert $class alert-dismissible fade show col-5 m-auto text-center" role="alert">
|
|
|
|
<strong>$message</strong>
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close" onclick="doClick()">
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
EOF;
|
|
|
|
}
|
|
|
|
|
|
|
|
function response($message, $class)
|
|
|
|
{
|
|
|
|
echo <<<EOF
|
|
|
|
<div class="alert $class alert-dismissible fade show col-5 m-auto text-center" role="alert">
|
|
|
|
<strong>$message</strong>
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
EOF;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function response_with_href($message, $class, $href)
|
|
|
|
{
|
|
|
|
response_with_click($message, $class, <<<EOF
|
|
|
|
location.href='$href'
|
|
|
|
EOF
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function error_res($err, $href)
|
|
|
|
{
|
|
|
|
response_with_href($err, "alert-danger", $href);
|
|
|
|
}
|
|
|
|
|
|
|
|
function info_res($info, $href)
|
|
|
|
{
|
|
|
|
response_with_href($info, "alert-info", $href);
|
|
|
|
}
|
|
|
|
|
|
|
|
function warn_res($warn, $href)
|
|
|
|
{
|
|
|
|
response_with_href($warn, "alert-warning", $href);
|
|
|
|
}
|
|
|
|
|
|
|
|
function warn_res_with_click($warn, $click)
|
|
|
|
{
|
|
|
|
response_with_click($warn, "alert-warning", $click);
|
|
|
|
}
|