type = MULTIPLE_ANSWER_TRUE_FALSE; $this->isContent = $this-> getIsContent(); $this->options = array(1=>get_lang('True'),2 =>get_lang('False'), 3 =>get_lang('DoubtScore')); } /** * function which redifines Question::createAnswersForm * @param the formvalidator instance * @param the answers number to display */ function createAnswersForm ($form) { $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759. $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); $obj_ex = $_SESSION['objExercise']; $html.='
| '.get_lang('Number').' | '.get_lang('True').' | '.get_lang('False').' | '.get_lang('Answer').' | '; // show column comment when feedback is enable if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM ) { $html .=''.get_lang('Comment').' | '; } $html .= '{error}{label} {element} | '); $answer_number=$form->addElement('text', null,null,'value="'.$i.'"'); $answer_number->freeze(); if (is_object($answer)) { $defaults['answer['.$i.']'] = $answer -> answer[$i]; $defaults['comment['.$i.']'] = $answer -> comment[$i]; //$defaults['weighting['.$i.']'] = float_format($answer -> weighting[$i], 1); $correct = $answer->correct[$i]; //$this->options $defaults['correct['.$i.']'] = $correct; $j = 1; if (!empty($option_data)) { foreach ($option_data as $id=>$data) { $form->addElement('radio', 'correct['.$i.']', null, null,$id); $j++; if ($j == 3) { break; } } } } else { $form->addElement('radio', 'correct['.$i.']', null, null, 1); $form->addElement('radio', 'correct['.$i.']', null, null, 2); $defaults['answer['.$i.']'] = ''; $defaults['comment['.$i.']'] = ''; $defaults['correct['.$i.']'] = ''; } //$form->addElement('select', 'correct['.$i.']',null, $this->options, array('id'=>$i,'onchange'=>'multiple_answer_true_false_onchange(this)')); $boxes_names[] = 'correct['.$i.']'; $form->addElement('html_editor', 'answer['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); // show comment when feedback is enable if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { $form->addElement('html_editor', 'comment['.$i.']',null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); } $form->addElement ('html', ''); } $form -> addElement ('html', '
|---|