Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

(no description)

File Size: 386 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: tool_launch_service  - X-Ref

Class tool_launch_service.

This class handles the launch of a resource by a user, using the LTI Advantage Resource Link Launch.

See http://www.imsglobal.org/spec/lti/v1p3/#launch-from-a-resource-link

__construct(deployment_repository $deploymentrepo,application_registration_repository $registrationrepo, resource_link_repository $resourcelinkrepo,user_repository $userrepo, context_repository $contextrepo)   X-Ref
The tool_launch_service constructor.

param: deployment_repository $deploymentrepo instance of a deployment_repository.
param: application_registration_repository $registrationrepo instance of an application_registration_repository.
param: resource_link_repository $resourcelinkrepo instance of a resource_link_repository.
param: user_repository $userrepo instance of a user_repository.
param: context_repository $contextrepo instance of a context_repository.

get_launch_data(LtiMessageLaunch $launch)   X-Ref
No description

context_from_launchdata(\stdClass $launchdata, deployment $deployment)   X-Ref
Get a context instance from the launch data.

param: \stdClass $launchdata launch data.
param: deployment $deployment the deployment to which the context belongs.
return: context the context instance.

resource_link_from_launchdata(\stdClass $launchdata, \stdClass $resource, deployment $deployment,?context $context)   X-Ref
Get a resource_link from the launch data.

param: \stdClass $launchdata the launch data.
param: \stdClass $resource the resource to which the resource link refers.
param: deployment $deployment the deployment to which the resource_link belongs.
param: context|null $context optional context in which the resource_link lives, null if not needed.
return: resource_link the resource_link instance.

lti_user_from_launchdata(\stdClass $user, \stdClass $launchdata, \stdClass $resource,resource_link $resourcelink)   X-Ref
Get an lti user instance from the launch data.

param: \stdClass $user the moodle user object.
param: \stdClass $launchdata the launch data.
param: \stdClass $resource the resource to which the user belongs.
param: resource_link $resourcelink the resource_link from which the user originated.
return: user the user instance.

migration_claim_from_launchdata(\stdClass $launchdata)   X-Ref
Get the migration claim from the launch data, or null if not found.

param: \stdClass $launchdata the launch data.
return: migration_claim|null the claim instance if present in the launch data, else null.

user_is_admin(\stdClass $launchdata)   X-Ref
Check whether the launch user has an admin role.

param: \stdClass $launchdata the launch data.
return: bool true if the user is admin, false otherwise.

user_is_staff(\stdClass $launchdata, bool $includelegacy = false)   X-Ref
Check whether the launch user is an instructor.

param: \stdClass $launchdata the launch data.
param: bool $includelegacy whether to also consider legacy simple names as valid roles.
return: bool true if the user is an instructor, false otherwise.

user_launches_tool(\stdClass $user, LtiMessageLaunch $launch)   X-Ref
Handles the use case "A user launches the tool so they can view an external resource".

param: \stdClass $user the Moodle user record, obtained via the auth_lti authentication process.
param: LtiMessageLaunch $launch the launch data.
return: array array containing [int $userid, \stdClass $resource]