![]() |
LTI Integration Library
3.1.0
PHP class library for building LTI integrations
|
Class to represent an LTI Tool Provider. More...
Public Member Functions | |
| __construct ($dataConnector) | |
| Class constructor. More... | |
| handleRequest () | |
| Process an incoming request. More... | |
| setParameterConstraint ($name, $required=true, $maxLength=null, $messageTypes=null) | |
| Add a parameter constraint to be checked on launch. More... | |
| getConsumers () | |
| Get an array of defined tool consumers. More... | |
| findService ($format, $methods) | |
| Find an offered service based on a media type and HTTP action(s) More... | |
| doToolProxyService () | |
| Send the tool proxy to the Tool Consumer. More... | |
| getMessageParameters () | |
| Get the message parameters. More... | |
Static Public Member Functions | |
| static | parseRoles ($roles, $ltiVersion=self::LTI_VERSION1) |
| Get an array of fully qualified user roles. More... | |
| static | sendForm ($url, $params, $target='') |
| Generate a web page containing an auto-submitted form of parameters. More... | |
Static Public Member Functions inherited from ApiHook | |
| static | registerApiHook ($hookName, $familyCode, $className) |
| Register the availability of an API hook. More... | |
Data Fields | |
| const | CONNECTION_ERROR_MESSAGE = 'Sorry, there was an error connecting you to the application.' |
| Default connection error message. More... | |
| const | LTI_VERSION1 = 'LTI-1p0' |
| LTI version 1 for messages. More... | |
| const | LTI_VERSION2 = 'LTI-2p0' |
| LTI version 2 for messages. More... | |
| const | ID_SCOPE_ID_ONLY = 0 |
| Use ID value only. More... | |
| const | ID_SCOPE_GLOBAL = 1 |
| Prefix an ID with the consumer key. More... | |
| const | ID_SCOPE_CONTEXT = 2 |
| Prefix the ID with the consumer key and context ID. More... | |
| const | ID_SCOPE_RESOURCE = 3 |
| Prefix the ID with the consumer key and resource ID. More... | |
| const | ID_SCOPE_SEPARATOR = ':' |
| Character used to separate each element of an ID. More... | |
| $ok = true | |
| True if the last request was successful. More... | |
| $consumer = null | |
| Tool Consumer object. More... | |
| $returnUrl = null | |
| Return URL provided by tool consumer. More... | |
| $userResult = null | |
| UserResult object. More... | |
| $resourceLink = null | |
| Resource link object. More... | |
| $context = null | |
| Context object. More... | |
| $dataConnector = null | |
| Data connector object. More... | |
| $defaultEmail = '' | |
| Default email domain. More... | |
| $idScope = self::ID_SCOPE_ID_ONLY | |
| Scope to use for user IDs. More... | |
| $allowSharing = false | |
| Whether shared resource link arrangements are permitted. More... | |
| $message = self::CONNECTION_ERROR_MESSAGE | |
| Message for last request processed. More... | |
| $reason = null | |
| Error message for last request processed. More... | |
| $details = array() | |
| Details for error message relating to last request processed. More... | |
| $baseUrl = null | |
| Base URL for tool provider service. More... | |
| $vendor = null | |
| Vendor details. More... | |
| $product = null | |
| Product details. More... | |
| $requiredServices = null | |
| Services required by Tool Provider. More... | |
| $optionalServices = null | |
| Optional services used by Tool Provider. More... | |
| $resourceHandlers = null | |
| Resource handlers for Tool Provider. More... | |
Protected Member Functions | |
| onLaunch () | |
| Process a valid launch request. More... | |
| onConfigure () | |
| Process a valid configure request. More... | |
| onDashboard () | |
| Process a valid dashboard request. More... | |
| onContentItem () | |
| Process a valid content-item request. More... | |
| onRegister () | |
| Process a valid tool proxy registration request. More... | |
| onError () | |
| Process a response to an invalid request. More... | |
Protected Attributes | |
| $redirectUrl = null | |
| URL to redirect user to on successful completion of the request. More... | |
| $mediaTypes = null | |
| Media types accepted by the Tool Consumer. More... | |
| $documentTargets = null | |
| Document targets accepted by the Tool Consumer. More... | |
| $output = null | |
| Default HTML to be displayed on a successful completion of the request. More... | |
| $errorOutput = null | |
| HTML to be displayed on an unsuccessful completion of the request and no return URL is available. More... | |
| $debugMode = false | |
| Whether debug messages explaining the cause of errors are to be returned to the tool consumer. More... | |
| $messageParameters = null | |
| LTI message parameters. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from ApiHook | |
| static | $USER_ID_HOOK = "UserId" |
| User Id hook name. More... | |
| static | $CONTEXT_ID_HOOK = "ContextId" |
| Context Id hook name. More... | |
| static | $MEMBERSHIPS_SERVICE_HOOK = "Memberships" |
| Memberships service hook name. More... | |
| static | $OUTCOMES_SERVICE_HOOK = "Outcomes" |
| Outcomes service hook name. More... | |
| static | $TOOL_SETTINGS_SERVICE_HOOK = "ToolSettings" |
| Tool Settings service hook name. More... | |
Class to represent an LTI Tool Provider.
Definition at line 20 of file ToolProvider.php.
| __construct | ( | $dataConnector | ) |
Class constructor.
| DataConnector | $dataConnector | Object containing a database connection object |
Definition at line 332 of file ToolProvider.php.
References ToolProvider\$dataConnector.
| doToolProxyService | ( | ) |
Send the tool proxy to the Tool Consumer.
Definition at line 425 of file ToolProvider.php.
References ToolProvider\$ok, ToolProvider\findService(), and DataConnector\getRandomString().
| findService | ( | $format, | |
| $methods | |||
| ) |
Find an offered service based on a media type and HTTP action(s)
| string | $format | Media type required |
| array | $methods | Array of HTTP actions required |
Definition at line 392 of file ToolProvider.php.
Referenced by ToolProvider\doToolProxyService().
| getConsumers | ( | ) |
Get an array of defined tool consumers.
Definition at line 379 of file ToolProvider.php.
| getMessageParameters | ( | ) |
Get the message parameters.
Definition at line 449 of file ToolProvider.php.
References ToolProvider\$messageParameters, OAuthRequest\$POST_INPUT, and OAuthUtil\parse_parameters().
Referenced by ToolProvider\handleRequest().
| handleRequest | ( | ) |
Process an incoming request.
Definition at line 347 of file ToolProvider.php.
References ToolProvider\getMessageParameters().
|
protected |
Process a valid configure request.
Definition at line 577 of file ToolProvider.php.
References ToolProvider\onError().
|
protected |
Process a valid content-item request.
Definition at line 597 of file ToolProvider.php.
References ToolProvider\onError().
|
protected |
Process a valid dashboard request.
Definition at line 587 of file ToolProvider.php.
References ToolProvider\onError().
|
protected |
Process a response to an invalid request.
Definition at line 617 of file ToolProvider.php.
Referenced by ToolProvider\onConfigure(), ToolProvider\onContentItem(), ToolProvider\onDashboard(), ToolProvider\onLaunch(), and ToolProvider\onRegister().
|
protected |
Process a valid launch request.
Definition at line 567 of file ToolProvider.php.
References ToolProvider\onError().
|
protected |
Process a valid tool proxy registration request.
Definition at line 607 of file ToolProvider.php.
References ToolProvider\onError().
|
static |
Get an array of fully qualified user roles.
| mixed | $roles | Comma-separated list of roles or array of roles |
| string | $ltiVersion | LTI version (default is LTI-1p0) |
Definition at line 478 of file ToolProvider.php.
Referenced by Membership\get(), and ResourceLink\getMemberships().
|
static |
Generate a web page containing an auto-submitted form of parameters.
| string | $url | URL to which the form should be submitted |
| array | $params | Array of form parameters |
| string | $target | Name of target (optional) |
Definition at line 510 of file ToolProvider.php.
| setParameterConstraint | ( | $name, | |
$required = true, |
|||
$maxLength = null, |
|||
$messageTypes = null |
|||
| ) |
Add a parameter constraint to be checked on launch.
| string | $name | Name of parameter to be checked |
| bool | $required | True if parameter is required (optional, default is true) |
| int | $maxLength | Maximum permitted length of parameter value (optional, default is null) |
| array | $messageTypes | Array of message types to which the constraint applies (optional, default is all) |
Definition at line 366 of file ToolProvider.php.
| bool $allowSharing = false |
Whether shared resource link arrangements are permitted.
Definition at line 206 of file ToolProvider.php.
| string null $baseUrl = null |
Base URL for tool provider service.
Definition at line 234 of file ToolProvider.php.
| ToolConsumer null $consumer = null |
Tool Consumer object.
Definition at line 150 of file ToolProvider.php.
| Context null $context = null |
Context object.
Definition at line 178 of file ToolProvider.php.
| DataConnector null $dataConnector = null |
Data connector object.
Definition at line 185 of file ToolProvider.php.
Referenced by ToolProvider\__construct().
|
protected |
Whether debug messages explaining the cause of errors are to be returned to the tool consumer.
Definition at line 311 of file ToolProvider.php.
| string $defaultEmail = '' |
Default email domain.
Definition at line 192 of file ToolProvider.php.
| array $details = array() |
Details for error message relating to last request processed.
Definition at line 227 of file ToolProvider.php.
|
protected |
Document targets accepted by the Tool Consumer.
Definition at line 290 of file ToolProvider.php.
|
protected |
HTML to be displayed on an unsuccessful completion of the request and no return URL is available.
Definition at line 304 of file ToolProvider.php.
| int $idScope = self::ID_SCOPE_ID_ONLY |
Scope to use for user IDs.
Definition at line 199 of file ToolProvider.php.
|
protected |
Media types accepted by the Tool Consumer.
Definition at line 283 of file ToolProvider.php.
| string $message = self::CONNECTION_ERROR_MESSAGE |
Message for last request processed.
Definition at line 213 of file ToolProvider.php.
|
protected |
LTI message parameters.
Definition at line 318 of file ToolProvider.php.
Referenced by ToolProvider\getMessageParameters().
| bool $ok = true |
True if the last request was successful.
Definition at line 143 of file ToolProvider.php.
Referenced by ToolProvider\doToolProxyService().
| array null $optionalServices = null |
Optional services used by Tool Provider.
Definition at line 262 of file ToolProvider.php.
|
protected |
Default HTML to be displayed on a successful completion of the request.
Definition at line 297 of file ToolProvider.php.
| Item null $product = null |
Product details.
Definition at line 248 of file ToolProvider.php.
| string null $reason = null |
Error message for last request processed.
Definition at line 220 of file ToolProvider.php.
|
protected |
URL to redirect user to on successful completion of the request.
Definition at line 276 of file ToolProvider.php.
| array null $requiredServices = null |
Services required by Tool Provider.
Definition at line 255 of file ToolProvider.php.
| array null $resourceHandlers = null |
Resource handlers for Tool Provider.
Definition at line 269 of file ToolProvider.php.
| ResourceLink null $resourceLink = null |
Resource link object.
Definition at line 171 of file ToolProvider.php.
| string null $returnUrl = null |
Return URL provided by tool consumer.
Definition at line 157 of file ToolProvider.php.
| UserResult null $userResult = null |
UserResult object.
Definition at line 164 of file ToolProvider.php.
| Item null $vendor = null |
Vendor details.
Definition at line 241 of file ToolProvider.php.
| const CONNECTION_ERROR_MESSAGE = 'Sorry, there was an error connecting you to the application.' |
Default connection error message.
Definition at line 26 of file ToolProvider.php.
| const ID_SCOPE_CONTEXT = 2 |
Prefix the ID with the consumer key and context ID.
Definition at line 51 of file ToolProvider.php.
Referenced by UserResult\getId().
| const ID_SCOPE_GLOBAL = 1 |
Prefix an ID with the consumer key.
Definition at line 46 of file ToolProvider.php.
Referenced by UserResult\getId().
| const ID_SCOPE_ID_ONLY = 0 |
Use ID value only.
Definition at line 41 of file ToolProvider.php.
Referenced by UserResult\getId(), ToolConsumer\initialize(), DataConnector_pg\loadUserResult(), DataConnector_mysql\loadUserResult(), DataConnector_sqlsrv\loadUserResult(), DataConnector_mysqli\loadUserResult(), DataConnector_oci\loadUserResult(), DataConnector_pdo\loadUserResult(), DataConnector_pg\saveUserResult(), DataConnector_mysql\saveUserResult(), DataConnector_sqlsrv\saveUserResult(), DataConnector_mysqli\saveUserResult(), DataConnector_oci\saveUserResult(), and DataConnector_pdo\saveUserResult().
| const ID_SCOPE_RESOURCE = 3 |
Prefix the ID with the consumer key and resource ID.
Definition at line 56 of file ToolProvider.php.
Referenced by Membership\get(), UserResult\getId(), and ResourceLink\getMemberships().
| const ID_SCOPE_SEPARATOR = ':' |
Character used to separate each element of an ID.
Definition at line 61 of file ToolProvider.php.
Referenced by UserResult\getId().
| const LTI_VERSION1 = 'LTI-1p0' |
LTI version 1 for messages.
Definition at line 31 of file ToolProvider.php.
| const LTI_VERSION2 = 'LTI-2p0' |
LTI version 2 for messages.
Definition at line 36 of file ToolProvider.php.