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 */
/**
* MatchingGlobal.
* MatchingCombination.
*/
class MatchingGlobal extends Matching
class MatchingCombination extends Matching
{
public $typePicture = 'matching_global.png';
public $explanationLangVar = 'MatchingGlobal';
public $typePicture = 'matching_co.png';
public $explanationLangVar = 'MatchingCombination';
/**
* Constructor.
@ -15,7 +15,7 @@ class MatchingGlobal extends Matching
public function __construct()
{
parent::__construct();
$this->type = MATCHING_GLOBAL;
$this->type = MATCHING_COMBINATION;
$this->isContent = $this->getIsContent();
}
}

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

@ -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();
if (in_array(
$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->read();

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

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

@ -1243,13 +1243,13 @@ if (!empty($questionList)) {
if ($current_question != $i) {
continue;
} 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++;
}
break;
}
} 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++;
}
}

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

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

@ -93,7 +93,7 @@ class ScormQuestion extends Question
$this->answer->questionJSId = $this->js_id;
break;
case HOT_SPOT:
case HOT_SPOT_GLOBAL:
case HOT_SPOT_COMBINATION:
$this->answer = new ScormAnswerHotspot($this->iid);
$this->answer->questionJSId = $this->js_id;
break;
@ -208,7 +208,7 @@ class ScormQuestion extends Question
$js .= $script;*/
break;
case HOT_SPOT:
case HOT_SPOT_GLOBAL:
case HOT_SPOT_COMBINATION:
//put the max score to 0 to avoid discounting the points of
//non-exported quiz types in the SCORM
$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>
var questionType = "'.$questionTypes[$this->type].'";
var firstTime = true;
@ -367,7 +367,7 @@ class FillBlanks extends Question
// 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>');
if (FILL_IN_BLANKS_GLOBAL === $this->type) {
if (FILL_IN_BLANKS_COMBINATION === $this->type) {
//only 1 answer the all deal ...
$form->addText('questionWeighting', get_lang('Score'), true, ['value' => 10]);
if (!empty($this->iid)) {
@ -468,7 +468,7 @@ class FillBlanks extends Question
$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');
}

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

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

@ -16,7 +16,7 @@ if (!is_object($objQuestion)) {
$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);
$options = [];

@ -44,13 +44,13 @@ abstract class Question
UNIQUE_ANSWER => ['unique_answer.class.php', 'UniqueAnswer'],
MULTIPLE_ANSWER => ['multiple_answer.class.php', 'MultipleAnswer'],
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_GLOBAL => ['MatchingGlobal.php', 'MatchingGlobal'],
MATCHING_COMBINATION => ['MatchingCombination.php', 'MatchingCombination'],
FREE_ANSWER => ['freeanswer.class.php', 'FreeAnswer'],
ORAL_EXPRESSION => ['oral_expression.class.php', 'OralExpression'],
HOT_SPOT => ['hotspot.class.php', 'HotSpot'],
HOT_SPOT_GLOBAL => ['HotSpotGlobal.php', 'HotSpotGlobal'],
HOT_SPOT_COMBINATION => ['HotSpotCombination.php', 'HotSpotCombination'],
HOT_SPOT_DELINEATION => ['HotSpotDelineation.php', 'HotSpotDelineation'],
MULTIPLE_ANSWER_COMBINATION => ['multiple_answer_combination.class.php', 'MultipleAnswerCombination'],
UNIQUE_ANSWER_NO_OPTION => ['unique_answer_no_option.class.php', 'UniqueAnswerNoOption'],
@ -68,13 +68,13 @@ abstract class Question
UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'],
DRAGGABLE => ['Draggable.php', 'Draggable'],
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')
ANNOTATION => ['Annotation.php', 'Annotation'],
READING_COMPREHENSION => ['ReadingComprehension.php', 'ReadingComprehension'],
UPLOAD_ANSWER => ['UploadAnswer.php', 'UploadAnswer'],
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
$this->questionTypeWithFeedback = [
MATCHING,
MATCHING_GLOBAL,
MATCHING_COMBINATION,
MATCHING_DRAGGABLE,
MATCHING_DRAGGABLE_GLOBAL,
MATCHING_DRAGGABLE_COMBINATION,
DRAGGABLE,
FILL_IN_BLANKS,
FILL_IN_BLANKS_GLOBAL,
FILL_IN_BLANKS_COMBINATION,
FREE_ANSWER,
ORAL_EXPRESSION,
CALCULATED_ANSWER,
@ -1109,7 +1109,7 @@ abstract class Question
);
// 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
->setCId($c_id)
@ -1831,7 +1831,7 @@ abstract class Question
switch ($this->type) {
case UNIQUE_ANSWER:
case MULTIPLE_ANSWER_DROPDOWN:
case MULTIPLE_ANSWER_DROPDOWN_GLOBAL:
case MULTIPLE_ANSWER_DROPDOWN_COMBINATION:
$buttonGroup = [];
$buttonGroup[] = $form->addButtonSave(
$text,
@ -2352,7 +2352,7 @@ abstract class Question
$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'));
return $header;
@ -2575,9 +2575,9 @@ abstract class Question
{
$oppositeAnswers = [
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_GLOBAL => [MULTIPLE_ANSWER],
MULTIPLE_ANSWER_DROPDOWN_COMBINATION => [MULTIPLE_ANSWER],
];
$this->type = $oppositeAnswers[$this->type][$index];
Database::update(
@ -2589,7 +2589,7 @@ abstract class Question
UNIQUE_ANSWER => 'UniqueAnswer',
MULTIPLE_ANSWER => 'MultipleAnswer',
MULTIPLE_ANSWER_DROPDOWN => 'MultipleAnswerDropdown',
MULTIPLE_ANSWER_DROPDOWN_GLOBAL => 'MultipleAnswerDropdownGlobal',
MULTIPLE_ANSWER_DROPDOWN_COMBINATION => 'MultipleAnswerDropdownCombination',
];
$swappedAnswer = new $answerClasses[$this->type]();
foreach ($this as $key => $value) {

@ -57,10 +57,10 @@ if (is_object($objQuestion)) {
$objQuestion->processAnswersCreation($form, $objExercise);
// TODO: maybe here is the better place to index this tool, including answers text
// 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(
).'"</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?'
.api_get_cidreq().'&'
.http_build_query(['exerciseId' => $exerciseId, 'page' => $page, 'mad_admin' => $objQuestion->iid]);

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

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

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

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

Loading…
Cancel
Save