Exercise: Rename globals questions by combination in code - refs BT#20518

pull/4583/head
Christian 3 years ago
parent 9eed3f67f6
commit c336df09ef
  1. 21
      main/exercise/FillBlanksCombination.php
  2. 21
      main/exercise/FillBlanksGlobal.php
  3. 20
      main/exercise/HotSpotCombination.php
  4. 20
      main/exercise/HotSpotGlobal.php
  5. 10
      main/exercise/MatchingCombination.php
  6. 4
      main/exercise/MatchingDraggable.php
  7. 21
      main/exercise/MatchingDraggableCombination.php
  8. 21
      main/exercise/MatchingDraggableGlobal.php
  9. 18
      main/exercise/MultipleAnswerDropdownCombination.php
  10. 16
      main/exercise/MultipleAnswerDropdownGlobal.php
  11. 2
      main/exercise/answer.class.php
  12. 89
      main/exercise/exercise.class.php
  13. 12
      main/exercise/exercise_show.php
  14. 4
      main/exercise/exercise_submit.php
  15. 8
      main/exercise/export/qti2/qti2_classes.php
  16. 2
      main/exercise/export/qti2/qti2_export.php
  17. 4
      main/exercise/export/scorm/ScormQuestion.php
  18. 6
      main/exercise/fill_blanks.class.php
  19. 14
      main/exercise/hotspot_admin.inc.php
  20. 4
      main/exercise/matching.class.php
  21. 2
      main/exercise/multiple_answer_dropdown_admin.php
  22. 28
      main/exercise/question.class.php
  23. 4
      main/exercise/question_admin.inc.php
  24. 4
      main/exercise/stats.php
  25. 18
      main/exercise/upload_exercise.php
  26. BIN
      main/img/icons/64/fill_in_blanks_co.png
  27. BIN
      main/img/icons/64/fill_in_blanks_co_na.png
  28. BIN
      main/img/icons/64/hotspot_co.png
  29. BIN
      main/img/icons/64/hotspot_co_na.png
  30. BIN
      main/img/icons/64/matching_co.png
  31. BIN
      main/img/icons/64/matching_co_na.png
  32. BIN
      main/img/icons/64/matchingdrag_co.png
  33. BIN
      main/img/icons/64/matchingdrag_co_na.png
  34. BIN
      main/img/icons/64/mcma_dropdown_co.png
  35. BIN
      main/img/icons/64/mcma_dropdown_co_na.png
  36. 8
      main/inc/ajax/exercise.ajax.php
  37. 10
      main/inc/lib/api.lib.php
  38. 56
      main/inc/lib/exercise.lib.php

@ -0,0 +1,21 @@
<?php
/* For licensing terms, see /license.txt */
/**
* FillBlanksCombination.
*/
class FillBlanksCombination extends FillBlanks
{
public $typePicture = 'fill_in_blanks_co.png';
public $explanationLangVar = 'FillBlanksCombination';
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
$this->type = FILL_IN_BLANKS_COMBINATION;
$this->isContent = $this->getIsContent();
}
}

@ -1,21 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* FillBlanksGlobal.
*/
class FillBlanksGlobal extends FillBlanks
{
public $typePicture = 'fill_in_blanks_global.png';
public $explanationLangVar = 'FillBlanksGlobal';
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
$this->type = FILL_IN_BLANKS_GLOBAL;
$this->isContent = $this->getIsContent();
}
}

@ -0,0 +1,20 @@
<?php
/* For licensing terms, see /license.txt */
/**
* HotSpotCombination.
*/
class HotSpotCombination extends HotSpot
{
public $typePicture = 'hotspot_co.png';
public $explanationLangVar = 'HotSpotCombination';
/**
* HotSpot constructor.
*/
public function __construct()
{
parent::__construct();
$this->type = HOT_SPOT_COMBINATION;
}
}

@ -1,20 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* HotSpotGlobal.
*/
class HotSpotGlobal extends HotSpot
{
public $typePicture = 'hotspot_global.png';
public $explanationLangVar = 'HotSpotGlobal';
/**
* HotSpot constructor.
*/
public function __construct()
{
parent::__construct();
$this->type = HOT_SPOT_GLOBAL;
}
}

@ -2,12 +2,12 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* MatchingGlobal. * MatchingCombination.
*/ */
class MatchingGlobal extends Matching class MatchingCombination extends Matching
{ {
public $typePicture = 'matching_global.png'; public $typePicture = 'matching_co.png';
public $explanationLangVar = 'MatchingGlobal'; public $explanationLangVar = 'MatchingCombination';
/** /**
* Constructor. * Constructor.
@ -15,7 +15,7 @@ class MatchingGlobal extends Matching
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->type = MATCHING_GLOBAL; $this->type = MATCHING_COMBINATION;
$this->isContent = $this->getIsContent(); $this->isContent = $this->getIsContent();
} }
} }

@ -206,7 +206,7 @@ class MatchingDraggable extends Question
$form->addHtml('</table>'); $form->addHtml('</table>');
if (MATCHING_DRAGGABLE_GLOBAL === $this->type) { if (MATCHING_DRAGGABLE_COMBINATION === $this->type) {
//only 1 answer the all deal ... //only 1 answer the all deal ...
$form->addText('questionWeighting', get_lang('Score'), true, ['value' => 10]); $form->addText('questionWeighting', get_lang('Score'), true, ['value' => 10]);
if (!empty($this->iid)) { if (!empty($this->iid)) {
@ -273,7 +273,7 @@ class MatchingDraggable extends Question
); );
} }
if (MATCHING_DRAGGABLE_GLOBAL == $this->type) { if (MATCHING_DRAGGABLE_COMBINATION == $this->type) {
$this->weighting = $form->getSubmitValue('questionWeighting'); $this->weighting = $form->getSubmitValue('questionWeighting');
} }

@ -0,0 +1,21 @@
<?php
/* For licensing terms, see /license.txt */
/**
* MatchingDraggableCombination.
*/
class MatchingDraggableCombination extends MatchingDraggable
{
public $typePicture = 'matchingdrag_co.png';
public $explanationLangVar = 'MatchingDraggableCombination';
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
$this->type = MATCHING_DRAGGABLE_COMBINATION;
$this->isContent = $this->getIsContent();
}
}

@ -1,21 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* MatchingDraggableGlobal.
*/
class MatchingDraggableGlobal extends MatchingDraggable
{
public $typePicture = 'matchingdrag_global.png';
public $explanationLangVar = 'MatchingDraggableGlobal';
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
$this->type = MATCHING_DRAGGABLE_GLOBAL;
$this->isContent = $this->getIsContent();
}
}

@ -0,0 +1,18 @@
<?php
/* For licensing terms, see /license.txt */
/**
* MultipleAnswerDropdownCombination.
*/
class MultipleAnswerDropdownCombination extends MultipleAnswerDropdown
{
public $typePicture = 'mcma_dropdown_co.png';
public $explanationLangVar = 'MultipleAnswerDropdownCombination';
public function __construct()
{
parent::__construct();
$this->type = MULTIPLE_ANSWER_DROPDOWN_COMBINATION;
}
}

@ -1,16 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
class MultipleAnswerDropdownGlobal extends MultipleAnswerDropdown
{
public $typePicture = 'mcma_dropdown_global.png';
public $explanationLangVar = 'MultipleAnswerDropdownGlobal';
public function __construct()
{
parent::__construct();
$this->type = MULTIPLE_ANSWER_DROPDOWN_GLOBAL;
}
}

@ -770,7 +770,7 @@ class Answer
$questionType = $this->getQuestionType(); $questionType = $this->getQuestionType();
if (in_array( if (in_array(
$questionType, $questionType,
[MATCHING, MATCHING_DRAGGABLE, MATCHING_GLOBAL, MATCHING_DRAGGABLE_GLOBAL] [MATCHING, MATCHING_DRAGGABLE, MATCHING_COMBINATION, MATCHING_DRAGGABLE_COMBINATION]
)) { )) {
$answer = new Answer($this->questionId, $courseId, $this->exercise, false); $answer = new Answer($this->questionId, $courseId, $this->exercise, false);
$answer->read(); $answer->read();

@ -3900,16 +3900,6 @@ class Exercise
$answerMatching[$real_answer['iid']] = $real_answer['answer']; $answerMatching[$real_answer['iid']] = $real_answer['answer'];
} }
// Get correct answers for multiple answers.
$sql = "SELECT iid
FROM $table_ans
WHERE question_id = $questionId AND correct = 1";
$resMAnswer = Database::query($sql);
$correctMultipleAnswers = [];
while ($rowMAanswer = Database::fetch_array($resMAnswer)) {
$correctMultipleAnswers[] = $rowMAanswer['iid'];
}
// Get first answer needed for global question, no matter the answer shuffle option; // Get first answer needed for global question, no matter the answer shuffle option;
$firstAnswer = []; $firstAnswer = [];
if ($answerType == MULTIPLE_ANSWER_COMBINATION || if ($answerType == MULTIPLE_ANSWER_COMBINATION ||
@ -3931,7 +3921,7 @@ class Exercise
$organs_at_risk_hit = 0; $organs_at_risk_hit = 0;
$questionScore = 0; $questionScore = 0;
$orderedHotSpots = []; $orderedHotSpots = [];
if (in_array($answerType, [HOT_SPOT_GLOBAL, HOT_SPOT, ANNOTATION])) { if (in_array($answerType, [HOT_SPOT_COMBINATION, HOT_SPOT, ANNOTATION])) {
$orderedHotSpots = $em->getRepository('ChamiloCoreBundle:TrackEHotspot')->findBy( $orderedHotSpots = $em->getRepository('ChamiloCoreBundle:TrackEHotspot')->findBy(
[ [
'hotspotQuestionId' => $questionId, 'hotspotQuestionId' => $questionId,
@ -3942,8 +3932,8 @@ class Exercise
); );
} }
if (in_array($answerType, [MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_GLOBAL])) { if (in_array($answerType, [MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_COMBINATION])) {
if (MULTIPLE_ANSWER_DROPDOWN_GLOBAL == $answerType) { if (MULTIPLE_ANSWER_DROPDOWN_COMBINATION == $answerType) {
$questionScore = $questionWeighting; $questionScore = $questionWeighting;
} }
@ -3971,7 +3961,7 @@ class Exercise
$correctChoices = array_keys($correctChoices); $correctChoices = array_keys($correctChoices);
if (MULTIPLE_ANSWER_DROPDOWN_GLOBAL == $answerType if (MULTIPLE_ANSWER_DROPDOWN_COMBINATION == $answerType
&& (array_diff($studentChoices, $correctChoices) || array_diff($correctChoices, $studentChoices)) && (array_diff($studentChoices, $correctChoices) || array_diff($correctChoices, $studentChoices))
) { ) {
$questionScore = 0; $questionScore = 0;
@ -4165,7 +4155,6 @@ class Exercise
$totalScore += $answerWeighting; $totalScore += $answerWeighting;
break; break;
case GLOBAL_MULTIPLE_ANSWER: case GLOBAL_MULTIPLE_ANSWER:
$validAnswer = false;
if ($from_database) { if ($from_database) {
$choice = []; $choice = [];
$sql = "SELECT answer FROM $TBL_TRACK_ATTEMPT $sql = "SELECT answer FROM $TBL_TRACK_ATTEMPT
@ -4174,20 +4163,14 @@ class Exercise
while ($row = Database::fetch_array($resultans)) { while ($row = Database::fetch_array($resultans)) {
$choice[$row['answer']] = 1; $choice[$row['answer']] = 1;
} }
if (!empty($choice) && count($choice) == count($correctMultipleAnswers)) {
$validAnswer = (0 == count(array_diff(array_keys($choice), $correctMultipleAnswers)));
}
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
$real_answers[$answerId] = (bool) $studentChoice; $real_answers[$answerId] = (bool) $studentChoice;
if ($studentChoice && $validAnswer) { if ($studentChoice) {
$questionScore += $answerWeighting; $questionScore += $answerWeighting;
} }
} else { } else {
if (!empty($choice) && count($choice) == count($correctMultipleAnswers)) {
$validAnswer = (0 == count(array_diff(array_keys($choice), $correctMultipleAnswers)));
}
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
if (isset($studentChoice) && $validAnswer) { if (isset($studentChoice)) {
$questionScore += $answerWeighting; $questionScore += $answerWeighting;
} }
$real_answers[$answerId] = (bool) $studentChoice; $real_answers[$answerId] = (bool) $studentChoice;
@ -4262,7 +4245,7 @@ class Exercise
} }
break; break;
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
$str = ''; $str = '';
$answerFromDatabase = ''; $answerFromDatabase = '';
if ($from_database) { if ($from_database) {
@ -4762,8 +4745,8 @@ class Exercise
break; break;
case DRAGGABLE: case DRAGGABLE:
case MATCHING_DRAGGABLE: case MATCHING_DRAGGABLE:
case MATCHING_DRAGGABLE_GLOBAL: case MATCHING_DRAGGABLE_COMBINATION:
case MATCHING_GLOBAL: case MATCHING_COMBINATION:
case MATCHING: case MATCHING:
if ($from_database) { if ($from_database) {
$sql = "SELECT iid, answer, id_auto $sql = "SELECT iid, answer, id_auto
@ -4910,8 +4893,8 @@ class Exercise
} }
switch ($answerType) { switch ($answerType) {
case MATCHING: case MATCHING:
case MATCHING_GLOBAL: case MATCHING_COMBINATION:
case MATCHING_DRAGGABLE_GLOBAL: case MATCHING_DRAGGABLE_COMBINATION:
case MATCHING_DRAGGABLE: case MATCHING_DRAGGABLE:
if (RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK == $this->results_disabled) { if (RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK == $this->results_disabled) {
if (false === $showTotalScoreAndUserChoicesInLastAttempt && empty($s_user_answer)) { if (false === $showTotalScoreAndUserChoicesInLastAttempt && empty($s_user_answer)) {
@ -4937,7 +4920,7 @@ class Exercise
if ($this->showExpectedChoice()) { if ($this->showExpectedChoice()) {
if ($this->showExpectedChoiceColumn()) { if ($this->showExpectedChoiceColumn()) {
echo '<td>'; echo '<td>';
if (in_array($answerType, [MATCHING, MATCHING_GLOBAL, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_GLOBAL])) { if (in_array($answerType, [MATCHING, MATCHING_COMBINATION, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_COMBINATION])) {
if (isset($real_list[$i_answer_correct_answer]) && if (isset($real_list[$i_answer_correct_answer]) &&
$showTotalScoreAndUserChoicesInLastAttempt == true $showTotalScoreAndUserChoicesInLastAttempt == true
) { ) {
@ -4950,7 +4933,7 @@ class Exercise
} }
echo '<td>'.$status.'</td>'; echo '<td>'.$status.'</td>';
} else { } else {
if (in_array($answerType, [MATCHING, MATCHING_GLOBAL, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_GLOBAL])) { if (in_array($answerType, [MATCHING, MATCHING_COMBINATION, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_COMBINATION])) {
if (isset($real_list[$i_answer_correct_answer]) && if (isset($real_list[$i_answer_correct_answer]) &&
$showTotalScoreAndUserChoicesInLastAttempt === true $showTotalScoreAndUserChoicesInLastAttempt === true
) { ) {
@ -4996,7 +4979,7 @@ class Exercise
echo '<td>'.$counterAnswer.'</td>'; echo '<td>'.$counterAnswer.'</td>';
echo '<td>'.$status.'</td>'; echo '<td>'.$status.'</td>';
echo '<td>'; echo '<td>';
if (in_array($answerType, [MATCHING, MATCHING_GLOBAL, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_GLOBAL])) { if (in_array($answerType, [MATCHING, MATCHING_COMBINATION, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_COMBINATION])) {
if (isset($real_list[$i_answer_correct_answer]) && if (isset($real_list[$i_answer_correct_answer]) &&
$showTotalScoreAndUserChoicesInLastAttempt === true $showTotalScoreAndUserChoicesInLastAttempt === true
) { ) {
@ -5040,7 +5023,7 @@ class Exercise
} }
break; break;
case HOT_SPOT: case HOT_SPOT:
case HOT_SPOT_GLOBAL: case HOT_SPOT_COMBINATION:
if ($from_database) { if ($from_database) {
$TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
// Check auto id // Check auto id
@ -5233,7 +5216,7 @@ class Exercise
if ($show_result) { if ($show_result) {
if ('exercise_result' === $from) { if ('exercise_result' === $from) {
// Display answers (if not matching type, or if the answer is correct) // Display answers (if not matching type, or if the answer is correct)
if (!in_array($answerType, [MATCHING, MATCHING_GLOBAL, DRAGGABLE, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_GLOBAL]) || if (!in_array($answerType, [MATCHING, MATCHING_COMBINATION, DRAGGABLE, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_COMBINATION]) ||
$answerCorrect $answerCorrect
) { ) {
if (in_array( if (in_array(
@ -5305,7 +5288,7 @@ class Exercise
$results_disabled, $results_disabled,
$showTotalScoreAndUserChoicesInLastAttempt $showTotalScoreAndUserChoicesInLastAttempt
); );
} elseif (in_array($answerType, [FILL_IN_BLANKS, FILL_IN_BLANKS_GLOBAL])) { } elseif (in_array($answerType, [FILL_IN_BLANKS, FILL_IN_BLANKS_COMBINATION])) {
ExerciseShowFunctions::display_fill_in_blanks_answer( ExerciseShowFunctions::display_fill_in_blanks_answer(
$this, $this,
$feedback_type, $feedback_type,
@ -5359,7 +5342,7 @@ class Exercise
$results_disabled, $results_disabled,
$questionScore $questionScore
); );
} elseif (in_array($answerType, [HOT_SPOT, HOT_SPOT_GLOBAL])) { } elseif (in_array($answerType, [HOT_SPOT, HOT_SPOT_COMBINATION])) {
$correctAnswerId = 0; $correctAnswerId = 0;
/** @var TrackEHotspot $hotspot */ /** @var TrackEHotspot $hotspot */
foreach ($orderedHotSpots as $correctAnswerId => $hotspot) { foreach ($orderedHotSpots as $correctAnswerId => $hotspot) {
@ -5538,7 +5521,7 @@ class Exercise
error_log(__LINE__.' first', 0); error_log(__LINE__.' first', 0);
} }
} }
} elseif (in_array($answerType, [MATCHING, MATCHING_GLOBAL, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_GLOBAL])) { } elseif (in_array($answerType, [MATCHING, MATCHING_COMBINATION, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_COMBINATION])) {
echo '<tr>'; echo '<tr>';
echo Display::tag('td', $answerMatching[$answerId]); echo Display::tag('td', $answerMatching[$answerId]);
echo Display::tag( echo Display::tag(
@ -5701,7 +5684,7 @@ class Exercise
} }
break; break;
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
ExerciseShowFunctions::display_fill_in_blanks_answer( ExerciseShowFunctions::display_fill_in_blanks_answer(
$this, $this,
$feedback_type, $feedback_type,
@ -5761,7 +5744,7 @@ class Exercise
</table>'; </table>';
break; break;
case HOT_SPOT: case HOT_SPOT:
case HOT_SPOT_GLOBAL: case HOT_SPOT_COMBINATION:
$correctAnswerId = 0; $correctAnswerId = 0;
/** @var TrackEHotspot $hotspot */ /** @var TrackEHotspot $hotspot */
foreach ($orderedHotSpots as $correctAnswerId => $hotspot) { foreach ($orderedHotSpots as $correctAnswerId => $hotspot) {
@ -5918,8 +5901,8 @@ class Exercise
break; break;
case DRAGGABLE: case DRAGGABLE:
case MATCHING_DRAGGABLE: case MATCHING_DRAGGABLE:
case MATCHING_DRAGGABLE_GLOBAL: case MATCHING_DRAGGABLE_COMBINATION:
case MATCHING_GLOBAL: case MATCHING_COMBINATION:
case MATCHING: case MATCHING:
echo '<tr>'; echo '<tr>';
echo Display::tag('td', $answerMatching[$answerId]); echo Display::tag('td', $answerMatching[$answerId]);
@ -5948,7 +5931,7 @@ class Exercise
} // end for that loops over all answers of the current question } // end for that loops over all answers of the current question
// It validates unique score when all answers are correct for global questions // It validates unique score when all answers are correct for global questions
if (FILL_IN_BLANKS_GLOBAL === $answerType) { if (FILL_IN_BLANKS_COMBINATION === $answerType) {
$questionScore = ExerciseLib::getUserQuestionScoreGlobal( $questionScore = ExerciseLib::getUserQuestionScoreGlobal(
$answerType, $answerType,
$listCorrectAnswers, $listCorrectAnswers,
@ -5957,7 +5940,7 @@ class Exercise
$questionWeighting $questionWeighting
); );
} }
if (HOT_SPOT_GLOBAL === $answerType) { if (HOT_SPOT_COMBINATION === $answerType) {
$listCorrectAnswers = isset($exerciseResultCoordinates[$questionId]) ? $exerciseResultCoordinates[$questionId] : []; $listCorrectAnswers = isset($exerciseResultCoordinates[$questionId]) ? $exerciseResultCoordinates[$questionId] : [];
$questionScore = ExerciseLib::getUserQuestionScoreGlobal( $questionScore = ExerciseLib::getUserQuestionScoreGlobal(
$answerType, $answerType,
@ -5969,7 +5952,7 @@ class Exercise
$nbrAnswers $nbrAnswers
); );
} }
if (in_array($answerType, [MATCHING_GLOBAL, MATCHING_DRAGGABLE_GLOBAL])) { if (in_array($answerType, [MATCHING_COMBINATION, MATCHING_DRAGGABLE_COMBINATION])) {
$questionScore = ExerciseLib::getUserQuestionScoreGlobal( $questionScore = ExerciseLib::getUserQuestionScoreGlobal(
$answerType, $answerType,
$matchingCorrectAnswers[$questionId], $matchingCorrectAnswers[$questionId],
@ -6022,7 +6005,7 @@ class Exercise
// we use the results from the session (from_db=0) // we use the results from the session (from_db=0)
// TODO Change this, because it is wrong to show the user // TODO Change this, because it is wrong to show the user
// some results that haven't been stored in the database yet // some results that haven't been stored in the database yet
if (in_array($answerType, [HOT_SPOT, HOT_SPOT_ORDER, HOT_SPOT_DELINEATION, HOT_SPOT_GLOBAL])) { if (in_array($answerType, [HOT_SPOT, HOT_SPOT_ORDER, HOT_SPOT_DELINEATION, HOT_SPOT_COMBINATION])) {
if ($debug) { if ($debug) {
error_log('$from AND this is a hotspot kind of question '); error_log('$from AND this is a hotspot kind of question ');
} }
@ -6157,7 +6140,7 @@ class Exercise
$relPath = api_get_path(WEB_CODE_PATH); $relPath = api_get_path(WEB_CODE_PATH);
if (in_array($answerType, [HOT_SPOT, HOT_SPOT_GLOBAL, HOT_SPOT_ORDER])) { if (in_array($answerType, [HOT_SPOT, HOT_SPOT_COMBINATION, HOT_SPOT_ORDER])) {
// We made an extra table for the answers // We made an extra table for the answers
if ($show_result) { if ($show_result) {
echo '</table></td></tr>'; echo '</table></td></tr>';
@ -6284,12 +6267,12 @@ class Exercise
MULTIPLE_ANSWER, MULTIPLE_ANSWER,
GLOBAL_MULTIPLE_ANSWER, GLOBAL_MULTIPLE_ANSWER,
MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN,
MULTIPLE_ANSWER_DROPDOWN_GLOBAL, MULTIPLE_ANSWER_DROPDOWN_COMBINATION,
] ]
) )
) { ) {
if ($choice != 0) { if ($choice != 0) {
if (in_array($answerType, [MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_GLOBAL])) { if (in_array($answerType, [MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_COMBINATION])) {
$reply = array_values($choice); $reply = array_values($choice);
} else { } else {
$reply = array_keys($choice); $reply = array_keys($choice);
@ -6348,7 +6331,7 @@ class Exercise
$questionDuration $questionDuration
); );
} }
} elseif (in_array($answerType, [MATCHING, MATCHING_GLOBAL, DRAGGABLE, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_GLOBAL])) { } elseif (in_array($answerType, [MATCHING, MATCHING_COMBINATION, DRAGGABLE, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_COMBINATION])) {
if (isset($matching)) { if (isset($matching)) {
foreach ($matching as $j => $val) { foreach ($matching as $j => $val) {
Event::saveQuestionAttempt( Event::saveQuestionAttempt(
@ -6413,7 +6396,7 @@ class Exercise
) { ) {
$answer = $choice; $answer = $choice;
Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->iid, false, $questionDuration); Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->iid, false, $questionDuration);
} elseif (in_array($answerType, [HOT_SPOT, HOT_SPOT_GLOBAL, ANNOTATION])) { } elseif (in_array($answerType, [HOT_SPOT, HOT_SPOT_COMBINATION, ANNOTATION])) {
$answer = []; $answer = [];
if (isset($exerciseResultCoordinates[$questionId]) && !empty($exerciseResultCoordinates[$questionId])) { if (isset($exerciseResultCoordinates[$questionId]) && !empty($exerciseResultCoordinates[$questionId])) {
if ($debug) { if ($debug) {
@ -8626,13 +8609,13 @@ class Exercise
if ($onlyCorrect) { if ($onlyCorrect) {
switch ($objAnswer->getQuestionType()) { switch ($objAnswer->getQuestionType()) {
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
$isCorrect = FillBlanks::isCorrect($answer['answer']); $isCorrect = FillBlanks::isCorrect($answer['answer']);
break; break;
case MATCHING: case MATCHING:
case MATCHING_GLOBAL: case MATCHING_COMBINATION:
case DRAGGABLE: case DRAGGABLE:
case MATCHING_DRAGGABLE_GLOBAL: case MATCHING_DRAGGABLE_COMBINATION:
case MATCHING_DRAGGABLE: case MATCHING_DRAGGABLE:
$isCorrect = Matching::isCorrect( $isCorrect = Matching::isCorrect(
$answer['position'], $answer['position'],
@ -10832,7 +10815,7 @@ class Exercise
if ($question) { if ($question) {
switch ($question->type) { switch ($question->type) {
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
$option['answer'] = $this->fill_in_blank_answer_to_string($option['answer']); $option['answer'] = $this->fill_in_blank_answer_to_string($option['answer']);
break; break;
} }

@ -442,20 +442,20 @@ foreach ($questionList as $questionId) {
case MULTIPLE_ANSWER: case MULTIPLE_ANSWER:
case MULTIPLE_ANSWER_TRUE_FALSE: case MULTIPLE_ANSWER_TRUE_FALSE:
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
case CALCULATED_ANSWER: case CALCULATED_ANSWER:
case GLOBAL_MULTIPLE_ANSWER: case GLOBAL_MULTIPLE_ANSWER:
case FREE_ANSWER: case FREE_ANSWER:
case UPLOAD_ANSWER: case UPLOAD_ANSWER:
case ORAL_EXPRESSION: case ORAL_EXPRESSION:
case MATCHING: case MATCHING:
case MATCHING_GLOBAL: case MATCHING_COMBINATION:
case DRAGGABLE: case DRAGGABLE:
case READING_COMPREHENSION: case READING_COMPREHENSION:
case MATCHING_DRAGGABLE: case MATCHING_DRAGGABLE:
case MATCHING_DRAGGABLE_GLOBAL: case MATCHING_DRAGGABLE_COMBINATION:
case MULTIPLE_ANSWER_DROPDOWN: case MULTIPLE_ANSWER_DROPDOWN:
case MULTIPLE_ANSWER_DROPDOWN_GLOBAL: case MULTIPLE_ANSWER_DROPDOWN_COMBINATION:
$question_result = $objExercise->manage_answer( $question_result = $objExercise->manage_answer(
$id, $id,
$questionId, $questionId,
@ -492,7 +492,7 @@ foreach ($questionList as $questionId) {
$totalScore += $questionResult['score']; $totalScore += $questionResult['score'];
break; break;
case HOT_SPOT: case HOT_SPOT:
case HOT_SPOT_GLOBAL: case HOT_SPOT_COMBINATION:
if ($show_results || $showTotalScoreAndUserChoicesInLastAttempt) { if ($show_results || $showTotalScoreAndUserChoicesInLastAttempt) {
// echo '<table class="table table-bordered table-striped"><tr><td>'; // echo '<table class="table table-bordered table-striped"><tr><td>';
} }
@ -596,7 +596,7 @@ foreach ($questionList as $questionId) {
echo '</table>'; echo '</table>';
} }
if ($show_results && !in_array($answerType, [HOT_SPOT_GLOBAL, HOT_SPOT])) { if ($show_results && !in_array($answerType, [HOT_SPOT_COMBINATION, HOT_SPOT])) {
echo '</table>'; echo '</table>';
} }

@ -1243,13 +1243,13 @@ if (!empty($questionList)) {
if ($current_question != $i) { if ($current_question != $i) {
continue; continue;
} else { } else {
if (in_array($selectType, [HOT_SPOT, HOT_SPOT_GLOBAL, HOT_SPOT_DELINEATION])) { if (in_array($selectType, [HOT_SPOT, HOT_SPOT_COMBINATION, HOT_SPOT_DELINEATION])) {
$number_of_hotspot_questions++; $number_of_hotspot_questions++;
} }
break; break;
} }
} else { } else {
if (in_array($selectType, [HOT_SPOT, HOT_SPOT_GLOBAL, HOT_SPOT_DELINEATION])) { if (in_array($selectType, [HOT_SPOT, HOT_SPOT_COMBINATION, HOT_SPOT_DELINEATION])) {
$number_of_hotspot_questions++; $number_of_hotspot_questions++;
} }
} }

@ -45,7 +45,7 @@ class Ims2Question extends Question
return $answer; return $answer;
case MCMA: case MCMA:
case MULTIPLE_ANSWER_DROPDOWN: case MULTIPLE_ANSWER_DROPDOWN:
case MULTIPLE_ANSWER_DROPDOWN_GLOBAL: case MULTIPLE_ANSWER_DROPDOWN_COMBINATION:
$answer = new ImsAnswerMultipleChoice($this->iid); $answer = new ImsAnswerMultipleChoice($this->iid);
return $answer; return $answer;
@ -67,7 +67,7 @@ class Ims2Question extends Question
return $answer; return $answer;
case HOT_SPOT: case HOT_SPOT:
case HOT_SPOT_GLOBAL: case HOT_SPOT_COMBINATION:
$answer = new ImsAnswerHotspot($this->iid); $answer = new ImsAnswerHotspot($this->iid);
return $answer; return $answer;
@ -135,7 +135,7 @@ class ImsAnswerMultipleChoice extends Answer implements ImsAnswerInterface
{ {
$this->answerList = $this->getAnswersList(true); $this->answerList = $this->getAnswersList(true);
$type = $this->getQuestionType(); $type = $this->getQuestionType();
if (in_array($type, [MCMA, MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_GLOBAL])) { if (in_array($type, [MCMA, MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_COMBINATION])) {
$cardinality = 'multiple'; $cardinality = 'multiple';
} else { } else {
$cardinality = 'single'; $cardinality = 'single';
@ -158,7 +158,7 @@ class ImsAnswerMultipleChoice extends Answer implements ImsAnswerInterface
if (is_array($this->answerList)) { if (is_array($this->answerList)) {
$out .= ' <mapping'; $out .= ' <mapping';
if (MULTIPLE_ANSWER_DROPDOWN_GLOBAL == $this->getQuestionType()) { if (MULTIPLE_ANSWER_DROPDOWN_COMBINATION == $this->getQuestionType()) {
$out .= ' defaultValue="'.$question->selectWeighting().'"'; $out .= ' defaultValue="'.$question->selectWeighting().'"';
} }

@ -462,7 +462,7 @@ function export_question_qti($questionId, $standalone = true)
|| $qst instanceof MultipleAnswer || $qst instanceof MultipleAnswer
|| $qst instanceof FreeAnswer || $qst instanceof FreeAnswer
|| $qst instanceof MultipleAnswerDropdown || $qst instanceof MultipleAnswerDropdown
|| $qst instanceof MultipleAnswerDropdownGlobal || $qst instanceof MultipleAnswerDropdownCombination
; ;
if (!$isValid) { if (!$isValid) {

@ -93,7 +93,7 @@ class ScormQuestion extends Question
$this->answer->questionJSId = $this->js_id; $this->answer->questionJSId = $this->js_id;
break; break;
case HOT_SPOT: case HOT_SPOT:
case HOT_SPOT_GLOBAL: case HOT_SPOT_COMBINATION:
$this->answer = new ScormAnswerHotspot($this->iid); $this->answer = new ScormAnswerHotspot($this->iid);
$this->answer->questionJSId = $this->js_id; $this->answer->questionJSId = $this->js_id;
break; break;
@ -208,7 +208,7 @@ class ScormQuestion extends Question
$js .= $script;*/ $js .= $script;*/
break; break;
case HOT_SPOT: case HOT_SPOT:
case HOT_SPOT_GLOBAL: case HOT_SPOT_COMBINATION:
//put the max score to 0 to avoid discounting the points of //put the max score to 0 to avoid discounting the points of
//non-exported quiz types in the SCORM //non-exported quiz types in the SCORM
$weight = 0; $weight = 0;

@ -63,7 +63,7 @@ class FillBlanks extends Question
} }
} }
$questionTypes = [FILL_IN_BLANKS => 'fillblanks', FILL_IN_BLANKS_GLOBAL => 'fillblanks_global']; $questionTypes = [FILL_IN_BLANKS => 'fillblanks', FILL_IN_BLANKS_COMBINATION => 'fillblanks_combination'];
echo '<script> echo '<script>
var questionType = "'.$questionTypes[$this->type].'"; var questionType = "'.$questionTypes[$this->type].'";
var firstTime = true; var firstTime = true;
@ -367,7 +367,7 @@ class FillBlanks extends Question
// setting the save button here and not in the question class.php // setting the save button here and not in the question class.php
$form->addHtml('<div id="defineoneblank" style="color:#D04A66; margin-left:160px">'.get_lang('DefineBlanks').'</div>'); $form->addHtml('<div id="defineoneblank" style="color:#D04A66; margin-left:160px">'.get_lang('DefineBlanks').'</div>');
if (FILL_IN_BLANKS_GLOBAL === $this->type) { if (FILL_IN_BLANKS_COMBINATION === $this->type) {
//only 1 answer the all deal ... //only 1 answer the all deal ...
$form->addText('questionWeighting', get_lang('Score'), true, ['value' => 10]); $form->addText('questionWeighting', get_lang('Score'), true, ['value' => 10]);
if (!empty($this->iid)) { if (!empty($this->iid)) {
@ -468,7 +468,7 @@ class FillBlanks extends Question
$this->weighting += (float) $form->getSubmitValue('weighting['.$i.']'); $this->weighting += (float) $form->getSubmitValue('weighting['.$i.']');
} }
if (FILL_IN_BLANKS_GLOBAL === $this->type) { if (FILL_IN_BLANKS_COMBINATION === $this->type) {
$this->weighting = $form->getSubmitValue('questionWeighting'); $this->weighting = $form->getSubmitValue('questionWeighting');
} }

@ -81,7 +81,7 @@ $buttonBack = isset($_POST['buttonBack']) ? true : false;
$nbrAnswers = isset($_POST['nbrAnswers']) ? (int) $_POST['nbrAnswers'] : 0; $nbrAnswers = isset($_POST['nbrAnswers']) ? (int) $_POST['nbrAnswers'] : 0;
if ($submitAnswers || $buttonBack) { if ($submitAnswers || $buttonBack) {
if (in_array($answerType, [HOT_SPOT, HOT_SPOT_GLOBAL])) { if (in_array($answerType, [HOT_SPOT, HOT_SPOT_COMBINATION])) {
if ($debug > 0) { if ($debug > 0) {
echo '$submitAnswers or $buttonBack was set'."<br />\n"; echo '$submitAnswers or $buttonBack was set'."<br />\n";
} }
@ -133,7 +133,7 @@ if ($submitAnswers || $buttonBack) {
$questionWeighting += $weighting[$i]; $questionWeighting += $weighting[$i];
} }
if (HOT_SPOT_GLOBAL == $answerType) { if (HOT_SPOT_COMBINATION == $answerType) {
$weighting[$i] = 0; $weighting[$i] = 0;
} }
@ -152,7 +152,7 @@ if ($submitAnswers || $buttonBack) {
$objAnswer->save(); $objAnswer->save();
// sets the total weighting of the question // sets the total weighting of the question
if (HOT_SPOT_GLOBAL == $answerType) { if (HOT_SPOT_COMBINATION == $answerType) {
$questionWeighting = $httpRequest->request->get('questionWeighting'); $questionWeighting = $httpRequest->request->get('questionWeighting');
} }
$objQuestion->updateWeighting($questionWeighting); $objQuestion->updateWeighting($questionWeighting);
@ -629,7 +629,7 @@ if (isset($modifyAnswers)) {
} else { } else {
echo '<th colspan="2">'.get_lang('Comment').'</th>'; echo '<th colspan="2">'.get_lang('Comment').'</th>';
} ?> } ?>
<?php if (HOT_SPOT_GLOBAL !== $answerType) { ?> <?php if (HOT_SPOT_COMBINATION !== $answerType) { ?>
<th><?php echo get_lang('QuestionWeighting'); ?> *</th> <th><?php echo get_lang('QuestionWeighting'); ?> *</th>
<?php } ?> <?php } ?>
</tr> </tr>
@ -981,9 +981,9 @@ if (isset($modifyAnswers)) {
<?php <?php
} }
} }
if (in_array($answerType, [HOT_SPOT_GLOBAL, HOT_SPOT])) { if (in_array($answerType, [HOT_SPOT_COMBINATION, HOT_SPOT])) {
?> ?>
<?php if (HOT_SPOT_GLOBAL === $answerType) { ?> <?php if (HOT_SPOT_COMBINATION === $answerType) { ?>
<input class="form-control" type="hidden" name="weighting[<?php echo $i; ?>]" value="1" /> <input class="form-control" type="hidden" name="weighting[<?php echo $i; ?>]" value="1" />
<?php } else { ?> <?php } else { ?>
<input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]"
@ -1111,7 +1111,7 @@ if (isset($modifyAnswers)) {
</tbody> </tbody>
</table> </table>
</div> </div>
<?php if (HOT_SPOT_GLOBAL === $answerType) { ?> <?php if (HOT_SPOT_COMBINATION === $answerType) { ?>
<div class="form-group "> <div class="form-group ">
<label for="question_admin_form_questionWeighting" class="col-sm-2 control-label"> <label for="question_admin_form_questionWeighting" class="col-sm-2 control-label">
<span class="form_required">*</span> <span class="form_required">*</span>

@ -221,7 +221,7 @@ class Matching extends Question
$form->addHtml('</table>'); $form->addHtml('</table>');
if (MATCHING_GLOBAL === $this->type) { if (MATCHING_COMBINATION === $this->type) {
//only 1 answer the all deal ... //only 1 answer the all deal ...
$form->addText('questionWeighting', get_lang('Score'), true, ['value' => 10]); $form->addText('questionWeighting', get_lang('Score'), true, ['value' => 10]);
if (!empty($this->iid)) { if (!empty($this->iid)) {
@ -288,7 +288,7 @@ class Matching extends Question
); );
} }
if (MATCHING_GLOBAL == $this->type) { if (MATCHING_COMBINATION == $this->type) {
$this->weighting = $form->getSubmitValue('questionWeighting'); $this->weighting = $form->getSubmitValue('questionWeighting');
} }

@ -16,7 +16,7 @@ if (!is_object($objQuestion)) {
$objQuestion = Question::read($questionId); $objQuestion = Question::read($questionId);
} }
$isGlobal = MULTIPLE_ANSWER_DROPDOWN_GLOBAL === (int) $objQuestion->type; $isGlobal = MULTIPLE_ANSWER_DROPDOWN_COMBINATION === (int) $objQuestion->type;
$objAnswer = new Answer($objQuestion->iid, 0, $objExercise); $objAnswer = new Answer($objQuestion->iid, 0, $objExercise);
$options = []; $options = [];

@ -44,13 +44,13 @@ abstract class Question
UNIQUE_ANSWER => ['unique_answer.class.php', 'UniqueAnswer'], UNIQUE_ANSWER => ['unique_answer.class.php', 'UniqueAnswer'],
MULTIPLE_ANSWER => ['multiple_answer.class.php', 'MultipleAnswer'], MULTIPLE_ANSWER => ['multiple_answer.class.php', 'MultipleAnswer'],
FILL_IN_BLANKS => ['fill_blanks.class.php', 'FillBlanks'], FILL_IN_BLANKS => ['fill_blanks.class.php', 'FillBlanks'],
FILL_IN_BLANKS_GLOBAL => ['FillBlanksGlobal.php', 'FillBlanksGlobal'], FILL_IN_BLANKS_COMBINATION => ['FillBlanksCombination.php', 'FillBlanksCombination'],
MATCHING => ['matching.class.php', 'Matching'], MATCHING => ['matching.class.php', 'Matching'],
MATCHING_GLOBAL => ['MatchingGlobal.php', 'MatchingGlobal'], MATCHING_COMBINATION => ['MatchingCombination.php', 'MatchingCombination'],
FREE_ANSWER => ['freeanswer.class.php', 'FreeAnswer'], FREE_ANSWER => ['freeanswer.class.php', 'FreeAnswer'],
ORAL_EXPRESSION => ['oral_expression.class.php', 'OralExpression'], ORAL_EXPRESSION => ['oral_expression.class.php', 'OralExpression'],
HOT_SPOT => ['hotspot.class.php', 'HotSpot'], HOT_SPOT => ['hotspot.class.php', 'HotSpot'],
HOT_SPOT_GLOBAL => ['HotSpotGlobal.php', 'HotSpotGlobal'], HOT_SPOT_COMBINATION => ['HotSpotCombination.php', 'HotSpotCombination'],
HOT_SPOT_DELINEATION => ['HotSpotDelineation.php', 'HotSpotDelineation'], HOT_SPOT_DELINEATION => ['HotSpotDelineation.php', 'HotSpotDelineation'],
MULTIPLE_ANSWER_COMBINATION => ['multiple_answer_combination.class.php', 'MultipleAnswerCombination'], MULTIPLE_ANSWER_COMBINATION => ['multiple_answer_combination.class.php', 'MultipleAnswerCombination'],
UNIQUE_ANSWER_NO_OPTION => ['unique_answer_no_option.class.php', 'UniqueAnswerNoOption'], UNIQUE_ANSWER_NO_OPTION => ['unique_answer_no_option.class.php', 'UniqueAnswerNoOption'],
@ -68,13 +68,13 @@ abstract class Question
UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'], UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'],
DRAGGABLE => ['Draggable.php', 'Draggable'], DRAGGABLE => ['Draggable.php', 'Draggable'],
MATCHING_DRAGGABLE => ['MatchingDraggable.php', 'MatchingDraggable'], MATCHING_DRAGGABLE => ['MatchingDraggable.php', 'MatchingDraggable'],
MATCHING_DRAGGABLE_GLOBAL => ['MatchingDraggableGlobal.php', 'MatchingDraggableGlobal'], MATCHING_DRAGGABLE_COMBINATION => ['MatchingDraggableCombination.php', 'MatchingDraggableCombination'],
//MEDIA_QUESTION => array('media_question.class.php' , 'MediaQuestion') //MEDIA_QUESTION => array('media_question.class.php' , 'MediaQuestion')
ANNOTATION => ['Annotation.php', 'Annotation'], ANNOTATION => ['Annotation.php', 'Annotation'],
READING_COMPREHENSION => ['ReadingComprehension.php', 'ReadingComprehension'], READING_COMPREHENSION => ['ReadingComprehension.php', 'ReadingComprehension'],
UPLOAD_ANSWER => ['UploadAnswer.php', 'UploadAnswer'], UPLOAD_ANSWER => ['UploadAnswer.php', 'UploadAnswer'],
MULTIPLE_ANSWER_DROPDOWN => ['MultipleAnswerDropdown.php', 'MultipleAnswerDropdown'], MULTIPLE_ANSWER_DROPDOWN => ['MultipleAnswerDropdown.php', 'MultipleAnswerDropdown'],
MULTIPLE_ANSWER_DROPDOWN_GLOBAL => ['MultipleAnswerDropdownGlobal.php', 'MultipleAnswerDropdownGlobal'], MULTIPLE_ANSWER_DROPDOWN_COMBINATION => ['MultipleAnswerDropdownCombination.php', 'MultipleAnswerDropdownCombination'],
]; ];
/** /**
@ -103,12 +103,12 @@ abstract class Question
// See BT#12611 // See BT#12611
$this->questionTypeWithFeedback = [ $this->questionTypeWithFeedback = [
MATCHING, MATCHING,
MATCHING_GLOBAL, MATCHING_COMBINATION,
MATCHING_DRAGGABLE, MATCHING_DRAGGABLE,
MATCHING_DRAGGABLE_GLOBAL, MATCHING_DRAGGABLE_COMBINATION,
DRAGGABLE, DRAGGABLE,
FILL_IN_BLANKS, FILL_IN_BLANKS,
FILL_IN_BLANKS_GLOBAL, FILL_IN_BLANKS_COMBINATION,
FREE_ANSWER, FREE_ANSWER,
ORAL_EXPRESSION, ORAL_EXPRESSION,
CALCULATED_ANSWER, CALCULATED_ANSWER,
@ -1109,7 +1109,7 @@ abstract class Question
); );
// If hotspot, create first answer // If hotspot, create first answer
if (in_array($type, [HOT_SPOT, HOT_SPOT_GLOBAL, HOT_SPOT_ORDER])) { if (in_array($type, [HOT_SPOT, HOT_SPOT_COMBINATION, HOT_SPOT_ORDER])) {
$quizAnswer = new CQuizAnswer(); $quizAnswer = new CQuizAnswer();
$quizAnswer $quizAnswer
->setCId($c_id) ->setCId($c_id)
@ -1831,7 +1831,7 @@ abstract class Question
switch ($this->type) { switch ($this->type) {
case UNIQUE_ANSWER: case UNIQUE_ANSWER:
case MULTIPLE_ANSWER_DROPDOWN: case MULTIPLE_ANSWER_DROPDOWN:
case MULTIPLE_ANSWER_DROPDOWN_GLOBAL: case MULTIPLE_ANSWER_DROPDOWN_COMBINATION:
$buttonGroup = []; $buttonGroup = [];
$buttonGroup[] = $form->addButtonSave( $buttonGroup[] = $form->addButtonSave(
$text, $text,
@ -2352,7 +2352,7 @@ abstract class Question
$header .= $message.'<br />'; $header .= $message.'<br />';
} }
if ($exercise->hideComment && in_array($this->type, [HOT_SPOT, HOT_SPOT_GLOBAL])) { if ($exercise->hideComment && in_array($this->type, [HOT_SPOT, HOT_SPOT_COMBINATION])) {
$header .= Display::return_message(get_lang('ResultsOnlyAvailableOnline')); $header .= Display::return_message(get_lang('ResultsOnlyAvailableOnline'));
return $header; return $header;
@ -2575,9 +2575,9 @@ abstract class Question
{ {
$oppositeAnswers = [ $oppositeAnswers = [
UNIQUE_ANSWER => [MULTIPLE_ANSWER], UNIQUE_ANSWER => [MULTIPLE_ANSWER],
MULTIPLE_ANSWER => [UNIQUE_ANSWER, MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_GLOBAL], MULTIPLE_ANSWER => [UNIQUE_ANSWER, MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_COMBINATION],
MULTIPLE_ANSWER_DROPDOWN => [MULTIPLE_ANSWER], MULTIPLE_ANSWER_DROPDOWN => [MULTIPLE_ANSWER],
MULTIPLE_ANSWER_DROPDOWN_GLOBAL => [MULTIPLE_ANSWER], MULTIPLE_ANSWER_DROPDOWN_COMBINATION => [MULTIPLE_ANSWER],
]; ];
$this->type = $oppositeAnswers[$this->type][$index]; $this->type = $oppositeAnswers[$this->type][$index];
Database::update( Database::update(
@ -2589,7 +2589,7 @@ abstract class Question
UNIQUE_ANSWER => 'UniqueAnswer', UNIQUE_ANSWER => 'UniqueAnswer',
MULTIPLE_ANSWER => 'MultipleAnswer', MULTIPLE_ANSWER => 'MultipleAnswer',
MULTIPLE_ANSWER_DROPDOWN => 'MultipleAnswerDropdown', MULTIPLE_ANSWER_DROPDOWN => 'MultipleAnswerDropdown',
MULTIPLE_ANSWER_DROPDOWN_GLOBAL => 'MultipleAnswerDropdownGlobal', MULTIPLE_ANSWER_DROPDOWN_COMBINATION => 'MultipleAnswerDropdownCombination',
]; ];
$swappedAnswer = new $answerClasses[$this->type](); $swappedAnswer = new $answerClasses[$this->type]();
foreach ($this as $key => $value) { foreach ($this as $key => $value) {

@ -57,10 +57,10 @@ if (is_object($objQuestion)) {
$objQuestion->processAnswersCreation($form, $objExercise); $objQuestion->processAnswersCreation($form, $objExercise);
// TODO: maybe here is the better place to index this tool, including answers text // TODO: maybe here is the better place to index this tool, including answers text
// redirect // redirect
if (in_array($objQuestion->type, [HOT_SPOT, HOT_SPOT_GLOBAL, HOT_SPOT_DELINEATION])) { if (in_array($objQuestion->type, [HOT_SPOT, HOT_SPOT_COMBINATION, HOT_SPOT_DELINEATION])) {
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&page='.$page.'&hotspotadmin='.$objQuestion->iid.'&'.api_get_cidreq( echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&page='.$page.'&hotspotadmin='.$objQuestion->iid.'&'.api_get_cidreq(
).'"</script>'; ).'"</script>';
} elseif (in_array($objQuestion->type, [MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_GLOBAL])) { } elseif (in_array($objQuestion->type, [MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_COMBINATION])) {
$url = 'admin.php?' $url = 'admin.php?'
.api_get_cidreq().'&' .api_get_cidreq().'&'
.http_build_query(['exerciseId' => $exerciseId, 'page' => $page, 'mad_admin' => $objQuestion->iid]); .http_build_query(['exerciseId' => $exerciseId, 'page' => $page, 'mad_admin' => $objQuestion->iid]);

@ -157,7 +157,7 @@ if (!empty($questionList)) {
// Overwriting values depending of the question // Overwriting values depending of the question
switch ($questionObj->type) { switch ($questionObj->type) {
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
$answer_info_db = $answer_info; $answer_info_db = $answer_info;
$answer_info = substr($answer_info, 0, strpos($answer_info, '::')); $answer_info = substr($answer_info, 0, strpos($answer_info, '::'));
$correct_answer = $is_correct; $correct_answer = $is_correct;
@ -240,7 +240,7 @@ if (!empty($questionList)) {
} }
break; break;
case HOT_SPOT: case HOT_SPOT:
case HOT_SPOT_GLOBAL: case HOT_SPOT_COMBINATION:
if ($answer_id == 1) { if ($answer_id == 1) {
$data[$id]['name'] = cut($questionObj->question, 100); $data[$id]['name'] = cut($questionObj->question, 100);
} else { } else {

@ -86,9 +86,9 @@ function lp_upload_quiz_main()
UNIQUE_ANSWER => get_lang('UniqueSelect'), UNIQUE_ANSWER => get_lang('UniqueSelect'),
MULTIPLE_ANSWER => get_lang('MultipleSelect'), MULTIPLE_ANSWER => get_lang('MultipleSelect'),
MULTIPLE_ANSWER_DROPDOWN => get_lang('MultipleAnswerDropdown'), MULTIPLE_ANSWER_DROPDOWN => get_lang('MultipleAnswerDropdown'),
MULTIPLE_ANSWER_DROPDOWN_GLOBAL => get_lang('MultipleAnswerDropdownGlobal'), MULTIPLE_ANSWER_DROPDOWN_COMBINATION => get_lang('MultipleAnswerDropdownCombination'),
FILL_IN_BLANKS => get_lang('FillBlanks'), FILL_IN_BLANKS => get_lang('FillBlanks'),
FILL_IN_BLANKS_GLOBAL => get_lang('FillBlanksGlobal'), FILL_IN_BLANKS_COMBINATION => get_lang('FillBlanksCombination'),
MATCHING => get_lang('Matching'), MATCHING => get_lang('Matching'),
FREE_ANSWER => get_lang('FreeAnswer'), FREE_ANSWER => get_lang('FreeAnswer'),
GLOBAL_MULTIPLE_ANSWER => get_lang('GlobalMultipleAnswer'), GLOBAL_MULTIPLE_ANSWER => get_lang('GlobalMultipleAnswer'),
@ -334,11 +334,11 @@ function lp_upload_quiz_action_handling()
case MULTIPLE_ANSWER_DROPDOWN: case MULTIPLE_ANSWER_DROPDOWN:
$answer = new MultipleAnswerDropdown(); $answer = new MultipleAnswerDropdown();
break; break;
case MULTIPLE_ANSWER_DROPDOWN_GLOBAL: case MULTIPLE_ANSWER_DROPDOWN_COMBINATION:
$answer = new MultipleAnswerDropdownGlobal(); $answer = new MultipleAnswerDropdownCombination();
break; break;
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
$answer = new FillBlanks(); $answer = new FillBlanks();
$question_description_text = ''; $question_description_text = '';
break; break;
@ -371,7 +371,7 @@ function lp_upload_quiz_action_handling()
switch ($detectQuestionType) { switch ($detectQuestionType) {
case GLOBAL_MULTIPLE_ANSWER: case GLOBAL_MULTIPLE_ANSWER:
case MULTIPLE_ANSWER_DROPDOWN: case MULTIPLE_ANSWER_DROPDOWN:
case MULTIPLE_ANSWER_DROPDOWN_GLOBAL: case MULTIPLE_ANSWER_DROPDOWN_COMBINATION:
case MULTIPLE_ANSWER: case MULTIPLE_ANSWER:
case UNIQUE_ANSWER: case UNIQUE_ANSWER:
$total = 0; $total = 0;
@ -434,7 +434,7 @@ function lp_upload_quiz_action_handling()
//$total = $total - $score; //$total = $total - $score;
} }
break; break;
case MULTIPLE_ANSWER_DROPDOWN_GLOBAL: case MULTIPLE_ANSWER_DROPDOWN_COMBINATION:
$score = 0; $score = 0;
break; break;
} }
@ -463,7 +463,7 @@ function lp_upload_quiz_action_handling()
if ($questionObj) { if ($questionObj) {
switch ($detectQuestionType) { switch ($detectQuestionType) {
case GLOBAL_MULTIPLE_ANSWER: case GLOBAL_MULTIPLE_ANSWER:
case MULTIPLE_ANSWER_DROPDOWN_GLOBAL: case MULTIPLE_ANSWER_DROPDOWN_COMBINATION:
$questionObj->updateWeighting($globalScore); $questionObj->updateWeighting($globalScore);
break; break;
case UNIQUE_ANSWER: case UNIQUE_ANSWER:
@ -485,7 +485,7 @@ function lp_upload_quiz_action_handling()
} }
break; break;
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
$fillInScoreList = []; $fillInScoreList = [];
$size = []; $size = [];
$globalScore = 0; $globalScore = 0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -751,7 +751,7 @@ switch ($action) {
$session_id, $session_id,
$my_question_id $my_question_id
); );
if (in_array($objQuestionTmp->type, [HOT_SPOT, HOT_SPOT_GLOBAL])) { if (in_array($objQuestionTmp->type, [HOT_SPOT, HOT_SPOT_COMBINATION])) {
Event::delete_attempt_hotspot( Event::delete_attempt_hotspot(
$exeId, $exeId,
api_get_user_id(), api_get_user_id(),
@ -961,7 +961,7 @@ switch ($action) {
} }
echo $id; echo $id;
echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>'; echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
if (in_array($objQuestion->type, [FILL_IN_BLANKS, FILL_IN_BLANKS_GLOBAL])) { if (in_array($objQuestion->type, [FILL_IN_BLANKS, FILL_IN_BLANKS_COMBINATION])) {
echo '<script> echo '<script>
$(function() { $(function() {
$(".selectpicker").selectpicker({}); $(".selectpicker").selectpicker({});
@ -974,7 +974,7 @@ switch ($action) {
echo '<script> MathJax.Hub.Queue(["Typeset",MathJax.Hub]);</script>'; echo '<script> MathJax.Hub.Queue(["Typeset",MathJax.Hub]);</script>';
} }
if (in_array($objQuestion->type, [HOT_SPOT, HOT_SPOT_GLOBAL])) { if (in_array($objQuestion->type, [HOT_SPOT, HOT_SPOT_COMBINATION])) {
echo '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; echo '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>';
} }
@ -1021,7 +1021,7 @@ switch ($action) {
} }
echo $id; echo $id;
echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>'; echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
if (in_array($objQuestion->type, [FILL_IN_BLANKS, FILL_IN_BLANKS_GLOBAL])) { if (in_array($objQuestion->type, [FILL_IN_BLANKS, FILL_IN_BLANKS_COMBINATION])) {
echo '<script> echo '<script>
$(function() { $(function() {
$(".selectpicker").selectpicker({}); $(".selectpicker").selectpicker({});

@ -527,11 +527,11 @@ define('ANNOTATION', 20);
define('READING_COMPREHENSION', 21); define('READING_COMPREHENSION', 21);
define('MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY', 22); define('MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY', 22);
define('UPLOAD_ANSWER', 23); define('UPLOAD_ANSWER', 23);
define('MATCHING_GLOBAL', 24); define('MATCHING_COMBINATION', 24);
define('MATCHING_DRAGGABLE_GLOBAL', 25); define('MATCHING_DRAGGABLE_COMBINATION', 25);
define('HOT_SPOT_GLOBAL', 26); define('HOT_SPOT_COMBINATION', 26);
define('FILL_IN_BLANKS_GLOBAL', 27); define('FILL_IN_BLANKS_COMBINATION', 27);
define('MULTIPLE_ANSWER_DROPDOWN_GLOBAL', 28); define('MULTIPLE_ANSWER_DROPDOWN_COMBINATION', 28);
define('MULTIPLE_ANSWER_DROPDOWN', 29); define('MULTIPLE_ANSWER_DROPDOWN', 29);
define('EXERCISE_CATEGORY_RANDOM_SHUFFLED', 1); define('EXERCISE_CATEGORY_RANDOM_SHUFFLED', 1);

@ -75,7 +75,7 @@ class ExerciseLib
$pictureName = $objQuestionTmp->getPictureFilename(); $pictureName = $objQuestionTmp->getPictureFilename();
$s = ''; $s = '';
if ($answerType != HOT_SPOT && if ($answerType != HOT_SPOT &&
$answerType != HOT_SPOT_GLOBAL && $answerType != HOT_SPOT_COMBINATION &&
$answerType != HOT_SPOT_DELINEATION && $answerType != HOT_SPOT_DELINEATION &&
$answerType != ANNOTATION $answerType != ANNOTATION
) { ) {
@ -139,9 +139,9 @@ class ExerciseLib
$num_suggestions = 0; $num_suggestions = 0;
switch ($answerType) { switch ($answerType) {
case MATCHING: case MATCHING:
case MATCHING_GLOBAL: case MATCHING_COMBINATION:
case DRAGGABLE: case DRAGGABLE:
case MATCHING_DRAGGABLE_GLOBAL: case MATCHING_DRAGGABLE_COMBINATION:
case MATCHING_DRAGGABLE: case MATCHING_DRAGGABLE:
if ($answerType == DRAGGABLE) { if ($answerType == DRAGGABLE) {
$isVertical = $objQuestionTmp->extra == 'v'; $isVertical = $objQuestionTmp->extra == 'v';
@ -342,7 +342,7 @@ class ExerciseLib
$s .= $form->returnForm(); $s .= $form->returnForm();
break; break;
case MULTIPLE_ANSWER_DROPDOWN: case MULTIPLE_ANSWER_DROPDOWN:
case MULTIPLE_ANSWER_DROPDOWN_GLOBAL: case MULTIPLE_ANSWER_DROPDOWN_COMBINATION:
if ($debug_mark_answer) { if ($debug_mark_answer) {
$s .= '<p><strong>' $s .= '<p><strong>'
.( .(
@ -967,7 +967,7 @@ class ExerciseLib
$s .= '</tr>'; $s .= '</tr>';
break; break;
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
// display the question, with field empty, for student to fill it, // display the question, with field empty, for student to fill it,
// or filled to display the answer in the Question preview of the exercise/admin.php page // or filled to display the answer in the Question preview of the exercise/admin.php page
$displayForStudent = true; $displayForStudent = true;
@ -1198,7 +1198,7 @@ class ExerciseLib
} }
break; break;
case MATCHING: case MATCHING:
case MATCHING_GLOBAL: case MATCHING_COMBINATION:
// matching type, showing suggestions and answers // matching type, showing suggestions and answers
// TODO: replace $answerId by $numAnswer // TODO: replace $answerId by $numAnswer
if ($answerCorrect != 0) { if ($answerCorrect != 0) {
@ -1358,7 +1358,7 @@ class ExerciseLib
$s .= '</li>'; $s .= '</li>';
} }
break; break;
case MATCHING_DRAGGABLE_GLOBAL: case MATCHING_DRAGGABLE_COMBINATION:
case MATCHING_DRAGGABLE: case MATCHING_DRAGGABLE:
if ($answerId == 1) { if ($answerId == 1) {
echo $objAnswerTmp->getJs(); echo $objAnswerTmp->getJs();
@ -1469,7 +1469,7 @@ HTML;
} }
break; break;
case MULTIPLE_ANSWER_DROPDOWN: case MULTIPLE_ANSWER_DROPDOWN:
case MULTIPLE_ANSWER_DROPDOWN_GLOBAL: case MULTIPLE_ANSWER_DROPDOWN_COMBINATION:
if ($debug_mark_answer && $answerCorrect) { if ($debug_mark_answer && $answerCorrect) {
$s .= '<p>' $s .= '<p>'
.( .(
@ -1484,7 +1484,7 @@ HTML;
} }
} }
if (in_array($answerType, [MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_GLOBAL]) if (in_array($answerType, [MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN_COMBINATION])
&& !$debug_mark_answer && !$debug_mark_answer
) { ) {
$userChoiceList = array_unique($userChoiceList); $userChoiceList = array_unique($userChoiceList);
@ -1536,9 +1536,9 @@ HTML;
$answerType, $answerType,
[ [
MATCHING, MATCHING,
MATCHING_GLOBAL, MATCHING_COMBINATION,
MATCHING_DRAGGABLE, MATCHING_DRAGGABLE,
MATCHING_DRAGGABLE_GLOBAL, MATCHING_DRAGGABLE_COMBINATION,
UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_NO_OPTION,
MULTIPLE_ANSWER_TRUE_FALSE, MULTIPLE_ANSWER_TRUE_FALSE,
MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE, MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE,
@ -1580,7 +1580,7 @@ HTML;
// $s .= '</div>'; // $s .= '</div>';
} }
if (in_array($answerType, [MATCHING, MATCHING_GLOBAL, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_GLOBAL])) { if (in_array($answerType, [MATCHING, MATCHING_COMBINATION, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_COMBINATION])) {
$s .= '</div>'; //drag_question $s .= '</div>'; //drag_question
} }
@ -1594,7 +1594,7 @@ HTML;
return $s; return $s;
} }
echo $s; echo $s;
} elseif (in_array($answerType, [HOT_SPOT, HOT_SPOT_DELINEATION, HOT_SPOT_GLOBAL])) { } elseif (in_array($answerType, [HOT_SPOT, HOT_SPOT_DELINEATION, HOT_SPOT_COMBINATION])) {
global $exe_id; global $exe_id;
// Question is a HOT_SPOT // Question is a HOT_SPOT
// Checking document/images visibility // Checking document/images visibility
@ -1674,7 +1674,7 @@ HTML;
</div> </div>
</div> </div>
<script> <script>
new ".(in_array($answerType, [HOT_SPOT, HOT_SPOT_GLOBAL]) ? "HotspotQuestion" : "DelineationQuestion")."({ new ".(in_array($answerType, [HOT_SPOT, HOT_SPOT_COMBINATION]) ? "HotspotQuestion" : "DelineationQuestion")."({
questionId: $questionId, questionId: $questionId,
exerciseId: {$exercise->iid}, exerciseId: {$exercise->iid},
exeId: 0, exeId: 0,
@ -4618,7 +4618,7 @@ EOT;
$courseId = api_get_course_int_id($course_code); $courseId = api_get_course_int_id($course_code);
$session_id = intval($session_id); $session_id = intval($session_id);
if (in_array($questionType, [FILL_IN_BLANKS, FILL_IN_BLANKS_GLOBAL])) { if (in_array($questionType, [FILL_IN_BLANKS, FILL_IN_BLANKS_COMBINATION])) {
$listStudentsId = []; $listStudentsId = [];
$listAllStudentInfo = CourseManager::get_student_list_from_course_code( $listAllStudentInfo = CourseManager::get_student_list_from_course_code(
api_get_course_id(), api_get_course_id(),
@ -4785,14 +4785,14 @@ EOT;
switch ($question_type) { switch ($question_type) {
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
$answer_condition = ''; $answer_condition = '';
$select_condition = ' e.exe_id, answer '; $select_condition = ' e.exe_id, answer ';
break; break;
case MATCHING: case MATCHING:
case MATCHING_GLOBAL: case MATCHING_COMBINATION:
case MATCHING_DRAGGABLE: case MATCHING_DRAGGABLE:
case MATCHING_DRAGGABLE_GLOBAL: case MATCHING_DRAGGABLE_COMBINATION:
default: default:
$answer_condition = " answer = $answer_id AND "; $answer_condition = " answer = $answer_id AND ";
$select_condition = ' DISTINCT exe_user_id '; $select_condition = ' DISTINCT exe_user_id ';
@ -4836,7 +4836,7 @@ EOT;
$good_answers = 0; $good_answers = 0;
switch ($question_type) { switch ($question_type) {
case FILL_IN_BLANKS: case FILL_IN_BLANKS:
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
while ($row = Database::fetch_array($result, 'ASSOC')) { while ($row = Database::fetch_array($result, 'ASSOC')) {
$fill_blank = self::check_fill_in_blanks( $fill_blank = self::check_fill_in_blanks(
$correct_answer, $correct_answer,
@ -4851,9 +4851,9 @@ EOT;
return $good_answers; return $good_answers;
break; break;
case MATCHING: case MATCHING:
case MATCHING_GLOBAL: case MATCHING_COMBINATION:
case MATCHING_DRAGGABLE: case MATCHING_DRAGGABLE:
case MATCHING_DRAGGABLE_GLOBAL: case MATCHING_DRAGGABLE_COMBINATION:
default: default:
$return = Database::num_rows($result); $return = Database::num_rows($result);
} }
@ -5785,7 +5785,7 @@ EOT;
$nbrCorrect = 0; $nbrCorrect = 0;
$nbrOptions = 0; $nbrOptions = 0;
switch ($answerType) { switch ($answerType) {
case FILL_IN_BLANKS_GLOBAL: case FILL_IN_BLANKS_COMBINATION:
if (!empty($listCorrectAnswers)) { if (!empty($listCorrectAnswers)) {
foreach ($listCorrectAnswers['student_score'] as $idx => $val) { foreach ($listCorrectAnswers['student_score'] as $idx => $val) {
if (1 === (int) $val) { if (1 === (int) $val) {
@ -5795,7 +5795,7 @@ EOT;
$nbrOptions = (int) $listCorrectAnswers['words_count']; $nbrOptions = (int) $listCorrectAnswers['words_count'];
} }
break; break;
case HOT_SPOT_GLOBAL: case HOT_SPOT_COMBINATION:
if (!empty($listCorrectAnswers)) { if (!empty($listCorrectAnswers)) {
foreach ($listCorrectAnswers as $idx => $val) { foreach ($listCorrectAnswers as $idx => $val) {
if (1 === (int) $choice[$idx]) { if (1 === (int) $choice[$idx]) {
@ -5816,8 +5816,8 @@ EOT;
} }
$nbrOptions = $nbrAnswers; $nbrOptions = $nbrAnswers;
break; break;
case MATCHING_GLOBAL: case MATCHING_COMBINATION:
case MATCHING_DRAGGABLE_GLOBAL: case MATCHING_DRAGGABLE_COMBINATION:
if (isset($listCorrectAnswers['form_values'])) { if (isset($listCorrectAnswers['form_values'])) {
if (isset($listCorrectAnswers['form_values']['correct'])) { if (isset($listCorrectAnswers['form_values']['correct'])) {
$nbrCorrect = count($listCorrectAnswers['form_values']['correct']); $nbrCorrect = count($listCorrectAnswers['form_values']['correct']);
@ -6338,10 +6338,10 @@ EOT;
READING_COMPREHENSION, READING_COMPREHENSION,
MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY, MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY,
UPLOAD_ANSWER, UPLOAD_ANSWER,
MATCHING_GLOBAL, MATCHING_COMBINATION,
FILL_IN_BLANKS_GLOBAL, FILL_IN_BLANKS_COMBINATION,
MULTIPLE_ANSWER_DROPDOWN, MULTIPLE_ANSWER_DROPDOWN,
MULTIPLE_ANSWER_DROPDOWN_GLOBAL, MULTIPLE_ANSWER_DROPDOWN_COMBINATION,
]; ];
$defaultTypes = [UNIQUE_ANSWER, MULTIPLE_ANSWER, UNIQUE_ANSWER_IMAGE]; $defaultTypes = [UNIQUE_ANSWER, MULTIPLE_ANSWER, UNIQUE_ANSWER_IMAGE];
$types = $defaultTypes; $types = $defaultTypes;

Loading…
Cancel
Save