src/Util/LTI.php
public static function sendJSONGrade($grade, $comment, $result_url, $key_key, $secret, &$debug_log=false, $signature=false) {
        global $LastJSONGradeResponse;
        $LastJSONGradeResponse = false;

        $content_type = "application/vnd.ims.lis.v2.result+json";

        if ( is_array($debug_log) ) $debug_log[] = array('Sending '.$grade.' to result_url='.$result_url);

        $addStructureRequest = self::getResultJSON($grade, $comment);

        $postBody = self::jsonIndent(json_encode($addStructureRequest));
        if ( is_array($debug_log) )  $debug_log[] = array('Grade JSON Request',$postBody);

        $more_headers = false;
        $response = self::sendOAuthBody("PUT", $result_url, $key_key,
            $secret, $content_type, $postBody, $more_headers, $signature);

        if ( is_array($debug_log) )  $debug_log[] = array('Grade JSON Response',$response);

        global $LastOAuthBodyBaseString;
        $lbs = $LastOAuthBodyBaseString;
        if ( is_array($debug_log) )  $debug_log[] = array('Our base string',$lbs);

        // TODO: Be smarter about this :)
        return true;
    }
public static function sendJSONGrade($grade, $comment, $result_url, $key_key, $secret, &$debug_log=false, $signature=false) {
        global $LastJSONGradeResponse;
        $LastJSONGradeResponse = false;

        $content_type = "application/vnd.ims.lis.v2.result+json";

        if ( is_array($debug_log) ) $debug_log[] = array('Sending '.$grade.' to result_url='.$result_url);

        $addStructureRequest = self::getResultJSON($grade, $comment);

        $postBody = self::jsonIndent(json_encode($addStructureRequest));
        if ( is_array($debug_log) )  $debug_log[] = array('Grade JSON Request',$postBody);

        $more_headers = false;
        $response = self::sendOAuthBody("PUT", $result_url, $key_key,
            $secret, $content_type, $postBody, $more_headers, $signature);

        if ( is_array($debug_log) )  $debug_log[] = array('Grade JSON Response',$response);

        global $LastOAuthBodyBaseString;
        $lbs = $LastOAuthBodyBaseString;
        if ( is_array($debug_log) )  $debug_log[] = array('Our base string',$lbs);

        // TODO: Be smarter about this :)
        return true;
    }
public static function sendJSONGrade ( $ grade , $ comment , $ result_url , $ key_key , $ secret , & $ debug_log = false , $ signature = false ) { global $ LastJSONGradeResponse ; $ LastJSONGradeResponse = false ; $ content_type = "application/vnd.ims.lis.v2.result+json" ; if ( is_array ( $ debug_log ) ) $ debug_log [ ] = array ( 'Sending ' . $ grade . ' to result_url=' . $ result_url ) ; $ addStructureRequest = self :: getResultJSON ( $ grade , $ comment ) ; $ postBody = self :: jsonIndent ( json_encode ( $ addStructureRequest ) ) ; if ( is_array ( $ debug_log ) ) $ debug_log [ ] = array ( 'Grade JSON Request' , $ postBody ) ; $ more_headers = false ; $ response = self :: sendOAuthBody ( "PUT" , $ result_url , $ key_key , $ secret , $ content_type , $ postBody , $ more_headers , $ signature ) ; if ( is_array ( $ debug_log ) ) $ debug_log [ ] = array ( 'Grade JSON Response' , $ response ) ; global $ LastOAuthBodyBaseString ; $ lbs = $ LastOAuthBodyBaseString ; if ( is_array ( $ debug_log ) ) $ debug_log [ ] = array ( 'Our base string' , $ lbs ) ; // TODO: Be smarter about this :) return true ; }
Send a grade using the JSON protocol from IMS LTI 2.x

@param debug_log This can either be false or an empty array.  If
this is an array, it is filled with data as the steps progress.
Each step is an array with a string message as the first element
and optional debug detail (i.e. like a post body) as the second
element.

@return mixed If things go well this returns true.
If this goes badly, this returns a string with an error message.
Send a grade using the JSON protocol from IMS LTI 2 . x