Browse Source

Apply patch from analyses/8906

Ivan Zambrano 6 years ago
parent
commit
a853f7dddb

File diff suppressed because it is too large
+ 605 - 599
main/exercise/multipleAnswerTrueFalseDegreeCertainty.php


+ 0 - 1
main/inc/ajax/exercise.ajax.php

@@ -524,7 +524,6 @@ switch ($action) {
                 $objQuestionTmp = Question::read($my_question_id, $course_id);
 
                 if ($objQuestionTmp->type == MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY) {
-
                     $myChoiceDegreeCertainty = isset($choiceDegreeCertainty[$my_question_id]) ? $choiceDegreeCertainty[$my_question_id] : null;
                 }
 

+ 11 - 6
main/inc/lib/exercise.lib.php

@@ -27,8 +27,9 @@ class ExerciseLib
      * @param bool     $show_comment
      * @param bool     $show_answers
      *
-     * @return bool|int
      * @throws \Exception
+     *
+     * @return bool|int
      */
     public static function showQuestion(
         $exercise,
@@ -2841,7 +2842,7 @@ HOTSPOT;
             $score = float_format($score, 1, $decimalSeparator, $thousandSeparator);
             $weight = float_format($weight, 1, $decimalSeparator, $thousandSeparator);
         }
-        
+
         $html = '';
         if ($show_percentage) {
             $percentageSign = '%';
@@ -3877,7 +3878,8 @@ EOT;
     }
 
     /**
-     * Get the number of questions with answers
+     * Get the number of questions with answers.
+     *
      * @param int    $question_id
      * @param int    $exercise_id
      * @param string $course_code
@@ -3969,7 +3971,8 @@ EOT;
     }
 
     /**
-     * Get number of answers to hotspot questions
+     * Get number of answers to hotspot questions.
+     *
      * @param int    $answer_id
      * @param int    $question_id
      * @param int    $exercise_id
@@ -4324,7 +4327,8 @@ EOT;
     }
 
     /**
-     * Return an HTML select menu with the student groups
+     * Return an HTML select menu with the student groups.
+     *
      * @param string $name     is the name and the id of the <select>
      * @param string $default  default value for option
      * @param string $onchange
@@ -4807,7 +4811,8 @@ EOT;
 
     /**
      * Get a special ribbon on top of "degree of certainty" questions (
-     * variation from getTotalScoreRibbon() for other question types)
+     * variation from getTotalScoreRibbon() for other question types).
+     *
      * @param Exercise $objExercise
      * @param float    $score
      * @param float    $weight

+ 23 - 28
main/inc/lib/exercise_show_functions.lib.php

@@ -528,15 +528,15 @@ class ExerciseShowFunctions
             <td width="5%">
                 <?php
                 $question = new MultipleAnswerTrueFalseDegreeCertainty();
-                $courseId = api_get_course_int_id();
-                $newOptions = Question::readQuestionOption($questionId, $courseId);
+        $courseId = api_get_course_int_id();
+        $newOptions = Question::readQuestionOption($questionId, $courseId);
 
-                //Your choice
-                if (isset($newOptions[$studentChoice])) {
-                    echo get_lang($newOptions[$studentChoice]['name']);
-                } else {
-                    echo '-';
-                } ?>
+        //Your choice
+        if (isset($newOptions[$studentChoice])) {
+            echo get_lang($newOptions[$studentChoice]['name']);
+        } else {
+            echo '-';
+        } ?>
             </td>
             <td width="5%">
                 <?php
@@ -553,13 +553,11 @@ class ExerciseShowFunctions
             </td>
             <td width="25%">
             <?php
-            echo $answer;
-            ?>
+            echo $answer; ?>
             </td>
             <td width="5%" style="text-align:center;">
             <?php
-            echo  $newOptions[$studentChoiceDegree]['name'];
-            ?>
+            echo  $newOptions[$studentChoiceDegree]['name']; ?>
             </td>
             <!-- color by certainty -->
             <?php
@@ -568,17 +566,16 @@ class ExerciseShowFunctions
                 $answerCorrect,
                 $newOptions[$studentChoiceDegree]['position']
             );
-            if ($degreeCertaintyColor == "#088A08" || $degreeCertaintyColor == "#FE2E2E") {
-                $color = "#FFFFFF";
-            } else {
-                $color = "#000000";
-            }
-            $responseCode = $question->getCodeResponse(
+        if ($degreeCertaintyColor == "#088A08" || $degreeCertaintyColor == "#FE2E2E") {
+            $color = "#FFFFFF";
+        } else {
+            $color = "#000000";
+        }
+        $responseCode = $question->getCodeResponse(
                 $studentChoice,
                 $answerCorrect,
                 $newOptions[$studentChoiceDegree]['position']
-            );
-            ?>
+            ); ?>
             <td width="10%">
                 <div style="text-align:center;color: <?php echo $color; ?>; 
                     border:1px #D6D4D4 solid;background-color: <?php echo $degreeCertaintyColor; ?>;
@@ -587,22 +584,20 @@ class ExerciseShowFunctions
             </td>
             <?php
             if ($feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) {
-            ?>
+                ?>
             <td width="20%">
             <?php
             $color = "black";
-            if (isset($newOptions[$studentChoice])) {
-                echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
-            }
-            ?>
+                if (isset($newOptions[$studentChoice])) {
+                    echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
+                } ?>
             </td>
             <?php
             } else {
-            ?>
+                ?>
             <td>&nbsp;</td>
         <?php
-            }
-        ?>
+            } ?>
         </tr>
         <?php
     }

Some files were not shown because too many files changed in this diff