diff --git a/main/exercise/MatchingDraggable.php b/main/exercise/MatchingDraggable.php index 1542215ae7..45206e54cb 100644 --- a/main/exercise/MatchingDraggable.php +++ b/main/exercise/MatchingDraggable.php @@ -267,7 +267,7 @@ class MatchingDraggable extends Question $header .= ''.get_lang('ElementList').''; if (!in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $header .= ''.get_lang('YourChoice').''; diff --git a/main/exercise/exercise.class.php b/main/exercise/exercise.class.php index 701679785b..7e2c8c4938 100755 --- a/main/exercise/exercise.class.php +++ b/main/exercise/exercise.class.php @@ -4324,7 +4324,7 @@ class Exercise echo ''; if (!in_array($this->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { echo ''.$s_answer_label.''; @@ -4371,7 +4371,7 @@ class Exercise if ($this->showExpectedChoice()) { if (!in_array($this->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { echo ''.$user_answer.''; diff --git a/main/exercise/global_multiple_answer.class.php b/main/exercise/global_multiple_answer.class.php index 83afa2ef62..3a02220455 100755 --- a/main/exercise/global_multiple_answer.class.php +++ b/main/exercise/global_multiple_answer.class.php @@ -271,7 +271,7 @@ class GlobalMultipleAnswer extends Question if (!in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $header .= ''.get_lang('Choice').''; diff --git a/main/exercise/matching.class.php b/main/exercise/matching.class.php index 0fa6f550c0..f3d3115b25 100755 --- a/main/exercise/matching.class.php +++ b/main/exercise/matching.class.php @@ -289,7 +289,7 @@ class Matching extends Question $header .= ''.get_lang('ElementList').''; if (!in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $header .= ''.get_lang('Choice').''; diff --git a/main/exercise/multiple_answer.class.php b/main/exercise/multiple_answer.class.php index d21cf84aaa..c2ade16b5d 100755 --- a/main/exercise/multiple_answer.class.php +++ b/main/exercise/multiple_answer.class.php @@ -237,7 +237,7 @@ class MultipleAnswer extends Question $header .= ''.get_lang('Choice').''; if (!in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $header .= ''.get_lang('ExpectedChoice').''; diff --git a/main/exercise/multiple_answer_combination.class.php b/main/exercise/multiple_answer_combination.class.php index d1523c8209..11ff47261a 100755 --- a/main/exercise/multiple_answer_combination.class.php +++ b/main/exercise/multiple_answer_combination.class.php @@ -234,7 +234,7 @@ class MultipleAnswerCombination extends Question if (!in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $header .= ''.get_lang('Choice').''; diff --git a/main/exercise/multiple_answer_true_false.class.php b/main/exercise/multiple_answer_true_false.class.php index 232ff74b52..966ed50720 100755 --- a/main/exercise/multiple_answer_true_false.class.php +++ b/main/exercise/multiple_answer_true_false.class.php @@ -315,7 +315,7 @@ class MultipleAnswerTrueFalse extends Question if (!in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $header .= ''.get_lang('Choice').''; diff --git a/main/exercise/question.class.php b/main/exercise/question.class.php index a12582750e..6df1e6a639 100755 --- a/main/exercise/question.class.php +++ b/main/exercise/question.class.php @@ -1996,7 +1996,7 @@ abstract class Question if (in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $scoreLabel = get_lang('QuizWrongAnswerHereIsTheCorrectOne'); @@ -2008,7 +2008,7 @@ abstract class Question if (in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $scoreLabel = get_lang('CorrectAnswer'); @@ -2046,7 +2046,7 @@ abstract class Question case UNIQUE_ANSWER: if (in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { if (isset($score['user_answered'])) { @@ -2080,7 +2080,7 @@ abstract class Question if (isset($score['result'])) { if (in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $score['result'] = null; diff --git a/main/exercise/unique_answer.class.php b/main/exercise/unique_answer.class.php index 29d772be33..31ac0a9fc2 100755 --- a/main/exercise/unique_answer.class.php +++ b/main/exercise/unique_answer.class.php @@ -419,7 +419,7 @@ class UniqueAnswer extends Question $header .= ''.get_lang('Choice').''; if (!in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $header .= ''.get_lang('ExpectedChoice').''; diff --git a/main/exercise/unique_answer_no_option.class.php b/main/exercise/unique_answer_no_option.class.php index daa8f6c56a..06e87746a7 100755 --- a/main/exercise/unique_answer_no_option.class.php +++ b/main/exercise/unique_answer_no_option.class.php @@ -406,7 +406,7 @@ class UniqueAnswerNoOption extends Question if (!in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $header .= ''.get_lang('Choice').''; diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php index f24a0eb0e6..735b51a831 100755 --- a/main/gradebook/lib/be/category.class.php +++ b/main/gradebook/lib/be/category.class.php @@ -2539,6 +2539,36 @@ class Category implements GradebookItem return $this; } + /** + * Return HTML code with links to download and view certificate. + * + * @param array $certificate + * + * @return string + */ + public static function getDownloadCertificateBlock(array $certificate) + { + if (!isset($certificate['pdf_url'])) { + return ''; + } + + $downloadLink = Display::toolbarButton( + get_lang('DownloadCertificatePdf'), + $certificate['pdf_url'], + 'file-pdf-o' + ); + $viewLink = $certificate['certificate_link']; + + return " +
+
+

".get_lang('NowDownloadYourCertificateClickHere')."

+
$downloadLink $viewLink
+
+
+ "; + } + /** * @return Category */ @@ -2744,34 +2774,4 @@ class Category implements GradebookItem return api_float_val($categoryScore); } - - /** - * Return HTML code with links to download and view certificate. - * - * @param array $certificate - * - * @return string - */ - public static function getDownloadCertificateBlock(array $certificate) - { - if (!isset($certificate['pdf_url'])) { - return ''; - } - - $downloadLink = Display::toolbarButton( - get_lang('DownloadCertificatePdf'), - $certificate['pdf_url'], - 'file-pdf-o' - ); - $viewLink = $certificate['certificate_link']; - - return " -
-
-

".get_lang('NowDownloadYourCertificateClickHere')."

-
$downloadLink $viewLink
-
-
- "; - } } diff --git a/main/inc/lib/exercise.lib.php b/main/inc/lib/exercise.lib.php index a4c585ef01..fa83d48ad4 100644 --- a/main/inc/lib/exercise.lib.php +++ b/main/inc/lib/exercise.lib.php @@ -5429,8 +5429,7 @@ EOT; $studentId, $courseCode, $sessionId = 0 - ) - { + ) { if (!api_get_configuration_value('quiz_generate_certificate_ending') || !self::isSuccessExerciseResult($totalScore, $totalWeight, $objExercise->selectPassPercentage()) ) { diff --git a/main/inc/lib/exercise_show_functions.lib.php b/main/inc/lib/exercise_show_functions.lib.php index 65598b0975..81fdd9a63a 100755 --- a/main/inc/lib/exercise_show_functions.lib.php +++ b/main/inc/lib/exercise_show_functions.lib.php @@ -262,7 +262,7 @@ class ExerciseShowFunctions } else { if (in_array($resultsDisabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { return ''; @@ -378,7 +378,7 @@ class ExerciseShowFunctions $studentChoiceClass = ''; if (in_array($resultsDisabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { if ($answerCorrect) { @@ -529,7 +529,7 @@ class ExerciseShowFunctions $color = 'black'; if (isset($new_options[$studentChoice]) || in_array($exercise->results_disabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { if ($studentChoice == $answerCorrect) { @@ -731,7 +731,7 @@ class ExerciseShowFunctions //@todo replace this harcoded value if ($studentChoice || in_array($resultsDisabled, [ RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER_AND_RANKING, - RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER + RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER, ]) ) { $color = 'black';