Class to represent a platform. More...
Public Member Functions | |
| __construct ($dataConnector=null) | |
| Class constructor. | |
| initialize () | |
| Initialise the platform. | |
| initialise () | |
| Initialise the platform. | |
| save () | |
| Save the platform to the database. | |
| delete () | |
| Delete the platform from the database. | |
| getId () | |
| Get the platform ID. | |
| getFamilyCode () | |
| Get platform family code (as reported by last platform connection). | |
| getDataConnector () | |
| Get the data connector. | |
| getAccessToken () | |
| Get the authorization access token. | |
| setAccessToken ($accessToken) | |
| Set the authorization access token. | |
| getIsAvailable () | |
| Is the platform available to accept launch requests? | |
| hasToolSettingsService () | |
| Check if the Tool Settings service is supported. | |
| getToolSettings ($simple=true) | |
| Get Tool Settings. | |
| setToolSettings ($settings=array()) | |
| Set Tool Settings. | |
| getTools () | |
| Get an array of defined tools. | |
| hasAccessTokenService () | |
| Check if the Access Token service is supported. | |
| getMessageParameters () | |
| Get the message parameters. | |
| handleRequest () | |
| Process an incoming request. | |
Public Member Functions inherited from System | |
| getRecordId () | |
| Get the system record ID. | |
| setRecordId ($id) | |
| Sets the system record ID. | |
| getKey () | |
| Get the consumer key. | |
| setKey ($key) | |
| Set the consumer key. | |
| getSetting ($name, $default='') | |
| Get a setting value. | |
| setSetting ($name, $value=null) | |
| Set a setting value. | |
| getSettings () | |
| Get an array of all setting values. | |
| setSettings ($settings) | |
| Set an array of all setting values. | |
| saveSettings () | |
| Save setting values. | |
| hasJwt () | |
| Check whether a JWT exists. | |
| getJwt () | |
| Get the JWT. | |
| getRawParameters () | |
| Get the raw POST parameters. | |
| getMessageClaims ($fullyQualified=false) | |
| Get the message claims. | |
| signParameters ($url, $type, $version, $params) | |
| Add the signature to an LTI message. | |
| signMessage (&$url, $type, $version, $params, $loginHint=null, $ltiMessageHint=null) | |
| Add the signature to an LTI message. | |
| sendMessage ($url, $type, $messageParams, $target='', $userId=null, $hint=null) | |
| Generate a web page containing an auto-submitted form of LTI message parameters. | |
| signServiceRequest ($url, $method, $type, $data=null) | |
| Generates the headers for an LTI service request. | |
| doServiceRequest ($service, $method, $format, $data) | |
| Perform a service request. | |
| useOAuth1 () | |
| Determine whether this consumer is using the OAuth 1 security model. | |
| addSignature ($endpoint, $data, $method='POST', $type=null, $nonce='', $hash=null, $timestamp=null) | |
| Add the signature to an array of message parameters or to a header string. | |
| checkMessage () | |
| Verify the required properties of an LTI message. | |
| verifySignature () | |
| Verify the signature of a message. | |
Static Public Member Functions | |
| static | fromConsumerKey ($key=null, $dataConnector=null, $autoEnable=false) |
| Load the platform from the database by its consumer key. | |
| static | fromPlatformId ($platformId, $clientId, $deploymentId, $dataConnector=null, $autoEnable=false) |
| Load the platform from the database by its platform, client and deployment IDs. | |
| static | fromRecordId ($id, $dataConnector) |
| Load the platform from the database by its record ID. | |
| static | getStorageJS () |
| Get the JavaScript for handling storage postMessages from a tool. | |
Static Public Member Functions inherited from System | |
| static | parseRoles ($roles, $ltiVersion=Util::LTI_VERSION1, $addPrincipalRole=false) |
| Parse a set of roles to comply with a specified version of LTI. | |
Static Public Member Functions inherited from ApiHook | |
| static | registerApiHook ($hookName, $familyCode, $className) |
| Register the availability of an API hook. | |
Data Fields | |
| $name = null | |
| Local name of platform. | |
| $platformId = null | |
| Platform ID. | |
| $clientId = null | |
| Client ID. | |
| $deploymentId = null | |
| Deployment ID. | |
| $authorizationServerId = null | |
| Authorization server ID. | |
| $authenticationUrl = null | |
| Login authentication URL. | |
| $accessTokenUrl = null | |
| Access Token service URL. | |
| $consumerName = null | |
| Name of platform (as reported by last platform connection). | |
| $consumerVersion = null | |
| Platform version (as reported by last platform connection). | |
| $profile = null | |
| The platform profile data. | |
| $toolProxy = null | |
| The tool proxy. | |
| $consumerGuid = null | |
| Platform GUID (as reported by first platform connection). | |
| $cssPath = null | |
| Optional CSS path (as reported by last platform connection). | |
| $protected = false | |
| Whether the platform instance is protected by matching the consumer_guid value in incoming requests. | |
| $idScope = Tool::ID_SCOPE_ID_ONLY | |
| Default scope to use when generating an Id value for a user. | |
| $defaultEmail = '' | |
| Default email address (or email domain) to use when no email address is provided for a user. | |
| $lastServiceRequest = null | |
| HttpMessage object for last service request. | |
Data Fields inherited from System | |
| $ok = true | |
| True if the last request was successful. | |
| $ltiVersion = null | |
| LTI version. | |
| $name = null | |
| Local name of platform/tool. | |
| $secret = null | |
| Shared secret. | |
| $signatureMethod = 'HMAC-SHA1' | |
| Method used for signing messages. | |
| $encryptionMethod = '' | |
| Algorithm used for encrypting messages. | |
| $dataConnector = null | |
| Data connector object. | |
| $rsaKey = null | |
| RSA key in PEM or JSON format. | |
| $requiredScopes = array() | |
| Scopes to request when obtaining an access token. | |
| $kid = null | |
| Key ID. | |
| $jku = null | |
| Endpoint for public key. | |
| $reason = null | |
| Error message for last request processed. | |
| $details = array() | |
| Details for error message relating to last request processed. | |
| $warnings = array() | |
| Warnings relating to last request processed. | |
| $debugMode = false | |
| Whether debug level messages are to be reported. | |
| $enabled = false | |
| Whether the system instance is enabled to accept connection requests. | |
| $enableFrom = null | |
| Timestamp from which the the system instance is enabled to accept connection requests. | |
| $enableUntil = null | |
| Timestamp until which the system instance is enabled to accept connection requests. | |
| $lastAccess = null | |
| Timestamp for date of last connection to this system. | |
| $created = null | |
| Timestamp for when the object was created. | |
| $updated = null | |
| Timestamp for when the object was last updated. | |
Static Public Attributes | |
| static | $MESSAGE_TYPES |
| List of supported incoming message types. | |
| static | $browserStorageFrame = null |
| Name of browser storage frame. | |
Static Public Attributes inherited from ApiHook | |
| static | $USER_ID_HOOK = "UserId" |
| User Id hook name. | |
| static | $CONTEXT_ID_HOOK = "ContextId" |
| Context Id hook name. | |
| static | $GROUPS_SERVICE_HOOK = "Groups" |
| Course Groups service hook name. | |
| static | $MEMBERSHIPS_SERVICE_HOOK = "Memberships" |
| Memberships service hook name. | |
| static | $OUTCOMES_SERVICE_HOOK = "Outcomes" |
| Outcomes service hook name. | |
| static | $TOOL_SETTINGS_SERVICE_HOOK = "ToolSettings" |
| Tool Settings service hook name. | |
| static | $ACCESS_TOKEN_SERVICE_HOOK = "AccessToken" |
| Access Token service hook name. | |
Protected Member Functions | |
| onInitiateLogin (&$url, &$loginHint, &$ltiMessageHint, $params) | |
| Save the hint and message parameters when sending an initiate login request. | |
| onAuthenticate () | |
| Check the hint and recover the message parameters for an authentication request. | |
| onContentItem () | |
| Process a valid content-item message. | |
| onLtiStartAssessment () | |
| Process a valid start assessment message. | |
| onError () | |
| Process a response to an invalid message. | |
Additional Inherited Members | |
Protected Attributes inherited from System | |
| $jwt = null | |
| JWT ClientInterface object. | |
| $rawParameters = null | |
| Raw message parameters. | |
| $messageParameters = null | |
| LTI message parameters. | |
Class to represent a platform.
Definition at line 17 of file Platform.php.
| __construct | ( | $dataConnector = null | ) |
Class constructor.
| DataConnector | null | $dataConnector | A data connector object |
Definition at line 168 of file Platform.php.
References System\$dataConnector, Context\getDataConnector(), and Platform\initialize().
| delete | ( | ) |
Delete the platform from the database.
Definition at line 237 of file Platform.php.
|
static |
Load the platform from the database by its consumer key.
| string | null | $key | Consumer key |
| DataConnector | $dataConnector | A data connector object |
| bool | $autoEnable | True if the platform is to be enabled automatically (optional, default is false) |
Definition at line 486 of file Platform.php.
References System\$dataConnector, and System\$ok.
Referenced by ToolConsumer\__construct(), and DataConnector_pdo\getPlatforms().
|
static |
Load the platform from the database by its platform, client and deployment IDs.
| string | $platformId | The platform ID |
| string | null | $clientId | The client ID |
| string | null | $deploymentId | The deployment ID |
| DataConnector | $dataConnector | A data connector object |
| bool | $autoEnable | True if the platform is to be enabled automatically (optional, default is false) |
Definition at line 511 of file Platform.php.
References Platform\$clientId, System\$dataConnector, Platform\$deploymentId, and Platform\$platformId.
|
static |
Load the platform from the database by its record ID.
| int | string | $id | The platform record ID |
| DataConnector | $dataConnector | A data connector object |
Definition at line 534 of file Platform.php.
References System\$dataConnector.
Referenced by Context\getPlatform(), and ResourceLink\getPlatform().
| getAccessToken | ( | ) |
Get the authorization access token.
Definition at line 302 of file Platform.php.
| getDataConnector | ( | ) |
Get the data connector.
Definition at line 292 of file Platform.php.
References System\$dataConnector.
| getFamilyCode | ( | ) |
Get platform family code (as reported by last platform connection).
Definition at line 273 of file Platform.php.
References Platform\$consumerVersion.
Referenced by Platform\getToolSettings(), Platform\hasAccessTokenService(), Platform\hasToolSettingsService(), and Platform\setToolSettings().
| getId | ( | ) |
Get the platform ID.
The ID will be the consumer key if one exists, otherwise a concatenation of the platform/client/deployment IDs
Definition at line 249 of file Platform.php.
References Platform\$clientId, Platform\$deploymentId, and Platform\$platformId.
| getIsAvailable | ( | ) |
Is the platform available to accept launch requests?
Definition at line 322 of file Platform.php.
References System\$enabled, and System\$ok.
| getMessageParameters | ( | ) |
Get the message parameters.
Definition at line 432 of file Platform.php.
References System\$messageParameters.
Referenced by Platform\handleRequest().
|
static |
Get the JavaScript for handling storage postMessages from a tool.
Definition at line 548 of file Platform.php.
| getTools | ( | ) |
Get an array of defined tools.
Definition at line 408 of file Platform.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 358 of file Platform.php.
References System\$ok, Platform\getFamilyCode(), and System\getSetting().
| handleRequest | ( | ) |
Process an incoming request.
Definition at line 444 of file Platform.php.
References Util\$logLevel, Platform\getMessageParameters(), Util\getRequestParameters(), Util\logError(), Util\LOGLEVEL_DEBUG, Util\logRequest(), and Platform\onError().
| hasAccessTokenService | ( | ) |
Check if the Access Token service is supported.
Definition at line 418 of file Platform.php.
References Platform\getFamilyCode(), and System\getSetting().
| hasToolSettingsService | ( | ) |
Check if the Tool Settings service is supported.
Definition at line 342 of file Platform.php.
References Platform\getFamilyCode(), and System\getSetting().
| initialise | ( | ) |
Initialise the platform.
Synonym for initialize().
Definition at line 217 of file Platform.php.
References Platform\initialize().
| initialize | ( | ) |
Initialise the platform.
Definition at line 180 of file Platform.php.
References Tool\ID_SCOPE_ID_ONLY.
Referenced by Platform\__construct(), and Platform\initialise().
|
protected |
Check the hint and recover the message parameters for an authentication request.
Override this method if the data has been saved elsewhere.
Definition at line 728 of file Platform.php.
|
protected |
Process a valid content-item message.
Definition at line 755 of file Platform.php.
|
protected |
Process a response to an invalid message.
Definition at line 773 of file Platform.php.
Referenced by Platform\handleRequest().
|
protected |
Save the hint and message parameters when sending an initiate login request.
Override this method to save the data elsewhere.
| string | $url | The message URL |
| string | $loginHint | The ID of the user |
| string | null | $ltiMessageHint | The message hint being sent to the tool |
| array | $params | An associative array of message parameters |
Definition at line 706 of file Platform.php.
|
protected |
Process a valid start assessment message.
Definition at line 764 of file Platform.php.
| save | ( | ) |
Save the platform to the database.
Definition at line 227 of file Platform.php.
| setAccessToken | ( | $accessToken | ) |
Set the authorization access token.
| AccessToken | $accessToken | Access token |
Definition at line 312 of file Platform.php.
| setToolSettings | ( | $settings = array() | ) |
Set Tool Settings.
| array | $settings | An associative array of settings (optional, default is none) |
Definition at line 385 of file Platform.php.
References System\$ok, Platform\getFamilyCode(), and System\getSetting().
| string null $accessTokenUrl = null |
Access Token service URL.
Definition at line 84 of file Platform.php.
| string null $authenticationUrl = null |
Login authentication URL.
Definition at line 77 of file Platform.php.
| string null $authorizationServerId = null |
Authorization server ID.
Definition at line 70 of file Platform.php.
|
static |
Name of browser storage frame.
Definition at line 35 of file Platform.php.
| string null $clientId = null |
Client ID.
Definition at line 56 of file Platform.php.
Referenced by Platform\fromPlatformId(), and Platform\getId().
| string null $consumerGuid = null |
Platform GUID (as reported by first platform connection).
Definition at line 119 of file Platform.php.
| string null $consumerName = null |
Name of platform (as reported by last platform connection).
Definition at line 91 of file Platform.php.
| string null $consumerVersion = null |
Platform version (as reported by last platform connection).
Definition at line 98 of file Platform.php.
Referenced by Platform\getFamilyCode().
| string null $cssPath = null |
Optional CSS path (as reported by last platform connection).
Definition at line 126 of file Platform.php.
| string $defaultEmail = '' |
Default email address (or email domain) to use when no email address is provided for a user.
Definition at line 147 of file Platform.php.
| string null $deploymentId = null |
Deployment ID.
Definition at line 63 of file Platform.php.
Referenced by Platform\fromPlatformId(), and Platform\getId().
| int $idScope = Tool::ID_SCOPE_ID_ONLY |
Default scope to use when generating an Id value for a user.
Definition at line 140 of file Platform.php.
| HttpMessage null $lastServiceRequest = null |
HttpMessage object for last service request.
Definition at line 154 of file Platform.php.
|
static |
List of supported incoming message types.
Definition at line 25 of file Platform.php.
| string null $name = null |
Local name of platform.
Definition at line 42 of file Platform.php.
| string null $platformId = null |
Platform ID.
Definition at line 49 of file Platform.php.
Referenced by Platform\fromPlatformId(), and Platform\getId().
| object null $profile = null |
The platform profile data.
Definition at line 105 of file Platform.php.
| bool $protected = false |
Whether the platform instance is protected by matching the consumer_guid value in incoming requests.
Definition at line 133 of file Platform.php.
| object null $toolProxy = null |
The tool proxy.
Definition at line 112 of file Platform.php.