Stud.IP  5.4
LtiLink Class Reference

Public Member Functions

 __construct ($launch_url, $consumer_key, $consumer_secret, $oauth_signature_method='sha1')
 
 setResource ($resource_id, $resource_title, $resource_description=null)
 
 setCourse ($course_id)
 
 setUser ($user_id, $roles='Learner', $send_lis_person=false)
 
 addLaunchParameter ($name, $value)
 
 addLaunchParameters ($params)
 
 addCustomParameter ($name, $value)
 
 addCustomParameters ($params)
 
 addVariable ($name, $value)
 
 addVariables ($variables)
 
 getVariables ()
 
 getLaunchURL ()
 
 getBasicLaunchData ()
 
 getLaunchSignature ($launch_params)
 

Protected Attributes

 $launch_url
 
 $consumer_key
 
 $consumer_secret
 
 $oauth_signature_method
 
 $parameters = []
 
 $variables = []
 

Detailed Description

LtiLink.php - LTI 1.x link representation for Stud.IP

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Author
Elmar Ludwig http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 The LtiLink class represents an LTI 1.x link inside the LMS. It stores the launch URL and the corresponding credentials as well as a list of launch parameters and custom parameter substitution variables.

Use LtiLink::getLaunchSignature() to fetch the OAuth signature to use for the launch request (or some other request).

Constructor & Destructor Documentation

◆ __construct()

__construct (   $launch_url,
  $consumer_key,
  $consumer_secret,
  $oauth_signature_method = 'sha1' 
)

Iniialize a new LtiLink instance with the given URL and credentials.

Parameters
string$launch_urllaunch URL of external LTI tool
string$consumer_keyconsumer key of the LTI link
string$consumer_secretconsumer secret of the LTI link

Member Function Documentation

◆ addCustomParameter()

addCustomParameter (   $name,
  $value 
)

Add a custom launch parameter to this LTI launch request. All custom parameter names are prefixed with 'custom_' and variable substitution is applied.

Parameters
string$nameparameter name
string$valuevalue (may contain variables)

◆ addCustomParameters()

addCustomParameters (   $params)

Add a list of custom launch parameters to this LTI launch request.

Parameters
array$paramslist of custom parameters

◆ addLaunchParameter()

addLaunchParameter (   $name,
  $value 
)

Add an additional launch parameter to this LTI launch request.

Parameters
string$nameparameter name
string$valuevalue (use NULL to unset)

◆ addLaunchParameters()

addLaunchParameters (   $params)

Add a list of additional launch parameters to this LTI launch request.

Parameters
array$paramslist of launch parameters

◆ addVariable()

addVariable (   $name,
  $value 
)

Add a substitution variable to this LTI launch request.

Parameters
string$namevariable name
string$valuevalue (use NULL to unset)

◆ addVariables()

addVariables (   $variables)

Add a list of substitution variables to this LTI launch request.

Parameters
array$variableslist of substitution variables

◆ getBasicLaunchData()

getBasicLaunchData ( )

Get the launch parameters for the LTI basic launch request.

Returns
array launch parameters (UTF-8 encoded)

◆ getLaunchSignature()

getLaunchSignature (   $launch_params)

Sign a launch request including the given launch parameters.

Parameters
array$launch_paramsarray of launch parameters
Returns
string launch signature

◆ getLaunchURL()

getLaunchURL ( )

Get the launch URL for this LTI link.

Returns
string launch URL of external LTI tool

◆ getVariables()

getVariables ( )

Get the substitution variables defined for this LTI link.

Returns
array list of substitution variables

◆ setCourse()

setCourse (   $course_id)

Set the Stud.IP course associated with this LTI link. The course data is used to set up the context and course parameters and variables.

Parameters
string$course_idid of associated course

◆ setResource()

setResource (   $resource_id,
  $resource_title,
  $resource_description = null 
)

Set the LMS resource associated with this LTI link. This is required for an LTI launch request.

Parameters
string$resource_idid of associated resource
string$resource_titletitle of associated resource
string$resource_descriptiondescription of associated resource

◆ setUser()

setUser (   $user_id,
  $roles = 'Learner',
  $send_lis_person = false 
)

Set the Stud.IP user associated with this LTI launch. The user data is used to set up the user and LIS person parameters and variables. If send_lis_person is true, the user's name and e-mail is included.

Parameters
string$user_idid of associated course
string$rolesroles of this user (defaults to 'Learner')
bool$send_lis_personinclude additional user information

Field Documentation

◆ $consumer_key

$consumer_key
protected

◆ $consumer_secret

$consumer_secret
protected

◆ $launch_url

$launch_url
protected

◆ $oauth_signature_method

$oauth_signature_method
protected

◆ $parameters

$parameters = []
protected

◆ $variables

$variables = []
protected

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