Tsugi

Link extends Entity
in package
uses SettingsTrait

This is a class to provide access to the resource link level data.

This data comes from the LTI launch from the LMS. A resource_link may or may not be in a context. If there is a link without a context, it is a "system-wide" link like "view profile" or "show all courses"

Table of Contents

Properties

$activity  : mixed
The count of the overall activity on this link at the moment of launch
$grade  : mixed
The current grade for the user
$guid  : mixed
Stable guid for this link, as 32 lowercase hex characters.
$id  : mixed
The integer primary key for this link in the 'lti_link' table.
$launch  : mixed
A reference to our containing launch
$result_id  : mixed
The result_id for the link (if set)
$settingsDebugArray  : mixed
$title  : mixed
The link title
$user_activity  : mixed
The count of the user's activity on this link at the moment of launch
$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)
getPlacementSecret()  : mixed
Get the placement secret for this Link
loadLinkInfo()  : mixed
Load link information for a different link than current
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.
settingsDefaultsFromCustom()  : mixed
Load defaults from custom parameters once
settingsGet()  : mixed
Retrieve a setting by bubbling up from link to context to key to system level
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

$activity

The count of the overall activity on this link at the moment of launch

public mixed $activity = 0

$grade

The current grade for the user

public mixed $grade = null

If there is a current grade (float between 0.0 and 1.0) it is in this variable. If there is not yet a grade for this user/link combination, this will be null.

$guid

Stable guid for this link, as 32 lowercase hex characters.

public mixed $guid = null

$id

The integer primary key for this link in the 'lti_link' table.

public mixed $id

$launch

A reference to our containing launch

public mixed $launch

$result_id

The result_id for the link (if set)

public mixed $result_id = null

This is the primary key for the lti_result row for this user/link combination. It may be null. Is this is not null, we can send a grade back to the LMS for this user/link combination.

$title

The link title

public mixed $title

$user_activity

The count of the user's activity on this link at the moment of launch

public mixed $user_activity = 0

$ENTITY_NAME

protected mixed $ENTITY_NAME = "link"

$PRIMARY_KEY

protected mixed $PRIMARY_KEY = "link_id"

$TABLE_NAME

protected mixed $TABLE_NAME = "lti_link"

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_link 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)

getPlacementSecret()

Get the placement secret for this Link

public getPlacementSecret() : mixed

loadLinkInfo()

Load link information for a different link than current

public static loadLinkInfo(mixed $link_id) : mixed

Make sure not to cross Context silos.

Returns a row or false.

Parameters
$link_id : mixed

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

settingsDefaultsFromCustom()

Load defaults from custom parameters once

public settingsDefaultsFromCustom(mixed $keys) : mixed

Example:

$LAUNCH->link->settingsDefaultsFromCustom(array('tries', 'delay'));

Parameters
$keys : mixed

settingsGet()

Retrieve a setting by bubbling up from link to context to key to system level

public settingsGet(string $key[, mixed $default = false ]) : mixed

This overrides the settingsGet method in the SettingsTrait.

This method looks for a setting at the link level first. If not found or empty, it checks the context level. If still not found or empty, it checks the key level. If still not found or empty, it checks the system-wide extension settings via $CFG->getExtension() adding a prefix of "globalsetting_" to the key. Returns the first non-null value found, or the default if none is found.

Parameters
$key : string

The setting key to retrieve

$default : mixed = false

The default value to return if setting is not found or null at any level

Return values
mixed —

The setting value found at the lowest level that is not null, or the default

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
params

$keyvals An array of key value pairs that are to be placed in the settings.

settingsSetAll()

Replace all the settings (Dangerous)

protected settingsSetAll(mixed $new_settings) : mixed
Parameters
$new_settings : mixed

        
On this page

Search results