type = UNIQUE_ANSWER; $this->isContent = $this->getIsContent(); } /** * function which redefines Question::createAnswersForm * @param FormValidator $form */ public function createAnswersForm($form) { // Getting the exercise list $obj_ex = $_SESSION['objExercise']; $editor_config = array( 'ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125' ); //this line defines how many questions by default appear when creating a choice question // The previous default value was 2. See task #1759. $nb_answers = isset($_POST['nb_answers']) ? (int)$_POST['nb_answers'] : 4; $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); /* Types of Feedback $feedback_option[0]=get_lang('Feedback'); $feedback_option[1]=get_lang('DirectFeedback'); $feedback_option[2]=get_lang('NoFeedback'); */ $feedback_title = ''; if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { //Scenario $editor_config['Width'] = '250'; $editor_config['Height'] = '110'; $comment_title = '
' . get_lang('Number') . ' | ' . get_lang('True') . ' | ' . get_lang('Answer') . ' | ' . $comment_title . ' ' . $feedback_title . '' . get_lang('Weighting') . ' | ||
---|---|---|---|---|---|
{error} {element} | ',
'correct'
);
$renderer->setElementTemplate(
'{error} {element} | ',
'counter[' . $i . ']'
);
$renderer->setElementTemplate(
'{error} {element} | ',
'answer[' . $i . ']'
);
$renderer->setElementTemplate(
'{error} {element} | ',
'comment[' . $i . ']'
);
$renderer->setElementTemplate(
'{error} {element} | ',
'weighting[' . $i . ']'
);
$answer_number = $form->addElement(
'text',
'counter[' . $i . ']',
null,
' value = "' . $i . '"'
);
$answer_number->freeze();
$form->addElement(
'radio',
'correct',
null,
null,
$i,
'class="checkbox" style="margin-left: 0em;"'
);
$form->addElement(
'html_editor',
'answer[' . $i . ']',
null,
'style="vertical-align:middle"',
$editor_config
);
$form->addRule(
'answer[' . $i . ']',
get_lang('ThisFieldIsRequired'),
'required'
);
if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
$form->addElement(
'html_editor',
'comment[' . $i . ']',
null,
'style="vertical-align:middle"',
$editor_config
);
// Direct feedback
//Adding extra feedback fields
$group = array();
$group['try' . $i] = $form->createElement(
'checkbox',
'try' . $i,
null,
get_lang('TryAgain')
);
$group['lp' . $i] = $form->createElement(
'select',
'lp' . $i,
get_lang('SeeTheory') . ': ',
$select_lp_id
);
$group['destination' . $i] = $form->createElement(
'select',
'destination' . $i,
get_lang('GoToQuestion') . ': ',
$select_question
);
$group['url' . $i] = $form->createElement(
'text',
'url' . $i,
get_lang('Other') . ': ',
array(
'class' => 'span2',
'placeholder' => get_lang('Other')
)
);
$form->addGroup($group, 'scenario');
$renderer->setElementTemplate(
'{error} {element}', 'scenario' ); } else { $form->addElement( 'html_editor', 'comment[' . $i . ']', null, 'style="vertical-align:middle"', $editor_config ); } $form->addElement( 'text', 'weighting[' . $i . ']', null, array('class' => "span1", 'value' => '0') ); $form->addElement('html', ' |
' . get_lang("Choice") . ' | ' . get_lang("ExpectedChoice") . ' | ' . get_lang("Answer") . ' | '; $header .= '' . get_lang("Comment") . ' | '; $header .= '
---|