Class to represent an LTI Tool Provider

author Stephen P Vickers
version 2.5.00
license GNU Lesser General Public License, version 3
package LTI

 Methods

Class constructor

__construct(mixed $data_connector = '', mixed $callbackHandler = NULL

Parameters

$data_connector

mixed

Object containing a database connection object (optional, default is a blank prefix and MySQL)

$callbackHandler

mixed

String containing name of callback function for launch request, or associative array of callback functions for each request type

Process an incoming request

execute() : mixed
deprecated Use handle_request instead
see

Returns

mixedReturns TRUE or FALSE, a redirection URL or HTML

Get an array of defined tool consumers

getConsumers() : array

Returns

arrayArray of LTI_Tool_Consumer objects

Process an incoming request

handle_request() : mixed

Returns

mixedReturns TRUE or FALSE, a redirection URL or HTML

Get an array of fully qualified user roles

parseRoles($rolesString) : array
Static

Parameters

$rolesString

Returns

arrayArray of roles

Generate a web page containing an auto-submitted form of parameters.

sendForm(string $url, array $params, string $target = ''
Static

Parameters

$url

string

URL to which the form should be submitted

$params

array

Array of form parameters

$target

string

Name of target (optional)

Add a parameter constraint to be checked on launch

setParameterConstraint(string $name, boolean $required = TRUE, integer $max_length = NULL, array $message_types = NULL

Parameters

$name

string

Name of parameter to be checked

$required

boolean

True if parameter is required (optional, default is TRUE)

$max_length

integer

Maximum permitted length of parameter value (optional, default is NULL)

$message_types

array

Array of message types to which the constraint applies (default is all)

Process a valid configure request

onConfigure() : boolean

Returns

booleanTrue if no error

Process a valid content-item request

onContentItem() : boolean

Returns

booleanTrue if no error

Process a valid dashboard request

onDashboard() : boolean

Returns

booleanTrue if no error

Process a response to an invalid request

onError() : boolean

Returns

booleanTrue if no further error processing required

Process a valid launch request

onLaunch() : boolean

Returns

booleanTrue if no error

Check the authenticity of the LTI launch request.

authenticate() : boolean
The consumer, resource link and user objects will be initialised if the request is valid.

Returns

booleanTrue if the request has been successfully validated.

Check if a share arrangement is in place.

checkForShare() : boolean

Returns

booleanTrue if no error is reported

Validate a parameter value from an array of permitted values.

checkValue($value, $values, $reason) : boolean

Parameters

$value

$values

$reason

Returns

booleanTrue if value is valid

Call any callback function for the requested action.

doCallback() : boolean
This function may set the redirectURL and output properties.

Returns

booleanTrue if no error reported

Call any callback function for the requested action.

doCallbackMethod(string $type = NULL) : boolean
This function may set the redirectURL and output properties.

Parameters

$type

string

Callback type

Returns

booleanTrue if no error reported

Perform the result of an action.

result() : string
This function may redirect the user to another URL rather than returning a value.

Returns

stringOutput to be displayed (redirection, or display HTML or message)

 Properties

 

Whether shared resource link arrangements are permitted.

$allowSharing : boolean

Default

FALSE
 

Tool Consumer object.

$consumer : \LTI_Tool_Consumer

Default

NULL
 

Resource link object. @deprecated Use resource_link instead @see LTI_Tool_Provider::$resource_link

$context : \LTI_Context

Default

NULL
 

Data connector object.

$data_connector : \LTI_Data_Connector

Default

NULL
 

Default email domain.

$defaultEmail : string

Default

''
 

Details for error message relating to last request processed.

$details : array

Default

array()
 

Scope to use for user IDs.

$id_scope : integer

Default

self::ID_SCOPE_ID_ONLY
 

True if the last request was successful.

$isOK : boolean

Default

TRUE
 

Message for last request processed

$message : string

Default

self::CONNECTION_ERROR_MESSAGE
 

Error message for last request processed.

$reason : string

Default

NULL
   

Return URL provided by tool consumer.

$return_url : string

Default

NULL
 

User object.

$user : \LTI_User

Default

NULL
 

Whether debug messages explaining the cause of errors are to be returned to the tool consumer.

$debugMode : boolean

Default

FALSE
 

URL to redirect user to on successful completion of the request.

$documentTargets : string

Default

NULL
 

HTML to be displayed on an unsuccessful completion of the request and no return URL is available.

$error_output : string

Default

NULL
 

URL to redirect user to on successful completion of the request.

$mediaTypes : string

Default

NULL
 

HTML to be displayed on a successful completion of the request.

$output : string

Default

NULL
 

URL to redirect user to on successful completion of the request.

$redirectURL : string

Default

NULL
 

Permitted LTI versions for messages.

$LTI_VERSIONS : array

Default

array(self::LTI_VERSION1, self::LTI_VERSION2)
 

Callback functions for handling requests.

$callbackHandler : array

Default

NULL
 

LTI parameter constraints for auto validation checks.

$constraints : array

Default

NULL
 

Names of LTI parameters to be retained in the settings property.

$lti_settings_names : array

Default

array('ext_resource_link_content', 'ext_resource_link_content_signature', 'lis_result_sourcedid', 'lis_outcome_service_url', 'ext_ims_lis_basic_outcome_url', 'ext_ims_lis_resultvalue_sourcedids', 'ext_ims_lis_memberships_id', 'ext_ims_lis_memberships_url', 'ext_ims_lti_tool_setting', 'ext_ims_lti_tool_setting_id', 'ext_ims_lti_tool_setting_url')
 

List of supported message types and associated callback type names

$messageTypes : array

Default

array('basic-lti-launch-request' => 'launch', 'ConfigureLaunchRequest' => 'configure', 'DashboardRequest' => 'dashboard', 'ContentItemSelectionRequest' => 'content-item')
 

List of supported message types and associated class methods

$methodNames : array

Default

array('basic-lti-launch-request' => 'onLaunch', 'ConfigureLaunchRequest' => 'onConfigure', 'DashboardRequest' => 'onDashboard', 'ContentItemSelectionRequest' => 'onContentItem')

 Constants

 

Default connection error message.

CONNECTION_ERROR_MESSAGE = 'Sorry, there was an error connecting you to the application.' 
 

Prefix the ID with the consumer key and context ID.

ID_SCOPE_CONTEXT = 2 
 

Prefix an ID with the consumer key.

ID_SCOPE_GLOBAL = 1 
 

Use ID value only.

ID_SCOPE_ID_ONLY = 0 
 

Prefix the ID with the consumer key and resource ID.

ID_SCOPE_RESOURCE = 3 
 

Character used to separate each element of an ID.

ID_SCOPE_SEPARATOR = ':' 
 

LTI version 1 for messages.

LTI_VERSION = 'LTI-1p0' 
deprecated Use LTI_VERSION1 instead
see
 

LTI version 1 for messages.

LTI_VERSION1 = 'LTI-1p0' 
 

LTI version 2 for messages.

LTI_VERSION2 = 'LTI-2p0'