ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SecurityContract.php
Go to the documentation of this file.
1 <?php
2 
5 
16 {
17 
24  function __construct($toolProvider, $secret)
25  {
26 
27  $tcContexts = array();
28  foreach ($toolProvider->consumer->profile->{'@context'} as $context) {
29  if (is_object($context)) {
30  $tcContexts = array_merge(get_object_vars($context), $tcContexts);
31  }
32  }
33 
34  $this->shared_secret = $secret;
35  $toolServices = array();
36  foreach ($toolProvider->requiredServices as $requiredService) {
37  foreach ($requiredService->formats as $format) {
38  $service = $toolProvider->findService($format, $requiredService->actions);
39  if (($service !== false) && !array_key_exists($service->{'@id'}, $toolServices)) {
40  $id = $service->{'@id'};
41  $parts = explode(':', $id, 2);
42  if (count($parts) > 1) {
43  if (array_key_exists($parts[0], $tcContexts)) {
44  $id = "{$tcContexts[$parts[0]]}{$parts[1]}";
45  }
46  }
47  $toolService = new \stdClass;
48  $toolService->{'@type'} = 'RestServiceProfile';
49  $toolService->service = $id;
50  $toolService->action = $requiredService->actions;
51  $toolServices[$service->{'@id'}] = $toolService;
52  }
53  }
54  }
55  foreach ($toolProvider->optionalServices as $optionalService) {
56  foreach ($optionalService->formats as $format) {
57  $service = $toolProvider->findService($format, $optionalService->actions);
58  if (($service !== false) && !array_key_exists($service->{'@id'}, $toolServices)) {
59  $id = $service->{'@id'};
60  $parts = explode(':', $id, 2);
61  if (count($parts) > 1) {
62  if (array_key_exists($parts[0], $tcContexts)) {
63  $id = "{$tcContexts[$parts[0]]}{$parts[1]}";
64  }
65  }
66  $toolService = new \stdClass;
67  $toolService->{'@type'} = 'RestServiceProfile';
68  $toolService->service = $id;
69  $toolService->action = $optionalService->actions;
70  $toolServices[$service->{'@id'}] = $toolService;
71  }
72  }
73  }
74  $this->tool_service = array_values($toolServices);
75 
76  }
77 
78 }
$format
Definition: metadata.php:141
$secret
Definition: demo.php:27
if(!array_key_exists('StateId', $_REQUEST)) $id
Class to represent an LTI Security Contract document.
$service
Definition: login.php:15
__construct($toolProvider, $secret)
Class constructor.
Create styles array
The data for the language used.