You are here

function qformat_blackboard_6::process_essay in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/blackboard_6/format.php \qformat_blackboard_6::process_essay()
1 call to qformat_blackboard_6::process_essay()
qformat_blackboard_6::readquestions in includes/moodle/question/format/blackboard_6/format.php
Parses an array of lines into an array of questions, where each item is a question object as defined by readquestion(). Questions are defined as anything between blank lines.

File

includes/moodle/question/format/blackboard_6/format.php, line 783

Class

qformat_blackboard_6

Code

function process_essay($quest, &$questions) {

  // this should be rewritten to accomodate moodle 1.6 essay question type eventually
  if (defined("ESSAY")) {

    // treat as short answer
    $question = $this
      ->process_common($quest);

    // copied this from process_mc
    $question->qtype = ESSAY;
    $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 = addslashes($feedback->text);
      }
    }

    //Added because essay/questiontype.php:save_question_option is expecting a

    //fraction property - CT 8/10/06
    $question->fraction[] = 1;
    if (!empty($question)) {
      $questions[] = $question;
    }
  }
  else {
    print "Essay question types are not handled because the quiz question type 'Essay' does not exist in this installation of Moodle<br/>";
    print "&nbsp;&nbsp;&nbsp;&nbsp;Omitted Question: " . $quest->QUESTION_BLOCK->text . '<br/><br/>';
  }
}