Saltar al contenido principal

Function: copyCourse()

function copyCourse(
context,
siteUrl,
courseId,
__namedParameters
): Promise<{
changed: string;
course: CourseRef;
}>;

Defined in: areas/backup/backup.ts:119

Copies a course into a new one, as Moodle's "Copy course" does: its content (and its people's data and enrolments, withUsers), under a new full and short name, in a category (the course's unless given), with new dates. Goes through Moodle's copy service, then waits for the copy, which Moodle makes in its scheduled tasks, up to timeoutMs (ten minutes). Needs the rights to back up, restore and create courses (moodle/backup:backupcourse, moodle/restore:restorecourse, moodle/course:create); without them, BackupError says so.

Parameters​

ParameterType
contextBrowserContext
siteUrlstring
courseIdnumber
__namedParameters{ categoryId?: number; end?: Date; fullName: string; shortName: string; start?: Date; timeoutMs?: number; visible?: boolean; withUsers?: boolean; }
__namedParameters.categoryId?number
__namedParameters.end?Date
__namedParameters.fullNamestring
__namedParameters.shortNamestring
__namedParameters.start?Date
__namedParameters.timeoutMs?number
__namedParameters.visible?boolean
__namedParameters.withUsers?boolean

Returns​

Promise<{ changed: string; course: CourseRef; }>