2016-07-09 01:55:03 +02:00
|
|
|
<?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';
|
2017-10-24 15:51:12 +02:00
|
|
|
$status .= '">'. _($message);
|
2016-07-09 01:55:03 +02:00
|
|
|
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;
|
2016-07-09 02:00:53 +02:00
|
|
|
}
|
|
|
|
if ( $clear ) $this->messages = array();
|
|
|
|
}
|
2016-07-09 01:55:03 +02:00
|
|
|
}
|
|
|
|
?>
|