Tsugi

LtiContentService
in package

One outbound launch. A lesson item stores content_id. Launch fields live here.

A new row is unpublished. link_id null is not a grade column. Checking send grade creates the link and copies published onto it. After that, student visibility is the link's published flag.

Table of Contents

Methods

copyTitle()  : void
Copy the lesson outline title onto this row, and onto its grade column.
customForResourceLink()  : array<string, string>
Custom parameters stored for this launch. Empty when the row has none.
editorRows()  : array<int, array<string, mixed>>
ensureGradeColumnForLaunch()  : int|null
Grade column for a launch that sends a grade and does not have one yet.
find()  : array<string, mixed>|null
inCourse()  : bool
The deployment is still available in this course.
place()  : array<string, mixed>
placeAt()  : array<string, mixed>
Place a launch URL that was chosen from a deployment's messages.
refuseDroppedPost()  : void
Refuse an address that will not accept the launch.
rowsForContext()  : array<int, array<string, mixed>>
Every launch row in this course, keyed by content id.
setPublished()  : bool
Student visibility. A grade column uses the link. Otherwise this row.
studentVisible()  : bool|null
True when students may see this launch. Null when the row is missing.
updateLaunch()  : array<string, mixed>
Target, launch URL, and the send flags. Does not change the lesson document.
version()  : string
contextRow()  : array<string, mixed>
customJson()  : string|null
db()  : PDOX
decodeCustom()  : array<string, string>
editorRow()  : array<string, mixed>
effectivePublished()  : bool
ensureGradeColumn()  : void
flag()  : int
grant()  : array{send_name: bool, send_email: bool, send_grade: bool}
headReply()  : array{code: int, location: string}|null
The status and redirect target from one HEAD. Null when the host does not answer.
newResourceLinkId()  : string
prefix()  : string
requireRow()  : array<string, mixed>
resolveRedirect()  : string
resourceLinkIdForNewContent()  : string
Keep a cartridge resource link id when this course does not already use it. A taken id would violate the content or link unique key, so the launch gets a new id instead.
resourceLinkShaTaken()  : bool
titleOrTool()  : string
visibleDeployment()  : array{registration_id: int, key_id: int, title: string, tool_deployment_id: int}
A deployment this course can see, LTI 1.1 or 1.3.
writeContent()  : array<string, mixed>

Methods

copyTitle()

Copy the lesson outline title onto this row, and onto its grade column.

public static copyTitle(int $contextId, int $contentId, string $title) : void

An empty lesson title leaves the content title alone.

Parameters
$contextId : int
$contentId : int
$title : string

Custom parameters stored for this launch. Empty when the row has none.

public static customForResourceLink(int $contextId, string $resourceLinkId) : array<string, string>
Parameters
$contextId : int
$resourceLinkId : string
Return values
array<string, string>

editorRows()

public static editorRows(int $contextId, array<int, int> $contentIds) : array<int, array<string, mixed>>
Parameters
$contextId : int
$contentIds : array<int, int>
Return values
array<int, array<string, mixed>>

ensureGradeColumnForLaunch()

Grade column for a launch that sends a grade and does not have one yet.

public static ensureGradeColumnForLaunch(int $contextId, int $contentId) : int|null

A launch that already has a column is left alone, including its published flag. A new or newly attached column copies this row's published flag, so an unpublished tool stays unpublished.

Parameters
$contextId : int
$contentId : int
Return values
int|null —

link_id, or null when this launch is missing or not gradable

find()

public static find(int $contextId, int $contentId) : array<string, mixed>|null
Parameters
$contextId : int
$contentId : int
Return values
array<string, mixed>|null

inCourse()

The deployment is still available in this course.

public static inCourse(int $contextId, int $toolDeploymentId) : bool
Parameters
$contextId : int
$toolDeploymentId : int
Return values
bool

place()

public static place(int $contextId, int $toolDeploymentId, string $title[, string $resourceLinkId = '' ]) : array<string, mixed>
Parameters
$contextId : int
$toolDeploymentId : int
$title : string

Outline title. Empty uses the tool title.

$resourceLinkId : string = ''

Cartridge id to keep. Empty mints a new id.

Return values
array<string, mixed>

placeAt()

Place a launch URL that was chosen from a deployment's messages.

public static placeAt(int $contextId, int $toolDeploymentId, string $title, string $launchUrl[, string $resourceLinkId = '' ][, array<string, string>|null $custom = null ]) : array<string, mixed>

The caller has already checked that this course can use the deployment and that the URL is the one the message or the deep link return named.

Parameters
$contextId : int
$toolDeploymentId : int
$title : string

Outline title. Empty uses the tool title.

$launchUrl : string
$resourceLinkId : string = ''

Cartridge id to keep. Empty mints a new id.

$custom : array<string, string>|null = null

Deep link content item custom parameters.

Return values
array<string, mixed>

refuseDroppedPost()

Refuse an address that will not accept the launch.

public static refuseDroppedPost(string $url[, callable|null $lookup = null ]) : void

Checked when the link is authored. A launch uses the stored address as it is. A redirect that drops a POST, or a missing address, is refused. No answer is allowed. The tool may simply be down.

Parameters
$url : string
$lookup : callable|null = null

Returns array{code:int, location:string}, or null when there is no answer.

rowsForContext()

Every launch row in this course, keyed by content id.

public static rowsForContext(int $contextId) : array<int, array<string, mixed>>
Parameters
$contextId : int
Return values
array<int, array<string, mixed>>

setPublished()

Student visibility. A grade column uses the link. Otherwise this row.

public static setPublished(int $contextId, int $contentId, bool $published) : bool
Parameters
$contextId : int
$contentId : int
$published : bool
Return values
bool

studentVisible()

True when students may see this launch. Null when the row is missing.

public static studentVisible(int $contextId, int $contentId) : bool|null
Parameters
$contextId : int
$contentId : int
Return values
bool|null

updateLaunch()

Target, launch URL, and the send flags. Does not change the lesson document.

public static updateLaunch(int $contextId, int $contentId, array<string, mixed> $fields) : array<string, mixed>
Parameters
$contextId : int
$contentId : int
$fields : array<string, mixed>
Return values
array<string, mixed>

version()

public static version(int $contextId, int $toolDeploymentId) : string
Parameters
$contextId : int
$toolDeploymentId : int
Return values
string

contextRow()

private static contextRow(int $contextId) : array<string, mixed>
Parameters
$contextId : int
Return values
array<string, mixed>

customJson()

private static customJson(mixed $custom) : string|null
Parameters
$custom : mixed
Return values
string|null

decodeCustom()

private static decodeCustom(mixed $value) : array<string, string>
Parameters
$value : mixed
Return values
array<string, string>

editorRow()

private static editorRow(array<string, mixed> $row) : array<string, mixed>
Parameters
$row : array<string, mixed>
Return values
array<string, mixed>

effectivePublished()

private static effectivePublished(array<string, mixed> $row) : bool
Parameters
$row : array<string, mixed>
Return values
bool

ensureGradeColumn()

private static ensureGradeColumn(array<string, mixed> $row) : void
Parameters
$row : array<string, mixed>

flag()

private static flag(mixed $value) : int
Parameters
$value : mixed
Return values
int

grant()

private static grant(int $toolDeploymentId) : array{send_name: bool, send_email: bool, send_grade: bool}
Parameters
$toolDeploymentId : int
Return values
array{send_name: bool, send_email: bool, send_grade: bool}

headReply()

The status and redirect target from one HEAD. Null when the host does not answer.

private static headReply(string $url) : array{code: int, location: string}|null
Parameters
$url : string
Return values
array{code: int, location: string}|null

newResourceLinkId()

private static newResourceLinkId(int $contextId) : string
Parameters
$contextId : int
Return values
string

requireRow()

private static requireRow(int $contextId, int $contentId) : array<string, mixed>
Parameters
$contextId : int
$contentId : int
Return values
array<string, mixed>

resolveRedirect()

private static resolveRedirect(string $from, string $location) : string
Parameters
$from : string
$location : string
Return values
string

resourceLinkIdForNewContent()

Keep a cartridge resource link id when this course does not already use it. A taken id would violate the content or link unique key, so the launch gets a new id instead.

private static resourceLinkIdForNewContent(int $contextId, string $preferred) : string
Parameters
$contextId : int
$preferred : string
Return values
string

resourceLinkShaTaken()

private static resourceLinkShaTaken(int $contextId, string $sha) : bool
Parameters
$contextId : int
$sha : string
Return values
bool

titleOrTool()

private static titleOrTool(string $title, string $toolTitle) : string
Parameters
$title : string
$toolTitle : string
Return values
string

visibleDeployment()

A deployment this course can see, LTI 1.1 or 1.3.

private static visibleDeployment(int $contextId, int $toolDeploymentId) : array{registration_id: int, key_id: int, title: string, tool_deployment_id: int}
Parameters
$contextId : int
$toolDeploymentId : int
Return values
array{registration_id: int, key_id: int, title: string, tool_deployment_id: int}

writeContent()

private static writeContent(int $contextId, array<string, mixed> $tool, string $title, string $launchUrl[, string $resourceLinkId = '' ][, array<string, string>|null $custom = null ]) : array<string, mixed>
Parameters
$contextId : int
$tool : array<string, mixed>
$title : string
$launchUrl : string
$resourceLinkId : string = ''
$custom : array<string, string>|null = null
Return values
array<string, mixed>

        
On this page

Search results