ToolPlacementService
in package
Placements a registered message can use, and which of those a deployment enables.
A message placement says where that message is capable of appearing. A deployment placement says the deployment has enabled that exact row. Org and course scope are a different question and stay on the scope tables.
An LTI 1.1 registration uses the same message rows. They are not parsed from a Dynamic Registration document. synthesizeLti11Messages() builds them from the launch checkboxes and the placement checkboxes. A resource link and a deep link are separate messages. A privacy launch is a third message. Name, email, grade, and roster checkboxes are written as the same claims and scope a Dynamic Registration document carries. Replacing a registration document, or synthesizing again, deletes the message rows, and that deletes their placements and any deployment enablement of those placements.
Table of Contents
Methods
- addPlacementToMessage() : int
- disablePlacementForDeployment() : void
- enablePlacementForDeployment() : void
- getAvailablePlacementsForDeployment() : array<int, array<string, mixed>>
- Every message placement declared by this deployment's registration.
- getEnabledPlacementsForDeployment() : array<int, array<string, mixed>>
- Message placements this deployment has enabled.
- getPlacementsForMessage() : array<int, array<string, mixed>>
- removePlacementFromMessage() : void
- Removing the placement also removes deployment enablement of that row.
- synthesizeLti11Messages() : void
- Build the LTI 1.1 message rows for one registration.
- capabilityRows() : array<int, array<string, mixed>>
- db() : PDOX
- findPlacementOnMessage() : array<string, mixed>|null
- insertPlacement() : int
- placementRows() : array<int, array<string, mixed>>
- prefix() : string
- requireDeployment() : array<string, mixed>
- requireLti11Registration() : array<string, mixed>
- requireMessage() : array<string, mixed>
- requirePlacement() : array<string, mixed>
- requireSameRegistration() : void
Methods
addPlacementToMessage()
public
static addPlacementToMessage(int $messageId, string $placement) : int
Parameters
- $messageId : int
- $placement : string
Return values
int —message_placement_id
disablePlacementForDeployment()
public
static disablePlacementForDeployment(int $toolDeploymentId, int $messagePlacementId) : void
Parameters
- $toolDeploymentId : int
- $messagePlacementId : int
enablePlacementForDeployment()
public
static enablePlacementForDeployment(int $toolDeploymentId, int $messagePlacementId) : void
Parameters
- $toolDeploymentId : int
- $messagePlacementId : int
getAvailablePlacementsForDeployment()
Every message placement declared by this deployment's registration.
public
static getAvailablePlacementsForDeployment(int $toolDeploymentId) : array<int, array<string, mixed>>
Scope does not filter this list. Enabled and not-yet-enabled rows are both included.
Parameters
- $toolDeploymentId : int
Return values
array<int, array<string, mixed>>getEnabledPlacementsForDeployment()
Message placements this deployment has enabled.
public
static getEnabledPlacementsForDeployment(int $toolDeploymentId) : array<int, array<string, mixed>>
Parameters
- $toolDeploymentId : int
Return values
array<int, array<string, mixed>>getPlacementsForMessage()
public
static getPlacementsForMessage(int $messageId) : array<int, array<string, mixed>>
Parameters
- $messageId : int
Return values
array<int, array<string, mixed>>removePlacementFromMessage()
Removing the placement also removes deployment enablement of that row.
public
static removePlacementFromMessage(int $messageId, string $placement) : void
Parameters
- $messageId : int
- $placement : string
synthesizeLti11Messages()
Build the LTI 1.1 message rows for one registration.
public
static synthesizeLti11Messages(int $registrationId, array<int, string> $messageTypes[, array<int, string> $checkedPlacements = array() ][, array<int, string> $claims = array() ][, array<int, string> $scopes = array() ]) : void
Each selected launch is one message whose target is the launch URL. Placement checkboxes hang off the launch they require. Claims and scopes are stored in registration_json in the Dynamic Registration shape. Nothing here enables placements on the deployment.
Parameters
- $registrationId : int
- $messageTypes : array<int, string>
- $checkedPlacements : array<int, string> = array()
- $claims : array<int, string> = array()
- $scopes : array<int, string> = array()
capabilityRows()
private
static capabilityRows(array<int, array<string, mixed>> $rows) : array<int, array<string, mixed>>
Parameters
- $rows : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>db()
private
static db() : PDOX
Return values
PDOXfindPlacementOnMessage()
private
static findPlacementOnMessage(int $messageId, string $placement) : array<string, mixed>|null
Parameters
- $messageId : int
- $placement : string
Return values
array<string, mixed>|nullinsertPlacement()
private
static insertPlacement(array<string, mixed> $message, string $placement) : int
Parameters
- $message : array<string, mixed>
- $placement : string
-
already validated
Return values
intplacementRows()
private
static placementRows(array<int, array<string, mixed>> $rows, array<string, mixed> $message) : array<int, array<string, mixed>>
Parameters
- $rows : array<int, array<string, mixed>>
- $message : array<string, mixed>
Return values
array<int, array<string, mixed>>prefix()
private
static prefix() : string
Return values
stringrequireDeployment()
private
static requireDeployment(int $toolDeploymentId) : array<string, mixed>
Parameters
- $toolDeploymentId : int
Return values
array<string, mixed>requireLti11Registration()
private
static requireLti11Registration(int $registrationId) : array<string, mixed>
Parameters
- $registrationId : int
Return values
array<string, mixed>requireMessage()
private
static requireMessage(int $messageId) : array<string, mixed>
Parameters
- $messageId : int
Return values
array<string, mixed>requirePlacement()
private
static requirePlacement(int $messagePlacementId) : array<string, mixed>
Parameters
- $messagePlacementId : int
Return values
array<string, mixed>requireSameRegistration()
private
static requireSameRegistration(array<string, mixed> $deployment, array<string, mixed> $placement) : void
Parameters
- $deployment : array<string, mixed>
- $placement : array<string, mixed>