Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
mod_lti\local\ltiservice\service_base Class Reference

The mod_lti\local\ltiservice\service_base class. More...

Inheritance diagram for mod_lti\local\ltiservice\service_base:
ltiservice_basicoutcomes\local\service\basicoutcomes ltiservice_gradebookservices\local\service\gradebookservices ltiservice_memberships\local\service\memberships ltiservice_profile\local\service\profile ltiservice_toolproxy\local\service\toolproxy ltiservice_toolsettings\local\service\toolsettings

Public Member Functions

 __construct ()
 Class constructor.
 
 check_tool ($typeid, $body=null, $scopes=null)
 Check that the request has been properly signed and is permitted. More...
 
 check_tool_proxy ($toolproxyguid, $body=null)
 Check that the request has been properly signed. More...
 
 check_type ($typeid, $courseid, $body=null)
 Check that the request has been properly signed. More...
 
 get_component_id ()
 Get the service compoent ID. More...
 
 get_configuration_options (&$mform)
 Returns the configuration options for this service. More...
 
 get_configuration_parameter_names ()
 Return an array with the names of the parameters that the service will be saving in the configuration. More...
 
 get_id ()
 Get the service ID. More...
 
 get_launch_parameters ($messagetype, $courseid, $userid, $typeid, $modlti=null)
 Return an array of key/values to add to the launch parameters. More...
 
 get_name ()
 Get the service name. More...
 
 get_permitted_scopes ()
 Get the scope(s) permitted for this service. More...
 
 get_resources ()
 Get the resources for this service. More...
 
 get_tool_proxy ()
 Get the tool proxy object. More...
 
 get_type ()
 Get the type object. More...
 
 get_typeconfig ()
 Get the type config array. More...
 
 is_allowed_in_context ($typeid, $courseid)
 Checks if there is a site tool or a course tool for this site. More...
 
 is_unsigned ()
 Get whether the service requests need to be signed. More...
 
 is_used_in_context ($typeid, $courseid)
 Default implementation will check for the existence of at least one mod_lti entry for that tool and context. More...
 
 parse_value ($value)
 Parse a string for custom substitution parameter variables supported by this service's resources. More...
 
stdClass set_tool_proxy ($toolproxy)
 Set the tool proxy object. More...
 
stdClass set_type ($type)
 Set the LTI type object. More...
 
array set_typeconfig ($typeconfig)
 Set the LTI type config object. More...
 

Static Public Member Functions

static get_service_path ()
 Get the path for service requests. More...
 

Public Attributes

const LTI_VERSION2P0 = 'LTI-2p0'
 Label representing an LTI 2 message type.
 
const SERVICE_ENABLED = 1
 Service enabled.
 

Protected Attributes

string $id
 ID for the service.
 
string $name
 Human readable name for the service.
 
array $resources
 Instances of the resources associated with this service.
 
boolean $unsigned
 true if requests for this service do not need to be signed.
 

Detailed Description

The mod_lti\local\ltiservice\service_base class.

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

Member Function Documentation

◆ check_tool()

mod_lti\local\ltiservice\service_base::check_tool (   $typeid,
  $body = null,
  $scopes = null 
)

Check that the request has been properly signed and is permitted.

Parameters
string$typeidLTI type ID
string$bodyRequest body (null if none)
string[]$scopesArray of required scope(s) for incoming request
Return values
boolean

◆ check_tool_proxy()

mod_lti\local\ltiservice\service_base::check_tool_proxy (   $toolproxyguid,
  $body = null 
)

Check that the request has been properly signed.

Parameters
string$toolproxyguidTool Proxy GUID
string$bodyRequest body (null if none)
Return values
boolean
Deprecated:
since Moodle 3.7 MDL-62599 - please do not use this function any more.
See also
service_base::check_tool()

◆ check_type()

mod_lti\local\ltiservice\service_base::check_type (   $typeid,
  $courseid,
  $body = null 
)

Check that the request has been properly signed.

Parameters
int$typeidThe tool id
int$courseidThe course we are at
string$bodyRequest body (null if none)
Return values
bool
Deprecated:
since Moodle 3.7 MDL-62599 - please do not use this function any more.
See also
service_base::check_tool()

◆ get_component_id()

mod_lti\local\ltiservice\service_base::get_component_id ( )

Get the service compoent ID.

Return values
string

◆ get_configuration_options()

mod_lti\local\ltiservice\service_base::get_configuration_options ( $mform)

Returns the configuration options for this service.

Parameters
MoodleQuickForm$mformMoodle quickform object definition

Reimplemented in ltiservice_toolsettings\local\service\toolsettings, ltiservice_memberships\local\service\memberships, and ltiservice_gradebookservices\local\service\gradebookservices.

◆ get_configuration_parameter_names()

mod_lti\local\ltiservice\service_base::get_configuration_parameter_names ( )

Return an array with the names of the parameters that the service will be saving in the configuration.

Return values
arrayNames list of the parameters that the service will be saving in the configuration
Deprecated:
since Moodle 3.7 - please do not use this function any more.

◆ get_id()

mod_lti\local\ltiservice\service_base::get_id ( )

Get the service ID.

Return values
string

◆ get_launch_parameters()

mod_lti\local\ltiservice\service_base::get_launch_parameters (   $messagetype,
  $courseid,
  $userid,
  $typeid,
  $modlti = null 
)

Return an array of key/values to add to the launch parameters.

Parameters
string$messagetype'basic-lti-launch-request' or 'ContentItemSelectionRequest'.
string$courseidThe course id.
string$useridThe user id.
string$typeidThe tool lti type id.
string$modltiThe id of the lti activity.

The type is passed to check the configuration and not return parameters for services not used.

Return values
arrayKey/value pairs to add as launch parameters.

Reimplemented in ltiservice_toolsettings\local\service\toolsettings, ltiservice_memberships\local\service\memberships, and ltiservice_gradebookservices\local\service\gradebookservices.

◆ get_name()

mod_lti\local\ltiservice\service_base::get_name ( )

Get the service name.

Return values
string

◆ get_permitted_scopes()

mod_lti\local\ltiservice\service_base::get_permitted_scopes ( )

Get the scope(s) permitted for this service.

A null value indicates that no scopes are required to access the service.

Return values
array|null

Reimplemented in ltiservice_toolsettings\local\service\toolsettings, ltiservice_memberships\local\service\memberships, ltiservice_gradebookservices\local\service\gradebookservices, and ltiservice_basicoutcomes\local\service\basicoutcomes.

◆ get_resources()

mod_lti\local\ltiservice\service_base::get_resources ( )
abstract

◆ get_service_path()

static mod_lti\local\ltiservice\service_base::get_service_path ( )
static

Get the path for service requests.

Return values
string

◆ get_tool_proxy()

mod_lti\local\ltiservice\service_base::get_tool_proxy ( )

Get the tool proxy object.

Return values
stdClass

◆ get_type()

mod_lti\local\ltiservice\service_base::get_type ( )

Get the type object.

Return values
stdClass

◆ get_typeconfig()

mod_lti\local\ltiservice\service_base::get_typeconfig ( )

Get the type config array.

Return values
array|null

◆ is_allowed_in_context()

mod_lti\local\ltiservice\service_base::is_allowed_in_context (   $typeid,
  $courseid 
)

Checks if there is a site tool or a course tool for this site.

Parameters
int$typeidThe tool lti type id.
int$courseidThe course id.
Return values
boolreturns True if tool is allowed in context, false otherwise.

◆ is_unsigned()

mod_lti\local\ltiservice\service_base::is_unsigned ( )

Get whether the service requests need to be signed.

Return values
boolean

◆ is_used_in_context()

mod_lti\local\ltiservice\service_base::is_used_in_context (   $typeid,
  $courseid 
)

Default implementation will check for the existence of at least one mod_lti entry for that tool and context.

It may be overridden if other inferences can be done.

Ideally a Site Tool should be explicitly engaged with a course, the check on the presence of a link is a proxy to infer a Site Tool engagement until an explicit Site Tool - Course relationship exists.

Parameters
int$typeidThe tool lti type id.
int$courseidThe course id.
Return values
boolreturns True if tool is used in context, false otherwise.

◆ parse_value()

mod_lti\local\ltiservice\service_base::parse_value (   $value)

Parse a string for custom substitution parameter variables supported by this service's resources.

Parameters
string$valueValue to be parsed
Return values
string

◆ set_tool_proxy()

stdClass mod_lti\local\ltiservice\service_base::set_tool_proxy (   $toolproxy)

Set the tool proxy object.

Parameters
object$toolproxyThe tool proxy for this service request

◆ set_type()

stdClass mod_lti\local\ltiservice\service_base::set_type (   $type)

Set the LTI type object.

Parameters
object$typeThe LTI type for this service request

◆ set_typeconfig()

array mod_lti\local\ltiservice\service_base::set_typeconfig (   $typeconfig)

Set the LTI type config object.

Parameters
array$typeconfigThe LTI type config for this service request

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