36 'ToolProxyBinding' =>
'context',
62 if (is_a(
$source,
'IMSGlobal\LTI\ToolProvider\ToolConsumer')) {
68 $mediaType =
'application/vnd.ims.lti.v2.toolsettings.simple+json';
70 $mediaType =
'application/vnd.ims.lti.v2.toolsettings+json';
85 public function get($mode = self::MODE_CURRENT_LEVEL) {
88 if ($mode === self::MODE_ALL_LEVELS) {
89 $parameter[
'bubble'] =
'all';
90 }
else if ($mode === self::MODE_DISTINCT_NAMES) {
91 $parameter[
'bubble'] =
'distinct';
96 }
else if ($this->simple) {
98 }
else if (isset(
$http->responseJson->{
'@graph'})) {
100 foreach (
$http->responseJson->{
'@graph'} as $level) {
101 $settings = json_decode(json_encode($level->custom),
true);
102 unset($settings[
'@id']);
103 $response[self::$LEVEL_NAMES[$level->{
'@type'}]] = $settings;
118 public function set($settings) {
120 if (!$this->simple) {
121 if (is_a($this->source,
'ToolConsumer')) {
123 }
else if (is_a($this->source,
'ToolConsumer')) {
124 $type =
'ToolProxyBinding';
128 $obj = new \stdClass();
129 $obj->{
'@context'} =
'http://purl.imsglobal.org/ctx/lti/v2/ToolSettings';
130 $obj->{
'@graph'} =
array();
131 $level = new \stdClass();
132 $level->{
'@type'} =
$type;
134 $level->{
'custom'} = $settings;
135 $obj->{
'@graph'}[] = $level;
136 $body = json_encode($obj);
138 $body = json_encode($settings);
141 $response = parent::send(
'PUT', null, $body);
Create styles array
The data for the language used.