Minor - format code

pull/2487/head
jmontoyaa 8 years ago
parent 6c03b39319
commit b0880bab36
  1. 5
      main/exercise/global_multiple_answer.class.php
  2. 40
      main/exercise/multiple_answer.class.php
  3. 4
      main/exercise/multiple_answer_combination_true_false.class.php

@ -63,13 +63,11 @@ class GlobalMultipleAnswer extends Question
} }
} }
#le nombre de r<EFBFBD>ponses est bien enregistr<EFBFBD> sous la forme int(nb) // le nombre de r<EFBFBD>ponses est bien enregistr<EFBFBD> sous la forme int(nb)
/* Ajout mise en forme nb reponse */ /* Ajout mise en forme nb reponse */
$form->addElement('hidden', 'nb_answers'); $form->addElement('hidden', 'nb_answers');
$boxes_names = array(); $boxes_names = array();
/* V<EFBFBD>rification : Cr<EFBFBD>action d'au moins une r<EFBFBD>ponse */
if ($nb_answers < 1) { if ($nb_answers < 1) {
$nb_answers = 1; $nb_answers = 1;
echo Display::return_message(get_lang('YouHaveToCreateAtLeastOneAnswer'), 'normal'); echo Display::return_message(get_lang('YouHaveToCreateAtLeastOneAnswer'), 'normal');
@ -207,7 +205,6 @@ class GlobalMultipleAnswer extends Question
*/ */
function processAnswersCreation($form) function processAnswersCreation($form)
{ {
$questionWeighting = $nbrGoodAnswers = 0;
$objAnswer = new Answer($this->id); $objAnswer = new Answer($this->id);
$nb_answers = $form->getSubmitValue('nb_answers'); $nb_answers = $form->getSubmitValue('nb_answers');

@ -4,13 +4,13 @@
use ChamiloSession as Session; use ChamiloSession as Session;
/** /**
* Class MultipleAnswer * Class MultipleAnswer
* *
* This class allows to instantiate an object of type MULTIPLE_ANSWER (MULTIPLE CHOICE, MULTIPLE ANSWER), * This class allows to instantiate an object of type MULTIPLE_ANSWER (MULTIPLE CHOICE, MULTIPLE ANSWER),
* extending the class question * extending the class question
* *
* @author Eric Marguin * @author Eric Marguin
* @package chamilo.exercise * @package chamilo.exercise
**/ **/
class MultipleAnswer extends Question class MultipleAnswer extends Question
{ {
@ -80,7 +80,6 @@ class MultipleAnswer extends Question
for ($i = 1; $i <= $nb_answers; ++$i) { for ($i = 1; $i <= $nb_answers; ++$i) {
$form->addHtml('<tr>'); $form->addHtml('<tr>');
if (is_object($answer)) { if (is_object($answer)) {
$defaults['answer[' . $i . ']'] = $answer->answer[$i]; $defaults['answer[' . $i . ']'] = $answer->answer[$i];
$defaults['comment[' . $i . ']'] = $answer->comment[$i]; $defaults['comment[' . $i . ']'] = $answer->comment[$i];
@ -182,12 +181,11 @@ class MultipleAnswer extends Question
$form->setConstants(array('nb_answers' => $nb_answers)); $form->setConstants(array('nb_answers' => $nb_answers));
} }
/**
/** * abstract function which creates the form to create / edit the answers of the question
* abstract function which creates the form to create / edit the answers of the question * @param the formvalidator instance
* @param the formvalidator instance * @param the answers number to display
* @param the answers number to display */
*/
function processAnswersCreation($form) function processAnswersCreation($form)
{ {
$questionWeighting = $nbrGoodAnswers = 0; $questionWeighting = $nbrGoodAnswers = 0;
@ -226,18 +224,16 @@ class MultipleAnswer extends Question
$this->save(); $this->save();
} }
function return_header($feedback_type = null, $counter = null, $score = null) function return_header($feedback_type = null, $counter = null, $score = null)
{ {
$header = parent::return_header($feedback_type, $counter, $score); $header = parent::return_header($feedback_type, $counter, $score);
$header .= '<table class="'.$this->question_table_class .'"> $header .= '<table class="'.$this->question_table_class .'">
<tr> <tr>
<th>'.get_lang("Choice").'</th> <th>'.get_lang("Choice").'</th>
<th>'. get_lang("ExpectedChoice").'</th> <th>'. get_lang("ExpectedChoice").'</th>
<th>'. get_lang("Answer").'</th>'; <th>'. get_lang("Answer").'</th>';
$header .= '<th>'.get_lang("Comment").'</th>'; $header .= '<th>'.get_lang("Comment").'</th>';
$header .= '</tr>'; $header .= '</tr>';
return $header; return $header;
} }
} }

@ -22,8 +22,8 @@ class MultipleAnswerCombinationTrueFalse extends MultipleAnswerCombination
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this -> type = MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE; $this->type = MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE;
$this -> isContent = $this-> getIsContent(); $this->isContent = $this->getIsContent();
$this->options = array( $this->options = array(
'1' => get_lang('True'), '1' => get_lang('True'),
'0' => get_lang('False'), '0' => get_lang('False'),

Loading…
Cancel
Save