Setting default correct question see #6720

1.9.x
Julio Montoya 11 years ago
parent 2fe3290a67
commit fc4c62f16b
  1. 23
      main/exercice/unique_answer.class.php

@ -30,8 +30,7 @@ class UniqueAnswer extends Question
/**
* function which redefines Question::createAnswersForm
* @param the formvalidator instance
* @param the answers number to display
* @param FormValidator $form
*/
public function createAnswersForm($form)
{
@ -57,18 +56,13 @@ class UniqueAnswer extends Question
*/
$feedback_title = '';
$comment_title = '';
if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
//Scenario
$editor_config['Width'] = '250';
$editor_config['Height'] = '110';
$comment_title = '<th width="500px" >' . get_lang(
'Comment'
) . '</th>';
$feedback_title = '<th width="350px" >' . get_lang(
'Scenario'
) . '</th>';
$comment_title = '<th width="500px" >' . get_lang('Comment') . '</th>';
$feedback_title = '<th width="350px" >' . get_lang('Scenario') . '</th>';
} else {
$comment_title = '<th>' . get_lang('Comment') . '</th>';
}
@ -246,8 +240,7 @@ class UniqueAnswer extends Question
'required'
);
if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT
) {
if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
$form->addElement(
'html_editor',
'comment[' . $i . ']',
@ -367,23 +360,27 @@ class UniqueAnswer extends Question
$form->addElement('html', '</div></div>');
//We check the first radio button to be sure a radio button will be check
// We check the first radio button to be sure a radio button will be check
if ($correct == 0) {
$correct = 1;
}
$defaults['correct'] = $correct;
if (!empty($this->id)) {
$form->setDefaults($defaults);
} else {
if ($this->isContent == 1) {
// Default sample content.
$form->setDefaults($defaults);
} else {
$form->setDefaults(array('correct' => 1));
}
}
$form->setConstants(array('nb_answers' => $nb_answers));
}
/**
* Receives the unique answer question type creation form data and creates
* or updates the answers from that question

Loading…
Cancel
Save