Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Extends the IMS Tool provider library data connector for moodle. More...
Public Member Functions | |
__construct () | |
data_connector constructor. | |
deleteContext ($context) | |
Delete context object. | |
deleteResourceLink ($resourcelink) | |
Delete resource link object. | |
deleteResourceLinkShareKey ($sharekey) | |
Delete resource link share key object. | |
deleteToolConsumer ($consumer) | |
Delete tool consumer object and related records. | |
deleteToolProxy ($toolproxy) | |
Delete the tool proxy from the database. | |
deleteUser ($user) | |
Delete user object. | |
get_consumers_mapped_to_tool ($toolid) | |
Fetches the list of ToolConsumer objects that are linked to a tool. | |
get_contexts_from_consumer (ToolConsumer $consumer) | |
Fetches the list of Context objects that are linked to a ToolConsumer. | |
get_resourcelink_from_consumer (ToolConsumer $consumer) | |
Fetches a resource link record that is associated with a ToolConsumer. | |
get_resourcelink_from_context (Context $context) | |
Fetches a resource link record that is associated with a Context object. | |
getSharesResourceLink ($resourcelink) | |
Get array of shares defined for this resource link. | |
getToolConsumers () | |
Load all tool consumers from the database. | |
getUserResultSourcedIDsResourceLink ($resourcelink, $localonly, $idscope) | |
Get array of user objects. | |
loadConsumerNonce ($nonce) | |
Load nonce object. | |
loadContext ($context) | |
Load context object. | |
loadResourceLink ($resourcelink) | |
Load resource link object. | |
loadResourceLinkShareKey ($sharekey) | |
Load resource link share key object. | |
loadToolConsumer ($consumer) | |
Load tool consumer object. | |
loadToolProxy ($toolproxy) | |
Load the tool proxy from the database. | |
loadUser ($user) | |
Load user object. | |
saveConsumerNonce ($nonce) | |
Save nonce object. | |
saveContext ($context) | |
Save context object. | |
saveResourceLink ($resourcelink) | |
Save resource link object. | |
saveResourceLinkShareKey ($sharekey) | |
Save resource link share key object. | |
saveToolConsumer ($consumer) | |
Save tool consumer object. | |
saveToolProxy ($toolproxy) | |
Save the tool proxy to the database. | |
saveUser ($user) | |
Save user object. | |
Static Public Member Functions | |
static | getDataConnector ($dbTableNamePrefix='', $db=null, $type='') |
Create data connector object. | |
static | getRandomString ($length=8) |
Generate a random string. | |
static | quoted ($value, $addQuotes=true) |
Quote a string for use in a database query. | |
Protected Member Functions | |
build_tool_consumer_object ($record, ToolConsumer $consumer) | |
Builds a ToolConsumer object from a record object from the DB. | |
Static Protected Member Functions | |
static | getConsumerKey ($key) |
Return a hash of a consumer key for values longer than 255 characters. | |
Protected Attributes | |
string | $consumertable |
Tool consumer table name. | |
string | $contexttable |
Context table name. | |
string | $dateFormat = 'Y-m-d' |
SQL date format (default = 'Y-m-d') | |
object | $db = null |
Database object. | |
string | $dbTableNamePrefix = '' |
Prefix for database table names. | |
string | $noncetable |
Consumer nonce table name. | |
string | $resourcelinktable |
Resource link table name. | |
string | $sharekeytable |
Resource link share key table name. | |
string | $timeFormat = 'H:i:s' |
SQL time format (default = 'H:i:s') | |
string | $toolproxytable |
Tool proxy table name. | |
string | $userresulttable |
User result table name. | |
Extends the IMS Tool provider library data connector for moodle.
|
protected |
enrol_lti\data_connector::deleteContext | ( | $context | ) |
Delete context object.
Context | $context | Context object |
boolean | True if the Context object was successfully deleted |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::deleteResourceLink | ( | $resourcelink | ) |
Delete resource link object.
ResourceLink | $resourcelink | ResourceLink object |
boolean | True if the resource link object and its related records were successfully deleted. Otherwise, a DML exception is thrown. |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::deleteResourceLinkShareKey | ( | $sharekey | ) |
Delete resource link share key object.
ResourceLinkShareKey | $sharekey | Resource link share key object |
boolean | True if the resource link share key object was successfully deleted |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::deleteToolConsumer | ( | $consumer | ) |
Delete tool consumer object and related records.
ToolConsumer | $consumer | Consumer object |
boolean | True if the tool consumer object was successfully deleted |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::deleteToolProxy | ( | $toolproxy | ) |
Delete the tool proxy from the database.
ToolProxy | $toolproxy |
bool |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::deleteUser | ( | $user | ) |
Delete user object.
User | $user | User object |
boolean | True if the user object was successfully deleted |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::get_consumers_mapped_to_tool | ( | $toolid | ) |
Fetches the list of ToolConsumer objects that are linked to a tool.
int | $toolid |
ToolConsumer[] |
enrol_lti\data_connector::get_contexts_from_consumer | ( | ToolConsumer | $consumer | ) |
Fetches the list of Context objects that are linked to a ToolConsumer.
ToolConsumer | $consumer |
Context[] |
enrol_lti\data_connector::get_resourcelink_from_consumer | ( | ToolConsumer | $consumer | ) |
Fetches a resource link record that is associated with a ToolConsumer.
ToolConsumer | $consumer |
ResourceLink |
enrol_lti\data_connector::get_resourcelink_from_context | ( | Context | $context | ) |
Fetches a resource link record that is associated with a Context object.
Context | $context |
ResourceLink |
|
staticprotectedinherited |
Return a hash of a consumer key for values longer than 255 characters.
string | $key |
string |
|
staticinherited |
Create data connector object.
A data connector provides access to persistent storage for the different objects.
Names of tables may be given a prefix to allow multiple versions to share the same schema. A separate sub-class is defined for each different database connection - the class to use is determined by inspecting the database object passed, but this can be overridden (for example, to use a bespoke connector) by specifying a type. If no database is passed then this class is used which acts as a dummy connector with no persistence.
string | $dbTableNamePrefix | Prefix for database table names (optional, default is none) |
object | $db | A database connection object or string (optional, default is no persistence) |
string | $type | The type of data connector (optional, default is based on $db parameter) |
DataConnector | Data connector object |
|
staticinherited |
Generate a random string.
The generated string will only comprise letters (upper- and lower-case) and digits.
int | $length | Length of string to be generated (optional, default is 8 characters) |
string | Random string |
enrol_lti\data_connector::getSharesResourceLink | ( | $resourcelink | ) |
Get array of shares defined for this resource link.
ResourceLink | $resourcelink | ResourceLink object |
array | Array of ResourceLinkShare objects |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::getToolConsumers | ( | ) |
Load all tool consumers from the database.
array |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::getUserResultSourcedIDsResourceLink | ( | $resourcelink, | |
$localonly, | |||
$idscope ) |
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.
ResourceLink | $resourcelink | Resource link object |
boolean | $localonly | True if only users within the resource link are to be returned (excluding users sharing this resource link) |
int | $idscope | Scope value to use for user IDs |
array | Array of User objects |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::loadConsumerNonce | ( | $nonce | ) |
Load nonce object.
ConsumerNonce | $nonce | Nonce object |
boolean | True if the nonce object was successfully loaded |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::loadContext | ( | $context | ) |
Load context object.
Context | $context | Context object |
boolean | True if the context object was successfully loaded |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::loadResourceLink | ( | $resourcelink | ) |
Load resource link object.
ResourceLink | $resourcelink | ResourceLink object |
boolean | True if the resource link object was successfully loaded |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::loadResourceLinkShareKey | ( | $sharekey | ) |
Load resource link share key object.
ResourceLinkShareKey | $sharekey | ResourceLink share key object |
boolean | True if the resource link share key object was successfully loaded |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::loadToolConsumer | ( | $consumer | ) |
Load tool consumer object.
ToolConsumer | $consumer | ToolConsumer object |
boolean | True if the tool consumer object was successfully loaded |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::loadToolProxy | ( | $toolproxy | ) |
Load the tool proxy from the database.
ToolProxy | $toolproxy |
bool |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::loadUser | ( | $user | ) |
Load user object.
User | $user | User object |
boolean | True if the user object was successfully loaded |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
|
staticinherited |
Quote a string for use in a database query.
Any single quotes in the value passed will be replaced with two single quotes. If a null value is passed, a string of 'null' is returned (which will never be enclosed in quotes irrespective of the value of the $addQuotes parameter.
string | $value | Value to be quoted |
bool | $addQuotes | If true the returned string will be enclosed in single quotes (optional, default is true) |
string | The quoted string. |
enrol_lti\data_connector::saveConsumerNonce | ( | $nonce | ) |
Save nonce object.
ConsumerNonce | $nonce | Nonce object |
boolean | True if the nonce object was successfully saved |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::saveContext | ( | $context | ) |
Save context object.
Context | $context | Context object |
boolean | True if the context object was successfully saved |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::saveResourceLink | ( | $resourcelink | ) |
Save resource link object.
ResourceLink | $resourcelink | Resource_Link object |
boolean | True if the resource link object was successfully saved |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::saveResourceLinkShareKey | ( | $sharekey | ) |
Save resource link share key object.
ResourceLinkShareKey | $sharekey | Resource link share key object |
boolean | True if the resource link share key object was successfully saved |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::saveToolConsumer | ( | $consumer | ) |
Save tool consumer object.
ToolConsumer | $consumer | Consumer object |
boolean | True if the tool consumer object was successfully saved |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::saveToolProxy | ( | $toolproxy | ) |
Save the tool proxy to the database.
ToolProxy | $toolproxy |
bool |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
enrol_lti\data_connector::saveUser | ( | $user | ) |
Save user object.
User | $user | User object |
boolean | True if the user object was successfully saved |
Reimplemented from IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector.
|
protectedinherited |
SQL date format (default = 'Y-m-d')
$dateFormat
|
protectedinherited |
Database object.
$db
|
protectedinherited |
Prefix for database table names.
$dbTableNamePrefix
|
protectedinherited |
SQL time format (default = 'H:i:s')
$timeFormat