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() 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() as $item)
856 if ($item->getPoints() > $gap_max_points)
858 $gap_max_points = $item->getPoints();
866 foreach ($gap->getItems() as $item)
868 if ($item->getPoints() > $srpoints)
870 $srpoints = $item->getPoints();
878 foreach ($gap->getItems() 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);
1250 $result = $this->getCurrentSolutionResultSet($active_id,
$pass);
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 $solutionSubmit = array();
1279 foreach (
$_POST as $key => $value)
1281 if (preg_match(
"/^gap_(\d+)/", $key, $matches))
1286 $gap = $this->
getGap($matches[1]);
1287 if (is_object($gap))
1289 if (!(($gap->getType() ==
CLOZE_SELECT) && ($value == -1)))
1293 $value = str_replace(
",",
".", $value);
1295 $solutionSubmit[trim($matches[1])] = $value;
1302 return $solutionSubmit;
1319 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1325 $affectedRows = $this->removeCurrentSolution($active_id,
$pass);
1327 $entered_values = 0;
1335 if (is_object($gap))
1337 if (!(($gap->getType() ==
CLOZE_SELECT) && ($value == -1)))
1339 $affectedRows = $this->saveCurrentSolution($active_id,
$pass, $val1, $value);
1348 if ($entered_values)
1350 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1358 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1389 return "assClozeTest";
1413 switch ($a_textgap_rating)
1422 $this->textgap_rating = $a_textgap_rating;
1439 return ($this->identical_scoring) ? 1 : 0;
1451 $this->identical_scoring = ($a_identical_scoring) ? 1 : 0;
1462 return "qpl_qst_cloze";
1473 return array(
"qpl_a_cloze",
'qpl_a_cloze_combi_res');
1484 $this->fixedTextLength = $a_text_len;
1509 $gap_max_points = 0;
1510 if (array_key_exists($gap_index, $this->gaps))
1512 $gap =& $this->gaps[$gap_index];
1513 foreach ($gap->getItems() as $answer)
1515 if ($answer->getPoints() > $gap_max_points)
1517 $gap_max_points = $answer->getPoints();
1531 return parent::getRTETextWithMediaObjects() . $this->
getClozeText();
1545 $this->gap_combinations_exists = $value;
1550 $this->gap_combinations = $value;
1566 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
1571 foreach ($this->
getGaps() as $gap_index => $gap)
1575 foreach ($solution as $solutionvalue)
1577 if ($gap_index == $solutionvalue[
"value1"])
1579 switch ($gap->getType())
1582 $worksheet->writeString($startrow + $i, 1, $gap->getItem($solutionvalue[
"value2"])->getAnswertext());
1586 $worksheet->writeString($startrow + $i, 1, $solutionvalue[
"value2"]);
1593 return $startrow + $i + 1;
1601 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1612 'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false)),
1613 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true))
1617 foreach ($this->
getGaps() as $key => $gap)
1620 foreach ($gap->getItems() as $item)
1623 $jitem[
'points'] = $item->getPoints();
1625 $jitem[
'order'] = $item->getOrder();
1628 $jitem[
'lowerbound'] = $item->getLowerBound();
1629 $jitem[
'upperbound'] = $item->getUpperBound();
1633 $jitem[
'value'] = trim($jitem[
'value']);
1635 array_push($items, $jitem);
1640 $jgap[
'size'] = $gap->getGapSize();
1643 $jgap[
'shuffle'] = $gap->getShuffle();
1644 $jgap[
'type'] = $gap->getType();
1645 $jgap[
'item'] = $items;
1647 array_push(
$gaps, $jgap);
1665 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1699 "SELECT sol.value1+1 as val, sol.value2, cloze.cloze_type FROM tst_solutions sol INNER JOIN qpl_a_cloze cloze ON cloze.gap_id = value1 AND cloze.question_fi = sol.question_fi WHERE sol.active_fi = %s AND sol.pass = %s AND sol.question_fi = %s AND sol.step = (
1700 SELECT MAX(step) FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s
1701 ) GROUP BY sol.solution_id",
1702 array(
"integer",
"integer",
"integer",
"integer",
"integer",
"integer"),
1708 if(
$row[
"cloze_type"] == 1)
1735 return $this->
getGap($index);
1749 if($assClozeGapCombinationObj->combinationExistsForQid($this->getId()))
1751 $combinations_for_question = $assClozeGapCombinationObj->getCleanCombinationArray($this->
getId());
1752 $gap_answers = array();
1753 $gap_used_in_combination = array();
1754 foreach($user_result as $user_result_build_list)
1756 if(is_array($user_result_build_list))
1758 $gap_answers[$user_result_build_list[
'gap_id']] = $user_result_build_list[
'value'];
1762 foreach($combinations_for_question as $combination)
1765 foreach($combination as $row_key => $row_answers)
1767 $combination_fulfilled =
true;
1768 $points_for_combination = $row_answers[
'points'];
1769 foreach($row_answers as $gap_key => $combination_gap_answer)
1771 if($gap_key !==
'points')
1773 $gap_used_in_combination[$gap_key]= $gap_key;
1775 if($combination_fulfilled && array_key_exists($gap_key, $gap_answers))
1777 switch($combination_gap_answer[
'type'])
1780 $is_text_gap_correct = $this->
getTextgapPoints($gap_answers[$gap_key], $combination_gap_answer[
'answer'], 1);
1781 if($is_text_gap_correct != 1)
1783 $combination_fulfilled =
false;
1787 $answer = $this->gaps[$gap_key]->getItem($gap_answers[$gap_key]);
1788 $answertext = $answer->getAnswertext();
1789 if($answertext != $combination_gap_answer[
'answer'])
1791 $combination_fulfilled =
false;
1795 $answer = $this->gaps[$gap_key]->getItem(0);
1796 if($combination_gap_answer[
'answer'] !=
'out_of_bound')
1798 $is_numeric_gap_correct = $this->
getNumericgapPoints($answer->getAnswertext(), $gap_answers[$gap_key], 1, $answer->getLowerBound(), $answer->getUpperBound());
1799 if($is_numeric_gap_correct != 1)
1801 $combination_fulfilled =
false;
1806 $wrong_is_the_new_right = $this->
getNumericgapPoints($answer->getAnswertext(), $gap_answers[$gap_key], 1, $answer->getLowerBound(), $answer->getUpperBound());
1807 if($wrong_is_the_new_right == 1)
1809 $combination_fulfilled =
false;
1817 if($gap_key !==
'points')
1819 $combination_fulfilled =
false;
1823 if($combination_fulfilled)
1825 $points += $points_for_combination;
1830 return array(
$points, $gap_used_in_combination);
1839 if($detailed ===
null)
1841 $detailed = array();
1845 $combinations[1] = array();
1846 if($assClozeGapCombinationObj->combinationExistsForQid($this->getId()))
1852 $solution_values_text = array();
1853 $solution_values_select = array();
1854 $solution_values_numeric = array();
1855 foreach($user_result as $gap_id => $value)
1857 if(is_string($value))
1859 $value = array(
"value" => $value);
1862 if(array_key_exists($gap_id, $this->gaps) && !array_key_exists ($gap_id, $combinations[1]))
1864 switch($this->gaps[$gap_id]->getType())
1868 for($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++)
1870 $answer = $this->gaps[$gap_id]->getItem($order);
1871 $gotpoints = $this->
getTextgapPoints($answer->getAnswertext(), $value[
"value"], $answer->getPoints());
1872 if($gotpoints > $gappoints) $gappoints = $gotpoints;
1877 if((in_array($value[
"value"], $solution_values_text)) && ($gappoints > 0))
1883 $detailed[$gap_id] = array(
"points" => $gappoints,
"best" => ($this->
getMaximumGapPoints($gap_id) == $gappoints) ? TRUE : FALSE,
"positive" => ($gappoints > 0) ? TRUE : FALSE);
1884 array_push($solution_values_text, $value[
"value"]);
1888 for($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++)
1890 $answer = $this->gaps[$gap_id]->getItem($order);
1891 $gotpoints = $this->
getNumericgapPoints($answer->getAnswertext(), $value[
"value"], $answer->getPoints(), $answer->getLowerBound(), $answer->getUpperBound());
1892 if($gotpoints > $gappoints) $gappoints = $gotpoints;
1897 include_once
"./Services/Math/classes/class.EvalMath.php";
1899 $eval->suppress_errors = TRUE;
1900 $found_value = FALSE;
1901 foreach($solution_values_numeric as $solval)
1903 if($eval->e($solval) == $eval->e($value[
"value"]))
1905 $found_value = TRUE;
1908 if($found_value && ($gappoints > 0))
1914 $detailed[$gap_id] = array(
"points" => $gappoints,
"best" => ($this->
getMaximumGapPoints($gap_id) == $gappoints) ? TRUE : FALSE,
"positive" => ($gappoints > 0) ? TRUE : FALSE);
1915 array_push($solution_values_numeric, $value[
"value"]);
1918 if($value[
"value"] >= 0)
1920 for($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++)
1922 $answer = $this->gaps[$gap_id]->getItem($order);
1923 if($value[
"value"] == $answer->getOrder())
1925 $answerpoints = $answer->getPoints();
1929 if((in_array($answer->getAnswertext(), $solution_values_select)) && ($answerpoints > 0))
1935 $detailed[$gap_id] = array(
"points" => $answerpoints,
"best" => ($this->
getMaximumGapPoints($gap_id) == $answerpoints) ? TRUE : FALSE,
"positive" => ($answerpoints > 0) ? TRUE : FALSE);
1936 array_push($solution_values_select, $answer->getAnswertext());
1950 $userSolution = array();
1954 $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...
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.
saveWorkingData($active_id, $pass=NULL)
Saves the learners input of the question to 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.
calculateReachedPoints($active_id, $pass=NULL, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
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)
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.
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.
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.
& getSolutionValues($active_id, $pass=NULL)
Loads solutions of a given user from the database an returns it.
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)
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.
getShuffle()
Gets the shuffle flag.
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
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.
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 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
Interface ilObjAnswerScoringAdjustable.
Interface ilObjQuestionScoringAdjustable.