Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

   1  <?php
   2  
   3  namespace Packback\Lti1p3;
   4  
   5  class LtiDeepLinkResource
   6  {
   7      private $type = 'ltiResourceLink';
   8      private $title;
   9      private $text;
  10      private $url;
  11      private $lineitem;
  12      private $custom_params = [];
  13      private $target = 'iframe';
  14  
  15      public static function new()
  16      {
  17          return new LtiDeepLinkResource();
  18      }
  19  
  20      public function getType()
  21      {
  22          return $this->type;
  23      }
  24  
  25      public function setType($value)
  26      {
  27          $this->type = $value;
  28  
  29          return $this;
  30      }
  31  
  32      public function getTitle()
  33      {
  34          return $this->title;
  35      }
  36  
  37      public function setTitle($value)
  38      {
  39          $this->title = $value;
  40  
  41          return $this;
  42      }
  43  
  44      public function getText()
  45      {
  46          return $this->text;
  47      }
  48  
  49      public function setText($value)
  50      {
  51          $this->text = $value;
  52  
  53          return $this;
  54      }
  55  
  56      public function getUrl()
  57      {
  58          return $this->url;
  59      }
  60  
  61      public function setUrl($value)
  62      {
  63          $this->url = $value;
  64  
  65          return $this;
  66      }
  67  
  68      public function getLineitem()
  69      {
  70          return $this->lineitem;
  71      }
  72  
  73      public function setLineitem(LtiLineitem $value)
  74      {
  75          $this->lineitem = $value;
  76  
  77          return $this;
  78      }
  79  
  80      public function getCustomParams()
  81      {
  82          return $this->custom_params;
  83      }
  84  
  85      public function setCustomParams($value)
  86      {
  87          $this->custom_params = $value;
  88  
  89          return $this;
  90      }
  91  
  92      public function getTarget()
  93      {
  94          return $this->target;
  95      }
  96  
  97      public function setTarget($value)
  98      {
  99          $this->target = $value;
 100  
 101          return $this;
 102      }
 103  
 104      public function toArray()
 105      {
 106          $resource = [
 107              'type' => $this->type,
 108              'title' => $this->title,
 109              'text' => $this->text,
 110              'url' => $this->url,
 111              'presentation' => [
 112                  'documentTarget' => $this->target,
 113              ],
 114              'custom' => $this->custom_params,
 115          ];
 116          if ($this->lineitem !== null) {
 117              $resource['lineItem'] = [
 118                  'scoreMaximum' => $this->lineitem->getScoreMaximum(),
 119                  'label' => $this->lineitem->getLabel(),
 120              ];
 121          }
 122  
 123          return $resource;
 124      }
 125  }