Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
enrol_lti\tool_provider Class Reference

Extends the IMS Tool provider library for the LTI enrolment. More...

Inheritance diagram for enrol_lti\tool_provider:
IMSGlobal\LTI\ToolProvider\ToolProvider

Public Member Functions

 __construct ($toolid)
 Create a new instance of tool_provider to handle all the LTI tool provider interactions.
 
 doToolProxyService ()
 Send the tool proxy to the Tool Consumer.
 
 findService ($format, $methods)
 Find an offered service based on a media type and HTTP action(s)
 
 getConsumers ()
 Get an array of defined tool consumers.
 
 handleRequest ()
 Process an incoming request.
 
 map_tool_to_consumer ()
 Performs mapping of the tool consumer to a published tool.
 
 setParameterConstraint ($name, $required=true, $maxLength=null, $messageTypes=null)
 Add a parameter constraint to be checked on launch.
 

Static Public Member Functions

static parseRoles ($roles)
 Get an array of fully qualified user roles.
 
static sendForm ($url, $params, $target='')
 Generate a web page containing an auto-submitted form of parameters.
 

Public Attributes

boolean $allowSharing = false
 Whether shared resource link arrangements are permitted.
 
string $baseUrl = null
 Base URL for tool provider service.
 
ToolConsumer $consumer = null
 Tool Consumer object.
 
Context $context = null
 Context object.
 
DataConnector $dataConnector = null
 Data connector object.
 
string $defaultEmail = ''
 Default email domain.
 
array $details = array()
 Details for error message relating to last request processed.
 
int $idScope = self::ID_SCOPE_ID_ONLY
 Scope to use for user IDs.
 
string $message = self::CONNECTION_ERROR_MESSAGE
 Message for last request processed.
 
boolean $ok = true
 True if the last request was successful.
 
array $optionalServices = null
 Optional services used by Tool Provider.
 
Item $product = null
 Product details.
 
string $reason = null
 Error message for last request processed.
 
array $requiredServices = null
 Services required by Tool Provider.
 
array $resourceHandlers = null
 Resource handlers for Tool Provider.
 
ResourceLink $resourceLink = null
 Resource link object.
 
string $returnUrl = null
 Return URL provided by tool consumer.
 
User $user = null
 User object.
 
Item $vendor = null
 Vendor details.
 
const CONNECTION_ERROR_MESSAGE = 'Sorry, there was an error connecting you to the application.'
 Default connection error message.
 
const ID_SCOPE_CONTEXT = 2
 Prefix the ID with the consumer key and context ID.
 
const ID_SCOPE_GLOBAL = 1
 Prefix an ID with the consumer key.
 
const ID_SCOPE_ID_ONLY = 0
 Use ID value only.
 
const ID_SCOPE_RESOURCE = 3
 Prefix the ID with the consumer key and resource ID.
 
const ID_SCOPE_SEPARATOR = ':'
 Character used to separate each element of an ID.
 
const LTI_VERSION1 = 'LTI-1p0'
 LTI version 1 for messages.
 
const LTI_VERSION2 = 'LTI-2p0'
 LTI version 2 for messages.
 

Protected Member Functions

 onContentItem ()
 Process a valid content-item request.
 
 onError ()
 Override onError for custom error handling.
 
 onLaunch ()
 Override onLaunch with tool logic.
 
 onRegister ()
 Override onRegister with registration code.
 
 strip_base_url ($url)
 Remove $this->baseUrl (wwwroot) from a given url string and return it.
 

Protected Attributes

boolean $debugMode = false
 Whether debug messages explaining the cause of errors are to be returned to the tool consumer.
 
string $documentTargets = null
 URL to redirect user to on successful completion of the request.
 
string $errorOutput = null
 HTML to be displayed on an unsuccessful completion of the request and no return URL is available.
 
string $mediaTypes = null
 URL to redirect user to on successful completion of the request.
 
string $output = null
 HTML to be displayed on a successful completion of the request.
 
string $redirectUrl = null
 URL to redirect user to on successful completion of the request.
 
stdClass $tool
 $tool The object representing the enrol instance providing this LTI tool
 

Detailed Description

Extends the IMS Tool provider library for the LTI enrolment.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

enrol_lti\tool_provider::__construct ( $toolid)

Create a new instance of tool_provider to handle all the LTI tool provider interactions.

Parameters
int$toolidThe id of the tool to be provided.

Reimplemented from IMSGlobal\LTI\ToolProvider\ToolProvider.

Member Function Documentation

◆ doToolProxyService()

IMSGlobal\LTI\ToolProvider\ToolProvider::doToolProxyService ( )
inherited

Send the tool proxy to the Tool Consumer.

Return values
booleanTrue if the tool proxy was accepted

◆ findService()

IMSGlobal\LTI\ToolProvider\ToolProvider::findService ( $format,
$methods )
inherited

Find an offered service based on a media type and HTTP action(s)

Parameters
string$formatMedia type required
array$methodsArray of HTTP actions required
Return values
objectThe service object

◆ getConsumers()

IMSGlobal\LTI\ToolProvider\ToolProvider::getConsumers ( )
inherited

Get an array of defined tool consumers.

Return values
arrayArray of ToolConsumer objects

◆ map_tool_to_consumer()

enrol_lti\tool_provider::map_tool_to_consumer ( )

Performs mapping of the tool consumer to a published tool.

Exceptions
moodle_exception

◆ onContentItem()

IMSGlobal\LTI\ToolProvider\ToolProvider::onContentItem ( )
protectedinherited

Process a valid content-item request.

Return values
booleanTrue if no error

◆ onError()

enrol_lti\tool_provider::onError ( )
protected

Override onError for custom error handling.

Return values
void

Reimplemented from IMSGlobal\LTI\ToolProvider\ToolProvider.

◆ onLaunch()

enrol_lti\tool_provider::onLaunch ( )
protected

Override onLaunch with tool logic.

Return values
void

Reimplemented from IMSGlobal\LTI\ToolProvider\ToolProvider.

◆ onRegister()

enrol_lti\tool_provider::onRegister ( )
protected

Override onRegister with registration code.

Reimplemented from IMSGlobal\LTI\ToolProvider\ToolProvider.

◆ parseRoles()

static IMSGlobal\LTI\ToolProvider\ToolProvider::parseRoles ( $roles)
staticinherited

Get an array of fully qualified user roles.

Parameters
mixed$rolesComma-separated list of roles or array of roles
Return values
arrayArray of roles

◆ sendForm()

static IMSGlobal\LTI\ToolProvider\ToolProvider::sendForm ( $url,
$params,
$target = '' )
staticinherited

Generate a web page containing an auto-submitted form of parameters.

Parameters
string$urlURL to which the form should be submitted
array$paramsArray of form parameters
string$targetName of target (optional)
Return values
string

◆ setParameterConstraint()

IMSGlobal\LTI\ToolProvider\ToolProvider::setParameterConstraint ( $name,
$required = true,
$maxLength = null,
$messageTypes = null )
inherited

Add a parameter constraint to be checked on launch.

Parameters
string$nameName of parameter to be checked
boolean$requiredTrue if parameter is required (optional, default is true)
int$maxLengthMaximum permitted length of parameter value (optional, default is null)
array$messageTypesArray of message types to which the constraint applies (optional, default is all)

◆ strip_base_url()

enrol_lti\tool_provider::strip_base_url ( $url)
protected

Remove $this->baseUrl (wwwroot) from a given url string and return it.

Parameters
string$urlThe url from which to remove the base url
Return values
string|nullA string of the relative path to the url, or null if it couldn't be determined.

Member Data Documentation

◆ $allowSharing

boolean IMSGlobal\LTI\ToolProvider\ToolProvider::$allowSharing = false
inherited

Whether shared resource link arrangements are permitted.

$allowSharing

◆ $baseUrl

string IMSGlobal\LTI\ToolProvider\ToolProvider::$baseUrl = null
inherited

Base URL for tool provider service.

$baseUrl

◆ $consumer

ToolConsumer IMSGlobal\LTI\ToolProvider\ToolProvider::$consumer = null
inherited

Tool Consumer object.

$consumer

◆ $context

Context IMSGlobal\LTI\ToolProvider\ToolProvider::$context = null
inherited

Context object.

$context

◆ $dataConnector

DataConnector IMSGlobal\LTI\ToolProvider\ToolProvider::$dataConnector = null
inherited

Data connector object.

$dataConnector

◆ $debugMode

boolean IMSGlobal\LTI\ToolProvider\ToolProvider::$debugMode = false
protectedinherited

Whether debug messages explaining the cause of errors are to be returned to the tool consumer.

$debugMode

◆ $defaultEmail

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

Default email domain.

$defaultEmail

◆ $details

array IMSGlobal\LTI\ToolProvider\ToolProvider::$details = array()
inherited

Details for error message relating to last request processed.

$details

◆ $documentTargets

string IMSGlobal\LTI\ToolProvider\ToolProvider::$documentTargets = null
protectedinherited

URL to redirect user to on successful completion of the request.

$documentTargets

◆ $errorOutput

string IMSGlobal\LTI\ToolProvider\ToolProvider::$errorOutput = null
protectedinherited

HTML to be displayed on an unsuccessful completion of the request and no return URL is available.

$errorOutput

◆ $idScope

int IMSGlobal\LTI\ToolProvider\ToolProvider::$idScope = self::ID_SCOPE_ID_ONLY
inherited

Scope to use for user IDs.

$idScope

◆ $mediaTypes

string IMSGlobal\LTI\ToolProvider\ToolProvider::$mediaTypes = null
protectedinherited

URL to redirect user to on successful completion of the request.

$mediaTypes

◆ $message

string IMSGlobal\LTI\ToolProvider\ToolProvider::$message = self::CONNECTION_ERROR_MESSAGE
inherited

Message for last request processed.

$message

◆ $ok

boolean IMSGlobal\LTI\ToolProvider\ToolProvider::$ok = true
inherited

True if the last request was successful.

$ok

◆ $optionalServices

array IMSGlobal\LTI\ToolProvider\ToolProvider::$optionalServices = null
inherited

Optional services used by Tool Provider.

$optionalServices

◆ $output

string IMSGlobal\LTI\ToolProvider\ToolProvider::$output = null
protectedinherited

HTML to be displayed on a successful completion of the request.

$output

◆ $product

Item IMSGlobal\LTI\ToolProvider\ToolProvider::$product = null
inherited

Product details.

$product

◆ $reason

string IMSGlobal\LTI\ToolProvider\ToolProvider::$reason = null
inherited

Error message for last request processed.

$reason

◆ $redirectUrl

string IMSGlobal\LTI\ToolProvider\ToolProvider::$redirectUrl = null
protectedinherited

URL to redirect user to on successful completion of the request.

$redirectUrl

◆ $requiredServices

array IMSGlobal\LTI\ToolProvider\ToolProvider::$requiredServices = null
inherited

Services required by Tool Provider.

$requiredServices

◆ $resourceHandlers

array IMSGlobal\LTI\ToolProvider\ToolProvider::$resourceHandlers = null
inherited

Resource handlers for Tool Provider.

$resourceHandlers

◆ $resourceLink

ResourceLink IMSGlobal\LTI\ToolProvider\ToolProvider::$resourceLink = null
inherited

Resource link object.

$resourceLink

◆ $returnUrl

string IMSGlobal\LTI\ToolProvider\ToolProvider::$returnUrl = null
inherited

Return URL provided by tool consumer.

$returnUrl

◆ $user

User IMSGlobal\LTI\ToolProvider\ToolProvider::$user = null
inherited

User object.

$user

◆ $vendor

Item IMSGlobal\LTI\ToolProvider\ToolProvider::$vendor = null
inherited

Vendor details.

$vendor


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