class User

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

This data comes from the LTI launch from the LMS. A context is the equivalent of a "class" or course. A context has a roster of users and each user has a role within the context. A launch may or may not contain a context. If there is a link without a context, it is a "system-wide" link like "view profile" or "show all courses"

Traits

This is a class holding convienence methods to access the json column for the core objects.

Properties

protected $TABLE_NAME
protected $PRIMARY_KEY
protected $ENTITY_NAME
$launch
$id The integer primary key for this user in the 'lti_user' table.
$key The logical key for this user in the 'lti_user' table.
$email The user's email
$displayname The user's display name
$firstname The user's first name
$lastname The user's last name
$locale The User's Locale
$image The User's Image / Avatar
$instructor Is the user an instructor?
$admin Is the user an administrator?

Methods

string
getJson()

Load the json field for this entity

from JsonTrait
getJsonKeyLegacy($key, $default = false)

No description

from JsonTrait
getJsonKey($key, $default = false)

Get a JSON key for this entity

from JsonTrait
setJson($json)

Set the JSON entry for this entity

from JsonTrait
setJsonKey($key, $value)

Set/update a JSON key for this entity

from JsonTrait
setJsonKeys($values)

Set/update an array of JSON keys for this entity

from JsonTrait
getNameAndEmail()

Construct the user's name / email combination

getFirstName($displayname = null)

Get the user's first name, falling back to email

static 
loadUserInfoBypass($user_id)

Load a user's info from the user_id

loadUserInfoBypassBySubject($user_subject)

Load a user's info from the user's subbect

Details

in JsonTrait at line 21
string getJson()

Load the json field for this entity

Return Value

string This returns the json string - it is not parsed - if there is nothing to return - this returns "false"

in JsonTrait at line 43
getJsonKeyLegacy($key, $default = false)

Parameters

$key
$default

in JsonTrait at line 61
getJsonKey($key, $default = false)

Get a JSON key for this entity

Parameters

$key The key to be retrieved from the JSON
$default The default value (optional)

in JsonTrait at line 78
setJson($json)

Set the JSON entry for this entity

Parameters

$json This is a string - no validation is done

in JsonTrait at line 96
setJsonKey($key, $value)

Set/update a JSON key for this entity

Parameters

$key The key to be inserted/updated in the JSON
$value The value to be inserted/updated in the JSON

in JsonTrait at line 114
setJsonKeys($values)

Set/update an array of JSON keys for this entity

Parameters

$values An array of key/value pairs to be inserted/updated in the JSON

at line 88
getNameAndEmail()

Construct the user's name / email combination

at line 109
getFirstName($displayname = null)

Get the user's first name, falling back to email

Parameters

$displayname

at line 123
static loadUserInfoBypass($user_id)

Load a user's info from the user_id

We make sure that the user is a member of the current context so as not to slide across silos.

Parameters

$user_id

at line 150
loadUserInfoBypassBySubject($user_subject)

Load a user's info from the user's subbect

We make sure that the user is a member of the current context and key so as not to slide across silos.

Parameters

$user_subject