<?php !defined('APP_DIR') ? die('acceess not defined') : '';
class remind {
    protected static $session_key = 'admin_remind_session';
    
    /**
     * 提示信息设置
     *
     * @param unknown_type $url
     * @param unknown_type $msg
     * @param unknown_type $status
     */
    static public function set( $url, $msg, $status='success' ){
        $remind_status = array('success', 'error', 'remind');
        if (!in_array($status, $remind_status)) {
        	$status = 'remind';
        }
        $session_data = array(
            'msg'    => $msg,
            'status' => $status
        );
        session::set(self::$session_key, $session_data);
        url::redirect($url);
    }
    
    /**
     * 提示信息展示
     *
     * @return unknown
     */
    static public function show(){
        $session_data = session::get(self::$session_key);
        if (empty($session_data)) {
        	return '';
        }
        session::delete(self::$session_key);
        return "<div class=\"option_message\"><div class=\"{$session_data['status']}\">{$session_data['msg']}</div></div>";
    }
}
?>