'."\n";
# Safe mode
if ($safe_mode)
{
echo
'
'.__('Safe mode').'
'.
'
'.__('You are in safe mode. All plugins have been temporarily disabled. Remind to log out then log in again normally to get back all functionalities').'
'.
'
';
}
// Display breadcrumb (if given) before any error message
echo $breadcrumb;
if ($core->error->flag()) {
echo
'
'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'
'.
$core->error->toHTML().
'
';
}
// Display notices
echo self::notices();
}
public static function notices()
{
// return notices if any
$res = '';
if (isset($_SESSION['notifications'])) {
$notifications = $_SESSION['notifications'];
foreach ($_SESSION['notifications'] as $notification) {
$res .= self::getNotification($notification);
}
unset($_SESSION['notifications']);
}
return $res;
}
public static function addNotice($type,$message,$options=array())
{
if (isset(self::$N_TYPES[$type])){
$class = self::$N_TYPES[$type];
} else {
$class=$type;
}
if (isset($_SESSION['notifications']) && is_array($_SESSION['notifications'])) {
$notifications = $_SESSION['notifications'];
} else {
$notifications = array();
}
$n = array_merge($options,array('class' => $class,'ts' => time(), 'text' => $message));
if ($type != "static") {
$notifications[] = $n;
} else {
array_unshift($notifications, $n);
}
$_SESSION['notifications'] = $notifications;
}
public static function addSuccessNotice($message,$options=array())
{
self::addNotice("success",$message,$options);
}
public static function addWarningNotice($message,$options=array())
{
self::addNotice("warning",$message,$options);
}
public static function addErrorNotice($message,$options=array())
{
self::addNotice("error",$message,$options);
}
protected static function getNotification($n)
{
global $core;
$tag = (isset($n['divtag'])&& $n['divtag'])?'div':'p';
$ts = '';
if (!isset($n['with_ts']) || ($n['with_ts'] == true)) {
$ts = dt::str(__('[%H:%M:%S]'),$n['ts'],$core->auth->getInfo('user_tz')).' ';
}
$res = '<'.$tag.' class="'.$n['class'].'" role="alert">'.$ts.$n['text'].''.$tag.'>';
return $res;
}
public static function close()
{
global $core;
if (!$GLOBALS['__resources']['ctxhelp']) {
echo
'
'.__('Global help').'
';
}
$menu =& $GLOBALS['_menu'];
echo
"