Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
ltiservice_memberships\local\service\memberships Class Reference

A service implementing Memberships. More...

Inheritance diagram for ltiservice_memberships\local\service\memberships:
mod_lti\local\ltiservice\service_base

Public Member Functions

 __construct ()
 Class constructor.
 
 check_tool ($typeid, $body=null, $scopes=null)
 Check that the request has been properly signed and is permitted.
 
 check_tool_proxy ($toolproxyguid, $body=null)
 Check that the request has been properly signed.
 
 check_type ($typeid, $courseid, $body=null)
 Check that the request has been properly signed.
 
 get_component_id ()
 Get the service compoent ID.
 
 get_configuration_options (&$mform)
 Adds form elements for membership add/edit page.
 
 get_configuration_parameter_names ()
 Return an array with the names of the parameters that the service will be saving in the configuration.
 
 get_id ()
 Get the service ID.
 
 get_jwt_claim_mappings ()
 Return an array of key/claim mapping allowing LTI 1.1 custom parameters to be transformed to LTI 1.3 claims.
 
 get_launch_parameters ($messagetype, $courseid, $user, $typeid, $modlti=null)
 Return an array of key/values to add to the launch parameters.
 
 get_members_json ($resource, $context, $course, $role, $limitfrom, $limitnum, $lti, $info, $response)
 Get the JSON for members.
 
 get_name ()
 Get the service name.
 
 get_permitted_scopes ()
 Get the scope(s) permitted for the tool relevant to this service.
 
 get_resources ()
 Get the resources for this service.
 
 get_scopes ()
 Get the scope(s) defined by this service.
 
 get_tool_proxy ()
 Get the tool proxy object.
 
 get_type ()
 Get the type object.
 
 get_typeconfig ()
 Get the type config array.
 
 instance_added (object $lti)
 Called when a new LTI Instance is added.
 
 instance_deleted (int $id)
 Called when a new LTI Instance is deleted.
 
 instance_updated (object $lti)
 Called when a new LTI Instance is updated.
 
 is_allowed_in_context ($typeid, $courseid)
 Checks if there is a site tool or a course tool for this site.
 
 is_unsigned ()
 Get whether the service requests need to be signed.
 
 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.
 
 override_endpoint (string $messagetype, string $targetlinkuri, ?string $customstr, int $courseid, ?object $lti=null)
 Called when the launch data is created, offering a possibility to alter the target link URI.
 
 parse_value ($value)
 Parse a string for custom substitution parameter variables supported by this service's resources.
 
 set_instance_form_values (object $defaultvalues)
 Set the form data when displaying the LTI Instance form.
 
stdClass set_tool_proxy ($toolproxy)
 Set the tool proxy object.
 
stdClass set_type ($type)
 Set the LTI type object.
 
array set_typeconfig ($typeconfig)
 Set the LTI type config object.
 

Static Public Member Functions

static get_service_path ()
 Get the path for service requests.
 
static get_users_json ($resource, $context, $contextid, $tool, $role, $limitfrom, $limitnum, $lti, $info)
 Get the JSON for members.
 

Public Attributes

const ALWAYS_INCLUDE_FIELD = 1
 Always include field.
 
const CONTEXT_ROLE_INSTRUCTOR = 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor'
 Context-level role for Instructor.
 
const CONTEXT_ROLE_LEARNER = 'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
 Context-level role for Learner.
 
const CONTEXT_ROLE_PREFIX = 'http://purl.imsglobal.org/vocab/lis/v2/membership#'
 Default prefix for context-level roles.
 
const DELEGATE_TO_INSTRUCTOR = 2
 Allow the instructor to decide if included.
 
const INSTRUCTOR_CAPABILITY = 'moodle/course:manageactivities'
 Capability used to identify Instructors.
 
const INSTRUCTOR_DELEGATE_INCLUDED = array(self::DELEGATE_TO_INSTRUCTOR && self::INSTRUCTOR_INCLUDED)
 Instructor delegated and approved for include.
 
const INSTRUCTOR_INCLUDED = 1
 Instructor chose to include field.
 
const LTI_VERSION2P0 = 'LTI-2p0'
 Label representing an LTI 2 message type.
 
const SCOPE_MEMBERSHIPS_READ = 'https://purl.imsglobal.org/spec/lti-nrps/scope/contextmembership.readonly'
 Scope for reading membership data.
 
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

A service implementing Memberships.

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

Constructor & Destructor Documentation

◆ __construct()

ltiservice_memberships\local\service\memberships::__construct ( )

Class constructor.

Reimplemented from mod_lti\local\ltiservice\service_base.

Member Function Documentation

◆ check_tool()

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

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 )
inherited

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 )
inherited

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 ( )
inherited

Get the service compoent ID.

Return values
string

◆ get_configuration_options()

ltiservice_memberships\local\service\memberships::get_configuration_options ( & $mform)

Adds form elements for membership add/edit page.

Parameters
MoodleQuickForm$mform

Reimplemented from mod_lti\local\ltiservice\service_base.

◆ get_configuration_parameter_names()

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

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 ( )
inherited

Get the service ID.

Return values
string

◆ get_jwt_claim_mappings()

ltiservice_memberships\local\service\memberships::get_jwt_claim_mappings ( )

Return an array of key/claim mapping allowing LTI 1.1 custom parameters to be transformed to LTI 1.3 claims.

Return values
arrayKey/value pairs of params to claim mapping.

Reimplemented from mod_lti\local\ltiservice\service_base.

◆ get_launch_parameters()

ltiservice_memberships\local\service\memberships::get_launch_parameters ( $messagetype,
$courseid,
$user,
$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$userThe 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
arrayof key/value pairs to add as launch parameters.

Reimplemented from mod_lti\local\ltiservice\service_base.

◆ get_members_json()

ltiservice_memberships\local\service\memberships::get_members_json ( $resource,
$context,
$course,
$role,
$limitfrom,
$limitnum,
$lti,
$info,
$response )

Get the JSON for members.

Parameters
mod_lti\local\ltiservice\resource_base$resourceResource handling the request
context_course$contextCourse context
course$courseCourse
string$roleUser role requested (empty if none)
int$limitfromPosition of first record to be returned
int$limitnumMaximum number of records to be returned
object$ltiLTI instance record
core_availability\info_module$infoConditional availability information for LTI instance (null if context-level request)
mod_lti\local\ltiservice\response$responseResponse object for the request
Return values
string

◆ get_name()

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

Get the service name.

Return values
string

◆ get_permitted_scopes()

ltiservice_memberships\local\service\memberships::get_permitted_scopes ( )

Get the scope(s) permitted for the tool relevant to this service.

Return values
array

Reimplemented from mod_lti\local\ltiservice\service_base.

◆ get_resources()

ltiservice_memberships\local\service\memberships::get_resources ( )

Get the resources for this service.

Return values
array

Reimplemented from mod_lti\local\ltiservice\service_base.

◆ get_scopes()

ltiservice_memberships\local\service\memberships::get_scopes ( )

Get the scope(s) defined by this service.

Return values
array

Reimplemented from mod_lti\local\ltiservice\service_base.

◆ get_service_path()

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

Get the path for service requests.

Return values
string

◆ get_tool_proxy()

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

Get the tool proxy object.

Return values
stdClass

◆ get_type()

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

Get the type object.

Return values
stdClass

◆ get_typeconfig()

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

Get the type config array.

Return values
array|null

◆ get_users_json()

static ltiservice_memberships\local\service\memberships::get_users_json ( $resource,
$context,
$contextid,
$tool,
$role,
$limitfrom,
$limitnum,
$lti,
$info )
static

Get the JSON for members.

Parameters
mod_lti\local\ltiservice\resource_base$resourceResource handling the request
context_course$contextCourse context
string$contextidCourse ID
object$toolTool instance object
string$roleUser role requested (empty if none)
int$limitfromPosition of first record to be returned
int$limitnumMaximum number of records to be returned
object$ltiLTI instance record
core_availability\info_module$infoConditional availability information for LTI instance (null if context-level request)
Return values
string
Deprecated
since Moodle 3.7 MDL-62599 - please do not use this function any more.
See also
memberships\get_members_json($resource, $context, $course, $role, $limitfrom, $limitnum, $lti, $info, $response)

◆ instance_added()

mod_lti\local\ltiservice\service_base::instance_added ( object $lti)
inherited

Called when a new LTI Instance is added.

Parameters
object$ltiLTI Instance.

Reimplemented in ltiservice_gradebookservices\local\service\gradebookservices.

◆ instance_deleted()

mod_lti\local\ltiservice\service_base::instance_deleted ( int $id)
inherited

Called when a new LTI Instance is deleted.

Parameters
int$idLTI Instance.

◆ instance_updated()

mod_lti\local\ltiservice\service_base::instance_updated ( object $lti)
inherited

Called when a new LTI Instance is updated.

Parameters
object$ltiLTI Instance.

Reimplemented in ltiservice_gradebookservices\local\service\gradebookservices.

◆ is_allowed_in_context()

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

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 ( )
inherited

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 )
inherited

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.

◆ override_endpoint()

mod_lti\local\ltiservice\service_base::override_endpoint ( string $messagetype,
string $targetlinkuri,
?string $customstr,
int $courseid,
?object $lti = null )
inherited

Called when the launch data is created, offering a possibility to alter the target link URI.

Parameters
string$messagetypemessage type for this launch
string$targetlinkuricurrent target link uri
null | string$customstrconcatenated list of custom parameters
int$courseid
null | object$ltiLTI Instance.
Return values
arraycontaining the target link URL and the custom params string to use.

Reimplemented in ltiservice_gradebookservices\local\service\gradebookservices.

◆ parse_value()

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

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

Parameters
string$valueValue to be parsed
Return values
string

◆ set_instance_form_values()

mod_lti\local\ltiservice\service_base::set_instance_form_values ( object $defaultvalues)
inherited

Set the form data when displaying the LTI Instance form.

Parameters
object$defaultvaluesDefault form values.

Reimplemented in ltiservice_gradebookservices\local\service\gradebookservices.

◆ set_tool_proxy()

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

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)
inherited

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)
inherited

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: