\smtech\ReflexiveCanvasLTI\LTIToolProvider

A simple LTI Tool Provider

Summary

Methods
Properties
Constants
__construct()
createConsumer()
setHandlerURL()
onLaunch()
onDashboard()
onConfigure()
onContentItem()
onError()
No public properties found
No constants found
isSchemaPresent()
loadSchema()
assignRedirect()
initSession()
$handlers
N/A
No private methods found
No private properties found
N/A

Properties

$handlers

$handlers : array<mixed,string>

Associative array of LTI request types and URLs to handle that type of request

Type

array<mixed,string>

Methods

__construct()

__construct(\mysqli  $mysql, array<mixed,string>  $handlers) 

Construct a ToolProvider

Parameters

\mysqli $mysql
array<mixed,string> $handlers

Associative array of LTI request types and URLs to handle that type of request

createConsumer()

createConsumer(string  $name, string  $key = false, string  $secret = false) : void

Create a new tool consumer, optionally with specific key and shared secret.

Parameters

string $name

Human-readable Tool Consumer name (e.g. "My School Canvas")

string $key

(Optional) A unique key to identify this consumer within the database

string $secret

(Optional) A shared secret to authenticate this tool consumer

setHandlerURL()

setHandlerURL(string|array<mixed,string>  $requestType_or_list, string  $url = null) 

Update request-type/script-handler pairings

This anticipates either a pair of strings or an associative array of pairs

['requestType' => 'URL of script handling this request']

Parameters

string|array<mixed,string> $requestType_or_list
string $url

Ignored if $requestType_or_list is an array, required if $requestType_or_list is a string

onLaunch()

onLaunch() : void

Handle LTI requests of type `launch`

onDashboard()

onDashboard() : void

Handle LTI requests of type `dashboard`

onConfigure()

onConfigure() : void

Handle LTI requests of type `configure`

onContentItem()

onContentItem() : void

Handle LTI requests of type `content-item`

onError()

onError() : void

Handle LTI requests of type `error`

isSchemaPresent()

isSchemaPresent(\mysqli  $mysql) : boolean

Is the `LTI_Tool_Provider` database schema loaded already?

Parameters

\mysqli $mysql

Returns

boolean

loadSchema()

loadSchema(\mysqli  $mysql) : void

Load the `LTI_Tool_Provider` schema into the database

Parameters

\mysqli $mysql

assignRedirect()

assignRedirect(string  $request) : string

Choose a redirection URL for a particular request type

If an unspecified request type is made, this will return the base request type with the GET parameter lti-request appended specifying $request

Parameters

string $request

Returns

string

initSession()

initSession() : void

Start a PHP session if not already started