Category can now be specified in Moodle XML format.

This commit is contained in:
thepurpleblob
2006-11-29 14:27:48 +00:00
parent b39c7aada6
commit ee259d0cd1
+17 -1
View File
@@ -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:
* <question type="category">
* <category>tom/dick/harry</category>
* </question>
*/
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 "<p>$notsupported</p>";
@@ -461,7 +478,6 @@ class qformat_xml extends qformat_default {
$questions[] = $qo;
}
}
return $questions;
}