Key
extends Entity
in package
uses
SettingsTrait
This is a class to provide access to the resource key level data.
This data comes from the LTI launch from the LMS. A context is the equivalent of a "client" or customer. A key has has security arrangements and possibly billing arrangements. Everything in Tsugi flows from a key. If you delete a key, all contexts and users are also deleted.
Table of Contents
Properties
- $guid : mixed
- Stable guid for this key, as 32 lowercase hex characters.
- $id : mixed
- The integer primary key for this context in the 'lti_key' table.
- $key : mixed
- $launch : mixed
- A reference to our containing launch
- $secret : mixed
- $settingsDebugArray : mixed
- $title : mixed
- The key title
- $ENTITY_NAME : mixed
- $PRIMARY_KEY : mixed
- $TABLE_NAME : mixed
Methods
- __construct() : mixed
- A guid already on the row is kept with no query. A null guid becomes the value read back after the conditional update, not the candidate that this request generated.
- getJson() : string
- Load the json field for this entity
- getJsonKey() : mixed
- Get a JSON key for this entity
- getJsonKeyLegacy() : mixed
- Get a JSON key for this entity (legacy array style)
- ltiCustomGet() : mixed
- Pull out a custom variable from the LTIX session. Do not include the "custom_" prefix - this is automatic.
- ltiParameter() : mixed
- Pull a keyed variable from the original LTI post data in the current session with default
- ltiParameterUpdate() : mixed
- Update a keyed variable from the original LTI post data in the current session with default
- ltiRawParameter() : mixed
- Pull a keyed variable from the original LTI post data in the current session with default
- ltiRawPostArray() : mixed
- Return the original $_POST array
- setJson() : mixed
- Set the JSON entry for this entity
- setJsonKey() : mixed
- Set/update a JSON key for this entity
- setJsonKeys() : mixed
- Set/update an array of JSON keys for this entity
- settingsDebug() : mixed
- Retrieve the debug array for the last operation.
- settingsGet() : mixed
- Retrieve a particular key from the settings.
- settingsGetAll() : mixed
- Retrieve an array of all of the settings
- settingsSet() : mixed
- Update a single key in settings
- settingsUpdate() : mixed
- Set or update a number of keys to new values in link settings.
- settingsSetAll() : mixed
- Replace all the settings (Dangerous)
Properties
$guid
Stable guid for this key, as 32 lowercase hex characters.
public
mixed
$guid
= null
$id
The integer primary key for this context in the 'lti_key' table.
public
mixed
$id
$key
public
mixed
$key
$launch
A reference to our containing launch
public
mixed
$launch
$secret
public
mixed
$secret
$settingsDebugArray
public
mixed
$settingsDebugArray
$title
The key title
public
mixed
$title
$ENTITY_NAME
protected
mixed
$ENTITY_NAME
= "key"
$PRIMARY_KEY
protected
mixed
$PRIMARY_KEY
= "key_id"
$TABLE_NAME
protected
mixed
$TABLE_NAME
= "lti_key"
Methods
__construct()
A guid already on the row is kept with no query. A null guid becomes the value read back after the conditional update, not the candidate that this request generated.
public
__construct([array<string, mixed>|null $row = null ]) : mixed
Parameters
- $row : array<string, mixed>|null = null
-
Launch or lti_key row. Null leaves guid unset.
getJson()
Load the json field for this entity
public
getJson() : string
Return values
string —This returns the json string - it is not parsed - if there is nothing to return - this returns "false"
getJsonKey()
Get a JSON key for this entity
public
getJsonKey(mixed $key[, mixed $default = false ]) : mixed
Parameters
- $key : mixed
-
The key to be retrieved from the JSON
- $default : mixed = false
-
The default value (optional)
getJsonKeyLegacy()
Get a JSON key for this entity (legacy array style)
public
getJsonKeyLegacy(mixed $key[, mixed $default = false ]) : mixed
Parameters
- $key : mixed
-
The key to be retrieved from the JSON
- $default : mixed = false
-
The default value (optional)
ltiCustomGet()
Pull out a custom variable from the LTIX session. Do not include the "custom_" prefix - this is automatic.
public
ltiCustomGet(mixed $varname[, mixed $default = false ]) : mixed
Parameters
- $varname : mixed
- $default : mixed = false
ltiParameter()
Pull a keyed variable from the original LTI post data in the current session with default
public
ltiParameter(mixed $varname[, mixed $default = false ]) : mixed
Parameters
- $varname : mixed
- $default : mixed = false
ltiParameterUpdate()
Update a keyed variable from the original LTI post data in the current session with default
public
ltiParameterUpdate(mixed $varname, mixed $value) : mixed
Parameters
- $varname : mixed
- $value : mixed
ltiRawParameter()
Pull a keyed variable from the original LTI post data in the current session with default
public
ltiRawParameter(mixed $varname[, mixed $default = false ]) : mixed
Parameters
- $varname : mixed
- $default : mixed = false
ltiRawPostArray()
Return the original $_POST array
public
ltiRawPostArray() : mixed
setJson()
Set the JSON entry for this entity
public
setJson(mixed $json) : mixed
Parameters
- $json : mixed
-
This is a string - no validation is done
setJsonKey()
Set/update a JSON key for this entity
public
setJsonKey(mixed $key, mixed $value) : mixed
Parameters
- $key : mixed
-
The key to be inserted/updated in the JSON
- $value : mixed
-
The value to be inserted/updated in the JSON
setJsonKeys()
Set/update an array of JSON keys for this entity
public
setJsonKeys(mixed $values) : mixed
Parameters
- $values : mixed
-
An array of key/value pairs to be inserted/updated in the JSON
settingsDebug()
Retrieve the debug array for the last operation.
public
settingsDebug() : mixed
settingsGet()
Retrieve a particular key from the settings.
public
settingsGet(mixed $key[, mixed $default = false ]) : mixed
Returns the value found in settings or false if the key was not found.
If the value is encrypted, it is decrypted using the LTIX::decrypt_secret method.
Parameters
- $key : mixed
-
- The key to get from the settings.
- $default : mixed = false
-
- What to return if the key is not present
settingsGetAll()
Retrieve an array of all of the settings
public
settingsGetAll() : mixed
If there are no settings, return an empty array.
settingsSet()
Update a single key in settings
public
settingsSet(mixed $key, mixed $value) : mixed
Parameters
- $key : mixed
- $value : mixed
settingsUpdate()
Set or update a number of keys to new values in link settings.
public
settingsUpdate(mixed $keyvals) : mixed
Parameters
- $keyvals : mixed
Tags
settingsSetAll()
Replace all the settings (Dangerous)
protected
settingsSetAll(mixed $new_settings) : mixed
Parameters
- $new_settings : mixed