ok, so here is the result of running the import script with the attached IMS QTI file.
stdClass Object
(
[shuffleanswers] => 0
[defaultgrade] => 1
[image] =>
[usecase] => 0
[multiplier] => Array
(
)
[questiontext] => Write me an Essay!!!!!!
[qtype] => essay
[single] => 1
[name] => Essay Question 1
[fraction] => Array
(
[0] => 1
)
[answer] => 1
[feedback] => Here is the correct answer for the esaay.
)
stdClass Object
(
[shuffleanswers] => 0
[defaultgrade] => 1
[image] =>
[usecase] => 0
[multiplier] => Array
(
)
[questiontext] => Write me a second essay!!!!!!!!!!!!!!!
[qtype] => essay
[single] => 1
[name] => Essay Question 2
[fraction] => Array
(
[0] => 1
)
[answer] => 1
[feedback] => Answer to the second essay (feedback).
)
stdClass Object
(
[shuffleanswers] => 0
[defaultgrade] => 1
[image] =>
[usecase] => 0
[multiplier] => Array
(
)
[questiontext] => Question with a score
[qtype] => essay
[single] => 1
[name] => Question with a score
[fraction] => Array
(
[0] => 1
)
[answer] => 1
[feedback] => feedback
)
Here is the listing of the attached file (for those who dislike attachments):
<?
xml version="1.0" encoding="ISO-8859-1"?>
<questestinterop>
<assessment title="EssayTest 2" ident="A1001">
<section title="Main" ident="S1002">
<item title="Essay Question 1" ident="QUE_1003">
<presentation>
<material>
<mattext texttype="text/html"><![CDATA[Write me an Essay!!!!!! ]]></mattext>
</material>
<response_str ident="QUE_1004_RS">
<render_fib fibtype="String" prompt="Box" rows="25" columns="50">
<response_label ident="QUE_1005_ANS">
</response_label>
</render_fib>
</response_str>
</presentation>
<resprocessing>
<respcondition>
<conditionvar>
<other/>
</conditionvar>
<displayfeedback feedbacktype="Response" linkrefid="QUE_1006_ALL"/>
</respcondition>
</resprocessing>
<itemfeedback ident="QUE_1006_ALL" view="All">
<material>
<mattext texttype="text/html"><![CDATA[Here is the correct answer for the esaay.]]></mattext>
</material>
</itemfeedback>
</item>
<item title="Essay Question 2" ident="QUE_1007">
<presentation>
<material>
<mattext texttype="text/html"><![CDATA[Write me a second essay!!!!!!!!!!!!!!!]]></mattext>
</material>
<response_str ident="QUE_1008_RS">
<render_fib fibtype="String" prompt="Box" rows="5" columns="50">
<response_label ident="QUE_1009_ANS">
</response_label>
</render_fib>
</response_str>
</presentation>
<resprocessing>
<respcondition>
<conditionvar>
<other/>
</conditionvar>
<displayfeedback feedbacktype="Response" linkrefid="QUE_1010_ALL"/>
</respcondition>
</resprocessing>
<itemfeedback ident="QUE_1010_ALL" view="All">
<material>
<mattext texttype="text/html"><![CDATA[Answer to the second essay (feedback).]]></mattext>
</material>
</itemfeedback>
</item>
<item title="Question with a score" ident="QUE_1011">
<presentation>
<material>
<mattext texttype="text/html"><![CDATA[Question with a score]]></mattext>
</material>
<response_str ident="QUE_1012_RS">
<render_fib fibtype="String" prompt="Box" rows="10" columns="50">
<response_label ident="QUE_1013_ANS">
</response_label>
</render_fib>
</response_str>
</presentation>
<resprocessing>
<respcondition>
<conditionvar>
<other/>
</conditionvar>
<displayfeedback feedbacktype="Response" linkrefid="QUE_1014_ALL"/>
</respcondition>
</resprocessing>
<itemfeedback ident="QUE_1014_ALL" view="All">
<material>
<mattext texttype="text/html"><![CDATA[feedback]]></mattext>
</material>
</itemfeedback>
</item>
</section>
</assessment>
</questestinterop>
here is a re-listing of my function:
///---------------------------------------------------------------
/// processes all essay questions in the questionString array
///---------------------------------------------------------------
function process_essay($questionStrings, &$questions) {
//loop through the $questionStrings array
//to see which question srings contain True-false questions.
//Convert questions that are true-false to objects.
foreach ($questionStrings as $questionString) {
if(determine_type($questionString) == 'essay') {
//make a new object to hold question information
$dummy = new qformat_default;
$question = $dummy->defaultquestion();
//get the bocy text of the question from the file
$question->questiontext = get_question_text($questionString);
//this comparison is borrowed from ../blackbord_6/format.php
if (defined("ESSAY")) {
$question->qtype = ESSAY;
$question->single = 1;
$question->defaultgrade = 1;
$question->usecase = 0; // Ignore case
$question->image = ""; // No images with this format
//get question name from the file
$question->name = get_question_name($questionString);
//store the grade for the responze.
$question->fraction[] = 1;
$question->answer = 1;
//get the feedback for the question
$feedbackArray = get_feedback($questionString);
//NOTE: essay questions can only have 1 feedback, so we only need to look
// at the first index of $feedbackArray.
if($feedbackArray == false) {
$feedbackArray[0] = ""; //only 1 feedback possible, no feedback, therefore set to blank.
}
$question->feedback = $feedbackArray[0]; //set feedback.
//FOR DEBUGGING ONLY!!!!!!
echo '<pre>'; print_r($question);
//print_object($question);
//question object passed into a by reference array to store it for callback.
$questions[]=$question;
}//end essay defined check
else {
print "Essay question types are not handled because the quiz question type 'Essay' does not exist in this installation of Moodle<br/>";
print " Omitted Question: ".$question->questiontext.'<br/><br/>';
}
}//end questiontype comparison
}//end loop through $questionStrings array
}//end function
So far, I haven't really been able to make sense of the defaultquestiontype.php file for ESSAY type questions. Its really confusing, and someone really should have commented which question parameters are necessay to make a ESSAY question type.