ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
 

Private Attributes

array $context = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilLTIConsumerLaunch::__construct ( int  $a_ref_id)

ilObjLTIConsumerLaunch constructor.

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

42 {
43 $this->ref_id = $a_ref_id;
44 }

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 54 of file class.ilLTIConsumerLaunch.php.

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

References $context, $DIC, and $path.

◆ getLTIContextType()

static ilLTIConsumerLaunch::getLTIContextType ( string  $a_type)
static

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

85 : string
86 {
87 switch ($a_type) {
88 case "crs":
89 return "http://purl.imsglobal.org/vocab/lis/v2/course#CourseOffering";
90 case "grp":
91 return "http://purl.imsglobal.org/vocab/lis/v2/course#Group";
92 case "root":
93 return "http://purl.imsglobal.org/vocab/lis/v2/course#CourseOffering";
94 case "cat":
95 default:
96 return "http://purl.imsglobal.org/vocab/lis/v2/course#CourseOffering";
97 }
98 }

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

+ Here is the caller graph for this function:

◆ signOAuth()

static ilLTIConsumerLaunch::signOAuth ( array  $a_params)
static

sign request data with OAuth

Parameters
array$a_params( "method => signature methos "key" => consumer key "secret" => shared secret "token" => request token "url" => request url data => array (key => value) )
Returns
array signed data
Exceptions
Exception

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

115 : array
116 {
117 switch ($a_params['sign_method']) {
118 case "HMAC_SHA1":
119 $method = new OAuthSignatureMethod_HMAC_SHA1();
120 break;
121 default:
122 throw new Exception("Unknown signature method: " . $a_params['sign_method']);
123 }
124
125 $consumer = new OAuthConsumer($a_params["key"], $a_params["secret"], $a_params["callback"]);
126 $request = OAuthRequest::from_consumer_and_token($consumer, $a_params["token"], $a_params["http_method"], $a_params["url"], $a_params["data"]);
127 $request->sign_request($method, $consumer, $a_params["token"]);
128
129 // Pass this back up "out of band" for debugging
130 // self::$last_oauth_base_string = $request->get_signature_base_string();
131 // die(self::$last_oauth_base_string);
132
133 return $request->get_parameters();
134 }

Field Documentation

◆ $context

array ilLTIConsumerLaunch::$context = null
private

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

Referenced by getContext().

◆ $ref_id

int ilLTIConsumerLaunch::$ref_id
protected

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


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