4require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
5require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
6require_once
'./Modules/TestQuestionPool/classes/class.assClozeGapCombination.php';
7require_once
'./Modules/TestQuestionPool/interfaces/interface.ilObjQuestionScoringAdjustable.php';
8require_once
'./Modules/TestQuestionPool/interfaces/interface.ilObjAnswerScoringAdjustable.php';
9require_once
'./Modules/TestQuestionPool/interfaces/interface.iQuestionCondition.php';
10require_once
'./Modules/TestQuestionPool/classes/class.ilUserQuestionResult.php';
118 $this->start_tag =
"[gap]";
119 $this->end_tag =
"[/gap]";
120 $this->gaps = array();
122 $this->fixedTextLength =
"";
123 $this->identical_scoring = 1;
124 $this->gap_combinations_exists =
false;
125 $this->gap_combinations = array();
155 $text = preg_replace(
"/\[gap[^\]]*?\]/",
"[gap]",
$text);
156 $text = preg_replace(
"/<gap([^>]*?)>/",
"[gap]",
$text);
157 $text = str_replace(
"</gap>",
"[/gap]",
$text);
177 $this->
setId($question_id);
191 include_once(
"./Services/RTE/classes/class.ilRTE.php");
206 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
207 include_once
"./Modules/TestQuestionPool/classes/class.assClozeGap.php";
208 $result =
$ilDB->queryF(
"SELECT * FROM qpl_a_cloze WHERE question_fi = %s ORDER BY gap_id, aorder ASC",
214 $this->gaps = array();
217 switch (
$data[
"cloze_type"])
220 if (!array_key_exists(
$data[
"gap_id"], $this->gaps))
229 $this->gaps[
$data[
"gap_id"]]->setGapSize(
$data[
'gap_size']);
231 $this->gaps[
$data[
"gap_id"]]->addItem($answer);
234 if (!array_key_exists(
$data[
"gap_id"], $this->gaps))
237 $this->gaps[
$data[
"gap_id"]]->setShuffle(
$data[
"shuffle"]);
244 $this->gaps[
$data[
"gap_id"]]->addItem($answer);
247 if (!array_key_exists(
$data[
"gap_id"], $this->gaps))
256 $this->gaps[
$data[
"gap_id"]]->setGapSize(
$data[
'gap_size']);
257 $answer->setLowerBound(
$data[
"lowerlimit"]);
258 $answer->setUpperBound(
$data[
"upperlimit"]);
259 $this->gaps[
$data[
"gap_id"]]->addItem($answer);
266 $check_for_gap_combinations = $assClozeGapCombinationObj->loadFromDb($question_id);
267 if(count($check_for_gap_combinations) != 0)
272 parent::loadFromDb($question_id);
275 #region Save question to db
302 $ilDB->manipulateF(
"DELETE FROM qpl_a_cloze WHERE question_fi = %s",
304 array( $this->
getId() )
307 foreach ($this->gaps as $key => $gap)
324 array( $this->
getId() )
328 .
" (question_fi, textgap_rating, identical_scoring, fixed_textlen, cloze_text) VALUES (%s, %s, %s, %s, %s)",
355 foreach ($gap->getItems($this->getShuffler()) as $item)
358 $next_id =
$ilDB->nextId(
'qpl_a_cloze' );
359 switch ($gap->getType())
385 $ilDB->manipulateF(
"INSERT INTO qpl_a_cloze (answer_id, question_fi, gap_id, answertext, points, aorder, cloze_type, gap_size) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
400 strlen( $item->getAnswertext() ) ? $item->getAnswertext() :
"",
404 (
int)$gap->getGapSize()
420 $ilDB->manipulateF(
"INSERT INTO qpl_a_cloze (answer_id, question_fi, gap_id, answertext, points, aorder, cloze_type, shuffle) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
435 strlen( $item->getAnswertext() ) ? $item->getAnswertext() :
"",
439 ($gap->getShuffle()) ?
"1" :
"0"
456 include_once
"./Services/Math/classes/class.EvalMath.php";
458 $eval->suppress_errors = TRUE;
459 $ilDB->manipulateF(
"INSERT INTO qpl_a_cloze (answer_id, question_fi, gap_id, answertext, points, aorder, cloze_type, lowerlimit, upperlimit, gap_size) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
476 strlen( $item->getAnswertext() ) ? $item->getAnswertext() :
"",
480 ($eval->e( $item->getLowerBound() !== FALSE ) && strlen( $item->getLowerBound()
481 ) > 0) ? $item->getLowerBound() : $item->getAnswertext(),
482 ($eval->e( $item->getUpperBound() !== FALSE ) && strlen( $item->getUpperBound()
483 ) > 0) ? $item->getUpperBound() : $item->getAnswertext(),
484 (
int)$gap->getGapSize()
491 #endregion Save question to db
513 $this->gaps = array();
527 $this->gaps = array();
606 include_once
"./Modules/TestQuestionPool/classes/class.assClozeGap.php";
607 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
608 $search_pattern =
"|\[gap\](.*?)\[/gap\]|i";
609 preg_match_all($search_pattern, $this->
getClozeText(), $found);
610 $this->gaps = array();
611 if (count($found[0]))
613 foreach ($found[1] as $gap_index => $answers)
617 $textparams = preg_split(
"/(?<!\\\\),/", $answers);
618 foreach ($textparams as $key => $value)
621 $gap->addItem($answer);
623 $this->gaps[$gap_index] = $gap;
635 if (array_key_exists($gap_index, $this->gaps))
637 $this->gaps[$gap_index]->setType($gap_type);
652 if (array_key_exists($gap_index, $this->gaps))
654 $this->gaps[$gap_index]->setShuffle(
$shuffle);
666 foreach ($this->gaps as $gap_index => $gap)
668 $this->gaps[$gap_index]->clearItems();
681 if (is_array($this->gaps))
683 return count($this->gaps);
703 if (array_key_exists($gap_index, $this->gaps))
708 $answer = str_replace(
",",
".", $answer);
710 $this->gaps[$gap_index]->addItem(
new assAnswerCloze($answer, 0, $order));
724 if (array_key_exists($gap_index, $this->gaps))
726 return $this->gaps[$gap_index];
736 if (array_key_exists($gap_index, $this->gaps))
738 $this->gaps[$gap_index]->setGapSize(
$size);
754 if (array_key_exists($gap_index, $this->gaps))
756 $this->gaps[$gap_index]->setItemPoints($order,
$points);
770 if (array_key_exists($gap_index, $this->gaps))
772 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
776 $this->gaps[$gap_index]->getItemCount()
778 $this->gaps[$gap_index]->addItem($answer);
792 $this->gaps[$index] = $gap;
807 if (array_key_exists($gap_index, $this->gaps))
809 $this->gaps[$gap_index]->setItemLowerBound($order, $bound);
825 if (array_key_exists($gap_index, $this->gaps))
827 $this->gaps[$gap_index]->setItemUpperBound($order, $bound);
841 $gaps_used_in_combination = array();
842 if($assClozeGapCombinationObj->combinationExistsForQid($this->getId()))
844 $points = $assClozeGapCombinationObj->getMaxPointsForCombination($this->
getId());
845 $gaps_used_in_combination = $assClozeGapCombinationObj->getGapsWhichAreUsedInCombination($this->
getId());
847 foreach ($this->gaps as $gap_index => $gap)
849 if(! array_key_exists($gap_index, $gaps_used_in_combination))
854 foreach ($gap->getItems($this->getShuffler()) as $item)
856 if ($item->getPoints() > $gap_max_points)
858 $gap_max_points = $item->getPoints();
866 foreach ($gap->getItems($this->getShuffler()) as $item)
868 if ($item->getPoints() > $srpoints)
870 $srpoints = $item->getPoints();
878 foreach ($gap->getItems($this->getShuffler()) as $item)
880 if ($item->getPoints() > $numpoints)
882 $numpoints = $item->getPoints();
906 $this_id = $this->
getId();
910 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
914 if( (
int)$testObjId > 0 )
916 $clone->setObjId($testObjId);
939 if($this->gap_combinations_exists)
952 $clone->copyPageOfQuestion($this_id);
954 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
956 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
958 return $clone->getId();
968 if ($this->
getId() <= 0)
974 $thisId = $this->
getId();
978 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
981 $clone->setObjId($target_questionpool_id);
989 if($this->gap_combinations_exists)
1000 $clone->onCopy($thisObjId, $thisId, $clone->getObjId(), $clone->getId());
1002 return $clone->getId();
1013 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
1016 $sourceParentId = $this->
getObjId();
1022 $clone->setObjId($targetParentId);
1024 if ($targetQuestionTitle)
1026 $clone->setTitle($targetQuestionTitle);
1031 if($this->gap_combinations_exists)
1036 $clone->copyPageOfQuestion($sourceQuestionId);
1038 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
1040 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
1048 $array = $assClozeGapCombinationObj->loadFromDb($orgID);
1049 $assClozeGapCombinationObj->importGapCombinationToDb($newID , $array);
1060 foreach ($this->
getGaps() as $gap_index => $gap)
1063 foreach ($gap->getItemsRaw() as $item)
1065 array_push($answers, str_replace(
",",
"\\,", $item->getAnswerText()));
1067 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/",
"[_gap]" . $this->
prepareTextareaOutput(join(
",", $answers),
true) .
"[/_gap]", $output, 1);
1069 $output = str_replace(
"_gap]",
"gap]", $output);
1070 $this->cloze_text = $output;
1084 if (array_key_exists($gap_index, $this->gaps))
1086 if ($this->gaps[$gap_index]->getItemCount() == 1)
1094 $this->gaps[$gap_index]->deleteItem($answer_index);
1110 if (array_key_exists($gap_index, $this->gaps))
1113 foreach ($this->
getGaps() as $replace_gap_index => $gap)
1116 foreach ($gap->getItemsRaw() as $item)
1118 array_push($answers, str_replace(
",",
"\\,", $item->getAnswerText()));
1120 if ($replace_gap_index == $gap_index)
1122 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/",
"", $output, 1);
1126 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/",
"[_gap]" . join(
",", $answers) .
"[/_gap]", $output, 1);
1129 $output = str_replace(
"_gap]",
"gap]", $output);
1130 $this->cloze_text = $output;
1131 unset($this->gaps[$gap_index]);
1132 $this->gaps = array_values($this->gaps);
1147 include_once
"./Services/Utilities/classes/class.ilStr.php";
1156 if (strcmp($a_original, $a_entered) == 0)
$result = $max_points;
1159 if (levenshtein($a_original, $a_entered) <= 1)
$result = $max_points;
1162 if (levenshtein($a_original, $a_entered) <= 2)
$result = $max_points;
1165 if (levenshtein($a_original, $a_entered) <= 3)
$result = $max_points;
1168 if (levenshtein($a_original, $a_entered) <= 4)
$result = $max_points;
1171 if (levenshtein($a_original, $a_entered) <= 5)
$result = $max_points;
1194 include_once
"./Services/Math/classes/class.EvalMath.php";
1196 $eval->suppress_errors = TRUE;
1199 if ($eval->e($a_entered) === FALSE)
1203 elseif (($eval->e($lowerBound) !== FALSE) && ($eval->e($upperBound) !== FALSE))
1206 if (($eval->e($a_entered) >= $eval->e($lowerBound)) && ($eval->e($a_entered) <= $eval->e($upperBound)))
$result = $max_points;
1208 else if ($eval->e($lowerBound) !== FALSE)
1210 if (($eval->e($a_entered) >= $eval->e($lowerBound)) && ($eval->e($a_entered) <= $eval->e($a_original)))
$result = $max_points;
1212 else if ($eval->e($upperBound) !== FALSE)
1214 if (($eval->e($a_entered) >= $eval->e($a_original)) && ($eval->e($a_entered) <= $eval->e($upperBound)))
$result = $max_points;
1218 if ($eval->e($a_entered) == $eval->e($a_original))
$result = $max_points;
1229 return preg_match(
"/^-?(\\d*)(,|\\.|\\/){0,1}(\\d*)$/", $value, $matches);
1251 $user_result = array();
1254 if (strcmp(
$data[
"value2"],
"") != 0)
1256 $user_result[
$data[
"value1"]] = array(
1257 "gap_id" =>
$data[
"value1"],
1258 "value" =>
$data[
"value2"]
1263 ksort($user_result);
1267 $detailed = array();
1277 if( is_numeric($submittedValue) )
1282 if( preg_match(
'/^[-+]{0,1}\d+\/\d+$/', $submittedValue) )
1294 $gap = $this->
getGap($gapIndex);
1313 $solutionSubmit = array();
1315 foreach (
$_POST as $key => $value)
1317 if (preg_match(
"/^gap_(\d+)/", $key, $matches))
1322 $gap = $this->
getGap($matches[1]);
1323 if (is_object($gap))
1325 if (!(($gap->getType() ==
CLOZE_SELECT) && ($value == -1)))
1329 $value = str_replace(
",",
".", $value);
1331 $solutionSubmit[trim($matches[1])] = $value;
1338 return $solutionSubmit;
1355 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1363 $entered_values = 0;
1371 if (is_object($gap))
1373 if (!(($gap->getType() ==
CLOZE_SELECT) && ($value == -1)))
1384 if ($entered_values)
1386 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1394 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1425 return "assClozeTest";
1449 switch ($a_textgap_rating)
1458 $this->textgap_rating = $a_textgap_rating;
1475 return ($this->identical_scoring) ? 1 : 0;
1487 $this->identical_scoring = ($a_identical_scoring) ? 1 : 0;
1498 return "qpl_qst_cloze";
1509 return array(
"qpl_a_cloze",
'qpl_a_cloze_combi_res');
1520 $this->fixedTextLength = $a_text_len;
1545 $gap_max_points = 0;
1546 if (array_key_exists($gap_index, $this->gaps))
1548 $gap =& $this->gaps[$gap_index];
1549 foreach ($gap->getItems($this->getShuffler()) as $answer)
1551 if ($answer->getPoints() > $gap_max_points)
1553 $gap_max_points = $answer->getPoints();
1567 return parent::getRTETextWithMediaObjects() . $this->
getClozeText();
1581 $this->gap_combinations_exists = $value;
1586 $this->gap_combinations = $value;
1602 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1607 foreach ($this->
getGaps() as $gap_index => $gap)
1611 foreach ($solution as $solutionvalue)
1613 if ($gap_index == $solutionvalue[
"value1"])
1615 switch ($gap->getType())
1618 $worksheet->writeString($startrow + $i, 1, $gap->getItem($solutionvalue[
"value2"])->getAnswertext());
1622 $worksheet->writeString($startrow + $i, 1, $solutionvalue[
"value2"]);
1629 return $startrow + $i + 1;
1648 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1658 'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false)),
1659 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true))
1663 foreach ($this->
getGaps() as $key => $gap)
1666 foreach ($gap->getItems($this->getShuffler()) as $item)
1669 $jitem[
'points'] = $item->getPoints();
1671 $jitem[
'order'] = $item->getOrder();
1674 $jitem[
'lowerbound'] = $item->getLowerBound();
1675 $jitem[
'upperbound'] = $item->getUpperBound();
1679 $jitem[
'value'] = trim($jitem[
'value']);
1681 array_push($items, $jitem);
1686 $jgap[
'size'] = $gap->getGapSize();
1689 $jgap[
'shuffle'] = $gap->getShuffle();
1690 $jgap[
'type'] = $gap->getType();
1691 $jgap[
'item'] = $items;
1693 array_push(
$gaps, $jgap);
1711 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1744 $maxStep = $this->lookupMaxStep($active_id,
$pass);
1746 if( $maxStep !==
null )
1750 SELECT sol.value1+1 as val, sol.value2, cloze.cloze_type
1751 FROM tst_solutions sol
1752 INNER JOIN qpl_a_cloze cloze ON cloze.gap_id = value1 AND cloze.question_fi = sol.question_fi
1753 WHERE sol.active_fi = %s AND sol.pass = %s AND sol.question_fi = %s AND sol.step = %s
1754 GROUP BY sol.solution_id, sol.value1+1, sol.value2, cloze.cloze_type
1756 array(
"integer",
"integer",
"integer",
"integer"),
1757 array($active_id,
$pass, $this->
getId(), $maxStep)
1764 SELECT sol.value1+1 as val, sol.value2, cloze.cloze_type
1765 FROM tst_solutions sol
1766 INNER JOIN qpl_a_cloze cloze ON cloze.gap_id = value1 AND cloze.question_fi = sol.question_fi
1767 WHERE sol.active_fi = %s AND sol.pass = %s AND sol.question_fi = %s
1768 GROUP BY sol.solution_id, sol.value1+1, sol.value2, cloze.cloze_type
1770 array(
"integer",
"integer",
"integer"),
1777 if(
$row[
"cloze_type"] == 1)
1804 return $this->
getGap($index);
1818 if($assClozeGapCombinationObj->combinationExistsForQid($this->getId()))
1820 $combinations_for_question = $assClozeGapCombinationObj->getCleanCombinationArray($this->
getId());
1821 $gap_answers = array();
1822 $gap_used_in_combination = array();
1823 foreach($user_result as $user_result_build_list)
1825 if(is_array($user_result_build_list))
1827 $gap_answers[$user_result_build_list[
'gap_id']] = $user_result_build_list[
'value'];
1831 foreach($combinations_for_question as $combination)
1834 foreach($combination as $row_key => $row_answers)
1836 $combination_fulfilled =
true;
1837 $points_for_combination = $row_answers[
'points'];
1838 foreach($row_answers as $gap_key => $combination_gap_answer)
1840 if($gap_key !==
'points')
1842 $gap_used_in_combination[$gap_key]= $gap_key;
1844 if($combination_fulfilled && array_key_exists($gap_key, $gap_answers))
1846 switch($combination_gap_answer[
'type'])
1849 $is_text_gap_correct = $this->
getTextgapPoints($gap_answers[$gap_key], $combination_gap_answer[
'answer'], 1);
1850 if($is_text_gap_correct != 1)
1852 $combination_fulfilled =
false;
1856 $answer = $this->gaps[$gap_key]->getItem($gap_answers[$gap_key]);
1857 $answertext = $answer->getAnswertext();
1858 if($answertext != $combination_gap_answer[
'answer'])
1860 $combination_fulfilled =
false;
1864 $answer = $this->gaps[$gap_key]->getItem(0);
1865 if($combination_gap_answer[
'answer'] !=
'out_of_bound')
1867 $is_numeric_gap_correct = $this->
getNumericgapPoints($answer->getAnswertext(), $gap_answers[$gap_key], 1, $answer->getLowerBound(), $answer->getUpperBound());
1868 if($is_numeric_gap_correct != 1)
1870 $combination_fulfilled =
false;
1875 $wrong_is_the_new_right = $this->
getNumericgapPoints($answer->getAnswertext(), $gap_answers[$gap_key], 1, $answer->getLowerBound(), $answer->getUpperBound());
1876 if($wrong_is_the_new_right == 1)
1878 $combination_fulfilled =
false;
1886 if($gap_key !==
'points')
1888 $combination_fulfilled =
false;
1892 if($combination_fulfilled)
1894 $points += $points_for_combination;
1899 return array(
$points, $gap_used_in_combination);
1908 if($detailed ===
null)
1910 $detailed = array();
1914 $combinations[1] = array();
1915 if($assClozeGapCombinationObj->combinationExistsForQid($this->getId()))
1921 $solution_values_text = array();
1922 $solution_values_select = array();
1923 $solution_values_numeric = array();
1924 foreach($user_result as $gap_id => $value)
1926 if(is_string($value))
1928 $value = array(
"value" => $value);
1931 if(array_key_exists($gap_id, $this->gaps) && !array_key_exists ($gap_id, $combinations[1]))
1933 switch($this->gaps[$gap_id]->getType())
1937 for($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++)
1939 $answer = $this->gaps[$gap_id]->getItem($order);
1940 $gotpoints = $this->
getTextgapPoints($answer->getAnswertext(), $value[
"value"], $answer->getPoints());
1941 if($gotpoints > $gappoints) $gappoints = $gotpoints;
1946 if((in_array($value[
"value"], $solution_values_text)) && ($gappoints > 0))
1952 $detailed[$gap_id] = array(
"points" => $gappoints,
"best" => ($this->
getMaximumGapPoints($gap_id) == $gappoints) ? TRUE : FALSE,
"positive" => ($gappoints > 0) ? TRUE : FALSE);
1953 array_push($solution_values_text, $value[
"value"]);
1957 for($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++)
1959 $answer = $this->gaps[$gap_id]->getItem($order);
1960 $gotpoints = $this->
getNumericgapPoints($answer->getAnswertext(), $value[
"value"], $answer->getPoints(), $answer->getLowerBound(), $answer->getUpperBound());
1961 if($gotpoints > $gappoints) $gappoints = $gotpoints;
1966 include_once
"./Services/Math/classes/class.EvalMath.php";
1968 $eval->suppress_errors = TRUE;
1969 $found_value = FALSE;
1970 foreach($solution_values_numeric as $solval)
1972 if($eval->e($solval) == $eval->e($value[
"value"]))
1974 $found_value = TRUE;
1977 if($found_value && ($gappoints > 0))
1983 $detailed[$gap_id] = array(
"points" => $gappoints,
"best" => ($this->
getMaximumGapPoints($gap_id) == $gappoints) ? TRUE : FALSE,
"positive" => ($gappoints > 0) ? TRUE : FALSE);
1984 array_push($solution_values_numeric, $value[
"value"]);
1987 if($value[
"value"] >= 0)
1989 for($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++)
1991 $answer = $this->gaps[$gap_id]->getItem($order);
1992 if($value[
"value"] == $answer->getOrder())
1994 $answerpoints = $answer->getPoints();
1998 if((in_array($answer->getAnswertext(), $solution_values_select)) && ($answerpoints > 0))
2004 $detailed[$gap_id] = array(
"points" => $answerpoints,
"best" => ($this->
getMaximumGapPoints($gap_id) == $answerpoints) ? TRUE : FALSE,
"positive" => ($answerpoints > 0) ? TRUE : FALSE);
2005 array_push($solution_values_select, $answer->getAnswertext());
2019 $userSolution = array();
2023 $userSolution[] = array(
'gap_id' => $key,
'value' => $val);
Class for cloze question numeric answers.
Class for cloze question gaps.
clearGapAnswers()
Removes all answers from the gaps.
getEndTag()
Returns the end tag of a cloze gap.
addGapAnswer($gap_index, $order, $answer)
Sets the answer text of a gap with a given index.
isComplete()
Returns TRUE, if a cloze test is complete for use.
setGapShuffle($gap_index=0, $shuffle=1)
Sets the shuffle state of a gap with a given index.
getClozeText()
Returns the cloze text.
getTextgapPoints($a_original, $a_entered, $max_points)
Returns the points for a text gap and compares the given solution with the entered solution using the...
isValidNumericSubmitValue($submittedValue)
setGapAnswerPoints($gap_index, $order, $points)
Sets the points of a gap with a given index and an answer with a given order.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
copyObject($target_questionpool_id, $title="")
Copies an assClozeTest object.
setClozeTextValue($cloze_text="")
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
addGapAtIndex($gap, $index)
Adds a ClozeGap object at a given index.
setTextgapRating($a_textgap_rating)
Sets the rating option for text gaps.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setGapSize($gap_index, $order, $size)
setGapAnswerUpperBound($gap_index, $order, $bound)
Sets the upper bound of a gap with a given index and an answer with a given order.
createGapsFromQuestiontext()
Create gap entries by parsing the question text.
getAnswerTableName()
Returns the name of the answer table in the database.
setGapCombinations($value)
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
updateClozeTextFromGaps()
Updates the gap parameters in the cloze text from the form input.
flushGaps()
Deletes all gaps without changing the cloze text.
getStartTag()
Returns the start tag of a cloze gap.
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
saveAnswerSpecificDataToDb()
Save all gaps to the database.
getFixedTextLength()
Gets the fixed text length for all text fields in the cloze question.
addGapText($gap_index)
Adds a new answer text value to a text gap with a given index.
setIdenticalScoring($a_identical_scoring)
Sets the identical scoring option for cloze questions.
saveToDb($original_id="")
Saves a assClozeTest object to a database.
getGaps()
Returns the array of gaps.
getOperators($expression)
Get all available operations for a specific question.
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assClozeTest constructor
getQuestionType()
Returns the question type of the question.
checkForValidFormula($value)
setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
Creates an Excel worksheet for the detailed cumulated results of this question.
getTextgapRating()
Returns the rating option for text gaps.
deleteGap($gap_index)
Deletes a gap with a given index.
getGap($gap_index=0)
Returns the gap at a given index.
setGapType($gap_index, $gap_type)
Set the type of a gap with a given index.
copyGapCombination($orgID, $newID)
calculateReachedPointsForSolution($user_result, &$detailed=null)
getGapCombinationsExists()
getExpressionTypes()
Get all available expression types for a specific question.
saveClozeTextGapRecordToDb($next_id, $key, $item, $gap)
Saves a gap-item record.
getGapCount()
Returns the number of gaps.
setGapCombinationsExists($value)
saveWorkingData($active_id, $pass=NULL, $authorized=true)
Saves the learners input of the question to the database.
saveClozeGapItemsToDb($gap, $key)
Save all items belonging to one cloze gap to the db.
setGapAnswerLowerBound($gap_index, $order, $bound)
Sets the lower bound of a gap with a given index and an answer with a given order.
setEndTag($end_tag="[/gap]")
Sets the end tag of a cloze gap.
getMaximumGapPoints($gap_index)
Returns the maximum points for a gap.
lmMigrateQuestionTypeSpecificContent(ilAssSelfAssessmentMigrator $migrator)
saveAdditionalQuestionDataToDb()
Saves the data for the additional data table.
deleteAnswerText($gap_index, $answer_index)
Deletes the answer text of a gap with a given index and an answer with a given order.
saveClozeSelectGapRecordToDb($next_id, $key, $item, $gap)
Saves a gap-item record.
toJSON()
Returns a JSON representation of the question.
loadFromDb($question_id)
Loads a assClozeTest object from a database.
setFixedTextLength($a_text_len)
Sets a fixed text length for all text fields in the cloze question.
calculateCombinationResult($user_result)
reworkWorkingData($active_id, $pass, $obligationsAnswered)
Reworks the allready saved working data if neccessary.
calculateReachedPoints($active_id, $pass=NULL, $authorized=true, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
setClozeText($cloze_text="")
Evaluates the text gap solutions from the cloze text.
saveClozeNumericGapRecordToDb($next_id, $key, $item, $gap)
Saves a gap-item record.
setStartTag($start_tag="[gap]")
Sets the start tag of a cloze gap.
getNumericgapPoints($a_original, $a_entered, $max_points, $lowerBound, $upperBound)
Returns the points for a text gap and compares the given solution with the entered solution using the...
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assClozeTest.
cleanQuestiontext($text)
Cleans cloze question text to remove attributes or tags from older ILIAS versions.
getIdenticalScoring()
Returns the identical scoring status of the question.
Abstract basic class which is to be extended by the concrete assessment question type classes.
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass.
static _getOriginalId($question_id)
Returns the original id of a question.
formatSAQuestion($a_q)
Format self assessment question.
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
saveQuestionDataToDb($original_id="")
getId()
Gets the id of the assQuestion object.
getObjId()
Get the object id of the container object.
setTitle($title="")
Sets the title string of the assQuestion object.
prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output in tests.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
setAuthor($author="")
Sets the authors name of the assQuestion object.
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
getShuffle()
Gets the shuffle flag.
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
removeCurrentSolution($active_id, $pass, $authorized=true, $ignoredSolutionIds=array())
getTitle()
Gets the title string of the assQuestion object.
setPoints($a_points)
Sets the maximum available points for the question.
setComment($comment="")
Sets the comment string of the assQuestion object.
getAuthor()
Gets the authors name of the assQuestion object.
setNrOfTries($a_nr_of_tries)
getQuestion()
Gets the question string of the question object.
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true)
setQuestion($question="")
Sets the question string of the question object.
getParticipantsSolution()
_convert_text($a_text, $a_target="has been removed")
_getLogLanguage()
retrieve the log language for assessment logging
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static getOperatorsByExpression($expression)
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static strToLower($a_string)
Class ilUserQuestionResult.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const TEXTGAP_RATING_LEVENSHTEIN5
const TEXTGAP_RATING_LEVENSHTEIN4
const TEXTGAP_RATING_LEVENSHTEIN3
const TEXTGAP_RATING_CASESENSITIVE
const TEXTGAP_RATING_LEVENSHTEIN2
const TEXTGAP_RATING_CASEINSENSITIVE
const TEXTGAP_RATING_LEVENSHTEIN1
const CLOZE_TEXT
Cloze question constants.
Class iQuestionCondition.
const PercentageResultExpression
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
const StringResultExpression
const NumericResultExpression
const EmptyAnswerExpression
const NumberOfResultExpression
migrateToLmContent($content)
Interface ilObjAnswerScoringAdjustable.
Interface ilObjQuestionScoringAdjustable.