ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
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... | |
Private Member Functions | |
doCallback ($method=null) | |
Call any callback function for the requested action. More... | |
result () | |
Perform the result of an action. More... | |
authenticate () | |
Check the authenticity of the LTI launch request. More... | |
checkForShare () | |
Check if a share arrangement is in place. More... | |
checkValue ($value, $values, $reason) | |
Validate a parameter value from an array of permitted values. More... | |
Private Attributes | |
$callbackHandler = null | |
Callback functions for handling requests. More... | |
$constraints = null | |
LTI parameter constraints for auto validation checks. More... | |
Static Private Attributes | |
static | $LTI_VERSIONS = array(self::LTI_VERSION1, self::LTI_VERSION2) |
Permitted LTI versions for messages. More... | |
static | $MESSAGE_TYPES |
List of supported message types and associated class methods. More... | |
static | $METHOD_NAMES |
List of supported message types and associated class methods. More... | |
static | $LTI_CONSUMER_SETTING_NAMES = array('custom_tc_profile_url', 'custom_system_setting_url') |
Names of LTI parameters to be retained in the consumer settings property. More... | |
static | $LTI_CONTEXT_SETTING_NAMES |
Names of LTI parameters to be retained in the context settings property. More... | |
static | $LTI_RESOURCE_LINK_SETTING_NAMES |
Names of LTI parameters to be retained in the resource link settings property. More... | |
static | $CUSTOM_SUBSTITUTION_VARIABLES |
Names of LTI custom parameter substitution variables (or capabilities) and their associated default message parameter names. More... | |
Class to represent an LTI Tool Provider.
Definition at line 21 of file ToolProvider.php.
IMSGlobal\LTI\ToolProvider\ToolProvider::__construct | ( | $dataConnector | ) |
Class constructor.
DataConnector | $dataConnector | Object containing a database connection object |
Definition at line 311 of file ToolProvider.php.
References $_POST, and IMSGlobal\LTI\ToolProvider\ToolProvider\$dataConnector.
|
private |
Check the authenticity of the LTI launch request.
The consumer, resource link and user objects will be initialised if the request is valid.
Definition at line 674 of file ToolProvider.php.
References $_POST, IMSGlobal\LTI\ToolProvider\ToolProvider\$consumer, IMSGlobal\LTI\ToolProvider\ToolProvider\$defaultEmail, IMSGlobal\LTI\ToolProvider\ToolProvider\$documentTargets, $email, $format, $http, IMSGlobal\LTI\ToolProvider\ToolProvider\$mediaTypes, IMSGlobal\LTI\ToolProvider\ToolProvider\$message, $name, IMSGlobal\LTI\ToolProvider\ToolProvider\$ok, $request, $res, $server, $store, $title, $version, IMSGlobal\LTI\ToolProvider\ToolProvider\checkForShare(), IMSGlobal\LTI\ToolProvider\ToolProvider\checkValue(), IMSGlobal\LTI\ToolProvider\ToolProvider\findService(), IMSGlobal\LTI\OAuth\OAuthRequest\from_request(), IMSGlobal\LTI\ToolProvider\Context\fromConsumer(), IMSGlobal\LTI\ToolProvider\ResourceLink\fromConsumer(), IMSGlobal\LTI\ToolProvider\User\fromResourceLink(), and user().
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\handleRequest().
|
private |
Check if a share arrangement is in place.
Definition at line 1175 of file ToolProvider.php.
References $_POST, IMSGlobal\LTI\ToolProvider\ToolProvider\$consumer, $id, $key, IMSGlobal\LTI\ToolProvider\ToolProvider\$ok, IMSGlobal\LTI\ToolProvider\ToolProvider\$resourceLink, IMSGlobal\LTI\ToolProvider\ResourceLink\fromConsumer(), and user().
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate().
|
private |
Validate a parameter value from an array of permitted values.
Definition at line 1263 of file ToolProvider.php.
References IMSGlobal\LTI\ToolProvider\ToolProvider\$ok, IMSGlobal\LTI\ToolProvider\ToolProvider\$reason, and $values.
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate().
|
private |
Call any callback function for the requested action.
This function may set the redirect_url and output properties.
Definition at line 583 of file ToolProvider.php.
References $_POST, and $result.
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\handleRequest(), and IMSGlobal\LTI\ToolProvider\ToolProvider\onError().
IMSGlobal\LTI\ToolProvider\ToolProvider::doToolProxyService | ( | ) |
Send the tool proxy to the Tool Consumer.
Definition at line 423 of file ToolProvider.php.
References $http, IMSGlobal\LTI\ToolProvider\ToolProvider\$ok, IMSGlobal\LTI\ToolProvider\ToolProvider\findService(), and IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector\getRandomString().
IMSGlobal\LTI\ToolProvider\ToolProvider::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 IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate(), and IMSGlobal\LTI\ToolProvider\ToolProvider\doToolProxyService().
IMSGlobal\LTI\ToolProvider\ToolProvider::getConsumers | ( | ) |
Get an array of defined tool consumers.
Definition at line 373 of file ToolProvider.php.
IMSGlobal\LTI\ToolProvider\ToolProvider::handleRequest | ( | ) |
Process an incoming request.
Definition at line 338 of file ToolProvider.php.
References IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate(), IMSGlobal\LTI\ToolProvider\ToolProvider\doCallback(), and IMSGlobal\LTI\ToolProvider\ToolProvider\result().
|
protected |
Process a valid content-item request.
Definition at line 542 of file ToolProvider.php.
References IMSGlobal\LTI\ToolProvider\ToolProvider\onError().
|
protected |
Process a response to an invalid request.
Definition at line 565 of file ToolProvider.php.
References IMSGlobal\LTI\ToolProvider\ToolProvider\doCallback().
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\onContentItem(), IMSGlobal\LTI\ToolProvider\ToolProvider\onLaunch(), IMSGlobal\LTI\ToolProvider\ToolProvider\onRegister(), and IMSGlobal\LTI\ToolProvider\ToolProvider\result().
|
protected |
Process a valid launch request.
Definition at line 530 of file ToolProvider.php.
References IMSGlobal\LTI\ToolProvider\ToolProvider\onError().
|
protected |
Process a valid tool proxy registration request.
Definition at line 554 of file ToolProvider.php.
References IMSGlobal\LTI\ToolProvider\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 IMSGlobal\LTI\ToolProvider\ResourceLink\doMembershipsService(), and IMSGlobal\LTI\ToolProvider\Service\Membership\get().
|
private |
Perform the result of an action.
This function may redirect the user to another URL rather than returning a value.
Definition at line 609 of file ToolProvider.php.
References $_POST, IMSGlobal\LTI\ToolProvider\ToolProvider\$errorOutput, IMSGlobal\LTI\ToolProvider\ToolProvider\$ok, IMSGlobal\LTI\ToolProvider\ToolProvider\$output, IMSGlobal\LTI\ToolProvider\ToolProvider\$returnUrl, $version, exit, and IMSGlobal\LTI\ToolProvider\ToolProvider\onError().
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\handleRequest().
|
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.
References $key, PHPMailer\PHPMailer\$params, EOD, html(), and input.
IMSGlobal\LTI\ToolProvider\ToolProvider::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.
References $name.
boolean IMSGlobal\LTI\ToolProvider\ToolProvider::$allowSharing = false |
Whether shared resource link arrangements are permitted.
Definition at line 200 of file ToolProvider.php.
string IMSGlobal\LTI\ToolProvider\ToolProvider::$baseUrl = null |
Base URL for tool provider service.
Definition at line 224 of file ToolProvider.php.
|
private |
Callback functions for handling requests.
Definition at line 298 of file ToolProvider.php.
|
private |
LTI parameter constraints for auto validation checks.
Definition at line 304 of file ToolProvider.php.
ToolConsumer IMSGlobal\LTI\ToolProvider\ToolProvider::$consumer = null |
Tool Consumer object.
Definition at line 152 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate(), and IMSGlobal\LTI\ToolProvider\ToolProvider\checkForShare().
Context IMSGlobal\LTI\ToolProvider\ToolProvider::$context = null |
Context object.
Definition at line 176 of file ToolProvider.php.
|
staticprivate |
Names of LTI custom parameter substitution variables (or capabilities) and their associated default message parameter names.
Definition at line 106 of file ToolProvider.php.
DataConnector IMSGlobal\LTI\ToolProvider\ToolProvider::$dataConnector = null |
Data connector object.
Definition at line 182 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\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 IMSGlobal\LTI\ToolProvider\ToolProvider::$defaultEmail = '' |
Default email domain.
Definition at line 188 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate().
array IMSGlobal\LTI\ToolProvider\ToolProvider::$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 IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate().
|
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 IMSGlobal\LTI\ToolProvider\ToolProvider\result().
int IMSGlobal\LTI\ToolProvider\ToolProvider::$idScope = self::ID_SCOPE_ID_ONLY |
Scope to use for user IDs.
Definition at line 194 of file ToolProvider.php.
|
staticprivate |
Names of LTI parameters to be retained in the consumer settings property.
Definition at line 81 of file ToolProvider.php.
|
staticprivate |
Names of LTI parameters to be retained in the context settings property.
Definition at line 87 of file ToolProvider.php.
|
staticprivate |
Names of LTI parameters to be retained in the resource link settings property.
Definition at line 95 of file ToolProvider.php.
|
staticprivate |
Permitted LTI versions for messages.
Definition at line 61 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 IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate().
string IMSGlobal\LTI\ToolProvider\ToolProvider::$message = self::CONNECTION_ERROR_MESSAGE |
Message for last request processed.
Definition at line 206 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate().
|
staticprivate |
List of supported message types and associated class methods.
Definition at line 65 of file ToolProvider.php.
|
staticprivate |
List of supported message types and associated class methods.
Definition at line 73 of file ToolProvider.php.
boolean IMSGlobal\LTI\ToolProvider\ToolProvider::$ok = true |
True if the last request was successful.
Definition at line 146 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate(), IMSGlobal\LTI\ToolProvider\ToolProvider\checkForShare(), IMSGlobal\LTI\ToolProvider\ToolProvider\checkValue(), IMSGlobal\LTI\ToolProvider\ToolProvider\doToolProxyService(), and IMSGlobal\LTI\ToolProvider\ToolProvider\result().
array IMSGlobal\LTI\ToolProvider\ToolProvider::$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 IMSGlobal\LTI\ToolProvider\ToolProvider\result().
Item IMSGlobal\LTI\ToolProvider\ToolProvider::$product = null |
Product details.
Definition at line 236 of file ToolProvider.php.
string IMSGlobal\LTI\ToolProvider\ToolProvider::$reason = null |
Error message for last request processed.
Definition at line 212 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\checkValue().
|
protected |
URL to redirect user to on successful completion of the request.
Definition at line 261 of file ToolProvider.php.
array IMSGlobal\LTI\ToolProvider\ToolProvider::$requiredServices = null |
Services required by Tool Provider.
Definition at line 242 of file ToolProvider.php.
array IMSGlobal\LTI\ToolProvider\ToolProvider::$resourceHandlers = null |
Resource handlers for Tool Provider.
Definition at line 254 of file ToolProvider.php.
ResourceLink IMSGlobal\LTI\ToolProvider\ToolProvider::$resourceLink = null |
Resource link object.
Definition at line 170 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\checkForShare().
string IMSGlobal\LTI\ToolProvider\ToolProvider::$returnUrl = null |
Return URL provided by tool consumer.
Definition at line 158 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\ToolProvider\result().
User IMSGlobal\LTI\ToolProvider\ToolProvider::$user = null |
User object.
Definition at line 164 of file ToolProvider.php.
Item IMSGlobal\LTI\ToolProvider\ToolProvider::$vendor = null |
Vendor details.
Definition at line 230 of file ToolProvider.php.
const IMSGlobal\LTI\ToolProvider\ToolProvider::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 IMSGlobal\LTI\ToolProvider\ToolProvider::ID_SCOPE_CONTEXT = 2 |
Prefix the ID with the consumer key and context ID.
Definition at line 48 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\User\getId().
const IMSGlobal\LTI\ToolProvider\ToolProvider::ID_SCOPE_GLOBAL = 1 |
Prefix an ID with the consumer key.
Definition at line 44 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\User\getId().
const IMSGlobal\LTI\ToolProvider\ToolProvider::ID_SCOPE_ID_ONLY = 0 |
Use ID value only.
Definition at line 40 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\User\getId(), IMSGlobal\LTI\ToolProvider\ToolConsumer\initialize(), IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector_mysql\loadUser(), IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector_pdo\loadUser(), IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector_mysql\saveUser(), and IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector_pdo\saveUser().
const IMSGlobal\LTI\ToolProvider\ToolProvider::ID_SCOPE_RESOURCE = 3 |
Prefix the ID with the consumer key and resource ID.
Definition at line 52 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\ResourceLink\doMembershipsService(), IMSGlobal\LTI\ToolProvider\Service\Membership\get(), and IMSGlobal\LTI\ToolProvider\User\getId().
const IMSGlobal\LTI\ToolProvider\ToolProvider::ID_SCOPE_SEPARATOR = ':' |
Character used to separate each element of an ID.
Definition at line 56 of file ToolProvider.php.
Referenced by IMSGlobal\LTI\ToolProvider\User\getId().
const IMSGlobal\LTI\ToolProvider\ToolProvider::LTI_VERSION1 = 'LTI-1p0' |
LTI version 1 for messages.
Definition at line 32 of file ToolProvider.php.
const IMSGlobal\LTI\ToolProvider\ToolProvider::LTI_VERSION2 = 'LTI-2p0' |
LTI version 2 for messages.
Definition at line 36 of file ToolProvider.php.