Tsugi

CourseCopy
in package

Copy into the current manifest course by exporting a Common Cartridge and letting the import code apply it.

Sources are the site file-based course ($CFG->lessons), when that file exists, and other manifest courses this user owns.

Table of Contents

Constants

FILE_SOURCE  : mixed = 'file'
SESSION_KEY  : mixed = 'tsugi_cc_copy_pending'
Separate from an in-progress Import upload.

Methods

exportTo()  : string
Export $sourceId into an existing temp path. Returns the source title.
fileCourseAvailable()  : mixed
True when $CFG->lessons is a readable course file.
parseSourceId()  : string|int|false
sources()  : array<int, array{id: string, title: string, kind: string}>
Courses the instructor may copy from. The current course is omitted.
writeFileCartridge()  : mixed
Thick Tsugi-flavor cartridge of a file-based lessons document.
writeManifestCartridge()  : mixed
Tsugi-flavor cartridge of a manifest course, including its files and pages.
assertHasModules()  : mixed
beginZip()  : ZipArchive
fileSourceRow()  : array{id: string, title: string, kind: string}|null
lessonsFromJson()  : LessonsService
lessonsTitle()  : string
loadFileLessons()  : LessonsService
loadManifestLessons()  : LessonsService
ownedManifestRows()  : array<int, array<string, mixed>>
ownsManifestCourse()  : mixed
Same ownership as Settings::contextAdministrable, and the course has a manifest.

Constants

SESSION_KEY

Separate from an in-progress Import upload.

public mixed SESSION_KEY = 'tsugi_cc_copy_pending'

Methods

exportTo()

Export $sourceId into an existing temp path. Returns the source title.

public static exportTo(mixed $sourceId, string $destPath, mixed $userId, mixed $currentContextId) : string
Parameters
$sourceId : mixed
$destPath : string
$userId : mixed
$currentContextId : mixed
Return values
string

fileCourseAvailable()

True when $CFG->lessons is a readable course file.

public static fileCourseAvailable() : mixed

parseSourceId()

public static parseSourceId(mixed $raw) : string|int|false
Parameters
$raw : mixed
Return values
string|int|false —

file, a context id, or false

sources()

Courses the instructor may copy from. The current course is omitted.

public static sources(mixed $userId, mixed $currentContextId) : array<int, array{id: string, title: string, kind: string}>
Parameters
$userId : mixed
$currentContextId : mixed
Return values
array<int, array{id: string, title: string, kind: string}>

writeFileCartridge()

Thick Tsugi-flavor cartridge of a file-based lessons document.

public static writeFileCartridge(object $l, string $destPath[, string $title = '' ]) : mixed
Parameters
$l : object
$destPath : string
$title : string = ''

writeManifestCartridge()

Tsugi-flavor cartridge of a manifest course, including its files and pages.

public static writeManifestCartridge(object $l, string $destPath, int $contextId) : mixed
Parameters
$l : object
$destPath : string
$contextId : int

Source course, used to load blobs

assertHasModules()

private static assertHasModules(object $l) : mixed
Parameters
$l : object

beginZip()

private static beginZip(string $destPath) : ZipArchive
Parameters
$destPath : string

Existing tempnam path. Replaced with a new zip.

Return values
ZipArchive

fileSourceRow()

private static fileSourceRow() : array{id: string, title: string, kind: string}|null
Return values
array{id: string, title: string, kind: string}|null

lessonsTitle()

private static lessonsTitle(object $l) : string
Parameters
$l : object
Return values
string

ownedManifestRows()

private static ownedManifestRows(mixed $userId, mixed $currentContextId) : array<int, array<string, mixed>>
Parameters
$userId : mixed
$currentContextId : mixed
Return values
array<int, array<string, mixed>>

ownsManifestCourse()

Same ownership as Settings::contextAdministrable, and the course has a manifest.

private static ownsManifestCourse(mixed $userId, mixed $contextId) : mixed
Parameters
$userId : mixed
$contextId : mixed

        
On this page

Search results