class Result extends Entity

This is a class to provide access to the user's result data.

This data comes from the LTI launch from the LMS.

Traits

This is a trait convienence methods to access the session from the launch object
This is a class holding convienence methods to access the json column for the core objects.

Properties

$launch A reference to our containing launch from Entity
protected $TABLE_NAME
protected $PRIMARY_KEY
$id The integer primary key for this link in the 'lti_result' table.
$grade The current grade for the user

Methods

session_get($key, $default = null)

Get a key from the session

session_put($key, $value)

Set a key in the session

session_forget($key)

Forget a key in the session

session_flush()

Flush the session

ltiRawPostArray()

Return the original $_POST array

ltiParameter($varname, $default = false)

Pull a keyed variable from the original LTI post data in the current session with default

ltiParameterUpdate($varname, $value)

Update a keyed variable from the original LTI post data in the current session with default

ltiRawParameter($varname, $default = false)

Pull a keyed variable from the original LTI post data in the current session with default

ltiCustomGet($varname, $default = false)

Pull out a custom variable from the LTIX session. Do not include the "custom_" prefix - this is automatic.

string
getJson()

Load the json field for this entity

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
static 
lookupResultBypass($user_id)

No description

static mixed
gradeGet($row = false, $debug_log = false)

Load the grade for a particular row and update our local copy

static mixed
gradeSendStatic($grade, $row = false, $debug_log = false)

Send a grade and update our local copy

mixed
gradeSend($grade, $row = false, $debug_log = false)

Send a grade and update our local copy

gradeSendDueDate($gradetosend, $oldgrade = false, $dueDate = false)

Send a grade applying the due date logic and only increasing grades

getJSON()

Get the JSON for this result

setJSON($json)

Set the JSON for this result

getNote()

Get the Note for this result

setNote($note)

Set the Note for this result

Details

in SessionTrait at line 17
session_get($key, $default = null)

Get a key from the session

Parameters

$key
$default

in SessionTrait at line 24
session_put($key, $value)

Set a key in the session

Parameters

$key
$value

in SessionTrait at line 31
session_forget($key)

Forget a key in the session

Parameters

$key

in SessionTrait at line 38
session_flush()

Flush the session

in SessionTrait at line 45
ltiRawPostArray()

Return the original $_POST array

in SessionTrait at line 53
ltiParameter($varname, $default = false)

Pull a keyed variable from the original LTI post data in the current session with default

Parameters

$varname
$default

in SessionTrait at line 60
ltiParameterUpdate($varname, $value)

Update a keyed variable from the original LTI post data in the current session with default

Parameters

$varname
$value

in SessionTrait at line 68
ltiRawParameter($varname, $default = false)

Pull a keyed variable from the original LTI post data in the current session with default

Parameters

$varname
$default

in SessionTrait at line 76
ltiCustomGet($varname, $default = false)

Pull out a custom variable from the LTIX session. Do not include the "custom_" prefix - this is automatic.

Parameters

$varname
$default

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 41
getJsonKey($key, $default = false)

Get a JSON key for this entity

Parameters

$key
$default

in JsonTrait at line 58
setJson($json)

Set the JSON entry for this entity

Parameters

$json

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

Set/update a JSON key for this entity

Parameters

$key
$value

in JsonTrait at line 93
setJsonKeys($values)

Set/update an array of JSON keys for this entity

Parameters

$values

at line 41
static lookupResultBypass($user_id)

Parameters

$user_id

at line 83
static mixed gradeGet($row = false, $debug_log = false)

Load the grade for a particular row and update our local copy

Call the right LTI service to retrieve the server's grade and update our local cached copy of the server_grade and the date retrieved. This routine pulls the key and secret from the LTIX session to avoid crossing cross tennant boundaries.

TODO: Add LTI 2.x support for the JSON style services to this

Parameters

$row An optional array with the data that has the result_id, sourcedid, and service (url) if this is not present, the data is pulled from the LTI session for the current user/link combination.
$debug_log An (optional) array (by reference) that returns the steps that were taken. Each entry is an array with the [0] element a message and an optional [1] element as some detail (i.e. like a POST body)

Return Value

mixed If this work this returns a float. If not you get a string with an error.

at line 144
static mixed gradeSendStatic($grade, $row = false, $debug_log = false)

Send a grade and update our local copy

Call the right LTI service to send a new grade up to the server. update our local cached copy of the server_grade and the date retrieved. This routine pulls the key and secret from the LTIX session to avoid crossing cross tennant boundaries.

Parameters

$grade A new grade - floating point number between 0.0 and 1.0
$row An optional array with the data that has the result_id, sourcedid, service (url), key_key, and secret. If these are not present, the data is pulled from the LTI session for the current user/link combination.
$debug_log An (optional) array (by reference) that returns the steps that were taken. Each entry is an array with the [0] element a message and an optional [1] element as some detail (i.e. like a POST body)

Return Value

mixed If this works it returns true. If not, you get a string with an error.

at line 283
mixed gradeSend($grade, $row = false, $debug_log = false)

Send a grade and update our local copy

Call the right LTI service to send a new grade up to the server. update our local cached copy of the server_grade and the date retrieved. This routine pulls the key and secret from the LTIX session to avoid crossing cross tennant boundaries.

Parameters

$grade A new grade - floating point number between 0.0 and 1.0
$row An optional array with the data that has the result_id, sourcedid, service (url), key_key, and secret. If these are not present, the data is pulled from the LTI session for the current user/link combination.
$debug_log An (optional) array (by reference) that returns the steps that were taken. Each entry is an array with the [0] element a message and an optional [1] element as some detail (i.e. like a POST body)

Return Value

mixed If this works it returns true. If not, you get a string with an error.

at line 327
gradeSendDueDate($gradetosend, $oldgrade = false, $dueDate = false)

Send a grade applying the due date logic and only increasing grades

Puts messages in the session for a redirect.

Parameters

$gradetosend
  • The grade in the range 0.0 .. 1.0
$oldgrade
  • The previous grade in the range 0.0 .. 1.0 (optional)
$dueDate
  • The due date for this assignment

at line 363
getJSON()

Get the JSON for this result

at line 380
setJSON($json)

Set the JSON for this result

Parameters

$json

at line 397
getNote()

Get the Note for this result

at line 414
setNote($note)

Set the Note for this result

Parameters

$note