Tsugi

HomeLayout
in package

Ordered blocks an instructor chooses for the course home page.

Stored on lti_context.json under the "home" key so other context JSON stays put. Hero, calendar, the due-date list, and a note to self appear once. Page and file blocks can repeat. Order is the array order.

Table of Contents

Constants

FILE_PLACES  : mixed = array('left', 'right', 'center', 'inline')
HERO_PLACES  : mixed = array('center', 'left', 'right', 'none')
JSON_KEY  : mixed = 'home'

Methods

block()  : array<string, mixed>|null
blockKey()  : string|null
Stable id for a block the instructor placed, or null for an empty slot.
defaultDocument()  : array{blocks: list>}
fromPost()  : array{blocks: list>}
load()  : array{blocks: list>}
normalize()  : array{blocks: list>}
save()  : mixed
cleanBlock()  : array<string, mixed>|null
filePlace()  : mixed
left, right, center, or inline (in the normal flow).
flag()  : mixed
heroPlace()  : mixed
center, left (float left), right (float right), or none.

Constants

FILE_PLACES

public mixed FILE_PLACES = array('left', 'right', 'center', 'inline')

HERO_PLACES

public mixed HERO_PLACES = array('center', 'left', 'right', 'none')

Methods

block()

public static block(array<string, mixed> $doc, mixed $type) : array<string, mixed>|null
Parameters
$doc : array<string, mixed>
$type : mixed
Return values
array<string, mixed>|null

blockKey()

Stable id for a block the instructor placed, or null for an empty slot.

public static blockKey(array<string, mixed> $block) : string|null

Hero, calendar, due dates, and the note use their type. A page is page:{id}. A file is file:{path}.

Parameters
$block : array<string, mixed>
Return values
string|null

defaultDocument()

public static defaultDocument() : array{blocks: list>}
Return values
array{blocks: list>}

fromPost()

public static fromPost(array<string, mixed> $post, array<int, int> $pageIds[, array<int, string> $filePaths = array() ]) : array{blocks: list>}
Parameters
$post : array<string, mixed>
$pageIds : array<int, int>

Pages in this course

$filePaths : array<int, string> = array()

Non-private course file paths

Return values
array{blocks: list>}

load()

public static load(int $context_id) : array{blocks: list>}
Parameters
$context_id : int
Return values
array{blocks: list>}

normalize()

public static normalize(mixed $doc) : array{blocks: list>}
Parameters
$doc : mixed
Return values
array{blocks: list>}

save()

public static save(int $context_id, array<string, mixed> $doc) : mixed
Parameters
$context_id : int
$doc : array<string, mixed>

cleanBlock()

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

filePlace()

left, right, center, or inline (in the normal flow).

private static filePlace(mixed $place) : mixed
Parameters
$place : mixed

flag()

private static flag(mixed $value) : mixed
Parameters
$value : mixed

heroPlace()

center, left (float left), right (float right), or none.

private static heroPlace(array<string, mixed> $row) : mixed

Older layouts stored on=true for "show the image". Those become float right.

Parameters
$row : array<string, mixed>

        
On this page

Search results