Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 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  #[\AllowDynamicProperties]
  18  class ToolProxy
  19  {
  20  
  21  /**
  22   * Class constructor.
  23   *
  24   * @param ToolProvider $toolProvider   Tool Provider object
  25   * @param ServiceDefinition $toolProxyService  Tool Proxy service
  26   * @param string $secret  Shared secret
  27   */
  28      function __construct($toolProvider, $toolProxyService, $secret)
  29      {
  30  
  31          $contexts = array();
  32  
  33          $this->{'@context'} = array_merge(array('http://purl.imsglobal.org/ctx/lti/v2/ToolProxy'), $contexts);
  34          $this->{'@type'} = 'ToolProxy';
  35          $this->{'@id'} = "{$toolProxyService->endpoint}";
  36          $this->lti_version = 'LTI-2p0';
  37          $this->tool_consumer_profile = $toolProvider->consumer->profile->{'@id'};
  38          $this->tool_profile = new ToolProfile($toolProvider);
  39          $this->security_contract = new SecurityContract($toolProvider, $secret);
  40  
  41      }
  42  
  43  }