Class to represent a platform context. More...
Public Member Functions | |
__construct () | |
Class constructor. | |
initialize () | |
Initialise the context. | |
initialise () | |
Initialise the context. | |
save () | |
Save the context to the database. | |
delete () | |
Delete the context from the database. | |
getConsumer () | |
Get tool consumer. | |
setConsumerId ($consumerId) | |
Set tool consumer ID. | |
getPlatform () | |
Get platform. | |
setPlatformId ($platformId) | |
Set platform ID. | |
getKey () | |
Get consumer key. | |
getId () | |
Get context ID. | |
getRecordId () | |
Get the context record ID. | |
setRecordId ($id) | |
Sets the context record ID. | |
getDataConnector () | |
Get the data connector. | |
getSetting ($name, $default='') | |
Get a setting value. | |
setSetting ($name, $value=null) | |
Set a setting value. | |
getSettings () | |
Get an array of all setting values. | |
setSettings ($settings) | |
Set an array of all setting values. | |
saveSettings () | |
Save setting values. | |
hasToolSettingsService () | |
Check if the Tool Settings service is available. | |
getToolSettings ($mode=Service\ToolSettings::MODE_CURRENT_LEVEL, $simple=true) | |
Get Tool Settings. | |
setToolSettings ($settings=array()) | |
Set Tool Settings. | |
hasGroupService () | |
Check if a Course Group service is available. | |
getGroups () | |
Get course group sets and groups. | |
hasMembershipService () | |
Check if the Membership service is supported. | |
hasMembershipsService () | |
Check if a Membership service is available. | |
getMembership () | |
Get Membership. | |
getMemberships ($withGroups=false) | |
Get Memberships. | |
hasLineItemService () | |
Check if the Line-item service is available. | |
hasScoreService () | |
Check if the Score service is available. | |
hasResultService () | |
Check if the Result service is available. | |
getLineItems ($resourceId=null, $tag=null, $limit=null) | |
Get line-items. | |
createLineItem ($lineItem) | |
Create a new line-item. | |
Static Public Member Functions | |
static | fromRecordId ($id, $dataConnector) |
Load the context from the database. | |
static | fromConsumer ($consumer, $ltiContextId) |
Class constructor from consumer. | |
static | fromPlatform ($platform, $ltiContextId) |
Class constructor from platform. | |
![]() | |
static | registerApiHook ($hookName, $familyCode, $className) |
Register the availability of an API hook. | |
Data Fields | |
$ltiContextId = null | |
Context ID as supplied in the last connection request. | |
$title = null | |
Context title. | |
$type = null | |
Context type. | |
$groupSets = null | |
User group sets (null if the platform does not support the groups enhancement) | |
$groups = null | |
User groups (null if the platform does not support the groups enhancement) | |
$lastServiceRequest = null | |
HttpMessage object for last service request. | |
$created = null | |
Timestamp for when the object was created. | |
$updated = null | |
Timestamp for when the object was last updated. | |
Additional Inherited Members | |
![]() | |
static | $USER_ID_HOOK = "UserId" |
User Id hook name. | |
static | $CONTEXT_ID_HOOK = "ContextId" |
Context Id hook name. | |
static | $GROUPS_SERVICE_HOOK = "Groups" |
Course Groups service hook name. | |
static | $MEMBERSHIPS_SERVICE_HOOK = "Memberships" |
Memberships service hook name. | |
static | $OUTCOMES_SERVICE_HOOK = "Outcomes" |
Outcomes service hook name. | |
static | $TOOL_SETTINGS_SERVICE_HOOK = "ToolSettings" |
Tool Settings service hook name. | |
static | $ACCESS_TOKEN_SERVICE_HOOK = "AccessToken" |
Access Token service hook name. | |
Class to represent a platform context.
Definition at line 17 of file Context.php.
__construct | ( | ) |
createLineItem | ( | $lineItem | ) |
Create a new line-item.
LineItem | $lineItem | Line-item object |
Definition at line 642 of file Context.php.
delete | ( | ) |
Delete the context from the database.
Definition at line 182 of file Context.php.
References Context\getDataConnector().
|
static |
Class constructor from consumer.
ToolConsumer | $consumer | Consumer instance |
string | $ltiContextId | LTI Context ID value |
Definition at line 681 of file Context.php.
References Context\$ltiContextId, and Context\fromPlatform().
|
static |
Class constructor from platform.
Platform | $platform | Platform instance |
string | $ltiContextId | LTI Context ID value |
Definition at line 694 of file Context.php.
References Context\$ltiContextId.
Referenced by Context\fromConsumer().
|
static |
Load the context from the database.
int | $id | Record ID of context |
DataConnector | $dataConnector | Database connection object |
Definition at line 661 of file Context.php.
Referenced by ResourceLink\getContext().
getConsumer | ( | ) |
Get tool consumer.
Definition at line 195 of file Context.php.
References Context\getPlatform(), and Util\logDebug().
getDataConnector | ( | ) |
Get the data connector.
Definition at line 287 of file Context.php.
Referenced by Platform\__construct(), Tool\__construct(), Context\delete(), Context\getPlatform(), and Context\save().
getGroups | ( | ) |
Get course group sets and groups.
Definition at line 452 of file Context.php.
References Context\getPlatform(), and Context\getSetting().
getId | ( | ) |
Get context ID.
Definition at line 257 of file Context.php.
References Context\$ltiContextId.
getKey | ( | ) |
Get consumer key.
Definition at line 247 of file Context.php.
References Context\getPlatform().
getLineItems | ( | $resourceId = null , |
|
$tag = null , |
|||
$limit = null |
|||
) |
Get line-items.
string | null | $resourceId | Tool resource ID |
string | null | $tag | Tag |
int | null | $limit | Limit of line-items to be returned in each request, null for service default |
Definition at line 621 of file Context.php.
getMembership | ( | ) |
Get Membership.
Definition at line 507 of file Context.php.
References Context\getMemberships(), and Util\logDebug().
getMemberships | ( | $withGroups = false | ) |
Get Memberships.
bool | $withGroups | True is group information is to be requested as well |
Definition at line 521 of file Context.php.
References Context\getPlatform(), and Context\getSetting().
Referenced by Context\getMembership().
getPlatform | ( | ) |
Get platform.
Definition at line 222 of file Context.php.
References Platform\fromRecordId(), and Context\getDataConnector().
Referenced by Context\getConsumer(), Context\getGroups(), Context\getKey(), Context\getMemberships(), Context\getToolSettings(), Context\hasGroupService(), Context\hasMembershipsService(), Context\hasToolSettingsService(), and Context\setToolSettings().
getRecordId | ( | ) |
Get the context record ID.
Definition at line 267 of file Context.php.
getSetting | ( | $name, | |
$default = '' |
|||
) |
Get a setting value.
string | $name | Name of setting |
string | $default | Value to return if the setting does not exist (optional, default is an empty string) |
Definition at line 300 of file Context.php.
Referenced by Context\getGroups(), Context\getMemberships(), Context\getToolSettings(), Context\hasGroupService(), Context\hasLineItemService(), Context\hasMembershipsService(), Context\hasResultService(), Context\hasScoreService(), Context\hasToolSettingsService(), Context\setSetting(), and Context\setToolSettings().
getSettings | ( | ) |
Get an array of all setting values.
Definition at line 335 of file Context.php.
getToolSettings | ( | $mode = Service\ToolSettings::MODE_CURRENT_LEVEL , |
|
$simple = true |
|||
) |
Get Tool Settings.
int | $mode | Mode for request (optional, default is current level only) |
bool | $simple | True if all the simple media type is to be used (optional, default is true) |
Definition at line 388 of file Context.php.
References Context\getPlatform(), and Context\getSetting().
hasGroupService | ( | ) |
Check if a Course Group service is available.
Definition at line 438 of file Context.php.
References Context\getPlatform(), and Context\getSetting().
hasLineItemService | ( | ) |
Check if the Line-item service is available.
Definition at line 563 of file Context.php.
References Context\getSetting().
hasMembershipService | ( | ) |
Check if the Membership service is supported.
Definition at line 478 of file Context.php.
References Context\hasMembershipsService(), and Util\logDebug().
hasMembershipsService | ( | ) |
Check if a Membership service is available.
Definition at line 490 of file Context.php.
References Context\getPlatform(), and Context\getSetting().
Referenced by Context\hasMembershipService().
hasResultService | ( | ) |
Check if the Result service is available.
Definition at line 599 of file Context.php.
References Result\$SCOPE, and Context\getSetting().
hasScoreService | ( | ) |
Check if the Score service is available.
Definition at line 581 of file Context.php.
References Score\$SCOPE, and Context\getSetting().
hasToolSettingsService | ( | ) |
Check if the Tool Settings service is available.
Definition at line 371 of file Context.php.
References Context\getPlatform(), and Context\getSetting().
initialise | ( | ) |
Initialise the context.
Synonym for initialize().
Definition at line 157 of file Context.php.
References Context\initialize().
initialize | ( | ) |
Initialise the context.
Definition at line 142 of file Context.php.
Referenced by Context\__construct(), and Context\initialise().
save | ( | ) |
Save the context to the database.
Definition at line 167 of file Context.php.
References Context\getDataConnector().
Referenced by Context\saveSettings().
saveSettings | ( | ) |
Save setting values.
Definition at line 355 of file Context.php.
References Context\save().
setConsumerId | ( | $consumerId | ) |
Set tool consumer ID.
int | $consumerId | Tool Consumer ID for this context. |
Definition at line 210 of file Context.php.
References Util\logDebug(), and Context\setPlatformId().
setPlatformId | ( | $platformId | ) |
Set platform ID.
int | null | $platformId | Platform ID for this context. |
Definition at line 236 of file Context.php.
Referenced by Context\setConsumerId().
setRecordId | ( | $id | ) |
Sets the context record ID.
int | string | null | $id | Context record ID value |
Definition at line 277 of file Context.php.
setSetting | ( | $name, | |
$value = null |
|||
) |
Set a setting value.
string | $name | Name of setting |
string | array | null | $value | Value to set, use an empty value to delete a setting (optional, default is null) |
Definition at line 317 of file Context.php.
References Context\getSetting().
setSettings | ( | $settings | ) |
Set an array of all setting values.
array | $settings | Associative array of setting values |
Definition at line 345 of file Context.php.
setToolSettings | ( | $settings = array() | ) |
Set Tool Settings.
array | $settings | An associative array of settings (optional, default is none) |
Definition at line 415 of file Context.php.
References Context\getPlatform(), and Context\getSetting().
int null $created = null |
Timestamp for when the object was created.
Definition at line 80 of file Context.php.
array null $groups = null |
User groups (null if the platform does not support the groups enhancement)
A group is represented by an associative array with the following elements:
Definition at line 66 of file Context.php.
array null $groupSets = null |
User group sets (null if the platform does not support the groups enhancement)
A group set is represented by an associative array with the following elements:
Definition at line 54 of file Context.php.
HttpMessage null $lastServiceRequest = null |
HttpMessage object for last service request.
Definition at line 73 of file Context.php.
string null $ltiContextId = null |
Context ID as supplied in the last connection request.
Definition at line 25 of file Context.php.
Referenced by Context\fromConsumer(), Context\fromPlatform(), and Context\getId().
string null $title = null |
Context title.
Definition at line 32 of file Context.php.
string null $type = null |
Context type.
Definition at line 39 of file Context.php.
int null $updated = null |
Timestamp for when the object was last updated.
Definition at line 87 of file Context.php.