$value) {
$list = '
';
if (count($value) == 1) {
if ($key == 'danger'){
$org_value = $value[0];
$value[0] = '' . $org_value . '
';
}
$return .= $this->_getMessageContainer($value[0], $key);
continue;
}
foreach ($value as $msg) {
$list .= '- ' . $msg . '
';
}
$list .= '
';
$return .= $this->_getMessageContainer($list, $key);
}
}
}
return $return;
}
/**
* Get system message array
*
* Messages are removed from $_SESSION['eclipse_system_messages']
* after calling this function.
*
* @return array
*/
function getMessagesArray(){
$messages = $_SESSION['eclipse_system_messages'];
$_SESSION['eclipse_system_messages'] = array();
$return = array();
if (!empty($messages)) {
foreach ($messages as $type) {
foreach ($type as $key => $value) {
foreach ($value as $msg) {
$return[$key][] = $msg;
}
}
}
}
return $return;
}
/**
* This function returns a DIV tag containing the $message with the proper CSS class
* @param $message - String containing the message
* @param $type - String containing the message type
* Accepted types: success, info, warning, danger
* @return string
* */
private function _getMessageContainer($message = '', $type = 'success') {
$class = "stay-visible alert alert-" . $type;
return '' . $message . '
';
}
}