4 require_once
'Modules/TestQuestionPool/classes/feedback/class.ilAssMultiOptionQuestionFeedback.php';
5 require_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'),
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(
305 $propertyPostVar =
"feedback_answer_{$gapIndex}_" . self::FB_TEXT_GAP_NOMATCH_INDEX;
310 $this->questionOBJ->isAdditionalContentEditingModePageObject()
313 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
318 $propertyPostVar =
"feedback_answer_{$gapIndex}_" . self::FB_TEXT_GAP_EMPTY_INDEX;
323 $this->questionOBJ->isAdditionalContentEditingModePageObject()
335 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
340 $propertyPostVar =
"feedback_answer_{$gapIndex}_{$optIndex}";
345 $this->questionOBJ->isAdditionalContentEditingModePageObject()
349 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
354 $propertyPostVar =
"feedback_answer_{$gapIndex}_" . self::FB_SELECT_GAP_EMPTY_INDEX;
359 $this->questionOBJ->isAdditionalContentEditingModePageObject()
370 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
375 $propertyPostVar =
"feedback_answer_{$gapIndex}_" . self::FB_NUMERIC_GAP_VALUE_HIT_INDEX;
380 $this->questionOBJ->isAdditionalContentEditingModePageObject()
384 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
389 $propertyPostVar =
"feedback_answer_{$gapIndex}_" . self::FB_NUMERIC_GAP_RANGE_HIT_INDEX;
394 $this->questionOBJ->isAdditionalContentEditingModePageObject()
398 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
403 $propertyPostVar =
"feedback_answer_{$gapIndex}_" . self::FB_NUMERIC_GAP_TOO_LOW_INDEX;
408 $this->questionOBJ->isAdditionalContentEditingModePageObject()
411 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
416 $propertyPostVar =
"feedback_answer_{$gapIndex}_" . self::FB_NUMERIC_GAP_TOO_HIGH_INDEX;
421 $this->questionOBJ->isAdditionalContentEditingModePageObject()
424 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
429 $propertyPostVar =
"feedback_answer_{$gapIndex}_" . self::FB_NUMERIC_GAP_EMPTY_INDEX;
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()) {
450 case self::FB_MODE_GAP_QUESTION:
455 case self::FB_MODE_GAP_ANSWERS:
475 switch ($gap->getType()) {
551 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
554 if ($fbMode != $this->questionOBJ->getFeedbackMode()) {
560 switch ($this->questionOBJ->getFeedbackMode()) {
561 case self::FB_MODE_GAP_QUESTION:
566 case self::FB_MODE_GAP_ANSWERS:
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)
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(
824 case self::FB_MODE_GAP_QUESTION:
828 case self::FB_MODE_GAP_ANSWERS:
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)) {
907 return self::FB_TEXT_GAP_EMPTY_INDEX;
912 foreach ($items as $answerIndex => $answer) {
915 if ($answer->getAnswertext() == $answerValue) {
920 return self::FB_TEXT_GAP_NOMATCH_INDEX;
924 if (strlen($answerValue)) {
928 return self::FB_SELECT_GAP_EMPTY_INDEX;
932 if (!strlen($answerValue)) {
933 return self::FB_NUMERIC_GAP_EMPTY_INDEX;
940 if ($answerValue == $item->getAnswertext()) {
941 return self::FB_NUMERIC_GAP_VALUE_HIT_INDEX;
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) {
955 return self::FB_NUMERIC_GAP_VALUE_HIT_INDEX;
958 if ($solutionValue >= $lowerBound && $solutionValue <= $upperBound) {
959 return self::FB_NUMERIC_GAP_RANGE_HIT_INDEX;
962 if ($solutionValue < $lowerBound) {
963 return self::FB_NUMERIC_GAP_TOO_LOW_INDEX;
966 if ($solutionValue > $upperBound) {
967 return self::FB_NUMERIC_GAP_TOO_HIGH_INDEX;
determineTestOutputGapFeedback($gapIndex, $answerIndex)
const FB_NUMERIC_GAP_TOO_HIGH_INDEX
This class represents an option in a radio group.
buildNumericGapEmptyFeedbackLabel($gapIndex)
buildSelectGapEmptyFeedbackLabel($gapIndex)
initFeedbackFieldsPerGapAnswers(ilPropertyFormGUI $form)
getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
initFeedbackFieldsPerGapQuestion(ilPropertyFormGUI $form)
completeFormPropsForFeedbackModeGapQuestion(ilRadioOption $fbModeOpt)
getPageObjectNonEditableValueHTML($pageObjectType, $pageObjectId)
returns html content to be used as value for non editable value form properties in feedback editing f...
buildPostVarForFbFieldPerGapQuestion($gapIndex)
const FB_NUMERIC_GAP_VALUE_HIT_INDEX
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
const CLOZE_TEXT
Cloze question constants.
completeFormPropsForFeedbackModeGapAnswers(ilRadioOption $fbModeOpt)
determineAnswerIndexForAnswerValue(assClozeGap $gap, $answerValue)
saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, $feedbackContent)
saves SPECIFIC answer feedback content for the given question id and answer index to the database...
deleteSpecificAnswerFeedbacksByIds($feedbackIds)
saveFbPropsForNumericGap(ilPropertyFormGUI $form, $gapIndex, assClozeGap $gap)
initFbPropsForNumericGap(ilPropertyFormGUI $form, $gapIndex, assClozeGap $gap)
completeFbPropsForTextGap(ilRadioOption $fbModeOpt, assClozeGap $gap, $gapIndex)
Class for cloze question gaps.
saveFbPropsForSelectGap(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
buildPostVarForFbFieldPerGapAnswers($gapIndex, $answerIndex)
const FB_NUMERIC_GAP_TOO_LOW_INDEX
buildNumericGapTooLowFeedbackLabel($gapIndex)
buildSelectGapOptionFeedbackLabel($gapIndex, $item)
saveSpecificFormProperties(ilPropertyFormGUI $form)
initSpecificFormProperties(ilPropertyFormGUI $form)
const FB_NUMERIC_GAP_RANGE_HIT_INDEX
buildNumericGapValueHitFeedbackLabel($gapIndex)
syncSpecificFeedbackSetting($sourceQuestionId, $targetQuestionId)
getSpecificAnswerFeedbackFormValue($gapIndex, $answerIndex)
getSpecificAnswerFeedbackTestPresentation($questionId, $questionIndex, $answerIndex)
returns the html of SPECIFIC feedback for the given question id and answer index for test presentatio...
foreach($_POST as $key=> $value) $res
buildTextGapGivenAnswerFeedbackLabel($gapIndex, $item)
if(isset($_POST['submit'])) $form
addSubItem($a_item)
Add Subitem.
cleanupSpecificAnswerFeedbacks($fbMode)
completeSpecificFormProperties(ilPropertyFormGUI $form)
completeFbPropsForNumericGap(ilRadioOption $fbModeOpt, $gapIndex, assClozeGap $gap)
buildTextGapWrongAnswerFeedbackLabel($gapIndex)
const FB_NUMERIC_GAP_EMPTY_INDEX
syncSpecificFeedback($originalQuestionId, $duplicateQuestionId)
buildNumericGapRangeHitFeedbackLabel($gapIndex)
fetchFeedbackIdsForGapAnswersMode()
buildTextGapEmptyFeedbackLabel($gapIndex)
saveSpecificFeedbackMode($questionId, $feedbackMode)
saves the given specific feedback mode for the given question id to the db.
getItems(ilArrayElementShuffler $shuffler)
Gets the items of a cloze gap.
const FB_TEXT_GAP_NOMATCH_INDEX
initFbPropsForSelectGap(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
const FB_TEXT_GAP_EMPTY_INDEX
constants for answer indexes in case of FB_MODE_GAP_ANSWERS
const FB_MODE_GAP_ANSWERS
ensurePageObjectDeleted($pageObjectType, $pageObjectId)
ensures a no more existing page object for given type and id
initFbPropsForTextGap(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
getGapsByIndex()
returns the answer options mapped by answer index (overwrites parent method from ilAssMultiOptionQues...
const FB_SELECT_GAP_EMPTY_INDEX
saveFeedbackFieldsPerGapQuestion(ilPropertyFormGUI $form)
getSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex)
returns the SPECIFIC answer feedback content for a given question id and answer index.
buildNumericGapTooHighFeedbackLabel($gapIndex)
getType()
Gets the cloze gap type.
buildGapFeedbackLabel($gapIndex, $gap)
builds an answer option label from given (mixed type) index and answer (overwrites parent method from...
buildFeedbackContentFormProperty($label, $postVar, $asNonEditable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
getItem($a_index)
Gets the item with a given index.
saveFbPropsForTextGap(ilPropertyFormGUI $form, assClozeGap $gap, $gapIndex)
saveFeedbackFieldsPerGapAnswers(ilPropertyFormGUI $form)
fetchFeedbackIdsForGapQuestionMode()
const FB_MODE_GAP_QUESTION
constants for different feedback modes (per gap or per gap-answers/options)
isSaveableInPageObjectEditingMode()
completeFbPropsForSelectGap(ilRadioOption $fbModeOpt, assClozeGap $gap, $gapIndex)
const SINGLE_GAP_FB_ANSWER_INDEX
duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId)
duplicates the SPECIFIC feedback relating to the given original question id and saves it for the give...