Tsugi

Importer
in package

Import a Common Cartridge into a course: Files, Pages, Quiz1, LTI links, Lessons.

Table of Contents

Methods

filesFolderFromHref()  : string
Files-tool folder for a cartridge href. Keep the zip path under web_resources (or the zip-relative path), minus the filename.
run()  : array<string, mixed>
runPackage()  : array<string, mixed>
anchor()  : mixed
appendModules()  : mixed
applyOrgItemExtras()  : mixed
Copy LOM extras from a parsed organization row onto a lesson/module array.
buildLessonsModules()  : array<int, array<string, mixed>>
firstElementText()  : mixed
htmlBody()  : mixed
isEmptyStarter()  : mixed
lessonFromObject()  : array<string, mixed>|null
ltiLaunch()  : mixed
materialize()  : array{local_kind: string, local_id: ?int, local_key: ?string, lesson: ?array, sha256?: string, href?: string}
mimeForName()  : mixed
orgItemDescription()  : string|null
LOM description from a parsed organization module or item, if present.
quizLinkKeyFromResource()  : mixed
Resource link id from the quiz item identifier. The resource id's _R suffix is dropped.
rewriteFileBase()  : mixed
topicText()  : mixed

Methods

filesFolderFromHref()

Files-tool folder for a cartridge href. Keep the zip path under web_resources (or the zip-relative path), minus the filename.

public static filesFolderFromHref(mixed $href) : string

No extra Imported wrapper.

Parameters
$href : mixed
Return values
string

run()

public static run(mixed $path, mixed $context_id, mixed $user_id[, array{modules?: list, replace?: bool} $options = array() ]) : array<string, mixed>
Parameters
$path : mixed
$context_id : mixed
$user_id : mixed
$options : array{modules?: list, replace?: bool} = array()

modules = organization keys from Package::describeModules(); replace = wipe pages, files, quizzes, resource links, results, and lessons first

Return values
array<string, mixed> —

Persisted cc_import row

runPackage()

public static runPackage(Package $pkg, mixed $context_id, mixed $user_id) : array<string, mixed>
Parameters
$pkg : Package
$context_id : mixed
$user_id : mixed
Return values
array<string, mixed>

anchor()

private static anchor(mixed $title, mixed $identifier) : mixed
Parameters
$title : mixed
$identifier : mixed

appendModules()

private static appendModules(mixed $context_id, mixed $user_id, mixed $cartridgeTitle, array<int, array<string, mixed>> $newModules, mixed $filename) : mixed
Parameters
$context_id : mixed
$user_id : mixed
$cartridgeTitle : mixed
$newModules : array<int, array<string, mixed>>
$filename : mixed

applyOrgItemExtras()

Copy LOM extras from a parsed organization row onto a lesson/module array.

private static applyOrgItemExtras(array<string, mixed> &$dest, array<string, mixed> $row) : mixed
Parameters
$dest : array<string, mixed>
$row : array<string, mixed>

buildLessonsModules()

private static buildLessonsModules(Package $pkg, Session $session, array<string, string> $actions, array<string, array<string, mixed>> $lessonsByRes) : array<int, array<string, mixed>>
Parameters
$pkg : Package
$session : Session
$actions : array<string, string>
$lessonsByRes : array<string, array<string, mixed>>
Return values
array<int, array<string, mixed>>

firstElementText()

private static firstElementText(mixed $xml, mixed $localName) : mixed
Parameters
$xml : mixed
$localName : mixed

htmlBody()

private static htmlBody(mixed $html) : mixed
Parameters
$html : mixed

isEmptyStarter()

private static isEmptyStarter(array<int, mixed> $modules) : mixed
Parameters
$modules : array<int, mixed>

lessonFromObject()

private static lessonFromObject(array<string, mixed> $object, mixed $title) : array<string, mixed>|null
Parameters
$object : array<string, mixed>
$title : mixed
Return values
array<string, mixed>|null

ltiLaunch()

private static ltiLaunch(mixed $xml) : mixed
Parameters
$xml : mixed

materialize()

private static materialize(Package $pkg, array<string, mixed> $res, mixed $kind, mixed $context_id, mixed $user_id, array<string, array<string, mixed>> $fileHrefToLocal[, mixed $isCopy = false ]) : array{local_kind: string, local_id: ?int, local_key: ?string, lesson: ?array, sha256?: string, href?: string}
Parameters
$pkg : Package
$res : array<string, mixed>
$kind : mixed
$context_id : mixed
$user_id : mixed
$fileHrefToLocal : array<string, array<string, mixed>>
$isCopy : mixed = false
Return values
array{local_kind: string, local_id: ?int, local_key: ?string, lesson: ?array, sha256?: string, href?: string}

mimeForName()

private static mimeForName(mixed $filename) : mixed
Parameters
$filename : mixed

orgItemDescription()

LOM description from a parsed organization module or item, if present.

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

quizLinkKeyFromResource()

Resource link id from the quiz item identifier. The resource id's _R suffix is dropped.

private static quizLinkKeyFromResource(array<string, mixed> $res) : mixed
Parameters
$res : array<string, mixed>

rewriteFileBase()

private static rewriteFileBase(mixed $html, array<string, array<string, mixed>> $fileHrefToLocal) : mixed
Parameters
$html : mixed
$fileHrefToLocal : array<string, array<string, mixed>>

topicText()

private static topicText(mixed $xml) : mixed
Parameters
$xml : mixed

        
On this page

Search results