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()));
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)
1126 $output = preg_replace(
"/\[gap\].*?\[\/gap\]/",
"[_gap]" . join(
",", $answers) .
"[/_gap]",
$output, 1);
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 ($submit 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;
1361 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1365 $entered_values = 0;
1367 $this->
getProcessLocker()->executeUserSolutionUpdateLockOperation(
function() use (&$entered_values, $active_id,
$pass, $authorized) {
1377 if (is_object($gap))
1379 if (!(($gap->getType() ==
CLOZE_SELECT) && ($value == -1)))
1390 if ($entered_values)
1392 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1400 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1426 return "assClozeTest";
1450 switch ($a_textgap_rating)
1459 $this->textgap_rating = $a_textgap_rating;
1476 return ($this->identical_scoring) ? 1 : 0;
1488 $this->identical_scoring = ($a_identical_scoring) ? 1 : 0;
1499 return "qpl_qst_cloze";
1510 return array(
"qpl_a_cloze",
'qpl_a_cloze_combi_res');
1521 $this->fixedTextLength = $a_text_len;
1546 $gap_max_points = 0;
1547 if (array_key_exists($gap_index, $this->gaps))
1549 $gap =& $this->gaps[$gap_index];
1550 foreach ($gap->getItems($this->getShuffler()) as $answer)
1552 if ($answer->getPoints() > $gap_max_points)
1554 $gap_max_points = $answer->getPoints();
1568 return parent::getRTETextWithMediaObjects() . $this->
getClozeText();
1582 $this->gap_combinations_exists = $value;
1587 $this->gap_combinations = $value;
1595 parent::setExportDetailsXLS(
$worksheet, $startrow, $active_id,
$pass);
1599 foreach ($this->
getGaps() as $gap_index => $gap)
1601 $worksheet->setCell($startrow + $i, 0,$this->lng->txt(
"gap") .
" $i");
1604 foreach ($solution as $solutionvalue)
1606 if ($gap_index == $solutionvalue[
"value1"])
1608 $string_escaping_org_value =
$worksheet->getStringEscaping();
1612 switch ($gap->getType())
1615 $worksheet->setCell($startrow + $i, 1, $gap->getItem($solutionvalue[
"value2"])->getAnswertext());
1619 $worksheet->setCell($startrow + $i, 1, $solutionvalue[
"value2"]);
1624 $worksheet->setStringEscaping($string_escaping_org_value);
1631 return $startrow + $i + 1;
1650 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1660 'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false)),
1661 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true))
1665 foreach ($this->
getGaps() as $key => $gap)
1668 foreach ($gap->getItems($this->getShuffler()) as $item)
1671 $jitem[
'points'] = $item->getPoints();
1673 $jitem[
'order'] = $item->getOrder();
1676 $jitem[
'lowerbound'] = $item->getLowerBound();
1677 $jitem[
'upperbound'] = $item->getUpperBound();
1681 $jitem[
'value'] = trim($jitem[
'value']);
1683 array_push($items, $jitem);
1688 $jgap[
'size'] = $gap->getGapSize();
1691 $jgap[
'shuffle'] = $gap->getShuffle();
1692 $jgap[
'type'] = $gap->getType();
1693 $jgap[
'item'] = $items;
1695 array_push(
$gaps, $jgap);
1713 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1746 $maxStep = $this->lookupMaxStep($active_id,
$pass);
1748 if( $maxStep !==
null )
1752 SELECT sol.value1+1 as val, sol.value2, cloze.cloze_type
1753 FROM tst_solutions sol
1754 INNER JOIN qpl_a_cloze cloze ON cloze.gap_id = value1 AND cloze.question_fi = sol.question_fi
1755 WHERE sol.active_fi = %s AND sol.pass = %s AND sol.question_fi = %s AND sol.step = %s
1756 GROUP BY sol.solution_id, sol.value1+1, sol.value2, cloze.cloze_type
1758 array(
"integer",
"integer",
"integer",
"integer"),
1759 array($active_id,
$pass, $this->
getId(), $maxStep)
1766 SELECT sol.value1+1 as val, sol.value2, cloze.cloze_type
1767 FROM tst_solutions sol
1768 INNER JOIN qpl_a_cloze cloze ON cloze.gap_id = value1 AND cloze.question_fi = sol.question_fi
1769 WHERE sol.active_fi = %s AND sol.pass = %s AND sol.question_fi = %s
1770 GROUP BY sol.solution_id, sol.value1+1, sol.value2, cloze.cloze_type
1772 array(
"integer",
"integer",
"integer"),
1779 if(
$row[
"cloze_type"] == 1)
1806 return $this->
getGap($index);
1820 if($assClozeGapCombinationObj->combinationExistsForQid($this->getId()))
1822 $combinations_for_question = $assClozeGapCombinationObj->getCleanCombinationArray($this->
getId());
1823 $gap_answers = array();
1824 $gap_used_in_combination = array();
1825 foreach($user_result as $user_result_build_list)
1827 if(is_array($user_result_build_list))
1829 $gap_answers[$user_result_build_list[
'gap_id']] = $user_result_build_list[
'value'];
1833 foreach($combinations_for_question as $combination)
1836 foreach($combination as $row_key => $row_answers)
1838 $combination_fulfilled =
true;
1839 $points_for_combination = $row_answers[
'points'];
1840 foreach($row_answers as $gap_key => $combination_gap_answer)
1842 if($gap_key !==
'points')
1844 $gap_used_in_combination[$gap_key]= $gap_key;
1846 if($combination_fulfilled && array_key_exists($gap_key, $gap_answers))
1848 switch($combination_gap_answer[
'type'])
1851 $is_text_gap_correct = $this->
getTextgapPoints($gap_answers[$gap_key], $combination_gap_answer[
'answer'], 1);
1852 if($is_text_gap_correct != 1)
1854 $combination_fulfilled =
false;
1858 $answer = $this->gaps[$gap_key]->getItem($gap_answers[$gap_key]);
1859 $answertext = $answer->getAnswertext();
1860 if($answertext != $combination_gap_answer[
'answer'])
1862 $combination_fulfilled =
false;
1866 $answer = $this->gaps[$gap_key]->getItem(0);
1867 if($combination_gap_answer[
'answer'] !=
'out_of_bound')
1869 $is_numeric_gap_correct = $this->
getNumericgapPoints($answer->getAnswertext(), $gap_answers[$gap_key], 1, $answer->getLowerBound(), $answer->getUpperBound());
1870 if($is_numeric_gap_correct != 1)
1872 $combination_fulfilled =
false;
1877 $wrong_is_the_new_right = $this->
getNumericgapPoints($answer->getAnswertext(), $gap_answers[$gap_key], 1, $answer->getLowerBound(), $answer->getUpperBound());
1878 if($wrong_is_the_new_right == 1)
1880 $combination_fulfilled =
false;
1888 if($gap_key !==
'points')
1890 $combination_fulfilled =
false;
1894 if($combination_fulfilled)
1896 $points += $points_for_combination;
1901 return array(
$points, $gap_used_in_combination);
1910 if($detailed ===
null)
1912 $detailed = array();
1916 $combinations[1] = array();
1917 if($assClozeGapCombinationObj->combinationExistsForQid($this->getId()))
1923 $solution_values_text = array();
1924 $solution_values_select = array();
1925 $solution_values_numeric = array();
1926 foreach($user_result as $gap_id => $value)
1928 if(is_string($value))
1930 $value = array(
"value" => $value);
1933 if(array_key_exists($gap_id, $this->gaps) && !array_key_exists ($gap_id, $combinations[1]))
1935 switch($this->gaps[$gap_id]->getType())
1939 for($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++)
1941 $answer = $this->gaps[$gap_id]->getItem($order);
1942 $gotpoints = $this->
getTextgapPoints($answer->getAnswertext(), $value[
"value"], $answer->getPoints());
1943 if($gotpoints > $gappoints) $gappoints = $gotpoints;
1948 if((in_array($value[
"value"], $solution_values_text)) && ($gappoints > 0))
1954 $detailed[$gap_id] = array(
"points" => $gappoints,
"best" => ($this->
getMaximumGapPoints($gap_id) == $gappoints) ? TRUE : FALSE,
"positive" => ($gappoints > 0) ? TRUE : FALSE);
1955 array_push($solution_values_text, $value[
"value"]);
1959 for($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++)
1961 $answer = $this->gaps[$gap_id]->getItem($order);
1962 $gotpoints = $this->
getNumericgapPoints($answer->getAnswertext(), $value[
"value"], $answer->getPoints(), $answer->getLowerBound(), $answer->getUpperBound());
1963 if($gotpoints > $gappoints) $gappoints = $gotpoints;
1968 include_once
"./Services/Math/classes/class.EvalMath.php";
1970 $eval->suppress_errors = TRUE;
1971 $found_value = FALSE;
1972 foreach($solution_values_numeric as $solval)
1974 if($eval->e($solval) == $eval->e($value[
"value"]))
1976 $found_value = TRUE;
1979 if($found_value && ($gappoints > 0))
1985 $detailed[$gap_id] = array(
"points" => $gappoints,
"best" => ($this->
getMaximumGapPoints($gap_id) == $gappoints) ? TRUE : FALSE,
"positive" => ($gappoints > 0) ? TRUE : FALSE);
1986 array_push($solution_values_numeric, $value[
"value"]);
1989 if($value[
"value"] >= 0)
1991 for($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++)
1993 $answer = $this->gaps[$gap_id]->getItem($order);
1994 if($value[
"value"] == $answer->getOrder())
1996 $answerpoints = $answer->getPoints();
2000 if((in_array($answer->getAnswertext(), $solution_values_select)) && ($answerpoints > 0))
2006 $detailed[$gap_id] = array(
"points" => $answerpoints,
"best" => ($this->
getMaximumGapPoints($gap_id) == $answerpoints) ? TRUE : FALSE,
"positive" => ($answerpoints > 0) ? TRUE : FALSE);
2007 array_push($solution_values_select, $answer->getAnswertext());
2021 $userSolution = array();
2025 $userSolution[] = array(
'gap_id' => $key,
'value' => $val);
An exception for terminatinating execution or to throw for unit testing.
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)
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.
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{Creates an Excel worksheet for the detailed cumulated results of this question.object}
reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
{Reworks the allready saved working data if neccessary.}
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.
fetchSolutionSubmit($submit)
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)
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.
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
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.
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
removeCurrentSolution($active_id, $pass, $authorized=true)
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.
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
setQuestion($question="")
Sets the question string of the question object.
ensureNonNegativePoints($points)
getParticipantsSolution()
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _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
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
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.