ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLTIConsumerLaunch Class Reference
+ Collaboration diagram for ilLTIConsumerLaunch:

Public Member Functions

 __construct (int $a_ref_id)
 ilObjLTIConsumerLaunch constructor. More...
 
 getContext (?array $a_valid_types=array('crs', 'grp', 'cat', 'root'))
 get info about the context in which the link is used The most outer matching course or group is used If not found the most inner category or root node is used More...
 

Static Public Member Functions

static getLTIContextType (string $a_type)
 
static signOAuth (array $a_params)
 sign request data with OAuth More...
 

Protected Attributes

int $ref_id
 

Detailed Description

Definition at line 31 of file class.ilLTIConsumerLaunch.php.

Constructor & Destructor Documentation

◆ __construct()

ilLTIConsumerLaunch::__construct ( int  $a_ref_id)

ilObjLTIConsumerLaunch constructor.

Definition at line 39 of file class.ilLTIConsumerLaunch.php.

40  {
41  $this->ref_id = $a_ref_id;
42  }

Member Function Documentation

◆ getContext()

ilLTIConsumerLaunch::getContext ( ?array  $a_valid_types = array('crs', 'grp', 'cat', 'root'))

get info about the context in which the link is used The most outer matching course or group is used If not found the most inner category or root node is used

Parameters
array | null$a_valid_typeslist of valid types
Returns
array|null context array ("ref_id", "title", "type")

Definition at line 52 of file class.ilLTIConsumerLaunch.php.

References $context, $DIC, and $path.

Referenced by ilLTIConsumerContentGUI\getLaunchParameters(), and ilLTIConsumerContentGUI\getLaunchParametersLTI13().

52  : ?array
53  {
54  global $DIC; /* @var \ILIAS\DI\Container $DIC */
55  $tree = $DIC->repositoryTree();
56 
57  if (!isset($this->context)) {
58  $this->context = array();
59 
60  // check fromm inner to outer
61  $path = array_reverse($tree->getPathFull($this->ref_id));
62  foreach ($path as $row) {
63  if (in_array($row['type'], $a_valid_types)) {
64  // take an existing inner context outside a course
65  if (in_array($row['type'], array('cat', 'root')) && !empty($this->context)) {
66  break;
67  }
68 
69  $this->context['id'] = $row['child'];
70  $this->context['title'] = $row['title'];
71  $this->context['type'] = $row['type'];
72 
73  // don't break to get the most outer course or group
74  }
75  }
76  }
77  return $this->context;
78  }
$context
Definition: webdav.php:29
$path
Definition: ltiservices.php:32
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getLTIContextType()

static ilLTIConsumerLaunch::getLTIContextType ( string  $a_type)
static

Definition at line 83 of file class.ilLTIConsumerLaunch.php.

Referenced by ilLTIConsumerContentGUI\getLaunchParameters(), and ilLTIConsumerContentGUI\getLaunchParametersLTI13().

83  : string
84  {
85  switch ($a_type) {
86  case "crs":
87  return "CourseOffering";
88  case "grp":
89  return "Group";
90  case "root":
91  return "urn:lti:context-type:ilias/RootNode";
92  case "cat":
93  default:
94  return "urn:lti:context-type:ilias/Category";
95  }
96  }
+ Here is the caller graph for this function:

◆ signOAuth()

static ilLTIConsumerLaunch::signOAuth ( array  $a_params)
static

sign request data with OAuth

Parameters
array( "method => signature methos "key" => consumer key "secret" => shared secret "token" => request token "url" => request url data => array (key => value) )
Returns
array|string signed data

Definition at line 113 of file class.ilLTIConsumerLaunch.php.

Referenced by ilObjLTIConsumer\buildLaunchParameters().

114  {
115  switch ($a_params['sign_method']) {
116  case "HMAC_SHA1":
118  break;
119  case "PLAINTEXT":
120  $method = new ILIAS\LTIOAuth\OAuthSignatureMethod_PLAINTEXT();
121  break;
122 // case "RSA_SHA1":
123 // $method = new ILIAS\LTIOAuth\OAuthSignatureMethod_RSA_SHA1();
124 // break;
125 
126  default:
127  return "ERROR: unsupported signature method!";
128  }
129  $consumer = new ILIAS\LTIOAuth\OAuthConsumer($a_params["key"], $a_params["secret"], $a_params["callback"]);
130  $request = ILIAS\LTIOAuth\OAuthRequest::from_consumer_and_token($consumer, $a_params["token"], $a_params["http_method"], $a_params["url"], $a_params["data"]);
131  $request->sign_request($method, $consumer, $a_params["token"]);
132 
133  // Pass this back up "out of band" for debugging
134 // self::$last_oauth_base_string = $request->get_signature_base_string();
135  // die(self::$last_oauth_base_string);
136 
137  return $request->get_parameters();
138  }
OAuth PECL extension includes an OAuth Exception class, so we need to wrap the definition of this cla...
Definition: OAuth.php:189
+ Here is the caller graph for this function:

Field Documentation

◆ $ref_id

int ilLTIConsumerLaunch::$ref_id
protected

Definition at line 34 of file class.ilLTIConsumerLaunch.php.


The documentation for this class was generated from the following file: