Using the Outcomes service
The Outcomes service is part of LTI 1.1 as well as also being available as an unofficial extension. It allows a grade (decimal value between 0 and 1) to be returned to a user's entry in a grade book column. The value may also be read and deleted.
Sample code
Open the outcomes.php file in a text editor and replace the "[RESOURCE_LINK_ID]" text with the resource link ID displayed in the earlier launch exercise and the "[RESULT_SOURCEDID]" text with the result sourcedid for a user with the learner role. Open the page in a browser and check the result of the request. Check the grade book entry for this student in the VLE. Try using the EXT_READ and EXT_DELETE actions as well.
outcomes.php
<?php // Load LTI classes require_once('LTI_Tool_Provider.php'); $db = new PDO('sqlite:lti-workshop.sqlitedb'); $consumer = new LTI_Tool_Consumer('jisc.ac.uk', $db); $resource_link = new LTI_Resource_Link($consumer, '[RESOURCE_LINK_ID]'); $outcome = new LTI_Outcome('[RESULT_SOURCEDID]'); $outcome->setValue('0.65'); $ok = $resource_link->doOutcomesService(LTI_Resource_Link::EXT_WRITE, $outcome); echo "Result = {$ok}\n\n"; echo $resource_link->ext_response; ?>