Abstract class to provide a connection to a persistent store for LTI objects

author Stephen P Vickers
version 2.5.00
license GNU Lesser General Public License, version 3
package LTI

 Methods

Load nonce object.

Consumer_Nonce_load(\LTI_Consumer_Nonce $nonce) : boolean

Parameters

$nonce

\LTI_Consumer_Nonce

Nonce object

Returns

booleanTrue if the nonce object was successfully loaded

Save nonce object.

Consumer_Nonce_save(\LTI_Consumer_Nonce $nonce) : boolean

Parameters

$nonce

\LTI_Consumer_Nonce

Nonce object

Returns

booleanTrue if the nonce object was successfully saved

Delete tool consumer object.

Tool_Consumer_delete(\LTI_Tool_Consumer $consumer) : boolean

Parameters

$consumer

\LTI_Tool_Consumer

Consumer object

Returns

booleanTrue if the tool consumer object was successfully deleted

Load tool consumer objects.

Tool_Consumer_list() : array

Returns

arrayArray of all defined LTI_Tool_Consumer objects

Load tool consumer object.

Tool_Consumer_load(mixed $consumer) : boolean

Parameters

$consumer

mixed

LTI_Tool_Consumer object

Returns

booleanTrue if the tool consumer object was successfully loaded

Save tool consumer object.

Tool_Consumer_save(\LTI_Tool_Consumer $consumer) : boolean

Parameters

$consumer

\LTI_Tool_Consumer

Consumer object

Returns

booleanTrue if the tool consumer object was successfully saved

Delete user object.

User_delete(\LTI_User $user) : boolean

Parameters

$user

\LTI_User

User object

Returns

booleanTrue if the user object was successfully deleted

Load user object.

User_load(\LTI_User $user) : boolean

Parameters

$user

\LTI_User

User object

Returns

booleanTrue if the user object was successfully loaded

Save user object.

User_save(\LTI_User $user) : boolean

Parameters

$user

\LTI_User

User object

Returns

booleanTrue if the user object was successfully saved

Create data connector object.

getDataConnector(mixed $data_connector, mixed $db = NULL, string $type = NULL) : \LTI_Data_Connector
Static
A type and table name prefix are required to make a database connection. The default is to use MySQL with no prefix. If a data connector object is passed, then this is returned unchanged. If the $data_connector parameter is a string, this is used as the prefix. If the $data_connector parameter is an array, the first entry should be a prefix string and an optional second entry being a string containing the database type or a database connection object (e.g. the value returned by a call to mysqli_connect() or a PDO object). A bespoke data connector class can be specified in the optional third parameter.

Parameters

$data_connector

mixed

A data connector object, string or array

$db

mixed

A database connection object or string (optional)

$type

string

The type of data connector (optional)

Returns

\LTI_Data_ConnectorData connector object

Generate a random string.

getRandomString(integer $length = 8) : string
Static
The generated string will only comprise letters (upper- and lower-case) and digits.

Parameters

$length

integer

Length of string to be generated (optional, default is 8 characters)

Returns

stringRandom string

Quote a string for use in a database query.

quoted(string $value, string $addQuotes = TRUE) : boolean
Static
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

$value

string

Value to be quoted

$addQuotes

string

If true the returned string will be enclosed in single quotes (optional, default is true)

Returns

booleanTrue if the user object was successfully deleted

 Properties

 

SQL date format (default = 'Y-m-d')

$date_format : string

Default

'Y-m-d'
 

SQL time format (default = 'H:i:s')

$time_format : string

Default

'H:i:s'

 Constants

 

Default name for database table used to store tool consumers.

CONSUMER_TABLE_NAME = 'lti_consumer' 
 

Default name for database table used to store resource links.

CONTEXT_TABLE_NAME = 'lti_context' 
 

Default name for database table used to store nonce values.

NONCE_TABLE_NAME = 'lti_nonce' 
     

Default name for database table used to store users.

USER_TABLE_NAME = 'lti_user'