From: Vincent Vanwaelscappel Date: Mon, 11 Jan 2021 12:45:42 +0000 (+0100) Subject: wait #4182 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1a72ca4e383d90503805561cb61a0b6ef5f8d3e7;p=fluidbook-toolbox.git wait #4182 @0.25 --- diff --git a/app/Models/Quiz.php b/app/Models/Quiz.php index 32ead26eb..53500f6b2 100644 --- a/app/Models/Quiz.php +++ b/app/Models/Quiz.php @@ -142,6 +142,13 @@ class Quiz extends CubistMagicAbstractModel 'column' => true, 'tab' => __('Paramètres')]); + $this->addField(['name' => 'display_score', + 'label' => __('Afficher le score'), + 'type' => 'Checkbox', + 'default' => true, + 'tab' => __('Paramètres'), + ]); + $this->addField(['name' => 'threshold', 'label' => __('Seuil de réussite'), 'type' => 'Integer', @@ -258,6 +265,7 @@ class Quiz extends CubistMagicAbstractModel $xml->addChild('restart_button', $data->get('restart_button', '0') ? '1' : '0'); $xml->addChild('instantReview', $data->get('instantReview', true) ? '1' : '0'); $xml->addChild('review', $data->get('review', 'always')); + $xml->addChild('display_score', $data->get('display_score', true) ? '1' : '0'); $xml->addChild('logattempts', $data->get('logattempts', false) ? '1' : '0'); $xt = $xml->addChild('translations'); /** @var QuizTranslation $translation */ diff --git a/resources/quiz/js/main.js b/resources/quiz/js/main.js index 3b60c1773..11f1a291c 100644 --- a/resources/quiz/js/main.js +++ b/resources/quiz/js/main.js @@ -97,6 +97,7 @@ threshold = 0; instantReview = $(data).find('instantReview').text() === '1'; logAttempts = $(data).find('logattempts').text() === '1'; + displayScore = $(data).find('display_score').text() === '1'; if ($(data).find('threshold').length > 0 && !isNaN(parseFloat($(data).find('threshold').text()))) { threshold = parseFloat($(data).find('threshold').text()); @@ -185,13 +186,19 @@ passedAction = $(data).find('passedAction').length > 0 && $(data).find('passedAction').text() !== '' ? $(data).find('passedAction').text() : null; failedAction = $(data).find('failedAction').length > 0 && $(data).find('failedAction').text() !== '' ? $(data).find('failedAction').text() : null; - var results = $('
' + - '

' + defaultMessage + '

' + - '

' + passedMessage + '

' + - '

' + failedMessage + '

' + - '
' + getTranslation('totalQuestions') + ' ' + countQuestions + '
' + getTranslation('correctAnswers') + '
' + - '' + getTranslation('restartQuiz') + '' + - '
'); + var results = '
'; + results += '
'; + results += '

' + defaultMessage + '

'; + results += '

' + passedMessage + '

'; + results += '

' + failedMessage + '

'; + if(displayScore) { + results += '
' + getTranslation('totalQuestions') + ' ' + countQuestions + '
' + getTranslation('correctAnswers') + '
'; + } + results += '
'; + results += '' + getTranslation('restartQuiz') + ''; + results += '
'; + + results = $(results); $(results).append(correction); $("main").append(results);