Browse Source

When an exercise is in committee mode the open question score is hidden see BT#6312

Julio Montoya 11 years ago
parent
commit
a0c86937e0
2 changed files with 18 additions and 12 deletions
  1. 6 4
      main/exercice/exercise.class.php
  2. 12 8
      main/exercice/freeanswer.class.php

+ 6 - 4
main/exercice/exercise.class.php

@@ -1248,9 +1248,10 @@ class Exercise
             }
         } else {
             // Creates a new exercise
-            $sql = "INSERT INTO $TBL_EXERCICES (c_id, start_time, end_time, title, description, sound, type, random, random_answers, active,
-                                                max_attempt, feedback_type, expired_time, session_id, review_answers, random_by_category,
-                                                text_when_finished, display_category_name, pass_percentage, end_button, email_notification_template, results_disabled)
+            $sql = "INSERT INTO $TBL_EXERCICES (
+                        c_id, start_time, end_time, title, description, sound, type, random, random_answers, active,
+                        max_attempt, feedback_type, expired_time, session_id, review_answers, random_by_category,
+                        text_when_finished, display_category_name, pass_percentage, end_button, email_notification_template, results_disabled, model_type)
 					VALUES(
 						".$this->course_id.",
 						'$start_time',
@@ -1273,7 +1274,8 @@ class Exercise
                         '".Database::escape_string($pass_percentage)."',
                         '".Database::escape_string($this->selectEndButton())."',
                         '".Database::escape_string($this->selectEmailNotificationTemplate())."',
-                        '".Database::escape_string($results_disabled)."'
+                        '".Database::escape_string($results_disabled)."',
+                        '".Database::escape_string($this->getModelType())."'
 						)";
             Database::query($sql);
             $this->id = Database::insert_id();

+ 12 - 8
main/exercice/freeanswer.class.php

@@ -37,16 +37,20 @@ class FreeAnswer extends Question
      */
     public function createAnswersForm($form)
     {
-        $form->addElement('text', 'weighting', get_lang('Weighting'), array('class' => 'span1'));
-        // setting the save button here and not in the question class.php
-        $form->addElement('style_submit_button', 'submitQuestion', $this->submitText, 'class="'.$this->submitClass.'"');
-        if (!empty($this->id)) {
-            $form->setDefaults(array('weighting' => Text::float_format($this->weighting, 1)));
-        } else {
-            if ($this->isContent == 1) {
-                $form->setDefaults(array('weighting' => '10'));
+
+        if ($this->exercise->getModelType() == EXERCISE_MODEL_TYPE_NORMAL) {
+            $form->addElement('text', 'weighting', get_lang('Weighting'), array('class' => 'span1'));
+            if (!empty($this->id)) {
+                $form->setDefaults(array('weighting' => Text::float_format($this->weighting, 1)));
+            } else {
+                if ($this->isContent == 1) {
+                    $form->setDefaults(array('weighting' => '10'));
+                }
             }
         }
+
+        // Setting the save button here and not in the question class.php.
+        $form->addElement('style_submit_button', 'submitQuestion', $this->submitText, 'class="'.$this->submitClass.'"');
     }
 
     /**