![]() |
LTI Integration Library
3.1.0
PHP class library for building LTI integrations
|
Class to represent a tool consumer. More...
Public Member Functions | |
| __construct ($key=null, $dataConnector=null, $autoEnable=false) | |
| Class constructor. More... | |
| initialize () | |
| Initialise the tool consumer. More... | |
| initialise () | |
| Initialise the tool consumer. More... | |
| save () | |
| Save the tool consumer to the database. More... | |
| delete () | |
| Delete the tool consumer from the database. More... | |
| getRecordId () | |
| Get the tool consumer record ID. More... | |
| setRecordId ($id) | |
| Sets the tool consumer record ID. More... | |
| getKey () | |
| Get the tool consumer key. More... | |
| setKey ($key) | |
| Set the tool consumer key. More... | |
| getFamilyCode () | |
| Get tool consumer family code (as reported by last tool consumer connection). More... | |
| getDataConnector () | |
| Get the data connector. More... | |
| getIsAvailable () | |
| Is the consumer key available to accept launch requests? More... | |
| getSetting ($name, $default='') | |
| Get a setting value. More... | |
| setSetting ($name, $value=null) | |
| Set a setting value. More... | |
| getSettings () | |
| Get an array of all setting values. More... | |
| setSettings ($settings) | |
| Set an array of all setting values. More... | |
| saveSettings () | |
| Save setting values. More... | |
| hasToolSettingsService () | |
| Check if the Tool Settings service is supported. More... | |
| getToolSettings ($simple=true) | |
| Get Tool Settings. More... | |
| setToolSettings ($settings=array()) | |
| Perform a Tool Settings service request. More... | |
| signParameters ($url, $type, $version, $params) | |
| Add the signature to an LTI message. More... | |
| signServiceRequest ($url, $method, $type, $data=null) | |
| Generates the headers for an LTI service request. More... | |
| addSignature ($endpoint, $data, $method='POST', $type=null, $forTP=false) | |
| Add the signature to an array of message parameters or to a header string. More... | |
| doServiceRequest ($service, $method, $format, $data) | |
| Perform a service request. More... | |
Static Public Member Functions | |
| static | fromRecordId ($id, $dataConnector) |
| Load the tool consumer from the database by its record ID. More... | |
Data Fields | |
| $name = null | |
| Local name of tool consumer. More... | |
| $secret = null | |
| Shared secret. More... | |
| $ltiVersion = null | |
| LTI version (as reported by last tool consumer connection). More... | |
| $signatureMethod = 'HMAC-SHA1' | |
| Method used for signing messages. More... | |
| $consumerName = null | |
| Name of tool consumer (as reported by last tool consumer connection). More... | |
| $consumerVersion = null | |
| Tool consumer version (as reported by last tool consumer connection). More... | |
| $profile = null | |
| The consumer profile data. More... | |
| $consumerGuid = null | |
| Tool consumer GUID (as reported by first tool consumer connection). More... | |
| $cssPath = null | |
| Optional CSS path (as reported by last tool consumer connection). More... | |
| $protected = false | |
| Whether the tool consumer instance is protected by matching the consumer_guid value in incoming requests. More... | |
| $enabled = false | |
| Whether the tool consumer instance is enabled to accept incoming connection requests. More... | |
| $enableFrom = null | |
| Timestamp from which the the tool consumer instance is enabled to accept incoming connection requests. More... | |
| $enableUntil = null | |
| Timestamp until which the tool consumer instance is enabled to accept incoming connection requests. More... | |
| $lastAccess = null | |
| Timestamp for date of last connection from this tool consumer. More... | |
| $idScope = ToolProvider::ID_SCOPE_ID_ONLY | |
| Default scope to use when generating an Id value for a user. More... | |
| $defaultEmail = '' | |
| Default email address (or email domain) to use when no email address is provided for a user. More... | |
| $lastServiceRequest = null | |
| HTTPMessage object for last service request. More... | |
| $created = null | |
| Timestamp for when the object was created. More... | |
| $updated = null | |
| Timestamp for when the object was last updated. More... | |
Class to represent a tool consumer.
Definition at line 18 of file ToolConsumer.php.
| __construct | ( | $key = null, |
|
$dataConnector = null, |
|||
$autoEnable = false |
|||
| ) |
Class constructor.
| string | $key | Consumer key |
| DataConnector | $dataConnector | A data connector object |
| bool | $autoEnable | true if the tool consumers is to be enabled automatically (optional, default is false) |
Definition at line 196 of file ToolConsumer.php.
References DataConnector\getDataConnector(), DataConnector\getRandomString(), and ToolConsumer\initialize().
| addSignature | ( | $endpoint, | |
| $data, | |||
$method = 'POST', |
|||
$type = null, |
|||
$forTP = false |
|||
| ) |
Add the signature to an array of message parameters or to a header string.
| string | $endpoint | URL to which message is being sent |
| mixed | $data | Data to be passed |
| string | $method | HTTP method |
| string | null | $type | Content type of data being passed |
| bool | $forTP | True of the signature is being signed for a Tool Provider request |
Definition at line 552 of file ToolConsumer.php.
Referenced by ToolConsumer\doServiceRequest(), ToolConsumer\signParameters(), and ToolConsumer\signServiceRequest().
| delete | ( | ) |
Delete the tool consumer from the database.
Definition at line 268 of file ToolConsumer.php.
| doServiceRequest | ( | $service, | |
| $method, | |||
| $format, | |||
| $data | |||
| ) |
Perform a service request.
| object | $service | Service object to be executed |
| string | $method | HTTP action |
| string | $format | Media type |
| mixed | $data | Array of parameters or body string |
Definition at line 578 of file ToolConsumer.php.
References ToolConsumer\addSignature().
|
static |
Load the tool consumer from the database by its record ID.
| string | $id | The consumer key record ID |
| DataConnector | $dataConnector | Database connection object |
Definition at line 601 of file ToolConsumer.php.
Referenced by Context\getConsumer(), and ResourceLink\getConsumer().
| getDataConnector | ( | ) |
Get the data connector.
Definition at line 333 of file ToolConsumer.php.
| getFamilyCode | ( | ) |
Get tool consumer family code (as reported by last tool consumer connection).
Definition at line 318 of file ToolConsumer.php.
Referenced by ToolConsumer\getToolSettings(), ToolConsumer\hasToolSettingsService(), and ToolConsumer\setToolSettings().
| getIsAvailable | ( | ) |
Is the consumer key available to accept launch requests?
Definition at line 343 of file ToolConsumer.php.
References ToolConsumer\$enabled.
| getKey | ( | ) |
Get the tool consumer key.
Definition at line 298 of file ToolConsumer.php.
| getRecordId | ( | ) |
Get the tool consumer record ID.
Definition at line 278 of file ToolConsumer.php.
| getSetting | ( | $name, | |
$default = '' |
|||
| ) |
Get a setting value.
| string | $name | Name of setting |
| string | $default | Value to return if the setting does not exist (optional, default is an empty string) |
Definition at line 366 of file ToolConsumer.php.
References ToolConsumer\$name.
Referenced by ToolConsumer\getToolSettings(), ToolConsumer\hasToolSettingsService(), ToolConsumer\setSetting(), and ToolConsumer\setToolSettings().
| getSettings | ( | ) |
Get an array of all setting values.
Definition at line 401 of file ToolConsumer.php.
| getToolSettings | ( | $simple = true | ) |
Get Tool Settings.
| bool | $simple | True if all the simple media type is to be used (optional, default is true) |
Definition at line 453 of file ToolConsumer.php.
References ToolConsumer\getFamilyCode(), and ToolConsumer\getSetting().
| hasToolSettingsService | ( | ) |
Check if the Tool Settings service is supported.
Definition at line 437 of file ToolConsumer.php.
References ToolConsumer\getFamilyCode(), and ToolConsumer\getSetting().
| initialise | ( | ) |
Initialise the tool consumer.
Pseudonym for initialize().
Definition at line 243 of file ToolConsumer.php.
References ToolConsumer\initialize().
| initialize | ( | ) |
Initialise the tool consumer.
Definition at line 213 of file ToolConsumer.php.
References ToolProvider\ID_SCOPE_ID_ONLY.
Referenced by ToolConsumer\__construct(), and ToolConsumer\initialise().
| save | ( | ) |
Save the tool consumer to the database.
Definition at line 253 of file ToolConsumer.php.
Referenced by ToolConsumer\saveSettings().
| saveSettings | ( | ) |
Save setting values.
Definition at line 421 of file ToolConsumer.php.
References ToolConsumer\save().
| setKey | ( | $key | ) |
Set the tool consumer key.
| string | $key | Consumer key value |
Definition at line 308 of file ToolConsumer.php.
| setRecordId | ( | $id | ) |
Sets the tool consumer record ID.
| int | $id | Consumer record ID value |
Definition at line 288 of file ToolConsumer.php.
| setSetting | ( | $name, | |
$value = null |
|||
| ) |
Set a setting value.
| string | $name | Name of setting |
| string | $value | Value to set, use an empty value to delete a setting (optional, default is null) |
Definition at line 383 of file ToolConsumer.php.
References ToolConsumer\$name, and ToolConsumer\getSetting().
| setSettings | ( | $settings | ) |
Set an array of all setting values.
| array | $settings | Associative array of setting values |
Definition at line 411 of file ToolConsumer.php.
| setToolSettings | ( | $settings = array() | ) |
Perform a Tool Settings service request.
| array | $settings | An associative array of settings (optional, default is none) |
Definition at line 480 of file ToolConsumer.php.
References ToolConsumer\getFamilyCode(), and ToolConsumer\getSetting().
| signParameters | ( | $url, | |
| $type, | |||
| $version, | |||
| $params | |||
| ) |
Add the signature to an LTI message.
| string | $url | URL for message request |
| string | $type | LTI message type |
| string | $version | LTI version |
| array | $params | Message parameters |
Definition at line 508 of file ToolConsumer.php.
References ToolConsumer\addSignature().
| signServiceRequest | ( | $url, | |
| $method, | |||
| $type, | |||
$data = null |
|||
| ) |
Generates the headers for an LTI service request.
| string | $url | URL for message request |
| string | $method | HTTP method |
| string | $type | Media type |
| string | $data | Data being passed in request body (optional) |
Definition at line 531 of file ToolConsumer.php.
References ToolConsumer\addSignature().
| string null $consumerGuid = null |
Tool consumer GUID (as reported by first tool consumer connection).
Definition at line 75 of file ToolConsumer.php.
| string null $consumerName = null |
Name of tool consumer (as reported by last tool consumer connection).
Definition at line 54 of file ToolConsumer.php.
| string null $consumerVersion = null |
Tool consumer version (as reported by last tool consumer connection).
Definition at line 61 of file ToolConsumer.php.
| int null $created = null |
Timestamp for when the object was created.
Definition at line 145 of file ToolConsumer.php.
| string null $cssPath = null |
Optional CSS path (as reported by last tool consumer connection).
Definition at line 82 of file ToolConsumer.php.
| string $defaultEmail = '' |
Default email address (or email domain) to use when no email address is provided for a user.
Definition at line 131 of file ToolConsumer.php.
| bool $enabled = false |
Whether the tool consumer instance is enabled to accept incoming connection requests.
Definition at line 96 of file ToolConsumer.php.
Referenced by ToolConsumer\getIsAvailable().
| int null $enableFrom = null |
Timestamp from which the the tool consumer instance is enabled to accept incoming connection requests.
Definition at line 103 of file ToolConsumer.php.
| int null $enableUntil = null |
Timestamp until which the tool consumer instance is enabled to accept incoming connection requests.
Definition at line 110 of file ToolConsumer.php.
| int $idScope = ToolProvider::ID_SCOPE_ID_ONLY |
Default scope to use when generating an Id value for a user.
Definition at line 124 of file ToolConsumer.php.
| int null $lastAccess = null |
Timestamp for date of last connection from this tool consumer.
Definition at line 117 of file ToolConsumer.php.
| HTTPMessage null $lastServiceRequest = null |
HTTPMessage object for last service request.
Definition at line 138 of file ToolConsumer.php.
| string null $ltiVersion = null |
LTI version (as reported by last tool consumer connection).
Definition at line 40 of file ToolConsumer.php.
| string null $name = null |
Local name of tool consumer.
Definition at line 26 of file ToolConsumer.php.
Referenced by ToolConsumer\getSetting(), and ToolConsumer\setSetting().
| object null $profile = null |
The consumer profile data.
Definition at line 68 of file ToolConsumer.php.
| bool $protected = false |
Whether the tool consumer instance is protected by matching the consumer_guid value in incoming requests.
Definition at line 89 of file ToolConsumer.php.
| string null $secret = null |
Shared secret.
Definition at line 33 of file ToolConsumer.php.
| string $signatureMethod = 'HMAC-SHA1' |
Method used for signing messages.
Definition at line 47 of file ToolConsumer.php.
| int null $updated = null |
Timestamp for when the object was last updated.
Definition at line 152 of file ToolConsumer.php.