NAME

WeBWorK::File::SetDef - utilities for dealing with set definition files.

importSetsFromDef

Usage: importSetsFromDef($ce, $db, $setDefFiles, $newSetName, $existingSets, $assign, $startDate)

Import requested set definition files into the course.

$ce must be a course environment object and $db a database object for the course.

$setDefFiles must be a reference to an array of set definition file names with path relative to the course templates directory.

$existingSets must be a reference to an array containing set ids of existing sets in the course if provided. If it is not provided, then the list of existing sets will be obtained from the database.

$assign is either 'all', a user id for a particular user to assign the imported sets to, or something that evaluates to false. If it evaluates to false the imported sets will not be assigned to any users.

$startDate is a date to shift the set dates relative to.

$newSetName is an optional name for the imported set. This can only be passed when one set is begin imported.

This returns a reference to an array of set ids of added sets, a reference to an array of set ids of skipped sets, and a reference to an array of errors that occurred in the process. Note that each entry in the array of errors is a reference to an array whose contents are suitable to be passed directly to maketext.

readSetDef

Usage: readSetDef($ce, $fileName)

Read and parse a set definition file.

$ce must be a course environment object for the course.

$filename should be the set definition file with path relative to the course templates directory.

Returns a reference to a hash containing the information from the set definition file and a reference to an array of errors in the file. See %data and %data{problemData} for details on the contents of the return set definition file data. Also note that each entry in the array of errors is a reference to an array whose contents are suitable to be passed directly to maketext.

exportSetsToDef

Usage: exportSetsToDef($ce, $db, @filenames)

Export sets to set definition files.

$ce must be a course environment object and $db a database object for the course.

@filenames is a list of set ids for the sets to be exported.