Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 402] [Versions 39 and 403]

   1  <?php
   2  
   3  namespace IMSGlobal\LTI\ToolProvider\MediaType;
   4  
   5  use IMSGlobal\LTI\Profile\ServiceDefinition;
   6  use IMSGlobal\LTI\ToolProvider\ToolProvider;
   7  
   8  /**
   9   * Class to represent an LTI Tool Proxy media type
  10   *
  11   * @author  Stephen P Vickers <svickers@imsglobal.org>
  12   * @copyright  IMS Global Learning Consortium Inc
  13   * @date  2016
  14   * @version  3.0.0
  15   * @license  GNU Lesser General Public License, version 3 (<http://www.gnu.org/licenses/lgpl.html>)
  16   */
  17  class ToolProxy
  18  {
  19  
  20  /**
  21   * Class constructor.
  22   *
  23   * @param ToolProvider $toolProvider   Tool Provider object
  24   * @param ServiceDefinition $toolProxyService  Tool Proxy service
  25   * @param string $secret  Shared secret
  26   */
  27      function __construct($toolProvider, $toolProxyService, $secret)
  28      {
  29  
  30          $contexts = array();
  31  
  32          $this->{'@context'} = array_merge(array('http://purl.imsglobal.org/ctx/lti/v2/ToolProxy'), $contexts);
  33          $this->{'@type'} = 'ToolProxy';
  34          $this->{'@id'} = "{$toolProxyService->endpoint}";
  35          $this->lti_version = 'LTI-2p0';
  36          $this->tool_consumer_profile = $toolProvider->consumer->profile->{'@id'};
  37          $this->tool_profile = new ToolProfile($toolProvider);
  38          $this->security_contract = new SecurityContract($toolProvider, $secret);
  39  
  40      }
  41  
  42  }