Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]

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: 1026 lines (36 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.

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

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

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

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

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

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

return: array

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

param: ToolProxy $toolproxy
return: bool

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

param: ToolProxy $toolproxy
return: bool

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

param: ToolProxy $toolproxy
return: bool

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

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

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

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

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

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

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

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

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

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

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

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

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.

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
return: array Array of User objects

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

param: ToolConsumer $consumer
return: Context[]

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

param: ToolConsumer $consumer
return: ResourceLink

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

param: Context $context
return: ResourceLink

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

param: int $toolid
return: ToolConsumer[]

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