|
| | __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...
|
| |
◆ __construct()
| ilLTIConsumerLaunch::__construct |
( |
int |
$a_ref_id | ) |
|
◆ 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_types | list of valid types |
- Returns
- array|null context array ("ref_id", "title", "type")
Definition at line 52 of file class.ilLTIConsumerLaunch.php.
52 : ?array
53 {
55 $tree =
$DIC->repositoryTree();
56
57 if (!isset($this->context)) {
58 $this->context = array();
59
60
61 $path = array_reverse($tree->getPathFull($this->ref_id));
62 foreach (
$path as $row) {
63 if (in_array($row['type'], $a_valid_types)) {
64
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
74 }
75 }
76 }
78 }
References $context, $DIC, and $path.
◆ getLTIContextType()
| static ilLTIConsumerLaunch::getLTIContextType |
( |
string |
$a_type | ) |
|
|
static |
◆ 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.
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
123
124
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
134
135
136
137 return $request->get_parameters();
138 }
Referenced by ilObjLTIConsumer\buildLaunchParameters().
◆ $ref_id
| int ilLTIConsumerLaunch::$ref_id |
|
protected |
The documentation for this class was generated from the following file: