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... | |
| 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 OAuth signature to an LTI message. More... | |
| doServiceRequest ($service, $method, $format, $data) | |
| Perform a service request. More... | |
Static Public Member Functions | |
| static | addSignature ($endpoint, $consumerKey, $consumerSecret, $data, $method= 'POST', $type=null) |
| Add the OAuth signature to an array of message parameters or to a header string. More... | |
| 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... | |
| $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... | |
| $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 | |
| Date/time from which the the tool consumer instance is enabled to accept incoming connection requests. More... | |
| $enableUntil = null | |
| Date/time until which the tool consumer instance is enabled to accept incoming connection requests. More... | |
| $lastAccess = null | |
| 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... | |
| $settings = null | |
| Setting values (LTI parameters, custom parameters and local parameters). More... | |
| $created = null | |
| Date/time when the object was created. More... | |
| $updated = null | |
| Date/time when the object was last updated. More... | |
Class to represent a tool consumer.
Definition at line 19 of file ToolConsumer.php.
| __construct | ( | $key = null, |
|
$dataConnector = null, |
|||
$autoEnable = false |
|||
| ) |
Class constructor.
| string | $key | Consumer key |
| DataConnector | $dataConnector | A data connector object |
| boolean | $autoEnable | true if the tool consumers is to be enabled automatically (optional, default is false) |
Definition at line 157 of file ToolConsumer.php.
References DataConnector\getDataConnector(), DataConnector\getRandomString(), and ToolConsumer\initialize().
|
static |
Add the OAuth signature to an array of message parameters or to a header string.
Definition at line 513 of file ToolConsumer.php.
References ToolConsumer\$name, and OAuthRequest\from_consumer_and_token().
Referenced by ToolConsumer\doServiceRequest(), and Service\send().
| delete | ( | ) |
Delete the tool consumer from the database.
Definition at line 236 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 580 of file ToolConsumer.php.
References ToolConsumer\$secret, and 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 605 of file ToolConsumer.php.
Referenced by ToolProxy\getConsumer(), Context\getConsumer(), and ResourceLink\getConsumer().
| getDataConnector | ( | ) |
Get the data connector.
Definition at line 296 of file ToolConsumer.php.
| getIsAvailable | ( | ) |
Is the consumer key available to accept launch requests?
Definition at line 308 of file ToolConsumer.php.
References ToolConsumer\$enabled.
| getKey | ( | ) |
Get the tool consumer key.
Definition at line 272 of file ToolConsumer.php.
Referenced by ToolConsumer\signParameters().
| getRecordId | ( | ) |
Get the tool consumer record ID.
Definition at line 248 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 333 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 372 of file ToolConsumer.php.
References ToolConsumer\$settings.
| getToolSettings | ( | $simple = true | ) |
Get Tool Settings.
| boolean | $simple | True if all the simple media type is to be used (optional, default is true) |
Definition at line 430 of file ToolConsumer.php.
References ToolConsumer\getSetting().
| hasToolSettingsService | ( | ) |
Check if the Tool Settings service is supported.
Definition at line 414 of file ToolConsumer.php.
References ToolConsumer\getSetting().
| initialise | ( | ) |
Initialise the tool consumer.
Pseudonym for initialize().
Definition at line 207 of file ToolConsumer.php.
References ToolConsumer\initialize().
| initialize | ( | ) |
Initialise the tool consumer.
Definition at line 176 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 219 of file ToolConsumer.php.
Referenced by ToolConsumer\saveSettings().
| saveSettings | ( | ) |
Save setting values.
Definition at line 396 of file ToolConsumer.php.
References ToolConsumer\save().
| setKey | ( | $key | ) |
Set the tool consumer key.
| string | $key | Consumer key value |
Definition at line 284 of file ToolConsumer.php.
| setRecordId | ( | $id | ) |
Sets the tool consumer record ID.
| int | $id | Consumer record ID value |
Definition at line 260 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 352 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 384 of file ToolConsumer.php.
References ToolConsumer\$settings.
| setToolSettings | ( | $settings = array() | ) |
Perform a Tool Settings service request.
| array | $settings | An associative array of settings (optional, default is none) |
Definition at line 448 of file ToolConsumer.php.
References ToolConsumer\$settings, and ToolConsumer\getSetting().
| signParameters | ( | $url, | |
| $type, | |||
| $version, | |||
| $params | |||
| ) |
Add the OAuth 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 469 of file ToolConsumer.php.
References ToolConsumer\$name, OAuthRequest\from_consumer_and_token(), and ToolConsumer\getKey().
| string $consumerGuid = null |
Tool consumer GUID (as reported by first tool consumer connection).
Definition at line 57 of file ToolConsumer.php.
| string $consumerName = null |
Name of tool consumer (as reported by last tool consumer connection).
Definition at line 45 of file ToolConsumer.php.
| string $consumerVersion = null |
Tool consumer version (as reported by last tool consumer connection).
Definition at line 51 of file ToolConsumer.php.
| int $created = null |
Date/time when the object was created.
Definition at line 117 of file ToolConsumer.php.
| string $cssPath = null |
Optional CSS path (as reported by last tool consumer connection).
Definition at line 63 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 105 of file ToolConsumer.php.
| boolean $enabled = false |
Whether the tool consumer instance is enabled to accept incoming connection requests.
Definition at line 75 of file ToolConsumer.php.
Referenced by ToolConsumer\getIsAvailable().
| int $enableFrom = null |
Date/time from which the the tool consumer instance is enabled to accept incoming connection requests.
Definition at line 81 of file ToolConsumer.php.
| int $enableUntil = null |
Date/time until which the tool consumer instance is enabled to accept incoming connection requests.
Definition at line 87 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 99 of file ToolConsumer.php.
| int $lastAccess = null |
Date of last connection from this tool consumer.
Definition at line 93 of file ToolConsumer.php.
| string $ltiVersion = null |
LTI version (as reported by last tool consumer connection).
Definition at line 39 of file ToolConsumer.php.
| string $name = null |
Local name of tool consumer.
Definition at line 27 of file ToolConsumer.php.
Referenced by ToolConsumer\addSignature(), ToolConsumer\getSetting(), ToolConsumer\setSetting(), and ToolConsumer\signParameters().
| boolean $protected = false |
Whether the tool consumer instance is protected by matching the consumer_guid value in incoming requests.
Definition at line 69 of file ToolConsumer.php.
| string $secret = null |
Shared secret.
Definition at line 33 of file ToolConsumer.php.
Referenced by ToolConsumer\doServiceRequest().
| array $settings = null |
Setting values (LTI parameters, custom parameters and local parameters).
Definition at line 111 of file ToolConsumer.php.
Referenced by ToolConsumer\getSettings(), ToolConsumer\setSettings(), and ToolConsumer\setToolSettings().
| int $updated = null |
Date/time when the object was last updated.
Definition at line 123 of file ToolConsumer.php.