LTI Integration Library 5.0.0-rc2
PHP class library for building LTI integrations
 
Loading...
Searching...
No Matches
DataConnector_mysql Class Reference

Class to represent an LTI Data Connector for MySQL. More...

Inheritance diagram for DataConnector_mysql:
DataConnector

Public Member Functions

 __construct ($db, $dbTableNamePrefix='')
 Class constructor.
 
bool loadPlatform ($platform)
 Load platform object.
 
bool savePlatform ($platform)
 Save platform object.
 
bool deletePlatform ($platform)
 Delete platform object.
 
Platform[] getPlatforms ()
 Load all platforms from the database.
 
bool loadContext ($context)
 Load context object.
 
bool saveContext ($context)
 Save context object.
 
bool deleteContext ($context)
 Delete context object.
 
bool loadResourceLink ($resourceLink)
 Load resource link object.
 
bool saveResourceLink ($resourceLink)
 Save resource link object.
 
bool deleteResourceLink ($resourceLink)
 Delete resource link object.
 
UserResult[] getUserResultSourcedIDsResourceLink ($resourceLink, $localOnly, $idScope)
 Get array of user objects.
 
ResourceLinkShare[] getSharesResourceLink ($resourceLink)
 Get array of shares defined for this resource link.
 
bool loadPlatformNonce ($nonce)
 Load nonce object.
 
bool savePlatformNonce ($nonce)
 Save nonce object.
 
bool deletePlatformNonce ($nonce)
 Delete nonce object.
 
bool loadAccessToken ($accessToken)
 Load access token object.
 
bool saveAccessToken ($accessToken)
 Save access token object.
 
bool loadResourceLinkShareKey ($shareKey)
 Load resource link share key object.
 
bool saveResourceLinkShareKey ($shareKey)
 Save resource link share key object.
 
bool deleteResourceLinkShareKey ($shareKey)
 Delete resource link share key object.
 
bool loadUserResult ($userresult)
 Load user object.
 
bool saveUserResult ($userresult)
 Save user object.
 
bool deleteUserResult ($userresult)
 Delete user object.
 
bool loadTool ($tool)
 Load tool object.
 
bool saveTool ($tool)
 Save tool object.
 
bool deleteTool ($tool)
 Delete tool object.
 
Tool[] getTools ()
 Load tool objects.
 
string escape ($value, $addQuotes=true)
 Escape a string for use in a database query.
 
- Public Member Functions inherited from DataConnector
bool loadToolConsumer ($consumer)
 Load tool consumer object.
 
bool saveToolConsumer ($consumer)
 Save tool consumer object.
 
bool deleteToolConsumer ($consumer)
 Delete tool consumer object.
 
ToolConsumer[] getToolConsumers ()
 Load tool consumer objects.
 
bool loadPlatform ($platform)
 Load platform object.
 
bool savePlatform ($platform)
 Save platform object.
 
bool deletePlatform ($platform)
 Delete platform object.
 
Platform[] getPlatforms ()
 Load platform objects.
 
bool loadContext ($context)
 Load context object.
 
bool saveContext ($context)
 Save context object.
 
bool deleteContext ($context)
 Delete context object.
 
bool loadResourceLink ($resourceLink)
 Load resource link object.
 
bool saveResourceLink ($resourceLink)
 Save resource link object.
 
bool deleteResourceLink ($resourceLink)
 Delete resource link object.
 
UserResult[] getUserResultSourcedIDsResourceLink ($resourceLink, $localOnly, $idScope)
 Get array of user objects.
 
ResourceLinkShare[] getSharesResourceLink ($resourceLink)
 Get array of shares defined for this resource link.
 
bool loadConsumerNonce ($nonce)
 Load nonce object.
 
bool saveConsumerNonce ($nonce)
 Save nonce object.
 
bool deleteConsumerNonce ($nonce)
 Delete nonce object.
 
bool loadPlatformNonce ($nonce)
 Load nonce object.
 
bool savePlatformNonce ($nonce)
 Save nonce object.
 
bool deletePlatformNonce ($nonce)
 Delete nonce object.
 
bool loadAccessToken ($accessToken)
 Load access token object.
 
bool saveAccessToken ($accessToken)
 Save access token object.
 
bool loadResourceLinkShareKey ($shareKey)
 Load resource link share key object.
 
bool saveResourceLinkShareKey ($shareKey)
 Save resource link share key object.
 
bool deleteResourceLinkShareKey ($shareKey)
 Delete resource link share key object.
 
bool loadUserResult ($userresult)
 Load user object.
 
bool saveUserResult ($userresult)
 Save user object.
 
bool deleteUserResult ($userresult)
 Delete user object.
 
bool loadTool ($tool)
 Load tool object.
 
bool saveTool ($tool)
 Save tool object.
 
bool deleteTool ($tool)
 Delete tool object.
 
Tool[] getTools ()
 Load platform objects.
 
string escape ($value, $addQuotes=true)
 Escape a string for use in a database query.
 

Additional Inherited Members

- Static Public Member Functions inherited from DataConnector
static bool useMemcache ($host=null, $port=-1)
 Set/check whether memcached should be used when available.
 
static DataConnector getDataConnector ($db=null, $dbTableNamePrefix='', $type='')
 Create data connector object.
 
static string getRandomString ($length=8)
 Generate a random string.
 
static string quoted ($value, $addQuotes=true)
 Quote a string for use in a database query.
 
- Public Attributes inherited from DataConnector
const PLATFORM_TABLE_NAME = 'lti2_consumer'
 Default name for database table used to store platforms.
 
const CONSUMER_TABLE_NAME = self::PLATFORM_TABLE_NAME
 Default name for database table used to store platforms.
 
const CONTEXT_TABLE_NAME = 'lti2_context'
 Default name for database table used to store contexts.
 
const RESOURCE_LINK_TABLE_NAME = 'lti2_resource_link'
 Default name for database table used to store resource links.
 
const USER_RESULT_TABLE_NAME = 'lti2_user_result'
 Default name for database table used to store users.
 
const RESOURCE_LINK_SHARE_KEY_TABLE_NAME = 'lti2_share_key'
 Default name for database table used to store resource link share keys.
 
const NONCE_TABLE_NAME = 'lti2_nonce'
 Default name for database table used to store nonce values.
 
const ACCESS_TOKEN_TABLE_NAME = 'lti2_access_token'
 Default name for database table used to store access token values.
 
const TOOL_TABLE_NAME = 'lti2_tool'
 Default name for database table used to store tools.
 
- Protected Member Functions inherited from DataConnector
 __construct ($db, $dbTableNamePrefix='')
 Class constructor.
 
 fixPlatformSettings ($platform, $isSave)
 Adjust the settings for any platform properties being stored as a setting value.
 
 fixToolSettings ($tool, $isSave)
 Adjust the settings for any tool properties being stored as a setting value.
 
- Protected Attributes inherited from DataConnector
object resource $db = null
 Database connection.
 
string $dbTableNamePrefix = ''
 Prefix for database table names.
 
string $dateFormat = 'Y-m-d'
 SQL date format (default = 'Y-m-d')
 
string $timeFormat = 'H:i:s'
 SQL time format (default = 'H:i:s')
 

Detailed Description

Class to represent an LTI Data Connector for MySQL.

Deprecated:
Use DataConnector_mysqli instead
See also
DataConnector_mysqli
Author
Stephen P Vickers steph.nosp@m.en@s.nosp@m.pvsof.nosp@m.twar.nosp@m.eprod.nosp@m.ucts.nosp@m..com
Licence: http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3

Constructor & Destructor Documentation

◆ __construct()

__construct (   $db,
  $dbTableNamePrefix = '' 
)

Class constructor.

Parameters
object | resource$dbDatabase connection object
string$dbTableNamePrefixPrefix for database table names (optional, default is none)

Reimplemented from DataConnector.

References DataConnector\$db, DataConnector\$dbTableNamePrefix, and Util\logDebug().

Member Function Documentation

◆ deleteContext()

bool deleteContext (   $context)

Delete context object.

Parameters
Context$contextContext object
Returns
bool True if the Context object was successfully deleted

Reimplemented from DataConnector.

◆ deletePlatform()

bool deletePlatform (   $platform)

Delete platform object.

Parameters
Platform$platformPlatform object
Returns
bool True if the platform object was successfully deleted

Reimplemented from DataConnector.

◆ deletePlatformNonce()

bool deletePlatformNonce (   $nonce)

Delete nonce object.

Parameters
PlatformNonce$nonceNonce object
Returns
bool True if the nonce object was successfully deleted

Reimplemented from DataConnector.

◆ deleteResourceLink()

bool deleteResourceLink (   $resourceLink)

Delete resource link object.

Parameters
ResourceLink$resourceLinkResourceLink object
Returns
bool True if the resource link object was successfully deleted

Reimplemented from DataConnector.

◆ deleteResourceLinkShareKey()

bool deleteResourceLinkShareKey (   $shareKey)

Delete resource link share key object.

Parameters
ResourceLinkShareKey$shareKeyResource link share key object
Returns
bool True if the resource link share key object was successfully deleted

Reimplemented from DataConnector.

◆ deleteTool()

bool deleteTool (   $tool)

Delete tool object.

Parameters
Tool$toolTool object
Returns
bool True if the tool object was successfully deleted

Reimplemented from DataConnector.

◆ deleteUserResult()

bool deleteUserResult (   $userresult)

Delete user object.

Parameters
UserResult$userresultUserResult object
Returns
bool True if the user object was successfully deleted

Reimplemented from DataConnector.

◆ escape()

string escape (   $value,
  $addQuotes = true 
)

Escape 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.

Parameters
string$valueValue to be escaped
bool$addQuotesIf true the returned string will be enclosed in single quotes (optional, default is true)
Returns
string The escaped string.

Reimplemented from DataConnector.

Referenced by DataConnector_mysql\loadPlatform(), DataConnector_mysql\loadResourceLink(), DataConnector_mysql\loadTool(), DataConnector_mysql\saveAccessToken(), DataConnector_mysql\saveContext(), DataConnector_mysql\savePlatform(), DataConnector_mysql\saveResourceLink(), DataConnector_mysql\saveResourceLinkShareKey(), DataConnector_mysql\saveTool(), and DataConnector_mysql\saveUserResult().

◆ getPlatforms()

Platform[] getPlatforms ( )

Load all platforms from the database.

Returns
Platform[] An array of the Platform objects

Reimplemented from DataConnector.

References DataConnector\fixPlatformSettings().

◆ getSharesResourceLink()

ResourceLinkShare[] getSharesResourceLink (   $resourceLink)

Get array of shares defined for this resource link.

Parameters
ResourceLink$resourceLinkResourceLink object
Returns
ResourceLinkShare[] Array of ResourceLinkShare objects

Reimplemented from DataConnector.

◆ getTools()

Tool[] getTools ( )

Load tool objects.

Returns
Tool[] Array of all defined Tool objects

Reimplemented from DataConnector.

References DataConnector\fixToolSettings().

◆ getUserResultSourcedIDsResourceLink()

UserResult[] getUserResultSourcedIDsResourceLink (   $resourceLink,
  $localOnly,
  $idScope 
)

Get array of user objects.

Obtain an array of UserResult 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.

Parameters
ResourceLink$resourceLinkResource link object
bool$localOnlyTrue if only users within the resource link are to be returned (excluding users sharing this resource link)
int$idScopeScope value to use for user IDs
Returns
UserResult[] Array of UserResult objects

Reimplemented from DataConnector.

◆ loadAccessToken()

bool loadAccessToken (   $accessToken)

Load access token object.

Parameters
AccessToken$accessTokenAccess token object
Returns
bool True if the nonce object was successfully loaded

Reimplemented from DataConnector.

◆ loadContext()

bool loadContext (   $context)

Load context object.

Parameters
Context$contextContext object
Returns
bool True if the context object was successfully loaded

Reimplemented from DataConnector.

◆ loadPlatform()

bool loadPlatform (   $platform)

Load platform object.

Parameters
Platform$platformPlatform object
Returns
bool True if the platform object was successfully loaded

Reimplemented from DataConnector.

References DataConnector_mysql\escape(), and DataConnector\fixPlatformSettings().

◆ loadPlatformNonce()

bool loadPlatformNonce (   $nonce)

Load nonce object.

Parameters
PlatformNonce$nonceNonce object
Returns
bool True if the nonce object was successfully loaded

Reimplemented from DataConnector.

◆ loadResourceLink()

bool loadResourceLink (   $resourceLink)

Load resource link object.

Parameters
ResourceLink$resourceLinkResourceLink object
Returns
bool True if the resource link object was successfully loaded

Reimplemented from DataConnector.

References DataConnector_mysql\escape().

◆ loadResourceLinkShareKey()

bool loadResourceLinkShareKey (   $shareKey)

Load resource link share key object.

Parameters
ResourceLinkShareKey$shareKeyResourceLink share key object
Returns
bool True if the resource link share key object was successfully loaded

Reimplemented from DataConnector.

◆ loadTool()

bool loadTool (   $tool)

Load tool object.

Parameters
Tool$toolTool object
Returns
bool True if the tool object was successfully loaded

Reimplemented from DataConnector.

References DataConnector_mysql\escape(), and DataConnector\fixToolSettings().

◆ loadUserResult()

bool loadUserResult (   $userresult)

Load user object.

Parameters
UserResult$userresultUserResult object
Returns
bool True if the user object was successfully loaded

Reimplemented from DataConnector.

References Tool\ID_SCOPE_ID_ONLY.

◆ saveAccessToken()

bool saveAccessToken (   $accessToken)

Save access token object.

Parameters
AccessToken$accessTokenAccess token object
Returns
bool True if the access token object was successfully saved

Reimplemented from DataConnector.

References DataConnector_mysql\escape().

◆ saveContext()

bool saveContext (   $context)

Save context object.

Parameters
Context$contextContext object
Returns
bool True if the context object was successfully saved

Reimplemented from DataConnector.

References DataConnector_mysql\escape().

◆ savePlatform()

bool savePlatform (   $platform)

Save platform object.

Parameters
Platform$platformPlatform object
Returns
bool True if the platform object was successfully saved

Reimplemented from DataConnector.

References DataConnector_mysql\escape(), and DataConnector\fixPlatformSettings().

◆ savePlatformNonce()

bool savePlatformNonce (   $nonce)

Save nonce object.

Parameters
PlatformNonce$nonceNonce object
Returns
bool True if the nonce object was successfully saved

Reimplemented from DataConnector.

◆ saveResourceLink()

bool saveResourceLink (   $resourceLink)

Save resource link object.

Parameters
ResourceLink$resourceLinkResourceLink object
Returns
bool True if the resource link object was successfully saved

Reimplemented from DataConnector.

References DataConnector_mysql\escape().

◆ saveResourceLinkShareKey()

bool saveResourceLinkShareKey (   $shareKey)

Save resource link share key object.

Parameters
ResourceLinkShareKey$shareKeyResource link share key object
Returns
bool True if the resource link share key object was successfully saved

Reimplemented from DataConnector.

References DataConnector_mysql\escape().

◆ saveTool()

bool saveTool (   $tool)

Save tool object.

Parameters
Tool$toolTool object
Returns
bool True if the tool object was successfully saved

Reimplemented from DataConnector.

References DataConnector_mysql\escape(), and DataConnector\fixToolSettings().

◆ saveUserResult()

bool saveUserResult (   $userresult)

Save user object.

Parameters
UserResult$userresultUserResult object
Returns
bool True if the user object was successfully saved

Reimplemented from DataConnector.

References DataConnector_mysql\escape(), and Tool\ID_SCOPE_ID_ONLY.


The documentation for this class was generated from the following file: