Class to represent a platform context. More...
Inheritance diagram for ceLTIc\LTI\Context:Public Member Functions | |
| __construct () | |
| Class constructor. | |
| void | initialize () |
| Initialise the context. | |
| void | initialise () |
| Initialise the context. | |
| bool | save () |
| Save the context to the database. | |
| bool | delete () |
| Delete the context from the database. | |
| Platform | getPlatform () |
| Get platform. | |
| void | setPlatformId (?int $platformId) |
| Set platform ID. | |
| string | getKey () |
| Get consumer key. | |
| string null | getId () |
| Get context ID. | |
| int string null | getRecordId () |
| Get the context record ID. | |
| void | setRecordId (int|string|null $id) |
| Sets the context record ID. | |
| DataConnector string | getDataConnector () |
| Get the data connector. | |
| string | getSetting (string $name, string $default='') |
| Get a setting value. | |
| void | setSetting (string $name, string|array|null $value=null) |
| Set a setting value. | |
| array | getSettings () |
| Get an array of all setting values. | |
| void | setSettings (array $settings) |
| Set an array of all setting values. | |
| bool | saveSettings () |
| Save setting values. | |
| bool | hasToolSettingsService () |
| Check if the Tool Settings service is available. | |
| array bool | getToolSettings (?ToolSettingsMode $mode=null, bool $simple=true) |
| Get Tool Settings. | |
| bool | setToolSettings (array $settings=[]) |
| Set Tool Settings. | |
| bool | hasGroupService () |
| Check if a Course Group service is available. | |
| bool | getGroups () |
| Get course group sets and groups. | |
| bool | hasMembershipsService () |
| Check if a Membership service is available. | |
| array bool | getMemberships (bool $withGroups=false) |
| Get Memberships. | |
| bool | hasLineItemService () |
| Check if the Line-item service is available. | |
| bool | hasScoreService () |
| Check if the Score service is available. | |
| bool | hasResultService () |
| Check if the Result service is available. | |
| LineItem[] bool | getLineItems (?string $resourceId=null, ?string $tag=null, ?int $limit=null) |
| Get line-items. | |
| bool | createLineItem (LineItem $lineItem) |
| Create a new line-item. | |
Static Public Member Functions | |
| static Context | fromRecordId (int $id, DataConnector $dataConnector) |
| Load the context from the database. | |
| static Context | fromPlatform (Platform $platform, string $ltiContextId) |
| Class constructor from platform. | |
Static Public Member Functions inherited from ceLTIc\LTI\ApiHook\ApiHook | |
| static void | registerApiHook (string $hookName, string $familyCode, string $className) |
| Register the availability of an API hook. | |
Public Attributes | |
| string | $ltiContextId = null |
| Context ID as supplied in the last connection request. | |
| string | $title = null |
| Context title. | |
| string | $type = null |
| Context type. | |
| array | $groupSets = null |
| User group sets (null if the platform does not support the groups enhancement) | |
| array | $groups = null |
| User groups (null if the platform does not support the groups enhancement) | |
| HttpMessage | $lastServiceRequest = null |
| HttpMessage object for last service request. | |
| int | $created = null |
| Timestamp for when the object was created. | |
| int | $updated = null |
| Timestamp for when the object was last updated. | |
Additional Inherited Members | |
Static Public Attributes inherited from ceLTIc\LTI\ApiHook\ApiHook | |
| static string | $USER_ID_HOOK = "UserId" |
| User Id hook name. | |
| static string | $CONTEXT_ID_HOOK = "ContextId" |
| Context Id hook name. | |
| static string | $GROUPS_SERVICE_HOOK = "Groups" |
| Course Groups service hook name. | |
| static string | $MEMBERSHIPS_SERVICE_HOOK = "Memberships" |
| Memberships service hook name. | |
| static string | $OUTCOMES_SERVICE_HOOK = "Outcomes" |
| Outcomes service hook name. | |
| static string | $TOOL_SETTINGS_SERVICE_HOOK = "ToolSettings" |
| Tool Settings service hook name. | |
| static string | $ACCESS_TOKEN_SERVICE_HOOK = "AccessToken" |
| Access Token service hook name. | |
Class to represent a platform context.
| ceLTIc\LTI\Context::__construct | ( | ) |
Class constructor.
| bool ceLTIc\LTI\Context::createLineItem | ( | LineItem | $lineItem | ) |
Create a new line-item.
| LineItem | $lineItem | Line-item object |
References $ltiContextId.
| bool ceLTIc\LTI\Context::delete | ( | ) |
Delete the context from the database.
Class constructor from platform.
| Platform | $platform | Platform instance |
| string | $ltiContextId | LTI Context ID value |
References getPlatform().
|
static |
Load the context from the database.
| int | $id | Record ID of context |
| DataConnector | $dataConnector | Database connection object |
References getDataConnector(), and initialize().
Referenced by ceLTIc\LTI\ResourceLink\getPlatform().
| DataConnector string ceLTIc\LTI\Context::getDataConnector | ( | ) |
Get the data connector.
Referenced by fromRecordId(), and initialize().
| bool ceLTIc\LTI\Context::getGroups | ( | ) |
Get course group sets and groups.
References getPlatform(), getSetting(), ceLTIc\LTI\Service\Membership\MEDIA_TYPE_MEMBERSHIPS_NRPS, and ceLTIc\LTI\Service\Membership\MEDIA_TYPE_MEMBERSHIPS_V1.
| string null ceLTIc\LTI\Context::getId | ( | ) |
Get context ID.
| string ceLTIc\LTI\Context::getKey | ( | ) |
Get consumer key.
| LineItem[] bool ceLTIc\LTI\Context::getLineItems | ( | ?string | $resourceId = null, |
| ?string | $tag = null, | ||
| ?int | $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 |
| array bool ceLTIc\LTI\Context::getMemberships | ( | bool | $withGroups = false | ) |
Get Memberships.
| bool | $withGroups | True is group information is to be requested as well |
References getSetting().
| Platform ceLTIc\LTI\Context::getPlatform | ( | ) |
Get platform.
Referenced by fromPlatform(), getGroups(), getSettings(), hasToolSettingsService(), and ceLTIc\LTI\ResourceLink\initialise().
| int string null ceLTIc\LTI\Context::getRecordId | ( | ) |
Get the context record ID.
Referenced by ceLTIc\LTI\DataConnector\DataConnector_mysqli\saveContext().
| string ceLTIc\LTI\Context::getSetting | ( | string | $name, |
| string | $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) |
Referenced by getGroups(), getMemberships(), getSettings(), hasLineItemService(), hasToolSettingsService(), setRecordId(), and setSettings().
| array ceLTIc\LTI\Context::getSettings | ( | ) |
Get an array of all setting values.
References getPlatform(), and getSetting().
| array bool ceLTIc\LTI\Context::getToolSettings | ( | ?ToolSettingsMode | $mode = null, |
| bool | $simple = true ) |
Get Tool Settings.
| ToolSettingsMode | null | $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) |
| bool ceLTIc\LTI\Context::hasGroupService | ( | ) |
Check if a Course Group service is available.
| bool ceLTIc\LTI\Context::hasLineItemService | ( | ) |
Check if the Line-item service is available.
References ceLTIc\LTI\Service\Result\$SCOPE, and getSetting().
| bool ceLTIc\LTI\Context::hasMembershipsService | ( | ) |
Check if a Membership service is available.
| bool ceLTIc\LTI\Context::hasResultService | ( | ) |
Check if the Result service is available.
| bool ceLTIc\LTI\Context::hasScoreService | ( | ) |
Check if the Score service is available.
| bool ceLTIc\LTI\Context::hasToolSettingsService | ( | ) |
Check if the Tool Settings service is available.
References getPlatform(), and getSetting().
| void ceLTIc\LTI\Context::initialise | ( | ) |
Initialise the context.
Synonym for initialize().
| void ceLTIc\LTI\Context::initialize | ( | ) |
Initialise the context.
References getDataConnector().
Referenced by fromRecordId(), and ceLTIc\LTI\DataConnector\DataConnector\getPlatforms().
| bool ceLTIc\LTI\Context::save | ( | ) |
Save the context to the database.
Referenced by setSetting().
| bool ceLTIc\LTI\Context::saveSettings | ( | ) |
Save setting values.
| void ceLTIc\LTI\Context::setPlatformId | ( | ?int | $platformId | ) |
Set platform ID.
| int | null | $platformId | Platform ID for this context. |
| void ceLTIc\LTI\Context::setRecordId | ( | int|string|null | $id | ) |
Sets the context record ID.
| int | string | null | $id | Context record ID value |
References getSetting().
| void ceLTIc\LTI\Context::setSetting | ( | string | $name, |
| string|array|null | $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) |
References save().
| void ceLTIc\LTI\Context::setSettings | ( | array | $settings | ) |
Set an array of all setting values.
| array | $settings | Associative array of setting values |
References getSetting().
| bool ceLTIc\LTI\Context::setToolSettings | ( | array | $settings = [] | ) |
Set Tool Settings.
| array | $settings | An associative array of settings (optional, default is none) |
| int ceLTIc\LTI\Context::$created = null |
Timestamp for when the object was created.
| array ceLTIc\LTI\Context::$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:
| array ceLTIc\LTI\Context::$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:
| HttpMessage ceLTIc\LTI\Context::$lastServiceRequest = null |
HttpMessage object for last service request.
| string ceLTIc\LTI\Context::$ltiContextId = null |
Context ID as supplied in the last connection request.
Referenced by createLineItem().
| string ceLTIc\LTI\Context::$title = null |
Context title.
| string ceLTIc\LTI\Context::$type = null |
Context type.
| int ceLTIc\LTI\Context::$updated = null |
Timestamp for when the object was last updated.