27 $this->ref_id = $a_ref_id;
39 public function getContext($a_valid_types = array(
'crs',
'grp',
'cat',
'root'))
42 $tree = $DIC->repositoryTree();
44 if (!isset($this->context)) {
45 $this->context = array();
48 $path = array_reverse($tree->getPathFull($this->ref_id));
49 foreach ($path as $key => $row) {
50 if (in_array($row[
'type'], $a_valid_types)) {
52 if (in_array($row[
'type'], array(
'cat',
'root')) && !empty($this->context)) {
56 $this->context[
'id'] = $row[
'child'];
57 $this->context[
'title'] = $row[
'title'];
58 $this->context[
'type'] = $row[
'type'];
74 return "CourseOffering";
80 return "urn:lti:context-type:ilias/RootNode";
84 return "urn:lti:context-type:ilias/Category";
106 require_once(
'./Modules/LTIConsumer/lib/OAuth.php');
107 switch ($a_params[
'sign_method']) {
119 return "ERROR: unsupported signature method!";
122 $consumer =
new OAuthConsumer($a_params[
"key"], $a_params[
"secret"], $a_params[
"callback"]);
124 $request->sign_request($method, $consumer, $a_params[
"token"]);
127 self::$last_oauth_base_string = $request->get_signature_base_string();
130 return $request->get_parameters();
static $last_oauth_base_string
static getLTIContextType($a_type)
__construct(int $a_ref_id)
ilObjLTIConsumerLaunch constructor.
static signOAuth($a_params)
sign request data with OAuth
static from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=null)
pretty much a helper function to set up the request
getContext($a_valid_types=array('crs', 'grp', 'cat', 'root'))
get info about the context in which the link is used