Skip to content

Commit

Permalink
MDL-10240:
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thepurpleblob committed Jun 29, 2007
1 parent 52dce76 commit 3f9156b
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions question/format/blackboard_6/format.php
Expand Up @@ -231,6 +231,9 @@ function readquestions ($lines) {
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\"<br />";
break;
Expand Down Expand Up @@ -300,6 +303,9 @@ function create_raw_question($quest) {
$block->choices[] = $choices;
}
break;
case 'Short Response':
// do nothing?
break;
case 'Fill in the Blank':
// do nothing?
break;
Expand Down Expand Up @@ -538,7 +544,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) {
Expand Down Expand Up @@ -577,7 +583,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();
Expand Down Expand Up @@ -642,7 +648,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) {
Expand Down Expand Up @@ -711,7 +717,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
Expand Down Expand Up @@ -767,17 +773,15 @@ 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
foreach($quest->feedback as $feedback) {
// 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
Expand All @@ -803,7 +807,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) {
Expand Down

0 comments on commit 3f9156b

Please sign in to comment.