diff --git a/mod/lti/service/toolsettings/classes/local/resource/contextsettings.php b/mod/lti/service/toolsettings/classes/local/resource/contextsettings.php index dbf19ae775b..28e320ae14d 100644 --- a/mod/lti/service/toolsettings/classes/local/resource/contextsettings.php +++ b/mod/lti/service/toolsettings/classes/local/resource/contextsettings.php @@ -50,7 +50,7 @@ class contextsettings extends \mod_lti\local\ltiservice\resource_base { parent::__construct($service); $this->id = 'ToolProxyBindingSettings'; - $this->template = '/{context_type}/{context_id}/bindings/{vendor_code}/{product_code}/custom'; + $this->template = '/{context_type}/{context_id}/bindings/{vendor_code}/{product_code}'; $this->variables[] = 'ToolProxyBinding.custom.url'; $this->formats[] = 'application/vnd.ims.lti.v2.toolsettings+json'; $this->formats[] = 'application/vnd.ims.lti.v2.toolsettings.simple+json'; @@ -135,6 +135,7 @@ class contextsettings extends \mod_lti\local\ltiservice\resource_base { } if ($ok) { $settings = $json->{"@graph"}[0]->custom; + unset($settings->{'@id'}); } } else { // Simple JSON. $json = json_decode($response->get_request_data(), true); diff --git a/mod/lti/service/toolsettings/classes/local/resource/linksettings.php b/mod/lti/service/toolsettings/classes/local/resource/linksettings.php index f092048349a..31b30dcab65 100644 --- a/mod/lti/service/toolsettings/classes/local/resource/linksettings.php +++ b/mod/lti/service/toolsettings/classes/local/resource/linksettings.php @@ -51,7 +51,7 @@ class linksettings extends \mod_lti\local\ltiservice\resource_base { parent::__construct($service); $this->id = 'LtiLinkSettings'; - $this->template = '/links/{link_id}/custom'; + $this->template = '/links/{link_id}'; $this->variables[] = 'LtiLink.custom.url'; $this->formats[] = 'application/vnd.ims.lti.v2.toolsettings+json'; $this->formats[] = 'application/vnd.ims.lti.v2.toolsettings.simple+json'; @@ -165,6 +165,7 @@ class linksettings extends \mod_lti\local\ltiservice\resource_base { } if ($ok) { $settings = $json->{"@graph"}[0]->custom; + unset($settings->{'@id'}); } } else { // Simple JSON. $json = json_decode($response->get_request_data(), true); diff --git a/mod/lti/service/toolsettings/classes/local/resource/systemsettings.php b/mod/lti/service/toolsettings/classes/local/resource/systemsettings.php index 1fc73d4eaad..8a381c55025 100644 --- a/mod/lti/service/toolsettings/classes/local/resource/systemsettings.php +++ b/mod/lti/service/toolsettings/classes/local/resource/systemsettings.php @@ -49,7 +49,7 @@ class systemsettings extends \mod_lti\local\ltiservice\resource_base { parent::__construct($service); $this->id = 'ToolProxySettings'; - $this->template = '/toolproxy/{tool_proxy_id}/custom'; + $this->template = '/toolproxy/{tool_proxy_id}'; $this->variables[] = 'ToolProxy.custom.url'; $this->formats[] = 'application/vnd.ims.lti.v2.toolsettings+json'; $this->formats[] = 'application/vnd.ims.lti.v2.toolsettings.simple+json'; @@ -113,6 +113,7 @@ class systemsettings extends \mod_lti\local\ltiservice\resource_base { } if ($ok) { $settings = $json->{"@graph"}[0]->custom; + unset($settings->{'@id'}); } } else { // Simple JSON. $json = json_decode($response->get_request_data(), true); diff --git a/mod/lti/service/toolsettings/classes/local/service/toolsettings.php b/mod/lti/service/toolsettings/classes/local/service/toolsettings.php index 8ee99e78c73..5626e217252 100644 --- a/mod/lti/service/toolsettings/classes/local/service/toolsettings.php +++ b/mod/lti/service/toolsettings/classes/local/service/toolsettings.php @@ -111,15 +111,15 @@ class toolsettings extends \mod_lti\local\ltiservice\service_base { if (!$simpleformat) { $json .= " {\n \"@type\":\"{$type}\",\n"; $json .= " \"@id\":\"{$resource->get_endpoint()}\",\n"; - $json .= ' "custom":'; - $json .= "{"; + $json .= " \"custom\":{\n"; + $json .= " \"@id\":\"{$resource->get_endpoint()}/custom\""; $indent = ' '; } - $isfirst = true; + $isfirst = $simpleformat; if (!empty($settings)) { foreach ($settings as $key => $value) { if (!$isfirst) { - $json .= ","; + $json .= ','; } else { $isfirst = false; } diff --git a/mod/lti/service/toolsettings/version.php b/mod/lti/service/toolsettings/version.php index 3788ece82ca..05abf9d4f38 100644 --- a/mod/lti/service/toolsettings/version.php +++ b/mod/lti/service/toolsettings/version.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2015111600; +$plugin->version = 2016041200; $plugin->requires = 2015111000; $plugin->component = 'ltiservice_toolsettings'; $plugin->dependencies = array(