DWZ操作成功后的回调方法

jerry PHP 2015年11月18日 收藏
tp+dwz回调刷新关dialog的方法
/**
     * 操作失败的Ajax返回
     * @param unknown $navTabId
     * @param string $message
     * @param string $statusCode
     * @param string $callbackType
     * @param string $rel
     * @param string $forwardUrl
     * @param string $type
     */
    public function ajaxDelReturnFail($message="删除操作失败",$navTabId="",$statusCode="0",$callbackType="",$rel="", $forwardUrl="",$type="JSON")
    {
        // 保证AJAX返回后也能保存日志
        if(C('LOG_RECORD')) Log::save();
            
        $result  =  array();
            
        $result['statusCode']  = $statusCode;    // zhanghuihua@msn.com
        $result['message'] = $message; // zhanghuihua@msn.com
        $result['navTabId']  = $navTabId;    // zhanghuihua@msn.com
        $result['rel']  = $rel;    // zhanghuihua@msn.com
        $result['callbackType']  =$callbackType;    // zhanghuihua@msn.com
        $result['forwardUrl']  =  $forwardUrl;    // zhanghuihua@msn.com

        // 返回JSON数据格式到客户端 包含状态信息
        header("Content-Type:text/html; charset=utf-8");
        exit(json_encode($result));

    }
    /**
     * Ajax删除操作成功
     * @param string $message
     * @param string $navTabId
     * @param string $statusCode
     * @param string $callbackType
     * @param string $rel
     * @param string $forwardUrl
     * @param string $type
     */
    public function ajaxDelReturnSucc($navTabId,$message="删除操作成功",$statusCode="1",$callbackType="",$rel="", $forwardUrl="",$type="JSON")
    {
        // 保证AJAX返回后也能保存日志
        if(C('LOG_RECORD')) Log::save();
            
        $result  =  array();
            
        $result['statusCode']  = $statusCode;    // zhanghuihua@msn.com
        $result['message'] = $message; // zhanghuihua@msn.com
        $result['navTabId']  = $navTabId;    // zhanghuihua@msn.com
        $result['rel']  = $rel;    // zhanghuihua@msn.com
        $result['callbackType']  =$callbackType;    // zhanghuihua@msn.com
        $result['forwardUrl']  =  $forwardUrl;    // zhanghuihua@msn.com

        // 返回JSON数据格式到客户端 包含状态信息
        header("Content-Type:text/html; charset=utf-8");
        exit(json_encode($result));

    }
    /**
     * 操作成功的Ajax返回
     * (non-PHPdoc)
     * @see Action::ajaxReturn()
     */
    public function ajaxInsertReturnSucc($navTabId,$message="新增操作成功",$statusCode="1",$callbackType="closeCurrent",$rel="", $forwardUrl="",$type="JSON")
    {
        // 保证AJAX返回后也能保存日志
        if(C('LOG_RECORD')) Log::save();
            
        $result  =  array();
            
        $result['statusCode']  = $statusCode;    // zhanghuihua@msn.com
        $result['message'] = $message; // zhanghuihua@msn.com
        $result['navTabId']  = $navTabId;    // zhanghuihua@msn.com
        $result['rel']  = $rel;    // zhanghuihua@msn.com
        $result['callbackType']  =$callbackType;    // zhanghuihua@msn.com
        $result['forwardUrl']  =  $forwardUrl;    // zhanghuihua@msn.com

        // 返回JSON数据格式到客户端 包含状态信息
        header("Content-Type:text/html; charset=utf-8");
        exit(json_encode($result));

    }
    /**
     * Ajax新增操作失败
     * @param unknown $navTabId
     * @param string $message
     * @param string $statusCode
     * @param string $callbackType
     * @param string $rel
     * @param string $forwardUrl
     * @param string $type
     */
    public function ajaxInsertReturnFail($message="新增操作失败",$navTabId="",$statusCode="0",$callbackType="",$rel="", $forwardUrl="",$type="JSON")
    {
        // 保证AJAX返回后也能保存日志
        if(C('LOG_RECORD')) Log::save();

        $result  =  array();

        $result['statusCode']  = $statusCode;    // zhanghuihua@msn.com
        $result['message'] = $message; // zhanghuihua@msn.com
        $result['navTabId']  = $navTabId;    // zhanghuihua@msn.com
        $result['rel']  = $rel;    // zhanghuihua@msn.com
        $result['callbackType']  =$callbackType;    // zhanghuihua@msn.com
        $result['forwardUrl']  =  $forwardUrl;    // zhanghuihua@msn.com

        // 返回JSON数据格式到客户端 包含状态信息
        header("Content-Type:text/html; charset=utf-8");
        exit(json_encode($result));

    }
    /**
     * 操作成功的Ajax返回
     * (non-PHPdoc)
     * @see Action::ajaxReturn()
     */
    public function ajaxUpdateReturnSucc($navTabId,$message="更新操作成功",$statusCode="1",$callbackType="closeCurrent",$rel="", $forwardUrl="",$type="JSON")
    {
        // 保证AJAX返回后也能保存日志
        if(C('LOG_RECORD')) Log::save();
            
        $result  =  array();
            
        $result['statusCode']  = $statusCode;    // zhanghuihua@msn.com
        $result['message'] = $message; // zhanghuihua@msn.com
        $result['navTabId']  = $navTabId;    // zhanghuihua@msn.com
        $result['rel']  = $rel;    // zhanghuihua@msn.com
        $result['callbackType']  =$callbackType;    // zhanghuihua@msn.com
        $result['forwardUrl']  =  $forwardUrl;    // zhanghuihua@msn.com

        // 返回JSON数据格式到客户端 包含状态信息
        header("Content-Type:text/html; charset=utf-8");
        exit(json_encode($result));

    }
    /**
     * Ajax新增操作失败
     * @param unknown $navTabId
     * @param string $message
     * @param string $statusCode
     * @param string $callbackType
     * @param string $rel
     * @param string $forwardUrl
     * @param string $type
     */
    public function ajaxUpdateReturnFail($message="更新操作失败",$navTabId="",$statusCode="0",$callbackType="",$rel="", $forwardUrl="",$type="JSON")
    {
        // 保证AJAX返回后也能保存日志
        if(C('LOG_RECORD')) Log::save();
        $result  =  array();
        $result['statusCode']  = $statusCode;    // zhanghuihua@msn.com
        $result['message'] = $message; // zhanghuihua@msn.com
        $result['navTabId']  = $navTabId;    // zhanghuihua@msn.com
        $result['rel']  = $rel;    // zhanghuihua@msn.com
        $result['callbackType']  =$callbackType;    // zhanghuihua@msn.com
        $result['forwardUrl']  =  $forwardUrl;    // zhanghuihua@msn.com

        // 返回JSON数据格式到客户端 包含状态信息
        header("Content-Type:text/html; charset=utf-8");
        exit(json_encode($result));

    }