Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
IMSGlobal\LTI\ToolProvider\ToolConsumer Class Reference

Public Member Functions

 __construct ($key=null, $dataConnector=null, $autoEnable=false)
 Class constructor.
 
 delete ()
 Delete the tool consumer from the database.
 
 doServiceRequest ($service, $method, $format, $data)
 Perform a service request.
 
 getDataConnector ()
 Get the data connector.
 
 getIsAvailable ()
 Is the consumer key available to accept launch requests?
 
 getKey ()
 Get the tool consumer key.
 
 getRecordId ()
 Get the tool consumer record ID.
 
 getSetting ($name, $default='')
 Get a setting value.
 
 getSettings ()
 Get an array of all setting values.
 
 getToolSettings ($simple=true)
 Get Tool Settings.
 
 hasToolSettingsService ()
 Check if the Tool Settings service is supported.
 
 initialise ()
 Initialise the tool consumer.
 
 initialize ()
 Initialise the tool consumer.
 
 save ()
 Save the tool consumer to the database.
 
 saveSettings ()
 Save setting values.
 
 setKey ($key)
 Set the tool consumer key.
 
 setRecordId ($id)
 Sets the tool consumer record ID.
 
 setSetting ($name, $value=null)
 Set a setting value.
 
 setSettings ($settings)
 Set an array of all setting values.
 
 setToolSettings ($settings=array())
 Perform a Tool Settings service request.
 
 signParameters ($url, $type, $version, $params)
 Add the OAuth signature to an LTI message.
 

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.
 
static fromRecordId ($id, $dataConnector)
 Load the tool consumer from the database by its record ID.
 

Public Attributes

string $consumerGuid = null
 Tool consumer GUID (as reported by first tool consumer connection).
 
string $consumerName = null
 Name of tool consumer (as reported by last tool consumer connection).
 
string $consumerVersion = null
 Tool consumer version (as reported by last tool consumer connection).
 
int $created = null
 Date/time when the object was created.
 
string $cssPath = null
 Optional CSS path (as reported by last tool consumer connection).
 
string $defaultEmail = ''
 Default email address (or email domain) to use when no email address is provided for a user.
 
boolean $enabled = false
 Whether the tool consumer instance is enabled to accept incoming connection requests.
 
int $enableFrom = null
 Date/time from which the the tool consumer instance is enabled to accept incoming connection requests.
 
int $enableUntil = null
 Date/time until which the tool consumer instance is enabled to accept incoming connection requests.
 
int $idScope = ToolProvider::ID_SCOPE_ID_ONLY
 Default scope to use when generating an Id value for a user.
 
int $lastAccess = null
 Date of last connection from this tool consumer.
 
string $ltiVersion = null
 LTI version (as reported by last tool consumer connection).
 
string $name = null
 Local name of tool consumer.
 
stdClass $profile = null
 The consumer profile data.
 
boolean $protected = false
 Whether the tool consumer instance is protected by matching the consumer_guid value in incoming requests.
 
string $secret = null
 Shared secret.
 
array $settings = null
 Setting values (LTI parameters, custom parameters and local parameters).
 
int $updated = null
 Date/time when the object was last updated.
 

Constructor & Destructor Documentation

◆ __construct()

IMSGlobal\LTI\ToolProvider\ToolConsumer::__construct ( $key = null,
$dataConnector = null,
$autoEnable = false )

Class constructor.

Parameters
string$keyConsumer key
DataConnector$dataConnectorA data connector object
boolean$autoEnabletrue if the tool consumers is to be enabled automatically (optional, default is false)

Member Function Documentation

◆ addSignature()

static IMSGlobal\LTI\ToolProvider\ToolConsumer::addSignature ( $endpoint,
$consumerKey,
$consumerSecret,
$data,
$method = 'POST',
$type = null )
static

Add the OAuth signature to an array of message parameters or to a header string.

Return values
mixedArray of signed message parameters or header string

◆ delete()

IMSGlobal\LTI\ToolProvider\ToolConsumer::delete ( )

Delete the tool consumer from the database.

Return values
booleanTrue if the object was successfully deleted

◆ doServiceRequest()

IMSGlobal\LTI\ToolProvider\ToolConsumer::doServiceRequest ( $service,
$method,
$format,
$data )

Perform a service request.

Parameters
object$serviceService object to be executed
string$methodHTTP action
string$formatMedia type
mixed$dataArray of parameters or body string
Return values
HTTPMessageHTTP object containing request and response details

◆ fromRecordId()

static IMSGlobal\LTI\ToolProvider\ToolConsumer::fromRecordId ( $id,
$dataConnector )
static

Load the tool consumer from the database by its record ID.

Parameters
string$idThe consumer key record ID
DataConnector$dataConnectorDatabase connection object
Return values
objectToolConsumer The tool consumer object

◆ getDataConnector()

IMSGlobal\LTI\ToolProvider\ToolConsumer::getDataConnector ( )

Get the data connector.

Return values
mixedData connector object or string

◆ getIsAvailable()

IMSGlobal\LTI\ToolProvider\ToolConsumer::getIsAvailable ( )

Is the consumer key available to accept launch requests?

Return values
booleanTrue if the consumer key is enabled and within any date constraints

◆ getKey()

IMSGlobal\LTI\ToolProvider\ToolConsumer::getKey ( )

Get the tool consumer key.

Return values
stringConsumer key value

◆ getRecordId()

IMSGlobal\LTI\ToolProvider\ToolConsumer::getRecordId ( )

Get the tool consumer record ID.

Return values
intConsumer record ID value

◆ getSetting()

IMSGlobal\LTI\ToolProvider\ToolConsumer::getSetting ( $name,
$default = '' )

Get a setting value.

Parameters
string$nameName of setting
string$defaultValue to return if the setting does not exist (optional, default is an empty string)
Return values
stringSetting value

◆ getSettings()

IMSGlobal\LTI\ToolProvider\ToolConsumer::getSettings ( )

Get an array of all setting values.

Return values
arrayAssociative array of setting values

◆ getToolSettings()

IMSGlobal\LTI\ToolProvider\ToolConsumer::getToolSettings ( $simple = true)

Get Tool Settings.

Parameters
boolean$simpleTrue if all the simple media type is to be used (optional, default is true)
Return values
mixedThe array of settings if successful, otherwise false

◆ hasToolSettingsService()

IMSGlobal\LTI\ToolProvider\ToolConsumer::hasToolSettingsService ( )

Check if the Tool Settings service is supported.

Return values
booleanTrue if this tool consumer supports the Tool Settings service

◆ initialise()

IMSGlobal\LTI\ToolProvider\ToolConsumer::initialise ( )

Initialise the tool consumer.

Pseudonym for initialize().

◆ save()

IMSGlobal\LTI\ToolProvider\ToolConsumer::save ( )

Save the tool consumer to the database.

Return values
booleanTrue if the object was successfully saved

◆ saveSettings()

IMSGlobal\LTI\ToolProvider\ToolConsumer::saveSettings ( )

Save setting values.

Return values
booleanTrue if the settings were successfully saved

◆ setKey()

IMSGlobal\LTI\ToolProvider\ToolConsumer::setKey ( $key)

Set the tool consumer key.

Parameters
string$keyConsumer key value

◆ setRecordId()

IMSGlobal\LTI\ToolProvider\ToolConsumer::setRecordId ( $id)

Sets the tool consumer record ID.

Parameters
int$idConsumer record ID value

◆ setSetting()

IMSGlobal\LTI\ToolProvider\ToolConsumer::setSetting ( $name,
$value = null )

Set a setting value.

Parameters
string$nameName of setting
string$valueValue to set, use an empty value to delete a setting (optional, default is null)

◆ setSettings()

IMSGlobal\LTI\ToolProvider\ToolConsumer::setSettings ( $settings)

Set an array of all setting values.

Parameters
array$settingsAssociative array of setting values

◆ setToolSettings()

IMSGlobal\LTI\ToolProvider\ToolConsumer::setToolSettings ( $settings = array())

Perform a Tool Settings service request.

Parameters
array$settingsAn associative array of settings (optional, default is none)
Return values
booleanTrue if action was successful, otherwise false

◆ signParameters()

IMSGlobal\LTI\ToolProvider\ToolConsumer::signParameters ( $url,
$type,
$version,
$params )

Add the OAuth signature to an LTI message.

Parameters
string$urlURL for message request
string$typeLTI message type
string$versionLTI version
array$paramsMessage parameters
Return values
arrayArray of signed message parameters

Member Data Documentation

◆ $consumerGuid

string IMSGlobal\LTI\ToolProvider\ToolConsumer::$consumerGuid = null

Tool consumer GUID (as reported by first tool consumer connection).

$consumerGuid

◆ $consumerName

string IMSGlobal\LTI\ToolProvider\ToolConsumer::$consumerName = null

Name of tool consumer (as reported by last tool consumer connection).

$consumerName

◆ $consumerVersion

string IMSGlobal\LTI\ToolProvider\ToolConsumer::$consumerVersion = null

Tool consumer version (as reported by last tool consumer connection).

$consumerVersion

◆ $created

int IMSGlobal\LTI\ToolProvider\ToolConsumer::$created = null

Date/time when the object was created.

$created

◆ $cssPath

string IMSGlobal\LTI\ToolProvider\ToolConsumer::$cssPath = null

Optional CSS path (as reported by last tool consumer connection).

$cssPath

◆ $defaultEmail

string IMSGlobal\LTI\ToolProvider\ToolConsumer::$defaultEmail = ''

Default email address (or email domain) to use when no email address is provided for a user.

$defaultEmail

◆ $enabled

boolean IMSGlobal\LTI\ToolProvider\ToolConsumer::$enabled = false

Whether the tool consumer instance is enabled to accept incoming connection requests.

$enabled

◆ $enableFrom

int IMSGlobal\LTI\ToolProvider\ToolConsumer::$enableFrom = null

Date/time from which the the tool consumer instance is enabled to accept incoming connection requests.

$enableFrom

◆ $enableUntil

int IMSGlobal\LTI\ToolProvider\ToolConsumer::$enableUntil = null

Date/time until which the tool consumer instance is enabled to accept incoming connection requests.

$enableUntil

◆ $idScope

int IMSGlobal\LTI\ToolProvider\ToolConsumer::$idScope = ToolProvider::ID_SCOPE_ID_ONLY

Default scope to use when generating an Id value for a user.

$idScope

◆ $lastAccess

int IMSGlobal\LTI\ToolProvider\ToolConsumer::$lastAccess = null

Date of last connection from this tool consumer.

$lastAccess

◆ $ltiVersion

string IMSGlobal\LTI\ToolProvider\ToolConsumer::$ltiVersion = null

LTI version (as reported by last tool consumer connection).

$ltiVersion

◆ $name

string IMSGlobal\LTI\ToolProvider\ToolConsumer::$name = null

Local name of tool consumer.

$name

◆ $protected

boolean IMSGlobal\LTI\ToolProvider\ToolConsumer::$protected = false

Whether the tool consumer instance is protected by matching the consumer_guid value in incoming requests.

$protected

◆ $secret

string IMSGlobal\LTI\ToolProvider\ToolConsumer::$secret = null

Shared secret.

$secret

◆ $settings

array IMSGlobal\LTI\ToolProvider\ToolConsumer::$settings = null

Setting values (LTI parameters, custom parameters and local parameters).

$settings

◆ $updated

int IMSGlobal\LTI\ToolProvider\ToolConsumer::$updated = null

Date/time when the object was last updated.

$updated


The documentation for this class was generated from the following file: