mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-29 02:50:28 +00:00
30 lines
776 B
PHP
Executable file
30 lines
776 B
PHP
Executable file
<?php
|
|
class StatusMessages
|
|
{
|
|
public $messages = array();
|
|
|
|
public function addMessage($message, $level = 'success', $dismissable = true)
|
|
{
|
|
$status = '<div class="alert alert-'.$level;
|
|
if ($dismissable) {
|
|
$status .= ' alert-dismissable';
|
|
}
|
|
$status .= '">'. _($message);
|
|
if ($dismissable) {
|
|
$status .= '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">x</button>';
|
|
}
|
|
$status .= '</div>';
|
|
|
|
array_push($this->messages, $status);
|
|
}
|
|
|
|
public function showMessages($clear = true)
|
|
{
|
|
foreach ($this->messages as $message) {
|
|
echo $message;
|
|
}
|
|
if ($clear) {
|
|
$this->messages = array();
|
|
}
|
|
}
|
|
}
|