diff --git a/main/exercice/multiple_answer.class.php b/main/exercice/multiple_answer.class.php index 608c23a7bf..997134e7cc 100644 --- a/main/exercice/multiple_answer.class.php +++ b/main/exercice/multiple_answer.class.php @@ -103,12 +103,10 @@ class MultipleAnswer extends Question { $defaults = array(); $correct = 0; - if(!empty($this -> id)) - { + if(!empty($this -> id)) { $answer = new Answer($this -> id); $answer -> read(); - if(count($answer->nbrAnswers)>0 && !$form->isSubmitted()) - { + if(count($answer->nbrAnswers)>0 && !$form->isSubmitted()) { $nb_answers = $answer->nbrAnswers; } } @@ -116,16 +114,22 @@ class MultipleAnswer extends Question { $form -> addElement('hidden', 'nb_answers'); $boxes_names = array(); - for($i = 1 ; $i <= $nb_answers ; ++$i) - { - if(is_object($answer)) - { + for($i = 1 ; $i <= $nb_answers ; ++$i) { + if(is_object($answer)) { $defaults['answer['.$i.']'] = $answer -> answer[$i]; $defaults['comment['.$i.']'] = $answer -> comment[$i]; $defaults['weighting['.$i.']'] = float_format($answer -> weighting[$i], 1); $defaults['correct['.$i.']'] = $answer -> correct[$i]; + } else { + $defaults['answer[1]'] = get_lang('langDefaultMultipleAnswer1'); + $defaults['comment[1]'] = get_lang('langDefaultMultipleComment1'); + $defaults['correct[1]'] = true; + $defaults['weighting[1]'] = 10; + $defaults['answer[2]'] = get_lang('langDefaultMultipleAnswer2'); + $defaults['comment[2]'] = get_lang('langDefaultMultipleComment2'); + $defaults['correct[2]'] = false; + $defaults['weighting[2]'] = -5; } - $renderer = & $form->defaultRenderer(); $renderer->setElementTemplate('{error}
{element}'); diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php index 2f114cefc0..99a51dcf65 100644 --- a/main/exercice/question.class.php +++ b/main/exercice/question.class.php @@ -1,4 +1,4 @@ -defaultRenderer(); $form->addElement('html','
'); // question name - $form->addElement('text','questionName',get_lang('Question'),'size="60"'); + $form->addElement('text','questionName','* '.get_lang('Question'),'size="60"'); $form->applyFilter('questionName','html_filter'); //$radios_results_enabled[] = $form->createElement('static', null, null, null); @@ -1002,7 +1002,7 @@ abstract class Question } $form->addGroup($radios_results_enabled,'questionLevel',get_lang('Difficulty')); - $renderer->setElementTemplate('
*
{label}
{element}
','questionName'); + $renderer->setElementTemplate('
{label}
{element}
','questionName'); $renderer->setElementTemplate('
{label}
{element}
','questionLevel'); $form->addRule('questionName', get_lang('GiveQuestion'), 'required'); @@ -1033,7 +1033,7 @@ abstract class Question $form -> addElement ('html',''); $renderer->setElementTemplate('
{label}
{element}
','questionDescription'); @@ -1041,7 +1041,13 @@ abstract class Question // hidden values $form->addElement('hidden','myid',$_REQUEST['myid']); - + switch($answerType) { + case 1: $this->question = get_lang('langDefaultUniqueQuestion'); break; + case 2: $this->question = get_lang('langDefaultMultipleQuestion'); break; + case 3: $this->question = get_lang('langDefaultFillBlankQuestion'); break; + case 4: $this->question = get_lang('langDefaultMathingQuestion'); break; + case 5: $this->question = get_lang('langDefaultOpenQuestion'); break; + } // default values $defaults = array(); $defaults['questionName'] = $this -> question; @@ -1094,39 +1100,36 @@ abstract class Question if ($feedbacktype==1) { //2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available $question_type_custom_list = array ( UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER]); - } - echo ''; - echo ''; + } + echo ''; - } - - echo ''; - echo '
'; - echo ''; - echo ''; - echo ''; - if ($feedbacktype==1) - echo ''; - else - echo ''; - - echo '
'; + echo ''.$explanation.''; + echo '
'; + echo ''; + } + echo '
  • '; + echo '
    '; + if ($feedbacktype==1) { + echo $url = ''; + } else { + echo $url = ''; + } + echo Display::return_icon('database.gif', get_lang('GetExistingQuestion'), ''); + echo '
    '; + echo $url; + echo get_lang('GetExistingQuestion'); + echo ''; + echo '
  • '; + echo ''; } static function get_types_information() diff --git a/main/exercice/unique_answer.class.php b/main/exercice/unique_answer.class.php index 8d681654a6..74bdffbf9f 100644 --- a/main/exercice/unique_answer.class.php +++ b/main/exercice/unique_answer.class.php @@ -212,9 +212,12 @@ class UniqueAnswer extends Question { $defaults['destination'.$i]=$list_destination; */ //$defaults['destination'.$i] = $list_destination; - } - else - { + }else { + $defaults['answer[1]'] = get_lang('langDefaultUniqueAnswer1'); + $defaults['weighting[1]'] = 10; + $defaults['answer[2]'] = get_lang('langDefaultUniqueAnswer2'); + $defaults['weighting[2]'] = 0; + $temp_scenario['destination'.$i] = array('0'); $temp_scenario['lp'.$i] = array('0'); //$defaults['scenario']