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... | |
Static Public Member Functions | |
| static | parseRoles ($roles) |
| 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... | |
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... | |
| $user = null | |
| User 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... | |
| 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 | |
| URL to redirect user to on successful completion of the request. More... | |
| $documentTargets = null | |
| URL to redirect user to on successful completion of the request. More... | |
| $output = null | |
| 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... | |
Class to represent an LTI Tool Provider.
Definition at line 21 of file ToolProvider.php.
| __construct | ( | $dataConnector | ) |
Class constructor.
| DataConnector | $dataConnector | Object containing a database connection object |
Definition at line 311 of file ToolProvider.php.
References ToolProvider\$dataConnector.
| doToolProxyService | ( | ) |
Send the tool proxy to the Tool Consumer.
Definition at line 423 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 388 of file ToolProvider.php.
Referenced by ToolProvider\doToolProxyService(), and ToolProvider\onError().
| getConsumers | ( | ) |
Get an array of defined tool consumers.
Definition at line 373 of file ToolProvider.php.
| handleRequest | ( | ) |
Process an incoming request.
Definition at line 338 of file ToolProvider.php.
|
protected |
Process a valid content-item request.
Definition at line 542 of file ToolProvider.php.
References ToolProvider\onError().
|
protected |
Process a response to an invalid request.
Definition at line 565 of file ToolProvider.php.
References ToolProvider\$consumer, ToolProvider\$defaultEmail, ToolProvider\$documentTargets, ToolProvider\$errorOutput, ToolProvider\$mediaTypes, ToolProvider\$message, ToolProvider\$ok, ToolProvider\$output, ToolProvider\$reason, ToolProvider\$resourceLink, ToolProvider\$returnUrl, ToolProvider\findService(), OAuthRequest\from_request(), Context\fromConsumer(), ResourceLink\fromConsumer(), and User\fromResourceLink().
Referenced by ToolProvider\onContentItem(), ToolProvider\onLaunch(), and ToolProvider\onRegister().
|
protected |
Process a valid launch request.
Definition at line 530 of file ToolProvider.php.
References ToolProvider\onError().
|
protected |
Process a valid tool proxy registration request.
Definition at line 554 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 |
Definition at line 450 of file ToolProvider.php.
Referenced by ResourceLink\doMembershipsService(), and Membership\get().
|
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 479 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 |
| boolean | $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 358 of file ToolProvider.php.
| boolean $allowSharing = false |
Whether shared resource link arrangements are permitted.
Definition at line 200 of file ToolProvider.php.
| string $baseUrl = null |
Base URL for tool provider service.
Definition at line 224 of file ToolProvider.php.
| ToolConsumer $consumer = null |
Tool Consumer object.
Definition at line 152 of file ToolProvider.php.
Referenced by ToolProvider\onError().
| Context $context = null |
Context object.
Definition at line 176 of file ToolProvider.php.
| DataConnector $dataConnector = null |
Data connector object.
Definition at line 182 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 291 of file ToolProvider.php.
| string $defaultEmail = '' |
Default email domain.
Definition at line 188 of file ToolProvider.php.
Referenced by ToolProvider\onError().
| array $details = array() |
Details for error message relating to last request processed.
Definition at line 218 of file ToolProvider.php.
|
protected |
URL to redirect user to on successful completion of the request.
Definition at line 273 of file ToolProvider.php.
Referenced by ToolProvider\onError().
|
protected |
HTML to be displayed on an unsuccessful completion of the request and no return URL is available.
Definition at line 285 of file ToolProvider.php.
Referenced by ToolProvider\onError().
| int $idScope = self::ID_SCOPE_ID_ONLY |
Scope to use for user IDs.
Definition at line 194 of file ToolProvider.php.
|
protected |
URL to redirect user to on successful completion of the request.
Definition at line 267 of file ToolProvider.php.
Referenced by ToolProvider\onError().
| string $message = self::CONNECTION_ERROR_MESSAGE |
Message for last request processed.
Definition at line 206 of file ToolProvider.php.
Referenced by ToolProvider\onError().
| boolean $ok = true |
True if the last request was successful.
Definition at line 146 of file ToolProvider.php.
Referenced by ToolProvider\doToolProxyService(), and ToolProvider\onError().
| array $optionalServices = null |
Optional services used by Tool Provider.
Definition at line 248 of file ToolProvider.php.
|
protected |
HTML to be displayed on a successful completion of the request.
Definition at line 279 of file ToolProvider.php.
Referenced by ToolProvider\onError().
| Item $product = null |
Product details.
Definition at line 236 of file ToolProvider.php.
| string $reason = null |
Error message for last request processed.
Definition at line 212 of file ToolProvider.php.
Referenced by ToolProvider\onError().
|
protected |
URL to redirect user to on successful completion of the request.
Definition at line 261 of file ToolProvider.php.
| array $requiredServices = null |
Services required by Tool Provider.
Definition at line 242 of file ToolProvider.php.
| array $resourceHandlers = null |
Resource handlers for Tool Provider.
Definition at line 254 of file ToolProvider.php.
| ResourceLink $resourceLink = null |
Resource link object.
Definition at line 170 of file ToolProvider.php.
Referenced by ToolProvider\onError().
| string $returnUrl = null |
Return URL provided by tool consumer.
Definition at line 158 of file ToolProvider.php.
Referenced by ToolProvider\onError().
| User $user = null |
User object.
Definition at line 164 of file ToolProvider.php.
| Item $vendor = null |
Vendor details.
Definition at line 230 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 27 of file ToolProvider.php.
| const ID_SCOPE_CONTEXT = 2 |
Prefix the ID with the consumer key and context ID.
Definition at line 48 of file ToolProvider.php.
Referenced by User\getId().
| const ID_SCOPE_GLOBAL = 1 |
Prefix an ID with the consumer key.
Definition at line 44 of file ToolProvider.php.
Referenced by User\getId().
| const ID_SCOPE_ID_ONLY = 0 |
Use ID value only.
Definition at line 40 of file ToolProvider.php.
Referenced by User\getId(), ToolConsumer\initialize(), DataConnector_mysql\loadUser(), DataConnector_pdo\loadUser(), DataConnector_mysql\saveUser(), and DataConnector_pdo\saveUser().
| const ID_SCOPE_RESOURCE = 3 |
Prefix the ID with the consumer key and resource ID.
Definition at line 52 of file ToolProvider.php.
Referenced by ResourceLink\doMembershipsService(), Membership\get(), and User\getId().
| const ID_SCOPE_SEPARATOR = ':' |
Character used to separate each element of an ID.
Definition at line 56 of file ToolProvider.php.
Referenced by User\getId().
| const LTI_VERSION1 = 'LTI-1p0' |
LTI version 1 for messages.
Definition at line 32 of file ToolProvider.php.
| const LTI_VERSION2 = 'LTI-2p0' |
LTI version 2 for messages.
Definition at line 36 of file ToolProvider.php.