jleyva/moodle-local_ltiprovider — pull request #12 by jellisii (2013-03-25 13:18:30+00:00)
Title: Modification to allow external tools to trigger a grade delivery on demand

I've kept the basic functionality that was already in the code, just refactored it out to allow the grade_on_demand.php to trigger the code that does the grade submission to the tool.

grade_on_demand.php uses the oauth pieces and two pieces of information: The launch link, and the sourcedId from the consumer. The sourcedId should always be unique per the BLTI spec, as it effectively points to a cell within the gradebook. The launch link is parsed for the tool id, which then grabs the secret and calculates the oauth hash to ensure we're actually talking to a authorized consumer.

return_grade.php is largely a copy/paste of the cron section of the existing lib.php within the module. There was a modification to check to see if the function local_ltiprovider_return_grade was called with a user object. If the user object is defined, it will process that single object. If the user object is null, it will gather an array of users as it did within the lib.php. After this, it verifies that it has an array of users to use, and then processes as it did before.

lib.php was modified to use return_grade and the local_ltiprovider_return_grade function.

Thanks for all your work on this.