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: 231 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: resource_link  - X-Ref

Class resource_link.

This class represents an LTI Advantage Resource Link (http://www.imsglobal.org/spec/lti/v1p3/#resource-link).

__construct(string $resourcelinkid, int $deploymentid, int $resourceid, ?int $contextid = null,int $id = null)   X-Ref
The private resource_link constructor.

param: string $resourcelinkid the id of the resource link as supplied by the platform.
param: int $deploymentid the local id of the deployment instance to which this resource link belongs.
param: int $resourceid the id of the local resource to which this link refers.
param: int|null $contextid the id local context object representing the context within the platform.
param: int|null $id the local id of this resource_link object.

create(string $resourcelinkid, int $deploymentid, int $resourceid, ?int $contextid = null,int $id = null)   X-Ref
Factory method to create an instance.

param: string $resourcelinkid the resourcelinkid, as provided by the platform.
param: int $deploymentid the local id of the deployment to which this resource link belongs.
param: int $resourceid the id of the local resource this resource_link refers to.
param: int|null $contextid the id of the local context object representing the platform context.
param: int|null $id the local id of the resource link instance.
return: resource_link the newly created instance.

get_id()   X-Ref
Return the id of this object instance.

return: null|int the id or null if the object has not yet been stored.

get_resourcelinkid()   X-Ref
Get the resourcelinkid as provided by the platform.

return: string the resourcelinkid.

get_deploymentid()   X-Ref
Return the id of the deployment to which this resource link belongs.

This id is the local id of the deployment instance, not the deploymentid provided by the platform.

return: int the deployment id.

get_resourceid()   X-Ref
Get the local id of the published resource to which this resource link refers.

return: int the id of the published resource.

get_contextid()   X-Ref
Return the id of the context object holding information about where this resource link resides.

return: int|null the id or null if not present.

set_contextid(int $contextid)   X-Ref
Link this resource_link instance with a context.

param: int $contextid the local id of the context instance containing information about the platform context.

set_resourceid(int $resourceid)   X-Ref
Set which local published resource this resource link refers to.

param: int $resourceid the published resource id.

add_grade_service(?\moodle_url $lineitemsurl = null, ?\moodle_url $lineitemurl = null, array $scopes = [])   X-Ref
Add grade service information to this resource_link instance.

param: \moodle_url|null $lineitemsurl the service URL for get/put of line items, if supported.
param: \moodle_url|null $lineitemurl the service URL if only a single line item is present in the platform.
param: string[] $scopes the string array of grade service scopes which may be used by the service.

get_grade_service()   X-Ref
Get the grade service attached to this resource_link instance, or null if there isn't one associated.

return: ags_info|null the grade service object instance, or null if not found.

add_names_and_roles_service(\moodle_url $contextmembershipurl, array $serviceversions)   X-Ref
Add names and roles service information to this resource_link instance.

param: \moodle_url $contextmembershipurl the service URL for memberships.
param: string[] $serviceversions the string array of supported service versions.

get_names_and_roles_service()   X-Ref
Get the names and roles service attached to this resource_link instance, or null if there isn't one associated.

return: nrps_info|null the names and roles service object instance, or null if not found.

add_user(int $userid, string $sourceid, string $lang,string $city, string $country, string $institution, string $timezone,?int $maildisplay = null)   X-Ref
Factory method to create a user from this resource_link instance.

This is useful for associating the user with the resource link and resource I.e. the user was created when
launching a specific resource link.

param: int $userid the id of the Moodle user record.
param: string $sourceid the id of the user on the platform.
param: string $lang the user's lang code.
param: string $city the user's city.
param: string $country the user's country.
param: string $institution the user's institution.
param: string $timezone the user's timezone.
param: int|null $maildisplay the user's maildisplay, which can be omitted to use sensible defaults.
return: user the user instance.