type = MULTIPLE_ANSWER_COMBINATION; $this->isContent = $this->getIsContent(); } /** * function which redefines Question::createAnswersForm * @param FormValidator instance */ public function createAnswersForm($form) { $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 2; $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); $obj_ex = $this->exercise; $html = '
'.get_lang('Number').' | '.get_lang('True').' | '.get_lang('Answer').' | '; // show column comment when feedback is enable if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) { $html .= ''.get_lang('Comment').' | '; } $html .= '{error} {element} | ',
'correct['.$i.']'
);
$renderer->setElementTemplate(
'{error} {element} | ',
'counter['.$i.']'
);
$renderer->setElementTemplate(
'{error} {element} | ',
'answer['.$i.']'
);
$renderer->setElementTemplate(
'{error} {element} | ',
'comment['.$i.']'
);
$answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"');
$answer_number->freeze();
$form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox" style="margin-left: 0em;"');
$boxes_names[] = 'correct['.$i.']';
if ($obj_ex->fastEdition) {
$form->addElement(
'textarea',
'answer['.$i.']',
null,
$this->textareaSettings
);
} else {
$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');
if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM) {
if ($obj_ex->fastEdition) {
$form->addElement(
'textarea',
'comment['.$i.']',
null,
$this->textareaSettings
);
} else {
$form->addElement(
'html_editor',
'comment['.$i.']',
null,
'style="vertical-align:middle"',
array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')
);
}
}
//only 1 answer the all deal ...
//$form->addElement('text', 'weighting['.$i.']',null, 'style="vertical-align:middle;margin-left: 0em;" size="5" value="10"');
$form->addElement('html', '');
}
$form->addElement('html', '
---|
'.get_lang("Choice").' | '.get_lang("ExpectedChoice").' | '.get_lang("Answer").' | '; if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { $header .= ''.get_lang("Comment").' | '; } else { $header .= ''; } $header .= ' |
---|