芝麻web文件管理V1.00
';
}
self::$error = array();
}
}
public static function success($message = '', $parameters = array()) {
self::loadSessionSuccess();
self::$success[] = array(
$message,
$parameters
);
}
public static function notice($message = '', $parameters = array()) {
self::loadSessionNotice();
self::$notice[] = array(
$message,
$parameters
);
}
public static function show() {
self::loadSessionError();
if (is_array(self::$error) && count(self::$error)) {
foreach (self::$error as $error) {
Js::addInline("_N2.Notification.error(" . json_encode($error[0]) . ", " . json_encode($error[1]) . ");");
}
self::$error = array();
}
self::loadSessionSuccess();
if (is_array(self::$success) && count(self::$success)) {
foreach (self::$success as $success) {
Js::addInline("_N2.Notification.success(" . json_encode($success[0]) . ", " . json_encode($success[1]) . ");");
}
self::$success = array();
}
self::loadSessionNotice();
if (is_array(self::$notice) && count(self::$notice)) {
foreach (self::$notice as $notice) {
Js::addInline("_N2.Notification.notice(" . json_encode($notice[0]) . ", " . json_encode($notice[1]) . ");");
}
self::$notice = array();
}
self::$flushed = true;
}
public static function showAjax() {
self::loadSessionError();
$messages = array();
if (is_array(self::$error) && count(self::$error)) {
$messages['error'] = array();
foreach (self::$error as $error) {
$messages['error'][] = $error;
}
self::$error = array();
}
self::loadSessionSuccess();
if (is_array(self::$success) && count(self::$success)) {
$messages['success'] = array();
foreach (self::$success as $success) {
$messages['success'][] = $success;
}
self::$success = array();
}
self::loadSessionNotice();
if (is_array(self::$notice) && count(self::$notice)) {
$messages['notice'] = array();
foreach (self::$notice as $notice) {
$messages['notice'][] = $notice;
}
self::$notice = array();
}
self::$flushed = true;
if (count($messages)) {
return $messages;
}
return false;
}
public static function storeInSession() {
if (self::$flushed) {
Session::delete('error');
Session::delete('success');
Session::delete('notice');
} else {
Session::set('error', self::$error);
Session::set('success', self::$success);
Session::set('notice', self::$notice);
}
}
}
new Notification();