4require_once
'Modules/TestQuestionPool/classes/feedback/class.ilAssMultiOptionQuestionFeedback.php';
5require_once
'Services/Randomization/classes/class.ilArrayElementOrderKeeper.php';
53 return $this->questionOBJ->gaps;
80 $answers[] =
'"' . $item->getAnswertext() .
'"';
83 $answers = implode(
' / ', $answers);
86 $DIC->language()->txt(
'ass_cloze_gap_fb_gap_label'),
104 $DIC->language()->txt(
'ass_cloze_gap_fb_txt_match_label'),
106 $item->getAnswertext()
117 return sprintf(
$DIC->language()->txt(
'ass_cloze_gap_fb_txt_nomatch_label'), $gapIndex + 1);
127 return sprintf(
$DIC->language()->txt(
'ass_cloze_gap_fb_txt_empty_label'), $gapIndex + 1);
140 $DIC->language()->txt(
'ass_cloze_gap_fb_sel_opt_label'),
142 $item->getAnswertext()
153 return sprintf(
$DIC->language()->txt(
'ass_cloze_gap_fb_sel_empty_label'), $gapIndex + 1);
163 return sprintf(
$DIC->language()->txt(
'ass_cloze_gap_fb_num_valuehit_label'), $gapIndex + 1);
173 return sprintf(
$DIC->language()->txt(
'ass_cloze_gap_fb_num_rangehit_label'), $gapIndex + 1);
183 return sprintf(
$DIC->language()->txt(
'ass_cloze_gap_fb_num_toolow_label'), $gapIndex + 1);
193 return sprintf(
$DIC->language()->txt(
'ass_cloze_gap_fb_num_toohigh_label'), $gapIndex + 1);
203 return sprintf(
$DIC->language()->txt(
'ass_cloze_gap_fb_num_empty_label'), $gapIndex + 1);
210 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
212 $header->setTitle($this->lng->txt(
'feedback_answers'));
216 $DIC->language()->txt(
'ass_cloze_fb_mode'),
219 $feedbackMode->setRequired(
true);
223 $DIC->language()->txt(
'ass_cloze_fb_mode_gap_qst'),
224 self::FB_MODE_GAP_QUESTION,
225 $DIC->language()->txt(
'ass_cloze_fb_mode_gap_qst_info')
228 $feedbackMode->addOption($fbModeGapQuestion);
231 $DIC->language()->txt(
'ass_cloze_fb_mode_gap_answ'),
232 self::FB_MODE_GAP_ANSWERS,
233 $DIC->language()->txt(
'ass_cloze_fb_mode_gap_answ_info')
236 $feedbackMode->addOption($fbModeGapAnswers);
243 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
251 $this->questionOBJ->isAdditionalContentEditingModePageObject()
259 switch ($gap->getType()) {
286 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
291 $propertyPostVar =
"feedback_answer_{$gapIndex}_{$answerIndex}";
296 $this->questionOBJ->isAdditionalContentEditingModePageObject()
300 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
310 $this->questionOBJ->isAdditionalContentEditingModePageObject()
313 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
323 $this->questionOBJ->isAdditionalContentEditingModePageObject()
335 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
340 $propertyPostVar =
"feedback_answer_{$gapIndex}_{$optIndex}";
345 $this->questionOBJ->isAdditionalContentEditingModePageObject()
349 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
359 $this->questionOBJ->isAdditionalContentEditingModePageObject()
370 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
380 $this->questionOBJ->isAdditionalContentEditingModePageObject()
384 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
394 $this->questionOBJ->isAdditionalContentEditingModePageObject()
398 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
408 $this->questionOBJ->isAdditionalContentEditingModePageObject()
411 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
421 $this->questionOBJ->isAdditionalContentEditingModePageObject()
424 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
434 $this->questionOBJ->isAdditionalContentEditingModePageObject()
440 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
443 $fbMode->setValue($this->questionOBJ->getFeedbackMode());
445 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
449 switch ($this->questionOBJ->getFeedbackMode()) {
475 switch ($gap->getType()) {
551 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
554 if ($fbMode != $this->questionOBJ->getFeedbackMode()) {
560 switch ($this->questionOBJ->getFeedbackMode()) {
581 $this->questionOBJ->getId(),
583 self::SINGLE_GAP_FB_ANSWER_INDEX,
592 switch ($gap->getType()) {
617 $this->questionOBJ->getId(),
627 $this->questionOBJ->getId(),
629 self::FB_TEXT_GAP_NOMATCH_INDEX,
636 $this->questionOBJ->getId(),
638 self::FB_TEXT_GAP_EMPTY_INDEX,
649 $this->questionOBJ->getId(),
659 $this->questionOBJ->getId(),
661 self::FB_SELECT_GAP_EMPTY_INDEX,
671 $this->questionOBJ->getId(),
673 self::FB_NUMERIC_GAP_VALUE_HIT_INDEX,
681 $this->questionOBJ->getId(),
683 self::FB_NUMERIC_GAP_RANGE_HIT_INDEX,
691 $this->questionOBJ->getId(),
693 self::FB_NUMERIC_GAP_TOO_LOW_INDEX,
700 $this->questionOBJ->getId(),
702 self::FB_NUMERIC_GAP_TOO_HIGH_INDEX,
709 $this->questionOBJ->getId(),
711 self::FB_NUMERIC_GAP_EMPTY_INDEX,
732 parent::duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId);
737 $res = $this->db->queryF(
738 "SELECT feedback_mode FROM {$this->questionOBJ->getAdditionalTableName()} WHERE question_fi = %s",
740 array($sourceQuestionId)
743 $row = $this->db->fetchAssoc(
$res);
746 $this->questionOBJ->getAdditionalTableName(),
747 array(
'feedback_mode' => array(
'text', $row[
'feedback_mode']) ),
748 array(
'question_fi' => array(
'integer', $targetQuestionId) )
755 parent::syncSpecificFeedback($originalQuestionId, $duplicateQuestionId);
766 $this->questionOBJ->setFeedbackMode($feedbackMode);
769 $this->questionOBJ->getAdditionalTableName(),
770 array(
'feedback_mode' => array(
'text', $feedbackMode)),
771 array(
'question_fi' => array(
'integer', $questionId))
781 return "feedback_answer_{$gapIndex}";
791 return "feedback_answer_{$gapIndex}_{$answerIndex}";
801 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
803 $this->questionOBJ->getId(),
813 $value = $this->questionOBJ->prepareTextareaOutput(
832 default: $feedbackIds = array();
840 require_once
'Modules/TestQuestionPool/classes/feedback/class.ilAssSpecificFeedbackIdentifierList.php';
842 $feedbackIdentifiers->load($this->questionOBJ->getId());
844 $feedbackIds = array();
846 foreach ($feedbackIdentifiers as $identifier) {
847 if ($identifier->getAnswerIndex() != self::SINGLE_GAP_FB_ANSWER_INDEX) {
851 $feedbackIds[] = $identifier->getFeedbackId();
859 require_once
'Modules/TestQuestionPool/classes/feedback/class.ilAssSpecificFeedbackIdentifierList.php';
861 $feedbackIdentifiers->load($this->questionOBJ->getId());
863 $feedbackIds = array();
865 foreach ($feedbackIdentifiers as $identifier) {
866 if ($identifier->getAnswerIndex() == self::SINGLE_GAP_FB_ANSWER_INDEX) {
870 $feedbackIds[] = $identifier->getFeedbackId();
878 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
879 foreach ($feedbackIds as $fbId) {
884 $IN_feedbackIds = $this->db->in(
'feedback_id', $feedbackIds,
false,
'integer');
885 $this->db->manipulate(
"DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE {$IN_feedbackIds}");
890 if ($this->questionOBJ->getFeedbackMode() == self::FB_MODE_GAP_QUESTION) {
892 $this->questionOBJ->getId(),
894 self::SINGLE_GAP_FB_ANSWER_INDEX
906 if (!strlen($answerValue)) {
912 foreach ($items as $answerIndex => $answer) {
915 if ($answer->getAnswertext() == $answerValue) {
924 if (strlen($answerValue)) {
932 if (!strlen($answerValue)) {
940 if ($answerValue == $item->getAnswertext()) {
944 require_once
'Services/Math/classes/class.EvalMath.php';
948 $lowerBound = $math->evaluate($item->getLowerBound());
949 $upperBound = $math->evaluate($item->getUpperBound());
950 $preciseValue = $math->evaluate($item->getAnswertext());
952 $solutionValue = $math->evaluate($answerValue);
954 if ($solutionValue == $preciseValue) {
958 if ($solutionValue >= $lowerBound && $solutionValue <= $upperBound) {
962 if ($solutionValue < $lowerBound) {
966 if ($solutionValue > $upperBound) {
An exception for terminatinating execution or to throw for unit testing.
Class for cloze question gaps.
getItems(ilArrayElementShuffler $shuffler)
Gets the items of a cloze gap.
getType()
Gets the cloze gap type.
getItem($a_index)
Gets the item with a given index.
buildGapFeedbackLabel($gapIndex, $gap)
builds an answer option label from given (mixed type) index and answer (overwrites parent method from...
const FB_NUMERIC_GAP_RANGE_HIT_INDEX
saveFbPropsForSelectGap(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
cleanupSpecificAnswerFeedbacks($fbMode)
initFbPropsForNumericGap(ilPropertyFormGUI $form, $gapIndex, assClozeGap $gap)
const FB_MODE_GAP_QUESTION
constants for different feedback modes (per gap or per gap-answers/options)
completeFormPropsForFeedbackModeGapQuestion(ilRadioOption $fbModeOpt)
const FB_NUMERIC_GAP_TOO_HIGH_INDEX
completeFormPropsForFeedbackModeGapAnswers(ilRadioOption $fbModeOpt)
buildPostVarForFbFieldPerGapAnswers($gapIndex, $answerIndex)
const FB_SELECT_GAP_EMPTY_INDEX
initFbPropsForSelectGap(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
const FB_TEXT_GAP_NOMATCH_INDEX
getSpecificAnswerFeedbackFormValue($gapIndex, $answerIndex)
const SINGLE_GAP_FB_ANSWER_INDEX
buildNumericGapTooLowFeedbackLabel($gapIndex)
getGapsByIndex()
returns the answer options mapped by answer index (overwrites parent method from ilAssMultiOptionQues...
saveFbPropsForTextGap(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
buildTextGapGivenAnswerFeedbackLabel($gapIndex, $item)
saveFbPropsForNumericGap(ilPropertyFormGUI $form, $gapIndex, assClozeGap $gap)
buildNumericGapValueHitFeedbackLabel($gapIndex)
buildNumericGapTooHighFeedbackLabel($gapIndex)
initFbPropsForTextGap(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
buildTextGapWrongAnswerFeedbackLabel($gapIndex)
saveSpecificFeedbackMode($questionId, $feedbackMode)
completeFbPropsForNumericGap(ilRadioOption $fbModeOpt, $gapIndex, assClozeGap $gap)
const FB_TEXT_GAP_EMPTY_INDEX
constants for answer indexes in case of FB_MODE_GAP_ANSWERS
initFeedbackFieldsPerGapQuestion(ilPropertyFormGUI $form)
const FB_MODE_GAP_ANSWERS
isSaveableInPageObjectEditingMode()
syncSpecificFeedbackSetting($sourceQuestionId, $targetQuestionId)
const FB_NUMERIC_GAP_TOO_LOW_INDEX
buildSelectGapEmptyFeedbackLabel($gapIndex)
syncSpecificFeedback($originalQuestionId, $duplicateQuestionId)
syncs the SPECIFIC feedback from a duplicated question back to the original question
initSpecificFormProperties(ilPropertyFormGUI $form)
initialises a given form object's specific form properties relating to this question type
saveFeedbackFieldsPerGapQuestion(ilPropertyFormGUI $form)
completeFbPropsForTextGap(ilRadioOption $fbModeOpt, assClozeGap $gap, $gapIndex)
saveSpecificFormProperties(ilPropertyFormGUI $form)
saves a given form object's specific form properties relating to this question type
buildSelectGapOptionFeedbackLabel($gapIndex, $item)
completeSpecificFormProperties(ilPropertyFormGUI $form)
completes a given form object with the specific form properties required by this question type
determineAnswerIndexForAnswerValue(assClozeGap $gap, $answerValue)
buildTextGapEmptyFeedbackLabel($gapIndex)
determineTestOutputGapFeedback($gapIndex, $answerIndex)
buildNumericGapEmptyFeedbackLabel($gapIndex)
const FB_NUMERIC_GAP_EMPTY_INDEX
const FB_NUMERIC_GAP_VALUE_HIT_INDEX
initFeedbackFieldsPerGapAnswers(ilPropertyFormGUI $form)
fetchFeedbackIdsForGapQuestionMode()
completeFbPropsForSelectGap(ilRadioOption $fbModeOpt, assClozeGap $gap, $gapIndex)
deleteSpecificAnswerFeedbacksByIds($feedbackIds)
buildPostVarForFbFieldPerGapQuestion($gapIndex)
saveFeedbackFieldsPerGapAnswers(ilPropertyFormGUI $form)
buildNumericGapRangeHitFeedbackLabel($gapIndex)
fetchFeedbackIdsForGapAnswersMode()
duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId)
duplicates the SPECIFIC feedback relating to the given original question id and saves it for the give...
getSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex)
returns the SPECIFIC answer feedback content for a given question id and answer index.
getSpecificAnswerFeedbackTestPresentation($questionId, $questionIndex, $answerIndex)
returns the html of SPECIFIC feedback for the given question id and answer index for test presentatio...
saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, $feedbackContent)
saves SPECIFIC answer feedback content for the given question id and answer index to the database.
getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
getPageObjectNonEditableValueHTML($pageObjectType, $pageObjectId)
returns html content to be used as value for non editable value form properties in feedback editing f...
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
ensurePageObjectDeleted($pageObjectType, $pageObjectId)
ensures a no more existing page object for given type and id
buildFeedbackContentFormProperty($label, $postVar, $asNonEditable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
This class represents an option in a radio group.
addSubItem($a_item)
Add Subitem.
const CLOZE_TEXT
Cloze question constants.
foreach($_POST as $key=> $value) $res