From: thepurpleblob Date: Wed, 29 Nov 2006 14:27:48 +0000 (+0000) Subject: Category can now be specified in Moodle XML format. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ee259d0cd1f05219547de294e60656d303462ac3;p=moodle.git Category can now be specified in Moodle XML format. --- diff --git a/question/format/xml/format.php b/question/format/xml/format.php index 5094305333..f7c6425f0e 100755 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -398,6 +398,20 @@ class qformat_xml extends qformat_default { return $qo; } + /** + * this is not a real question type. It's a dummy type used + * to specify the import category + * format is: + * + * tom/dick/harry + * + */ + function import_category( $question ) { + $qo->qtype = 'category'; + $qo->category = $question['#']['category'][0]['#']; + return $qo; + } + /** * parse the array of lines into an array of questions * this *could* burn memory - but it won't happen that much @@ -450,6 +464,9 @@ class qformat_xml extends qformat_default { elseif ($question_type=='essay') { $qo = $this->import_essay( $question ); } + elseif ($question_type=='category') { + $qo = $this->import_category( $question ); + } else { $notsupported = get_string( 'xmltypeunsupported','quiz',$question_type ); echo "

$notsupported

"; @@ -461,7 +478,6 @@ class qformat_xml extends qformat_default { $questions[] = $qo; } } - return $questions; }