From 46064cb582b16fb65f1a83a76f1d1ec6e6f03b29 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 17 Jul 2018 15:51:54 +0200 Subject: [PATCH] Minor - fix php notices, clean php code, flint fixes --- ...MultipleAnswerTrueFalseDegreeCertainty.php | 31 ++++++++++++++----- main/inc/lib/exercise_show_functions.lib.php | 1 - 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php b/main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php index 8cc71c7490..9653bc9dba 100644 --- a/main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php +++ b/main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php @@ -484,9 +484,9 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question /** * Display basic bar charts of results by category of questions. * - * @param array $scoreListAll - * @param string $title The block title - * @param int $sizeRatio + * @param array $scoreListAll + * @param string $title The block title + * @param int $sizeRatio * * @return string The HTML/CSS code for the charts block */ @@ -771,9 +771,24 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question .'' ; - $nbResponsesInc = (isset($scoreList[4]) || isset($scoreList[5])) ? $scoreList[4] + $scoreList[5] : 0; - $nbResponsesIng = (isset($scoreList[3])) ? $scoreList[3] : 0; - $nbResponsesCor = (isset($scoreList[1]) || isset($scoreList[2])) ? $scoreList[1] + $scoreList[2] : 0; + $nbResponsesInc = 0; + if (isset($scoreList[4])) { + $nbResponsesInc += (int) $scoreList[4]; + } + if (isset($scoreList[5])) { + $nbResponsesInc += (int) $scoreList[5]; + } + + $nbResponsesIng = isset($scoreList[3]) ? $scoreList[3] : 0; + + $nbResponsesCor = 0; + if (isset($scoreList[1])) { + $nbResponsesCor += (int) $scoreList[1]; + } + if (isset($scoreList[2])) { + $nbResponsesCor += (int) $scoreList[2]; + } + $colWidth = $widthTable / 5; $html .= ' @@ -1245,9 +1260,9 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question /** * send mail to student with degre certainty result test. * - * @param int $userId + * @param int $userId * @param Exercise $objExercise - * @param int $exeId + * @param int $exeId */ public static function sendQuestionCertaintyNotification($userId, $objExercise, $exeId) { diff --git a/main/inc/lib/exercise_show_functions.lib.php b/main/inc/lib/exercise_show_functions.lib.php index e66bdf5554..c8d0efd7f4 100755 --- a/main/inc/lib/exercise_show_functions.lib.php +++ b/main/inc/lib/exercise_show_functions.lib.php @@ -585,7 +585,6 @@ class ExerciseShowFunctions echo ''.nl2br($answerComment).''; } echo ''; - } else { echo ' '; }