소스 검색

LTI allow send custom params - refs BT#13469

Angel Fernando Quiroz Campos 6 년 전
부모
커밋
6d09bf9ed8
2개의 변경된 파일11개의 추가작업 그리고 6개의 파일을 삭제
  1. 9 6
      plugin/ims_lti/Entity/ImsLtiTool.php
  2. 2 0
      plugin/ims_lti/form.php

+ 9 - 6
plugin/ims_lti/Entity/ImsLtiTool.php

@@ -254,13 +254,16 @@ class ImsLtiTool
      */
     public function parseCustomParams()
     {
-        $strings = explode($this->customParams, "\n");
-        $pairs = explode('=', $strings);
+        $params = [];
+        $strings = explode("\n", $this->customParams);
 
-        return [
-            'key' => 'custom_'.$pairs[0],
-            'value' => $pairs[1]
-        ];
+        foreach ($strings as $string) {
+            $pairs = explode('=', $string);
+
+            $params['custom_'.$pairs[0]] = $pairs[1];
+        }
+
+        return $params;
     }
 
     /**

+ 2 - 0
plugin/ims_lti/form.php

@@ -106,6 +106,8 @@ $params['tool_consumer_instance_name'] = api_get_setting('siteName');
 $params['tool_consumer_instance_url'] = api_get_path(WEB_PATH);
 $params['tool_consumer_instance_contact_email'] = api_get_setting('emailAdministrator');
 
+$params += $tool->parseCustomParams();
+
 $oauth = new OAuthSimple(
     $tool->getConsumerKey(),
     $tool->getSharedSecret()