ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLTIConsumerServiceBase.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
31 {
32  public const LTI_VERSION2P0 = 'LTI-2p0';
33 
34  public const SERVICE_ENABLED = 1;
35 
37  private array $services;
38 
40  protected string $id;
41 
43  protected string $name;
44 
46  protected bool $unsigned;
47 
49  private ?stdClass $toolproxy;
50 
52  private ?stdClass $type;
53 
55  private ?array $typeconfig;
56 
58  protected ?array $resources;
59 
61  protected string $resourcePath;
62 
63  public function __construct()
64  {
65  $this->services = array(
66  'gradeservice'
67  );
68  $this->id = '';
69  $this->name = '';
70  $this->unsigned = false;
71  $this->toolproxy = null;
72  $this->type = null;
73  $this->typeconfig = null;
74  $this->resources = null;
75  $this->resourcePath = '';
76  }
77 
81  protected function parseValue(string $value): string
82  {
83  if (empty($this->resources)) {
84  $this->resources = $this->getResources();
85  }
86  if (!empty($this->resources)) {
87  foreach ($this->resources as $resource) {
88  $value = $resource->parseValue($value);
89  }
90  }
91  return $value;
92  }
93 
97  abstract public function getResources(): array;
98 
102  public function setResourcePath(string $resourcePath): void
103  {
104  $this->resourcePath = $resourcePath;
105  }
106 
110  public function getResourcePath(): string
111  {
112  return $this->resourcePath;
113  }
114 
118  public function checkTool(): ?object
119  {
121  }
122 
126  /*
127  public function getLtiServices(): array {
128  return array();
129  }
130  */
131 }
array $typeconfig
LTI type config array for the current service request.
parseValue(string $value)
Parse a string for custom substitution parameter variables supported by this service&#39;s resources...
stdClass $type
LTI type object for the current service request.
array $services
lti services (for further use)
stdClass $toolproxy
Tool proxy object for the current service request.
bool $unsigned
if requests for this service do not need to be signed.
string $name
Human readable name for the service.
string $resourcePath
cleaned requested resourcePath
checkTool()
Check that the request has been properly signed and is permitted.
getResourcePath()
Get cleaned resourcePath without service part.
getResources()
Get the resources for this service.
array $resources
Instances of the resources associated with this service.
setResourcePath(string $resourcePath)
Set the cleaned resourcePath without service part.