$data->xml = $xml; $data->messageid = lti_parse_message_id($xml); $data->messagetype = $messagetype; $data->consumerkey = $consumerkey; $data->sharedsecret = $sharedsecret; $eventdata = array(); $eventdata['other'] = array(); $eventdata['other']['messageid'] = $data->messageid; $eventdata['other']['messagetype'] = $messagetype; $eventdata['other']['consumerkey'] = $consumerkey; // Before firing the event, allow subplugins a chance to handle. if (lti_extend_lti_services($data)) { break; } // If an event handler handles the web service, it should set this global to true // So this code knows whether to send an "operation not supported" or not. global $ltiwebservicehandled; $ltiwebservicehandled = false; try { $event = \mod_lti\event\unknown_service_api_called::create($eventdata); $event->set_message_data($data); $event->trigger(); } catch (Exception $e) { $ltiwebservicehandled = false; } if (!$ltiwebservicehandled) { $responsexml = lti_get_response_xml('unsupported', 'unsupported', lti_parse_message_id($xml), $messagetype); echo $responsexml->asXML(); } break; }
function lti_parse_grade_delete_message($xml) { $node = $xml->imsx_POXBody->deleteResultRequest->resultRecord->sourcedGUID->sourcedId; $resultjson = json_decode((string) $node); $parsed = new stdClass(); $parsed->instanceid = $resultjson->data->instanceid; $parsed->userid = $resultjson->data->userid; $parsed->launchid = $resultjson->data->launchid; $parsed->sourcedidhash = $resultjson->hash; $parsed->messageid = lti_parse_message_id($xml); return $parsed; }
/** * Test that lti_parse_message_id never fails with good and bad XML. * * @dataProvider message_id_provider * @param mixed $expected Expected message ID. * @param string $xml XML to parse. */ public function test_lti_parse_message_id($expected, $xml) { $xml = simplexml_load_string($xml); $this->assertEquals($expected, lti_parse_message_id($xml)); }
$data->messagetype = $messagetype; $data->consumerkey = $consumerkey; $data->sharedsecret = $sharedsecret; //If an event handler handles the web service, it should set this global to true //So this code knows whether to send an "operation not supported" or not. global $lti_web_service_handled; $lti_web_service_handled = false; events_trigger('lti_unknown_service_api_call', $data); if (!$lti_web_service_handled) { $responsexml = lti_get_response_xml( 'unsupported', 'unsupported', lti_parse_message_id($xml), $messagetype ); echo $responsexml->asXML(); } break; } //echo print_r(apache_request_headers(), true); //echo '<br />'; //echo file_get_contents("php://input");