/** * Returns the registration request for a tool proxy. * * @param int $id the lti instance id * @return array of registration parameters * @since Moodle 3.1 * @throws moodle_exception */ public static function get_tool_proxy_registration_request($id) { $params = self::validate_parameters(self::get_tool_proxy_registration_request_parameters(), array('id' => $id)); $id = $params['id']; $context = context_system::instance(); self::validate_context($context); require_capability('moodle/site:config', $context); $toolproxy = lti_get_tool_proxy($id); return lti_build_registration_request($toolproxy); }
/** * Generates some of the tool proxy configuration based on the admin configuration details * * @param int $id * * @return Tool Proxy details */ function lti_get_tool_proxy_config($id) { $toolproxy = lti_get_tool_proxy($id); $tp = new \stdClass(); $tp->lti_registrationname = $toolproxy->name; $tp->toolproxyid = $toolproxy->id; $tp->state = $toolproxy->state; $tp->lti_registrationurl = $toolproxy->regurl; $tp->lti_capabilities = explode("\n", $toolproxy->capabilityoffered); $tp->lti_services = explode("\n", $toolproxy->serviceoffered); return $tp; }
public function test_mod_lti_delete_tool_proxy() { $proxy = mod_lti_external::create_tool_proxy('Test proxy', $this->getExternalTestFileUrl('/test.html'), array(), array()); $this->assertNotEmpty(lti_get_tool_proxy($proxy->id)); $proxy = mod_lti_external::delete_tool_proxy($proxy->id); $this->assertEquals('Test proxy', $proxy->name); $this->assertEquals($this->getExternalTestFileUrl('/test.html'), $proxy->regurl); $this->assertEquals(LTI_TOOL_PROXY_STATE_PENDING, $proxy->state); $this->assertEmpty(lti_get_tool_proxy($proxy->id)); }