Moving fields in question see #3370

skala
Julio Montoya 13 years ago
parent ba7f9ba2ce
commit 7f5316f15c
  1. 2
      main/exercice/global_multiple_answer.class.php
  2. 4
      main/exercice/multiple_answer_combination_true_false.class.php
  3. 63
      main/exercice/multiple_answer_true_false.class.php

@ -110,7 +110,7 @@ if (!class_exists('GlobalMultipleAnswer')):
$answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
$answer_number->freeze(); $answer_number->freeze();
$form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox" style="margin-left: 2em;"'); $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"');
$boxes_names[] = 'correct[' . $i . ']'; $boxes_names[] = 'correct[' . $i . ']';
$form->addElement('html_editor', 'answer[' . $i . ']', null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')); $form->addElement('html_editor', 'answer[' . $i . ']', null, 'style="vertical-align:middle"', array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));

@ -1,5 +1,5 @@
<?php // $Id: document.php 16494 2008-10-10 22:07:36Z yannoo $ <?php
/* For licensing terms, see /chamilo_license.txt */ /* For licensing terms, see /license.txt */
/** /**
* File containing the MultipleAnswer class. * File containing the MultipleAnswer class.
* @package chamilo.exercise * @package chamilo.exercise

@ -43,30 +43,11 @@ class MultipleAnswerTrueFalse extends Question {
$obj_ex = $_SESSION['objExercise']; $obj_ex = $_SESSION['objExercise'];
$form -> addElement ('html', '<table><tr>');
$renderer = & $form->defaultRenderer(); $renderer = & $form->defaultRenderer();
$defaults = array(); $defaults = array();
//Extra values True, false, Dont known
if (!empty($this->extra)) {
$scores = explode(':',$this->extra);
if (!empty($scores)) {
for ($i = 1; $i <=3; $i++) {
$defaults['option['.$i.']'] = $scores[$i-1];
}
}
}
// 3 scores
$form->addElement('text', 'option[1]',get_lang('Correct'), array('size'=>'5','value'=>'1'));
$form->addElement('text', 'option[2]',get_lang('Wrong'), array('size'=>'5','value'=>'-0.5'));
$form->addElement('text', 'option[3]',get_lang('DoubtScore'),array('size'=>'5','value'=>'0'));
$form -> addElement('hidden', 'options_count', 3);
$form -> addElement ('html', '</tr></table>');
$html.='<table class="data_table"> $html = '<table class="data_table">
<tr style="text-align: center;"> <tr style="text-align: center;">
<th> <th>
'.get_lang('Number').' '.get_lang('Number').'
@ -80,15 +61,15 @@ class MultipleAnswerTrueFalse extends Question {
<th> <th>
'.get_lang('Answer').' '.get_lang('Answer').'
</th>'; </th>';
// show column comment when feedback is enable // show column comment when feedback is enable
if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM ) { if ($obj_ex->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM ) {
$html .='<th>'.get_lang('Comment').'</th>'; $html .='<th>'.get_lang('Comment').'</th>';
} }
$html .= '</tr>'; $html .= '</tr>';
$form -> addElement ('label', get_lang('Answers').'<br /> <img src="../img/fill_field.png">', $html); $form -> addElement ('label', get_lang('Answers').'<br /> <img src="../img/fill_field.png">', $html);
$correct = 0; $correct = 0;
if (!empty($this -> id)) { if (!empty($this -> id)) {
$answer = new Answer($this -> id); $answer = new Answer($this -> id);
$answer->read(); $answer->read();
if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) { if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) {
@ -161,12 +142,33 @@ class MultipleAnswerTrueFalse extends Question {
} }
$form->addElement ('html', '</tr>'); $form->addElement ('html', '</tr>');
} }
$form -> addElement ('html', '</table>');
$form -> addElement ('html', '<br />'); $form->addElement('html', '</table>');
$form->addElement('html', '<br />');
$form->addElement('html', '<table><tr>');
//Extra values True, false, Dont known
if (!empty($this->extra)) {
$scores = explode(':',$this->extra);
if (!empty($scores)) {
for ($i = 1; $i <=3; $i++) {
$defaults['option['.$i.']'] = $scores[$i-1];
}
}
}
// 3 scores
$form->addElement('text', 'option[1]', get_lang('Correct'), array('size'=>'5','value'=>'1'));
$form->addElement('text', 'option[2]', get_lang('Wrong'), array('size'=>'5','value'=>'-0.5'));
$form->addElement('text', 'option[3]', get_lang('DoubtScore'),array('size'=>'5','value'=>'0'));
$form -> addElement('hidden', 'options_count', 3);
$form -> addElement ('html', '</tr></table>');
//$form -> add_multiple_required_rule ($boxes_names , get_lang('ChooseAtLeastOneCheckbox') , 'multiple_required'); //$form -> add_multiple_required_rule ($boxes_names , get_lang('ChooseAtLeastOneCheckbox') , 'multiple_required');
$navigator_info = api_get_navigator(); $navigator_info = api_get_navigator();
global $text, $class, $show_quiz_edition; global $text, $class, $show_quiz_edition;
@ -198,7 +200,6 @@ class MultipleAnswerTrueFalse extends Question {
$form -> setDefaults($defaults); $form -> setDefaults($defaults);
//} //}
} }
$form->setConstants(array('nb_answers' => $nb_answers)); $form->setConstants(array('nb_answers' => $nb_answers));
} }

Loading…
Cancel
Save