Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

Extends the IMS Tool provider library data connector for moodle.

Copyright: 2016 John Okely <john@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1024 lines (35 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: data_connector  - X-Ref

Extends the IMS Tool provider library data connector for moodle.

__construct()   X-Ref
data_connector constructor.


loadToolConsumer($consumer)   X-Ref
Load tool consumer object.

return: boolean True if the tool consumer object was successfully loaded
param: ToolConsumer $consumer ToolConsumer object

saveToolConsumer($consumer)   X-Ref
Save tool consumer object.

return: boolean True if the tool consumer object was successfully saved
param: ToolConsumer $consumer Consumer object

deleteToolConsumer($consumer)   X-Ref
Delete tool consumer object and related records.

return: boolean True if the tool consumer object was successfully deleted
param: ToolConsumer $consumer Consumer object

getToolConsumers()   X-Ref
Load all tool consumers from the database.

return: array

loadToolProxy($toolproxy)   X-Ref
Load the tool proxy from the database.

return: bool
param: ToolProxy $toolproxy

saveToolProxy($toolproxy)   X-Ref
Save the tool proxy to the database.

return: bool
param: ToolProxy $toolproxy

deleteToolProxy($toolproxy)   X-Ref
Delete the tool proxy from the database.

return: bool
param: ToolProxy $toolproxy

loadContext($context)   X-Ref
Load context object.

return: boolean True if the context object was successfully loaded
param: Context $context Context object

saveContext($context)   X-Ref
Save context object.

return: boolean True if the context object was successfully saved
param: Context $context Context object

deleteContext($context)   X-Ref
Delete context object.

return: boolean True if the Context object was successfully deleted
param: Context $context Context object

loadResourceLink($resourcelink)   X-Ref
Load resource link object.

return: boolean True if the resource link object was successfully loaded
param: ResourceLink $resourcelink ResourceLink object

saveResourceLink($resourcelink)   X-Ref
Save resource link object.

return: boolean True if the resource link object was successfully saved
param: ResourceLink $resourcelink Resource_Link object

deleteResourceLink($resourcelink)   X-Ref
Delete resource link object.

return: boolean True if the resource link object and its related records were successfully deleted.
param: ResourceLink $resourcelink ResourceLink object

getUserResultSourcedIDsResourceLink($resourcelink, $localonly, $idscope)   X-Ref
Get array of user objects.

Obtain an array of User objects for users with a result sourcedId.  The array may include users from other
resource links which are sharing this resource link.  It may also be optionally indexed by the user ID of a specified scope.

return: array Array of User objects
param: ResourceLink $resourcelink Resource link object
param: boolean $localonly True if only users within the resource link are to be returned
param: int $idscope Scope value to use for user IDs

getSharesResourceLink($resourcelink)   X-Ref
Get array of shares defined for this resource link.

return: array Array of ResourceLinkShare objects
param: ResourceLink $resourcelink ResourceLink object

loadConsumerNonce($nonce)   X-Ref
Load nonce object.

return: boolean True if the nonce object was successfully loaded
param: ConsumerNonce $nonce Nonce object

saveConsumerNonce($nonce)   X-Ref
Save nonce object.

return: boolean True if the nonce object was successfully saved
param: ConsumerNonce $nonce Nonce object

loadResourceLinkShareKey($sharekey)   X-Ref
Load resource link share key object.

return: boolean True if the resource link share key object was successfully loaded
param: ResourceLinkShareKey $sharekey ResourceLink share key object

saveResourceLinkShareKey($sharekey)   X-Ref
Save resource link share key object.

return: boolean True if the resource link share key object was successfully saved
param: ResourceLinkShareKey $sharekey Resource link share key object

deleteResourceLinkShareKey($sharekey)   X-Ref
Delete resource link share key object.

return: boolean True if the resource link share key object was successfully deleted
param: ResourceLinkShareKey $sharekey Resource link share key object

loadUser($user)   X-Ref
Load user object.

return: boolean True if the user object was successfully loaded
param: User $user User object

saveUser($user)   X-Ref
Save user object.

return: boolean True if the user object was successfully saved
param: User $user User object

deleteUser($user)   X-Ref
Delete user object.

return: boolean True if the user object was successfully deleted
param: User $user User object

get_contexts_from_consumer(ToolConsumer $consumer)   X-Ref
Fetches the list of Context objects that are linked to a ToolConsumer.

return: Context[]
param: ToolConsumer $consumer

get_resourcelink_from_consumer(ToolConsumer $consumer)   X-Ref
Fetches a resource link record that is associated with a ToolConsumer.

return: ResourceLink
param: ToolConsumer $consumer

get_resourcelink_from_context(Context $context)   X-Ref
Fetches a resource link record that is associated with a Context object.

return: ResourceLink
param: Context $context

get_consumers_mapped_to_tool($toolid)   X-Ref
Fetches the list of ToolConsumer objects that are linked to a tool.

return: ToolConsumer[]
param: int $toolid

build_tool_consumer_object($record, ToolConsumer $consumer)   X-Ref
Builds a ToolConsumer object from a record object from the DB.

param: stdClass $record The DB record object.
param: ToolConsumer $consumer