From 3e60818b91027fbfe3b6e1f21d745b42fcc208e4 Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Fri, 29 Jun 2007 14:32:20 +0000 Subject: [PATCH] MDL-10240: Added Bb Short Response as a Moodle Essay type question. Found quite a lot of stuff that could do to be checked and improved in this code, so this should be considered an intermediate step. --- question/format/blackboard_6/format.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/question/format/blackboard_6/format.php b/question/format/blackboard_6/format.php index 3de0e07c36..779282518c 100644 --- a/question/format/blackboard_6/format.php +++ b/question/format/blackboard_6/format.php @@ -234,6 +234,9 @@ class qformat_blackboard_6 extends qformat_default { case 'Fill in the Blank': $this->process_fblank($question, $questions); break; + case 'Short Response': + $this->process_essay($question, $questions); + break; default: print "Unknown or unhandled question type: \"$question->qtype\"
"; break; @@ -303,6 +306,9 @@ function create_raw_question($quest) { $block->choices[] = $choices; } break; + case 'Short Response': + // do nothing? + break; case 'Fill in the Blank': // do nothing? break; @@ -541,7 +547,7 @@ function process_tf($quest, &$questions) { $question->image = ""; // No images with this format $question->questiontext = addslashes($quest->QUESTION_BLOCK->text); // put name in question object - $question->name = $question->questiontext; + $question->name = shorten_text($question->questiontext, 250); // first choice is true, second is false. if ($quest->responses[0]->fraction == 1) { @@ -580,7 +586,7 @@ function process_fblank($quest, &$questions) { $question->usecase = 0; $question->image = ''; $question->questiontext = addslashes($quest->QUESTION_BLOCK->text); - $question->name = $question->questiontext; + $question->name = shorten_text($question->questiontext, 250); $answers = array(); $fractions = array(); $feedbacks = array(); @@ -645,7 +651,7 @@ function process_mc($quest, &$questions) { $question->single = 1; $question->image = ""; $question->questiontext = addslashes($quest->QUESTION_BLOCK->text); - $question->name = $question->questiontext; + $question->name = shorten_text($question->questiontext, 250); $feedback = array(); foreach($quest->feedback as $fback) { @@ -714,7 +720,7 @@ function process_mc($quest, &$questions) { function process_ma($quest, &$questions) { $question = $this->defaultquestion(); // copied this from process_mc $question->questiontext = addslashes($quest->QUESTION_BLOCK->text); - $question->name = $question->questiontext; + $question->name = shorten_text($question->questiontext, 250); $question->qtype = MULTICHOICE; $question->defaultgrade = 1; $question->single = 0; // More than one answer allowed @@ -770,9 +776,7 @@ function process_essay($quest, &$questions) { $question->usecase = 0; // Ignore case $question->image = ""; // No images with this format $question->questiontext = addslashes(trim($quest->QUESTION_BLOCK->text)); - $question->name = $question->questiontext; - - print $question->name; + $question->name = shorten_text($question->questiontext, 250); $question->feedback = array(); // not sure where to get the correct answer from @@ -780,7 +784,7 @@ function process_essay($quest, &$questions) { // Added this code to put the possible solution that the // instructor gives as the Moodle answer for an essay question if ($feedback->ident == 'solution') { - $question->feedback = $feedback->text; + $question->feedback = addslashes($feedback->text); } } //Added because essay/questiontype.php:save_question_option is expecting a @@ -806,7 +810,7 @@ function process_matching($quest, &$questions) { $question->qtype = RENDEREDMATCH; $question->defaultgrade = 1; $question->questiontext = addslashes($quest->QUESTION_BLOCK->text); - $question->name = $question->questiontext; + $question->name = shorten_text($question->questiontext, 250); foreach($quest->RESPONSE_BLOCK->subquestions as $qid => $subq) { foreach($quest->responses as $rid => $resp) { -- 2.39.5