Class: qformat_gift - X-Ref
The GIFT import filter was designed as an easy to use method
for teachers writing questions as a text file. It supports most
question types and the missing word format.
Multiple Choice / Missing Word
Who's buried in Grant's tomb?{~Grant ~Jefferson =no one}
Grant is {~buried =entombed ~living} in Grant's tomb.
True-False:
Grant is buried in Grant's tomb.{FALSE}
Short-Answer.
Who's buried in Grant's tomb?{=no one =nobody}
Numerical
When was Ulysses S. Grant born?{#1822:5}
Matching
Match the following countries with their corresponding
capitals.{=Canada->Ottawa =Italy->Rome =Japan->Tokyo}
Comment lines start with a double backslash (//).
Optional question names are enclosed in double colon(::).
Answer feedback is indicated with hash mark (#).
Percentage answer weights immediately follow the tilde (for
multiple choice) or equal sign (for short answer and numerical),
and are enclosed in percent signs (% %). See docs and examples.txt for more.
This filter was written through the collaboration of numerous
members of the Moodle community. It was originally based on
the missingword format, which included code from Thomas Robb
and others. Paul Tsuchido Shew wrote this filter in December 2003.
validate_file(stored_file $file)
X-Ref
|
Validate the given file.
For more expensive or detailed integrity checks.
param: stored_file $file the file to check
return: string the error message that occurred while validating the given file
|
extract_idnumber_and_tags_from_comment(string $comment)
X-Ref
|
Extract any tags or idnumber declared in the question comment.
param: string $comment E.g. "// Line 1.\n//Line 2.\n".
return: array with two elements. string $idnumber (or '') and string[] of tags.
|
write_general_feedback($question, $indent = "\t")
X-Ref
|
Outputs the general feedback for the question, if any. This needs to be the
last thing before the }.
param: object $question the question data.
param: string $indent to put before the general feedback. Defaults to a tab.
|
write_idnumber_and_tags(stdClass $questiondata)
X-Ref
|
Prepare any question idnumber or tags for export.
param: stdClass $questiondata the question data we are exporting.
return: string a string that can be written as a line in the GIFT file,
|