ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAssClozeTestFeedback Class Reference
+ Inheritance diagram for ilAssClozeTestFeedback:
+ Collaboration diagram for ilAssClozeTestFeedback:

Public Member Functions

 isSaveableInPageObjectEditingMode ()
 returns the fact wether the feedback editing form is saveable in page object editing or not. More...
 
 completeSpecificFormProperties (ilPropertyFormGUI $form)
 completes a given form object with the specific form properties required by this question type More...
 
 initSpecificFormProperties (ilPropertyFormGUI $form)
 initialises a given form object's specific form properties relating to this question type More...
 
 saveSpecificFormProperties (ilPropertyFormGUI $form)
 saves a given form object's SPECIFIC form properties relating to this question type More...
 
 isSpecificAnswerFeedbackAvailable (int $question_id)
 
 determineTestOutputGapFeedback (int $gap_index, int $answer_index)
 
 determineAnswerIndexForAnswerValue (assClozeGap $gap, string $answerValue)
 
- Public Member Functions inherited from ilAssMultiOptionQuestionFeedback
 getSpecificAnswerFeedbackTestPresentation (int $question_id, int $question_index, int $answer_index)
 returns the html of SPECIFIC feedback for the given question id and answer index for test presentation More...
 
 completeSpecificFormProperties (ilPropertyFormGUI $form)
 completes a given form object with the specific form properties required by this question type More...
 
 initSpecificFormProperties (ilPropertyFormGUI $form)
 initialises a given form object's specific form properties relating to this question type More...
 
 saveSpecificFormProperties (ilPropertyFormGUI $form)
 saves a given form object's SPECIFIC form properties relating to this question type More...
 
 getSpecificAnswerFeedbackContent (int $question_id, int $question_index, int $answer_index)
 
 getAllSpecificAnswerFeedbackContents (int $question_id)
 
 getAllSpecificAnswerPageEditorFeedbackContents (int $question_id)
 
 saveSpecificAnswerFeedbackContent (int $question_id, int $question_index, int $answer_index, string $feedback_content)
 
 deleteSpecificAnswerFeedbacks (int $question_id, bool $is_additional_content_editing_mode_page_object)
 
 getAnswerOptionsByAnswerIndex ()
 
 getSpecificAnswerFeedbackExportPresentation (int $question_id, int $question_index, int $answer_index)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 importSpecificAnswerFeedback (int $question_id, int $question_index, int $answer_index, string $feedback_content)
 
 specificAnswerFeedbackExists ()
 
- Public Member Functions inherited from ilAssQuestionFeedback
 __construct (assQuestion $questionOBJ, ilCtrl $ctrl, ilDBInterface $db, ilLanguage $lng)
 constructor More...
 
 getGenericFeedbackTestPresentation (int $question_id, bool $solution_completed)
 returns the html of GENERIC feedback for the given question id for test presentation (either for the complete solution or for the incomplete solution) More...
 
 getSpecificAnswerFeedbackTestPresentation (int $question_id, int $question_index, int $answer_index)
 returns the html of SPECIFIC feedback for the given question id and answer index for test presentation More...
 
 completeGenericFormProperties (ilPropertyFormGUI $form)
 completes a given form object with the GENERIC form properties required by all question types More...
 
 completeSpecificFormProperties (ilPropertyFormGUI $form)
 completes a given form object with the SPECIFIC form properties required by this question type More...
 
 initGenericFormProperties (ilPropertyFormGUI $form)
 initialises a given form object's GENERIC form properties relating to all question types More...
 
 initSpecificFormProperties (ilPropertyFormGUI $form)
 initialises a given form object's SPECIFIC form properties relating to this question type More...
 
 saveGenericFormProperties (ilPropertyFormGUI $form)
 saves a given form object's GENERIC form properties relating to all question types More...
 
 saveSpecificFormProperties (ilPropertyFormGUI $form)
 saves a given form object's SPECIFIC form properties relating to this question type More...
 
 isSaveableInPageObjectEditingMode ()
 returns the fact wether the feedback editing form is saveable in page object editing or not. More...
 
 getGenericFeedbackContent (int $question_id, bool $solution_completed)
 returns the GENERIC feedback content for a given question state. More...
 
 getSpecificAnswerFeedbackContent (int $question_id, int $question_index, int $answer_index)
 
 getAllSpecificAnswerFeedbackContents (int $question_id)
 
 isSpecificAnswerFeedbackAvailable (int $question_id)
 
 saveGenericFeedbackContent (int $question_id, bool $solution_completed, string $feedback_content)
 saves GENERIC feedback content for the given question id to the database. More...
 
 saveSpecificAnswerFeedbackContent (int $question_id, int $question_index, int $answer_index, string $feedback_content)
 
 deleteGenericFeedbacks (int $question_id, bool $isAdditionalContentEditingModePageObject)
 deletes all GENERIC feedback contents (and page objects if required) for the given question id More...
 
 deleteSpecificAnswerFeedbacks (int $question_id, bool $isAdditionalContentEditingModePageObject)
 
 duplicateFeedback (int $originalQuestionId, int $duplicateQuestionId)
 duplicates the feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 cloneFeedback (int $originalQuestionId, int $duplicateQuestionId)
 syncs the feedback from a duplicated question back to the original question More...
 
 checkFeedbackParent (int $feedbackId)
 
 getClassNameByType (string $a_type, bool $a_gui=false)
 
 setPageObjectOutputMode (string $page_obj_output_mode)
 
 getPageObjectOutputMode ()
 
 getGenericFeedbackExportPresentation (int $question_id, bool $solution_completed)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 getSpecificAnswerFeedbackExportPresentation (int $question_id, int $question_index, int $answer_index)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 importGenericFeedback (int $question_id, bool $solution_completed, string $feedback_content)
 imports the given feedback content as generic feedback for the given question id for either the complete or incomplete solution More...
 
 importSpecificAnswerFeedback (int $question_id, int $question_index, int $answer_index, string $feedback_content)
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator, int $question_id)
 
 createFeedbackPages (string $mode)
 

Data Fields

const FB_MODE_GAP_QUESTION = 'gapQuestion'
 constants for different feedback modes (per gap or per gap-answers/options) More...
 
const FB_MODE_GAP_ANSWERS = 'gapAnswers'
 
const FB_TEXT_GAP_EMPTY_INDEX = -1
 constants for answer indexes in case of FB_MODE_GAP_ANSWERS More...
 
const FB_TEXT_GAP_NOMATCH_INDEX = -2
 
const FB_SELECT_GAP_EMPTY_INDEX = -1
 
const FB_NUMERIC_GAP_EMPTY_INDEX = -1
 
const FB_NUMERIC_GAP_VALUE_HIT_INDEX = 0
 
const FB_NUMERIC_GAP_RANGE_HIT_INDEX = 1
 
const FB_NUMERIC_GAP_TOO_LOW_INDEX = 2
 
const FB_NUMERIC_GAP_TOO_HIGH_INDEX = 3
 
const SINGLE_GAP_FB_ANSWER_INDEX = -10
 
- Data Fields inherited from ilAssMultiOptionQuestionFeedback
const TABLE_NAME_SPECIFIC_FEEDBACK = 'qpl_fb_specific'
 table name for specific feedback More...
 
- Data Fields inherited from ilAssQuestionFeedback
const CSS_CLASS_FEEDBACK_CORRECT = 'ilc_qfeedr_FeedbackRight'
 
const CSS_CLASS_FEEDBACK_WRONG = 'ilc_qfeedw_FeedbackWrong'
 
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK = 'qfbg'
 type for generic feedback page objects More...
 
const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK = 'qfbs'
 type for specific feedback page objects More...
 
const FEEDBACK_SOLUTION_INCOMPLETE_PAGE_OBJECT_ID = 1
 id for page object relating to generic incomplete solution feedback More...
 
const FEEDBACK_SOLUTION_COMPLETE_PAGE_OBJECT_ID = 2
 id for page object relating to generic complete solution feedback More...
 
const TABLE_NAME_GENERIC_FEEDBACK = 'qpl_fb_generic'
 

Protected Member Functions

 buildGapFeedbackLabel (int $gapIndex, assClozeGap $gap)
 builds an answer option label from given (mixed type) index and answer (overwrites parent method from ilAssMultiOptionQuestionFeedback) More...
 
 buildTextGapGivenAnswerFeedbackLabel (int $gapIndex, assAnswerCloze $item)
 
 buildTextGapWrongAnswerFeedbackLabel (int $gapIndex)
 
 buildTextGapEmptyFeedbackLabel (int $gapIndex)
 
 buildSelectGapOptionFeedbackLabel (int $gapIndex, assAnswerCloze $item)
 
 buildSelectGapEmptyFeedbackLabel (int $gapIndex)
 
 buildNumericGapValueHitFeedbackLabel (int $gapIndex)
 
 buildNumericGapRangeHitFeedbackLabel (int $gapIndex)
 
 buildNumericGapTooLowFeedbackLabel (int $gapIndex)
 
 buildNumericGapTooHighFeedbackLabel (int $gapIndex)
 
 buildNumericGapEmptyFeedbackLabel (int $gapIndex)
 
 completeFormPropsForFeedbackModeGapQuestion (ilRadioOption $fbModeOpt)
 
 completeFormPropsForFeedbackModeGapAnswers (ilRadioOption $fbModeOpt)
 
 completeFbPropsForTextGap (ilRadioOption $fbModeOpt, assClozeGap $gap, int $gapIndex)
 
 completeFbPropsForSelectGap (ilRadioOption $fbModeOpt, assClozeGap $gap, int $gapIndex)
 
 completeFbPropsForNumericGap (ilRadioOption $fbModeOpt, assClozeGap $gap, int $gapIndex)
 
 initFeedbackFieldsPerGapQuestion (ilPropertyFormGUI $form)
 
 initFeedbackFieldsPerGapAnswers (ilPropertyFormGUI $form)
 
 initFbPropsForTextGap (ilPropertyFormGUI $form, assClozeGap $gap, int $gapIndex)
 
 initFbPropsForSelectGap (ilPropertyFormGUI $form, assClozeGap $gap, int $gapIndex)
 
 initFbPropsForNumericGap (ilPropertyFormGUI $form, int $gapIndex, assClozeGap $gap)
 
 saveFeedbackFieldsPerGapQuestion (ilPropertyFormGUI $form)
 
 saveFeedbackFieldsPerGapAnswers (ilPropertyFormGUI $form)
 
 saveFbPropsForTextGap (ilPropertyFormGUI $form, assClozeGap $gap, int $gapIndex)
 
 saveFbPropsForSelectGap (ilPropertyFormGUI $form, assClozeGap $gap, int $gapIndex)
 
 saveFbPropsForNumericGap (ilPropertyFormGUI $form, assClozeGap $gap, int $gapIndex)
 
 cloneSpecificFeedback (int $originalQuestionId, int $duplicateQuestionId)
 duplicates the SPECIFIC feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 saveSpecificFeedbackMode (int $questionId, string $feedbackMode)
 saves the given specific feedback mode for the given question id to the db. More...
 
 buildPostVarForFbFieldPerGapQuestion (int $gapIndex)
 
 buildPostVarForFbFieldPerGapAnswers (int $gapIndex, int $answerIndex)
 
 getSpecificAnswerFeedbackFormValue (int $gapIndex, int $answerIndex)
 
 cleanupSpecificAnswerFeedbacks (string $fbMode)
 
 fetchFeedbackIdsForGapQuestionMode ()
 
 fetchFeedbackIdsForGapAnswersMode ()
 
 deleteSpecificAnswerFeedbacksByIds (array $feedbackIds)
 
- Protected Member Functions inherited from ilAssMultiOptionQuestionFeedback
 cloneSpecificFeedback (int $source_question_id, int $target_question_id)
 duplicates the SPECIFIC feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 getSpecificAnswerFeedbackId (int $question_id, int $question_index, int $answer_index)
 
 getSpecificFeedbackContentForFeedbackIds (array $feedback_ids)
 
 isSpecificAnswerFeedbackId (int $feedback_id)
 
 getSpecificFeedbackTableName ()
 
 buildAnswerOptionLabel (int $index, $answer)
 
 getSpecificAnswerFeedbackPageObjectId (int $question_id, int $question_index, int $answer_index)
 returns a useable page object id for specific answer feedback page objects for the given question id and answer index (using the id sequence of non page object specific answer feedback) More...
 
- Protected Member Functions inherited from ilAssQuestionFeedback
 buildFeedbackContentFormProperty (string $label, string $post_var, bool $as_non_editable)
 builds and returns a form property gui object with the given label and postvar that is addable to property forms depending on the given flag "asNonEditable" it returns a ... More...
 
 cloneSpecificFeedback (int $originalQuestionId, int $duplicateQuestionId)
 duplicates the SPECIFIC feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 getGenericFeedbackId (int $question_id, bool $solution_completed)
 returns the SPECIFIC answer feedback ID for a given question id and answer index. More...
 
 isGenericFeedbackId (int $feedbackId)
 
 isSpecificAnswerFeedbackId (int $feedbackId)
 
 getGenericFeedbackTableName ()
 
 getPageObjectNonEditableValueHTML (string $page_object_type, int $page_object_id)
 returns html content to be used as value for non editable value form properties in feedback editing form More...
 
 getPageObjectXML (string $page_object_type, int $page_object_id)
 
 createPageObject (string $page_object_type, int $page_object_id, string $page_object_content)
 
 clonePageObject (string $page_object_type, int $source_page_object_id, int $target_page_object_id, int $target_page_object_parent_id)
 
 ensurePageObjectDeleted (string $page_object_type, int $page_object_id)
 
 getGenericFeedbackPageObjectType ()
 
 getSpecificAnswerFeedbackPageObjectType ()
 
 getGenericFeedbackPageObjectId (int $question_id, bool $solution_completed)
 returns a useable page object id for generic feedback page objects for the given question id for either the complete or incomplete solution (using the id sequence of non page object generic feedback) More...
 
 cleanupPageContent (string $content)
 

Private Member Functions

 cloneSpecificFeedbackSetting (int $source_question_id, int $target_question_id)
 
 randomGroup ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ilAssQuestionFeedback
static isValidFeedbackPageObjectType (string $feedbackPageObjectType)
 returns the fact whether the given page object type relates to generic or specific feedback page objects More...
 
- Protected Attributes inherited from ilAssQuestionFeedback
assQuestion $questionOBJ
 
ilCtrl $ctrl
 
ilDBInterface $db
 
ilLanguage $lng
 
string $page_obj_output_mode = "presentation"
 

Detailed Description

Definition at line 29 of file class.ilAssClozeTestFeedback.php.

Member Function Documentation

◆ buildGapFeedbackLabel()

ilAssClozeTestFeedback::buildGapFeedbackLabel ( int  $gapIndex,
assClozeGap  $gap 
)
protected

builds an answer option label from given (mixed type) index and answer (overwrites parent method from ilAssMultiOptionQuestionFeedback)

Definition at line 60 of file class.ilAssClozeTestFeedback.php.

60 : string
61 {
62 $answers = [];
63
64 foreach ($gap->getItems($this->randomGroup()->dontShuffle()) as $item) {
65 $answers[] = '"' . ilLegacyFormElementsUtil::prepareFormOutput($item->getAnswertext()) . '"';
66 }
67
68 $answers = implode(' / ', $answers);
69
70 return sprintf(
71 $this->lng->txt('ass_cloze_gap_fb_gap_label'),
72 $gapIndex + 1,
73 $answers
74 );
75 }
getItems(Transformation $shuffler, ?int $gap_index=null)
static prepareFormOutput($a_str, bool $a_strip=false)

References assClozeGap\getItems(), ILIAS\Repository\lng(), and ilLegacyFormElementsUtil\prepareFormOutput().

Referenced by completeFormPropsForFeedbackModeGapQuestion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildNumericGapEmptyFeedbackLabel()

ilAssClozeTestFeedback::buildNumericGapEmptyFeedbackLabel ( int  $gapIndex)
protected

Definition at line 130 of file class.ilAssClozeTestFeedback.php.

130 : string
131 {
132 return sprintf($this->lng->txt('ass_cloze_gap_fb_num_empty_label'), $gapIndex + 1);
133 }

References ILIAS\Repository\lng().

Referenced by completeFbPropsForNumericGap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildNumericGapRangeHitFeedbackLabel()

ilAssClozeTestFeedback::buildNumericGapRangeHitFeedbackLabel ( int  $gapIndex)
protected

Definition at line 115 of file class.ilAssClozeTestFeedback.php.

115 : string
116 {
117 return sprintf($this->lng->txt('ass_cloze_gap_fb_num_rangehit_label'), $gapIndex + 1);
118 }

References ILIAS\Repository\lng().

Referenced by completeFbPropsForNumericGap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildNumericGapTooHighFeedbackLabel()

ilAssClozeTestFeedback::buildNumericGapTooHighFeedbackLabel ( int  $gapIndex)
protected

Definition at line 125 of file class.ilAssClozeTestFeedback.php.

125 : string
126 {
127 return sprintf($this->lng->txt('ass_cloze_gap_fb_num_toohigh_label'), $gapIndex + 1);
128 }

References ILIAS\Repository\lng().

Referenced by completeFbPropsForNumericGap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildNumericGapTooLowFeedbackLabel()

ilAssClozeTestFeedback::buildNumericGapTooLowFeedbackLabel ( int  $gapIndex)
protected

Definition at line 120 of file class.ilAssClozeTestFeedback.php.

120 : string
121 {
122 return sprintf($this->lng->txt('ass_cloze_gap_fb_num_toolow_label'), $gapIndex + 1);
123 }

References ILIAS\Repository\lng().

Referenced by completeFbPropsForNumericGap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildNumericGapValueHitFeedbackLabel()

ilAssClozeTestFeedback::buildNumericGapValueHitFeedbackLabel ( int  $gapIndex)
protected

Definition at line 110 of file class.ilAssClozeTestFeedback.php.

110 : string
111 {
112 return sprintf($this->lng->txt('ass_cloze_gap_fb_num_valuehit_label'), $gapIndex + 1);
113 }

References ILIAS\Repository\lng().

Referenced by completeFbPropsForNumericGap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPostVarForFbFieldPerGapAnswers()

ilAssClozeTestFeedback::buildPostVarForFbFieldPerGapAnswers ( int  $gapIndex,
int  $answerIndex 
)
protected

Definition at line 680 of file class.ilAssClozeTestFeedback.php.

680 : string
681 {
682 return "feedback_answer_{$gapIndex}_{$answerIndex}";
683 }

Referenced by initFbPropsForNumericGap(), initFbPropsForSelectGap(), initFbPropsForTextGap(), saveFbPropsForNumericGap(), saveFbPropsForSelectGap(), and saveFbPropsForTextGap().

+ Here is the caller graph for this function:

◆ buildPostVarForFbFieldPerGapQuestion()

ilAssClozeTestFeedback::buildPostVarForFbFieldPerGapQuestion ( int  $gapIndex)
protected

Definition at line 675 of file class.ilAssClozeTestFeedback.php.

675 : string
676 {
677 return "feedback_answer_{$gapIndex}";
678 }

Referenced by completeFormPropsForFeedbackModeGapQuestion(), initFeedbackFieldsPerGapQuestion(), and saveFeedbackFieldsPerGapQuestion().

+ Here is the caller graph for this function:

◆ buildSelectGapEmptyFeedbackLabel()

ilAssClozeTestFeedback::buildSelectGapEmptyFeedbackLabel ( int  $gapIndex)
protected

Definition at line 105 of file class.ilAssClozeTestFeedback.php.

105 : string
106 {
107 return sprintf($this->lng->txt('ass_cloze_gap_fb_sel_empty_label'), $gapIndex + 1);
108 }

References ILIAS\Repository\lng().

Referenced by completeFbPropsForSelectGap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildSelectGapOptionFeedbackLabel()

ilAssClozeTestFeedback::buildSelectGapOptionFeedbackLabel ( int  $gapIndex,
assAnswerCloze  $item 
)
protected

Definition at line 96 of file class.ilAssClozeTestFeedback.php.

96 : string
97 {
98 return sprintf(
99 $this->lng->txt('ass_cloze_gap_fb_sel_opt_label'),
100 $gapIndex + 1,
102 );
103 }
getAnswertext()
Gets the answer text.

References ASS_AnswerSimple\getAnswertext(), ILIAS\Repository\lng(), and ilLegacyFormElementsUtil\prepareFormOutput().

Referenced by completeFbPropsForSelectGap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTextGapEmptyFeedbackLabel()

ilAssClozeTestFeedback::buildTextGapEmptyFeedbackLabel ( int  $gapIndex)
protected

Definition at line 91 of file class.ilAssClozeTestFeedback.php.

91 : string
92 {
93 return sprintf($this->lng->txt('ass_cloze_gap_fb_txt_empty_label'), $gapIndex + 1);
94 }

References ILIAS\Repository\lng().

Referenced by completeFbPropsForTextGap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTextGapGivenAnswerFeedbackLabel()

ilAssClozeTestFeedback::buildTextGapGivenAnswerFeedbackLabel ( int  $gapIndex,
assAnswerCloze  $item 
)
protected

Definition at line 77 of file class.ilAssClozeTestFeedback.php.

77 : string
78 {
79 return sprintf(
80 $this->lng->txt('ass_cloze_gap_fb_txt_match_label'),
81 $gapIndex + 1,
83 );
84 }

References ASS_AnswerSimple\getAnswertext(), ILIAS\Repository\lng(), and ilLegacyFormElementsUtil\prepareFormOutput().

Referenced by completeFbPropsForTextGap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTextGapWrongAnswerFeedbackLabel()

ilAssClozeTestFeedback::buildTextGapWrongAnswerFeedbackLabel ( int  $gapIndex)
protected

Definition at line 86 of file class.ilAssClozeTestFeedback.php.

86 : string
87 {
88 return sprintf($this->lng->txt('ass_cloze_gap_fb_txt_nomatch_label'), $gapIndex + 1);
89 }

References ILIAS\Repository\lng().

Referenced by completeFbPropsForTextGap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanupSpecificAnswerFeedbacks()

ilAssClozeTestFeedback::cleanupSpecificAnswerFeedbacks ( string  $fbMode)
protected

Definition at line 707 of file class.ilAssClozeTestFeedback.php.

707 : void
708 {
709 switch ($fbMode) {
711 $feedbackIds = $this->fetchFeedbackIdsForGapQuestionMode();
712 break;
713
715 $feedbackIds = $this->fetchFeedbackIdsForGapAnswersMode();
716 break;
717
718 default: $feedbackIds = [];
719 }
720
721 $this->deleteSpecificAnswerFeedbacksByIds($feedbackIds);
722 }
const FB_MODE_GAP_QUESTION
constants for different feedback modes (per gap or per gap-answers/options)
deleteSpecificAnswerFeedbacksByIds(array $feedbackIds)

Referenced by saveSpecificFormProperties().

+ Here is the caller graph for this function:

◆ cloneSpecificFeedback()

ilAssClozeTestFeedback::cloneSpecificFeedback ( int  $originalQuestionId,
int  $duplicateQuestionId 
)
protected

duplicates the SPECIFIC feedback relating to the given original question id and saves it for the given duplicate question id

Reimplemented from ilAssMultiOptionQuestionFeedback.

Definition at line 654 of file class.ilAssClozeTestFeedback.php.

654 : void
655 {
656 $this->cloneSpecificFeedbackSetting($originalQuestionId, $duplicateQuestionId);
657 parent::cloneSpecificFeedback($originalQuestionId, $duplicateQuestionId);
658 }
cloneSpecificFeedbackSetting(int $source_question_id, int $target_question_id)

◆ cloneSpecificFeedbackSetting()

ilAssClozeTestFeedback::cloneSpecificFeedbackSetting ( int  $source_question_id,
int  $target_question_id 
)
private

Definition at line 635 of file class.ilAssClozeTestFeedback.php.

638 : void {
639 $res = $this->db->queryF(
640 "SELECT feedback_mode FROM {$this->questionOBJ->getAdditionalTableName()} WHERE question_fi = %s",
641 ['integer'],
642 [$source_question_id]
643 );
644
645 $row = $this->db->fetchAssoc($res);
646
647 $this->db->update(
648 $this->questionOBJ->getAdditionalTableName(),
649 [ 'feedback_mode' => ['text', $row['feedback_mode']] ],
650 [ 'question_fi' => ['integer', $target_question_id] ]
651 );
652 }
$res
Definition: ltiservices.php:69

◆ completeFbPropsForNumericGap()

ilAssClozeTestFeedback::completeFbPropsForNumericGap ( ilRadioOption  $fbModeOpt,
assClozeGap  $gap,
int  $gapIndex 
)
protected
Parameters
ilRadioOption$fbModeOpt
assClozeGap$gap
integer$gapIndex

Definition at line 287 of file class.ilAssClozeTestFeedback.php.

287 : void
288 {
290 $this->buildNumericGapValueHitFeedbackLabel($gapIndex),
291 true
292 );
293
294 $propertyPostVar = "feedback_answer_{$gapIndex}_" . self::FB_NUMERIC_GAP_VALUE_HIT_INDEX;
295
297 $propertyLabel,
298 $propertyPostVar,
299 $this->questionOBJ->isAdditionalContentEditingModePageObject()
300 ));
301
302 if ($gap->numericRangeExists()) {
304 $this->buildNumericGapRangeHitFeedbackLabel($gapIndex),
305 true
306 );
307
308 $propertyPostVar = "feedback_answer_{$gapIndex}_" . self::FB_NUMERIC_GAP_RANGE_HIT_INDEX;
309
311 $propertyLabel,
312 $propertyPostVar,
313 $this->questionOBJ->isAdditionalContentEditingModePageObject()
314 ));
315 }
316
318 $this->buildNumericGapTooLowFeedbackLabel($gapIndex),
319 true
320 );
321
322 $propertyPostVar = "feedback_answer_{$gapIndex}_" . self::FB_NUMERIC_GAP_TOO_LOW_INDEX;
323
325 $propertyLabel,
326 $propertyPostVar,
327 $this->questionOBJ->isAdditionalContentEditingModePageObject()
328 ));
329
331 $this->buildNumericGapTooHighFeedbackLabel($gapIndex),
332 true
333 );
334
335 $propertyPostVar = "feedback_answer_{$gapIndex}_" . self::FB_NUMERIC_GAP_TOO_HIGH_INDEX;
336
338 $propertyLabel,
339 $propertyPostVar,
340 $this->questionOBJ->isAdditionalContentEditingModePageObject()
341 ));
342
344 $this->buildNumericGapEmptyFeedbackLabel($gapIndex),
345 true
346 );
347
348 $propertyPostVar = "feedback_answer_{$gapIndex}_" . self::FB_NUMERIC_GAP_EMPTY_INDEX;
349
351 $propertyLabel,
352 $propertyPostVar,
353 $this->questionOBJ->isAdditionalContentEditingModePageObject()
354 ));
355 }
buildFeedbackContentFormProperty(string $label, string $post_var, bool $as_non_editable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free,...

References ilRadioOption\addSubItem(), ilAssQuestionFeedback\buildFeedbackContentFormProperty(), buildNumericGapEmptyFeedbackLabel(), buildNumericGapRangeHitFeedbackLabel(), buildNumericGapTooHighFeedbackLabel(), buildNumericGapTooLowFeedbackLabel(), buildNumericGapValueHitFeedbackLabel(), FB_NUMERIC_GAP_EMPTY_INDEX, FB_NUMERIC_GAP_RANGE_HIT_INDEX, FB_NUMERIC_GAP_TOO_HIGH_INDEX, FB_NUMERIC_GAP_TOO_LOW_INDEX, FB_NUMERIC_GAP_VALUE_HIT_INDEX, assClozeGap\numericRangeExists(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

Referenced by completeFormPropsForFeedbackModeGapAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ completeFbPropsForSelectGap()

ilAssClozeTestFeedback::completeFbPropsForSelectGap ( ilRadioOption  $fbModeOpt,
assClozeGap  $gap,
int  $gapIndex 
)
protected

Definition at line 251 of file class.ilAssClozeTestFeedback.php.

251 : void
252 {
253 foreach ($gap->getItems($this->randomGroup()->dontShuffle()) as $optIndex => $item) {
255 $this->buildSelectGapOptionFeedbackLabel($gapIndex, $item),
256 true
257 );
258
259 $propertyPostVar = "feedback_answer_{$gapIndex}_{$optIndex}";
260
262 $propertyLabel,
263 $propertyPostVar,
264 $this->questionOBJ->isAdditionalContentEditingModePageObject()
265 ));
266 }
267
269 $this->buildSelectGapEmptyFeedbackLabel($gapIndex),
270 true
271 );
272
273 $propertyPostVar = "feedback_answer_{$gapIndex}_" . self::FB_SELECT_GAP_EMPTY_INDEX;
274
276 $propertyLabel,
277 $propertyPostVar,
278 $this->questionOBJ->isAdditionalContentEditingModePageObject()
279 ));
280 }
buildSelectGapOptionFeedbackLabel(int $gapIndex, assAnswerCloze $item)

References ilRadioOption\addSubItem(), ilAssQuestionFeedback\buildFeedbackContentFormProperty(), buildSelectGapEmptyFeedbackLabel(), buildSelectGapOptionFeedbackLabel(), FB_SELECT_GAP_EMPTY_INDEX, assClozeGap\getItems(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

Referenced by completeFormPropsForFeedbackModeGapAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ completeFbPropsForTextGap()

ilAssClozeTestFeedback::completeFbPropsForTextGap ( ilRadioOption  $fbModeOpt,
assClozeGap  $gap,
int  $gapIndex 
)
protected

Definition at line 207 of file class.ilAssClozeTestFeedback.php.

207 : void
208 {
209 foreach ($gap->getItems($this->randomGroup()->dontShuffle()) as $answerIndex => $item) {
211 $this->buildTextGapGivenAnswerFeedbackLabel($gapIndex, $item),
212 true
213 );
214
215 $propertyPostVar = "feedback_answer_{$gapIndex}_{$answerIndex}";
216
218 $propertyLabel,
219 $propertyPostVar,
220 $this->questionOBJ->isAdditionalContentEditingModePageObject()
221 ));
222 }
223
225 $this->buildTextGapWrongAnswerFeedbackLabel($gapIndex),
226 true
227 );
228
229 $propertyPostVar = "feedback_answer_{$gapIndex}_" . self::FB_TEXT_GAP_NOMATCH_INDEX;
230
232 $propertyLabel,
233 $propertyPostVar,
234 $this->questionOBJ->isAdditionalContentEditingModePageObject()
235 ));
236
238 $this->buildTextGapEmptyFeedbackLabel($gapIndex),
239 true
240 );
241
242 $propertyPostVar = "feedback_answer_{$gapIndex}_" . self::FB_TEXT_GAP_EMPTY_INDEX;
243
245 $propertyLabel,
246 $propertyPostVar,
247 $this->questionOBJ->isAdditionalContentEditingModePageObject()
248 ));
249 }
buildTextGapGivenAnswerFeedbackLabel(int $gapIndex, assAnswerCloze $item)
const FB_TEXT_GAP_EMPTY_INDEX
constants for answer indexes in case of FB_MODE_GAP_ANSWERS
buildTextGapWrongAnswerFeedbackLabel(int $gapIndex)

References ilRadioOption\addSubItem(), ilAssQuestionFeedback\buildFeedbackContentFormProperty(), buildTextGapEmptyFeedbackLabel(), buildTextGapGivenAnswerFeedbackLabel(), buildTextGapWrongAnswerFeedbackLabel(), FB_TEXT_GAP_EMPTY_INDEX, FB_TEXT_GAP_NOMATCH_INDEX, assClozeGap\getItems(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

Referenced by completeFormPropsForFeedbackModeGapAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ completeFormPropsForFeedbackModeGapAnswers()

ilAssClozeTestFeedback::completeFormPropsForFeedbackModeGapAnswers ( ilRadioOption  $fbModeOpt)
protected

Definition at line 185 of file class.ilAssClozeTestFeedback.php.

185 : void
186 {
187 foreach ($this->questionOBJ->getGaps() as $gapIndex => $gap) {
188 switch ($gap->getType()) {
190
191 $this->completeFbPropsForTextGap($fbModeOpt, $gap, $gapIndex);
192 break;
193
195
196 $this->completeFbPropsForSelectGap($fbModeOpt, $gap, $gapIndex);
197 break;
198
200
201 $this->completeFbPropsForNumericGap($fbModeOpt, $gap, $gapIndex);
202 break;
203 }
204 }
205 }
completeFbPropsForNumericGap(ilRadioOption $fbModeOpt, assClozeGap $gap, int $gapIndex)
completeFbPropsForTextGap(ilRadioOption $fbModeOpt, assClozeGap $gap, int $gapIndex)
completeFbPropsForSelectGap(ilRadioOption $fbModeOpt, assClozeGap $gap, int $gapIndex)

References completeFbPropsForNumericGap(), completeFbPropsForSelectGap(), completeFbPropsForTextGap(), assClozeGap\TYPE_NUMERIC, assClozeGap\TYPE_SELECT, and assClozeGap\TYPE_TEXT.

Referenced by completeSpecificFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ completeFormPropsForFeedbackModeGapQuestion()

ilAssClozeTestFeedback::completeFormPropsForFeedbackModeGapQuestion ( ilRadioOption  $fbModeOpt)
protected

Definition at line 167 of file class.ilAssClozeTestFeedback.php.

167 : void
168 {
169 foreach ($this->questionOBJ->getGaps() as $gapIndex => $gap) {
171 $this->buildGapFeedbackLabel($gapIndex, $gap),
172 true
173 );
174
175 $fbModeOpt->addSubItem(
177 $propertyLabel,
178 $this->buildPostVarForFbFieldPerGapQuestion($gapIndex),
179 $this->questionOBJ->isAdditionalContentEditingModePageObject()
180 )
181 );
182 }
183 }
buildGapFeedbackLabel(int $gapIndex, assClozeGap $gap)
builds an answer option label from given (mixed type) index and answer (overwrites parent method from...

References ilRadioOption\addSubItem(), ilAssQuestionFeedback\buildFeedbackContentFormProperty(), buildGapFeedbackLabel(), buildPostVarForFbFieldPerGapQuestion(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

Referenced by completeSpecificFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ completeSpecificFormProperties()

ilAssClozeTestFeedback::completeSpecificFormProperties ( ilPropertyFormGUI  $form)

completes a given form object with the specific form properties required by this question type

Reimplemented from ilAssMultiOptionQuestionFeedback.

Definition at line 135 of file class.ilAssClozeTestFeedback.php.

135 : void
136 {
137 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
138 $header = new ilFormSectionHeaderGUI();
139 $header->setTitle($this->lng->txt('feedback_answers'));
140 $form->addItem($header);
141
142 $feedbackMode = new ilRadioGroupInputGUI(
143 $this->lng->txt('ass_cloze_fb_mode'),
144 'feedback_mode'
145 );
146 $feedbackMode->setRequired(true);
147 $form->addItem($feedbackMode);
148
149 $fbModeGapQuestion = new ilRadioOption(
150 $this->lng->txt('ass_cloze_fb_mode_gap_qst'),
151 self::FB_MODE_GAP_QUESTION,
152 $this->lng->txt('ass_cloze_fb_mode_gap_qst_info')
153 );
154 $this->completeFormPropsForFeedbackModeGapQuestion($fbModeGapQuestion);
155 $feedbackMode->addOption($fbModeGapQuestion);
156
157 $fbModeGapAnswers = new ilRadioOption(
158 $this->lng->txt('ass_cloze_fb_mode_gap_answ'),
159 self::FB_MODE_GAP_ANSWERS,
160 $this->lng->txt('ass_cloze_fb_mode_gap_answ_info')
161 );
162 $this->completeFormPropsForFeedbackModeGapAnswers($fbModeGapAnswers);
163 $feedbackMode->addOption($fbModeGapAnswers);
164 }
165 }
completeFormPropsForFeedbackModeGapQuestion(ilRadioOption $fbModeOpt)
completeFormPropsForFeedbackModeGapAnswers(ilRadioOption $fbModeOpt)
This class represents a section header in a property form.
This class represents a property in a property form.
This class represents an option in a radio group.

References ilPropertyFormGUI\addItem(), completeFormPropsForFeedbackModeGapAnswers(), completeFormPropsForFeedbackModeGapQuestion(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ deleteSpecificAnswerFeedbacksByIds()

ilAssClozeTestFeedback::deleteSpecificAnswerFeedbacksByIds ( array  $feedbackIds)
protected
Parameters
int[]$feedbackIds

Definition at line 791 of file class.ilAssClozeTestFeedback.php.

791 : void
792 {
793 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
794 foreach ($feedbackIds as $fbId) {
796 }
797 }
798
799 $IN_feedbackIds = $this->db->in('feedback_id', $feedbackIds, false, 'integer');
800 $this->db->manipulate("DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE {$IN_feedbackIds}");
801 }
ensurePageObjectDeleted(string $page_object_type, int $page_object_id)

◆ determineAnswerIndexForAnswerValue()

ilAssClozeTestFeedback::determineAnswerIndexForAnswerValue ( assClozeGap  $gap,
string  $answerValue 
)

Definition at line 816 of file class.ilAssClozeTestFeedback.php.

816 : int
817 {
818 switch ($gap->getType()) {
820 if ($answerValue === '') {
822 }
823
824 $items = $gap->getItems($this->randomGroup()->dontShuffle());
825
826 foreach ($items as $answerIndex => $answer) {
827 /* @var assAnswerCloze $answer */
828
829 if ($answer->getAnswertext() == $answerValue) {
830 return $answerIndex;
831 }
832 }
833
835
837 if ($answerValue !== '') {
838 return $answerValue;
839 }
840
842
843 default:
845 if ($answerValue === '') {
847 }
848
849 /* @var assAnswerCloze $item */
850
851 $item = current($gap->getItems($this->randomGroup()->dontShuffle()));
852
853 if ($answerValue == $item->getAnswertext()) {
855 }
856
857 $math = new EvalMath();
858
859 $item = $gap->getItem(0);
860 $lowerBound = $math->evaluate($item->getLowerBound());
861 $upperBound = $math->evaluate($item->getUpperBound());
862 $preciseValue = $math->evaluate($item->getAnswertext());
863
864 $solutionValue = $math->evaluate($answerValue);
865
866 if ($solutionValue == $preciseValue) {
868 } elseif ($solutionValue >= $lowerBound && $solutionValue <= $upperBound) {
870 } elseif ($solutionValue < $lowerBound) {
872 }
873
874 // if ($solutionValue > $upperBound) {
876 //}
877 }
878 }
getItem($a_index)
Gets the item with a given index.

References assClozeGap\getItem(), assClozeGap\getItems(), assClozeGap\getType(), assClozeGap\TYPE_NUMERIC, assClozeGap\TYPE_SELECT, and assClozeGap\TYPE_TEXT.

+ Here is the call graph for this function:

◆ determineTestOutputGapFeedback()

ilAssClozeTestFeedback::determineTestOutputGapFeedback ( int  $gap_index,
int  $answer_index 
)

Definition at line 803 of file class.ilAssClozeTestFeedback.php.

803 : string
804 {
805 if ($this->questionOBJ->getFeedbackMode() === self::FB_MODE_GAP_QUESTION) {
807 $this->questionOBJ->getId(),
808 $gap_index,
809 self::SINGLE_GAP_FB_ANSWER_INDEX
810 );
811 }
812
813 return $this->getSpecificAnswerFeedbackTestPresentation($this->questionOBJ->getId(), $gap_index, $answer_index);
814 }
getSpecificAnswerFeedbackTestPresentation(int $question_id, int $question_index, int $answer_index)
returns the html of SPECIFIC feedback for the given question id and answer index for test presentatio...

◆ fetchFeedbackIdsForGapAnswersMode()

ilAssClozeTestFeedback::fetchFeedbackIdsForGapAnswersMode ( )
protected
Returns
int[]

Definition at line 748 of file class.ilAssClozeTestFeedback.php.

748 : array
749 {
750 $feedbackIdentifiers = new ilAssSpecificFeedbackIdentifierList();
751 $feedbackIdentifiers->load($this->questionOBJ->getId());
752
753 $feedbackIds = [];
754
755 foreach ($feedbackIdentifiers as $identifier) {
756 if ($identifier->getAnswerIndex() == self::SINGLE_GAP_FB_ANSWER_INDEX) {
757 continue;
758 }
759
760 $feedbackIds[] = $identifier->getFeedbackId();
761 }
762
763 return $feedbackIds;
764 }

◆ fetchFeedbackIdsForGapQuestionMode()

ilAssClozeTestFeedback::fetchFeedbackIdsForGapQuestionMode ( )
protected
Returns
int[]

Definition at line 727 of file class.ilAssClozeTestFeedback.php.

727 : array
728 {
729 $feedbackIdentifiers = new ilAssSpecificFeedbackIdentifierList();
730 $feedbackIdentifiers->load($this->questionOBJ->getId());
731
732 $feedbackIds = [];
733
734 foreach ($feedbackIdentifiers as $identifier) {
735 if ($identifier->getAnswerIndex() != self::SINGLE_GAP_FB_ANSWER_INDEX) {
736 continue;
737 }
738
739 $feedbackIds[] = $identifier->getFeedbackId();
740 }
741
742 return $feedbackIds;
743 }

◆ getSpecificAnswerFeedbackFormValue()

ilAssClozeTestFeedback::getSpecificAnswerFeedbackFormValue ( int  $gapIndex,
int  $answerIndex 
)
protected

Definition at line 685 of file class.ilAssClozeTestFeedback.php.

685 : string
686 {
687 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
688 $pageObjectId = $this->getSpecificAnswerFeedbackPageObjectId(
689 $this->questionOBJ->getId(),
690 $gapIndex,
691 $answerIndex
692 );
693
694 $value = $this->getPageObjectNonEditableValueHTML(
696 $pageObjectId
697 );
698 } else {
700 $this->getSpecificAnswerFeedbackContent($this->questionOBJ->getId(), $gapIndex, $answerIndex)
701 );
702 }
703
704 return $value;
705 }
getSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index)
getSpecificAnswerFeedbackPageObjectId(int $question_id, int $question_index, int $answer_index)
returns a useable page object id for specific answer feedback page objects for the given question id ...
getPageObjectNonEditableValueHTML(string $page_object_type, int $page_object_id)
returns html content to be used as value for non editable value form properties in feedback editing f...

References ilLegacyFormElementsUtil\prepareTextareaOutput().

Referenced by initFbPropsForNumericGap(), initFbPropsForSelectGap(), initFbPropsForTextGap(), and initFeedbackFieldsPerGapQuestion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFbPropsForNumericGap()

ilAssClozeTestFeedback::initFbPropsForNumericGap ( ilPropertyFormGUI  $form,
int  $gapIndex,
assClozeGap  $gap 
)
protected

Definition at line 443 of file class.ilAssClozeTestFeedback.php.

443 : void
444 {
445 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, self::FB_NUMERIC_GAP_VALUE_HIT_INDEX);
446 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_NUMERIC_GAP_VALUE_HIT_INDEX);
447 $form->getItemByPostVar($postVar)->setValue($value);
448
449 if ($gap->numericRangeExists()) {
450 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, self::FB_NUMERIC_GAP_RANGE_HIT_INDEX);
451 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_NUMERIC_GAP_RANGE_HIT_INDEX);
452 $form->getItemByPostVar($postVar)->setValue($value);
453 }
454
455 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, self::FB_NUMERIC_GAP_TOO_LOW_INDEX);
456 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_NUMERIC_GAP_TOO_LOW_INDEX);
457 $form->getItemByPostVar($postVar)->setValue($value);
458
459 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, self::FB_NUMERIC_GAP_TOO_HIGH_INDEX);
460 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_NUMERIC_GAP_TOO_HIGH_INDEX);
461 $form->getItemByPostVar($postVar)->setValue($value);
462
463 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, self::FB_NUMERIC_GAP_EMPTY_INDEX);
464 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_NUMERIC_GAP_EMPTY_INDEX);
465 $form->getItemByPostVar($postVar)->setValue($value);
466 }
getSpecificAnswerFeedbackFormValue(int $gapIndex, int $answerIndex)
buildPostVarForFbFieldPerGapAnswers(int $gapIndex, int $answerIndex)
getItemByPostVar(string $a_post_var)

References buildPostVarForFbFieldPerGapAnswers(), ilPropertyFormGUI\getItemByPostVar(), getSpecificAnswerFeedbackFormValue(), and assClozeGap\numericRangeExists().

Referenced by initFeedbackFieldsPerGapAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFbPropsForSelectGap()

ilAssClozeTestFeedback::initFbPropsForSelectGap ( ilPropertyFormGUI  $form,
assClozeGap  $gap,
int  $gapIndex 
)
protected

Definition at line 430 of file class.ilAssClozeTestFeedback.php.

430 : void
431 {
432 foreach ($gap->getItems($this->randomGroup()->dontShuffle()) as $optIndex => $item) {
433 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, $optIndex);
434 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, $optIndex);
435 $form->getItemByPostVar($postVar)->setValue($value);
436 }
437
438 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, self::FB_SELECT_GAP_EMPTY_INDEX);
439 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_SELECT_GAP_EMPTY_INDEX);
440 $form->getItemByPostVar($postVar)->setValue($value);
441 }

References buildPostVarForFbFieldPerGapAnswers(), ilPropertyFormGUI\getItemByPostVar(), assClozeGap\getItems(), and getSpecificAnswerFeedbackFormValue().

Referenced by initFeedbackFieldsPerGapAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFbPropsForTextGap()

ilAssClozeTestFeedback::initFbPropsForTextGap ( ilPropertyFormGUI  $form,
assClozeGap  $gap,
int  $gapIndex 
)
protected

Definition at line 413 of file class.ilAssClozeTestFeedback.php.

413 : void
414 {
415 foreach ($gap->getItems($this->randomGroup()->dontShuffle()) as $answerIndex => $item) {
416 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, $answerIndex);
417 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, $answerIndex);
418 $form->getItemByPostVar($postVar)->setValue($value);
419 }
420
421 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, self::FB_TEXT_GAP_NOMATCH_INDEX);
422 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_TEXT_GAP_NOMATCH_INDEX);
423 $form->getItemByPostVar($postVar)->setValue($value);
424
425 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, self::FB_TEXT_GAP_EMPTY_INDEX);
426 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_TEXT_GAP_EMPTY_INDEX);
427 $form->getItemByPostVar($postVar)->setValue($value);
428 }

References buildPostVarForFbFieldPerGapAnswers(), ilPropertyFormGUI\getItemByPostVar(), assClozeGap\getItems(), and getSpecificAnswerFeedbackFormValue().

Referenced by initFeedbackFieldsPerGapAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFeedbackFieldsPerGapAnswers()

ilAssClozeTestFeedback::initFeedbackFieldsPerGapAnswers ( ilPropertyFormGUI  $form)
protected

Definition at line 391 of file class.ilAssClozeTestFeedback.php.

391 : void
392 {
393 foreach ($this->questionOBJ->getGaps() as $gapIndex => $gap) {
394 switch ($gap->getType()) {
396
397 $this->initFbPropsForTextGap($form, $gap, $gapIndex);
398 break;
399
401
402 $this->initFbPropsForSelectGap($form, $gap, $gapIndex);
403 break;
404
406
407 $this->initFbPropsForNumericGap($form, $gapIndex, $gap);
408 break;
409 }
410 }
411 }
initFbPropsForTextGap(ilPropertyFormGUI $form, assClozeGap $gap, int $gapIndex)
initFbPropsForSelectGap(ilPropertyFormGUI $form, assClozeGap $gap, int $gapIndex)
initFbPropsForNumericGap(ilPropertyFormGUI $form, int $gapIndex, assClozeGap $gap)

References initFbPropsForNumericGap(), initFbPropsForSelectGap(), initFbPropsForTextGap(), assClozeGap\TYPE_NUMERIC, assClozeGap\TYPE_SELECT, and assClozeGap\TYPE_TEXT.

Referenced by initSpecificFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFeedbackFieldsPerGapQuestion()

ilAssClozeTestFeedback::initFeedbackFieldsPerGapQuestion ( ilPropertyFormGUI  $form)
protected

Definition at line 383 of file class.ilAssClozeTestFeedback.php.

383 : void
384 {
385 foreach ($this->questionOBJ->getGaps() as $gapIndex => $gap) {
386 $value = $this->getSpecificAnswerFeedbackFormValue($gapIndex, self::SINGLE_GAP_FB_ANSWER_INDEX);
387 $form->getItemByPostVar($this->buildPostVarForFbFieldPerGapQuestion($gapIndex))->setValue($value);
388 }
389 }

References buildPostVarForFbFieldPerGapQuestion(), ilPropertyFormGUI\getItemByPostVar(), and getSpecificAnswerFeedbackFormValue().

Referenced by initSpecificFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSpecificFormProperties()

ilAssClozeTestFeedback::initSpecificFormProperties ( ilPropertyFormGUI  $form)

initialises a given form object's specific form properties relating to this question type

Reimplemented from ilAssMultiOptionQuestionFeedback.

Definition at line 357 of file class.ilAssClozeTestFeedback.php.

357 : void
358 {
359 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
360 /* @var ilRadioGroupInputGUI $fbMode */
361 $fbMode = $form->getItemByPostVar('feedback_mode');
362 $fbMode->setValue($this->questionOBJ->getFeedbackMode());
363
364 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
367 } else {
368 switch ($this->questionOBJ->getFeedbackMode()) {
370
372 break;
373
375
377 break;
378 }
379 }
380 }
381 }
initFeedbackFieldsPerGapQuestion(ilPropertyFormGUI $form)
initFeedbackFieldsPerGapAnswers(ilPropertyFormGUI $form)

References FB_MODE_GAP_ANSWERS, FB_MODE_GAP_QUESTION, ilPropertyFormGUI\getItemByPostVar(), initFeedbackFieldsPerGapAnswers(), and initFeedbackFieldsPerGapQuestion().

+ Here is the call graph for this function:

◆ isSaveableInPageObjectEditingMode()

ilAssClozeTestFeedback::isSaveableInPageObjectEditingMode ( )

returns the fact wether the feedback editing form is saveable in page object editing or not.

by default all properties are edited as page object unless there are additional settings (this method can be overwritten per question type if required)

Reimplemented from ilAssQuestionFeedback.

Definition at line 51 of file class.ilAssClozeTestFeedback.php.

51 : bool
52 {
53 return true;
54 }

◆ isSpecificAnswerFeedbackAvailable()

ilAssClozeTestFeedback::isSpecificAnswerFeedbackAvailable ( int  $question_id)

Reimplemented from ilAssQuestionFeedback.

Definition at line 766 of file class.ilAssClozeTestFeedback.php.

766 : bool
767 {
768 if ($this->questionOBJ->getFeedbackMode() === self::FB_MODE_GAP_QUESTION) {
769 $feedback_ids = $this->fetchFeedbackIdsForGapQuestionMode();
770 } else {
771 $feedback_ids = $this->fetchFeedbackIdsForGapAnswersMode();
772 }
773
774 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
775 $all_feedback_content = '';
776 foreach ($feedback_ids as $feedback_id) {
777 $all_feedback_content .= $this->getPageObjectXML(
779 $feedback_id
780 );
781 }
782 return trim(strip_tags($all_feedback_content)) !== '';
783 }
784
785 return implode('', $this->getSpecificFeedbackContentForFeedbackIds($feedback_ids)) !== '';
786 }
getPageObjectXML(string $page_object_type, int $page_object_id)

◆ randomGroup()

ilAssClozeTestFeedback::randomGroup ( )
private

Definition at line 880 of file class.ilAssClozeTestFeedback.php.

880 : RandomGroup
881 {
882 global $DIC;
883
884 return $DIC->refinery()->random();
885 }
global $DIC
Definition: shib_login.php:26

References $DIC.

◆ saveFbPropsForNumericGap()

ilAssClozeTestFeedback::saveFbPropsForNumericGap ( ilPropertyFormGUI  $form,
assClozeGap  $gap,
int  $gapIndex 
)
protected

Definition at line 585 of file class.ilAssClozeTestFeedback.php.

585 : void
586 {
587 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_NUMERIC_GAP_VALUE_HIT_INDEX);
588 $value = $form->getItemByPostVar($postVar)->getValue();
590 $this->questionOBJ->getId(),
591 $gapIndex,
592 self::FB_NUMERIC_GAP_VALUE_HIT_INDEX,
593 $value
594 );
595
596 if ($gap->numericRangeExists()) {
597 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_NUMERIC_GAP_RANGE_HIT_INDEX);
598 $value = $form->getItemByPostVar($postVar)->getValue();
600 $this->questionOBJ->getId(),
601 $gapIndex,
602 self::FB_NUMERIC_GAP_RANGE_HIT_INDEX,
603 $value
604 );
605 }
606
607 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_NUMERIC_GAP_TOO_LOW_INDEX);
608 $value = $form->getItemByPostVar($postVar)->getValue();
610 $this->questionOBJ->getId(),
611 $gapIndex,
612 self::FB_NUMERIC_GAP_TOO_LOW_INDEX,
613 $value
614 );
615
616 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_NUMERIC_GAP_TOO_HIGH_INDEX);
617 $value = $form->getItemByPostVar($postVar)->getValue();
619 $this->questionOBJ->getId(),
620 $gapIndex,
621 self::FB_NUMERIC_GAP_TOO_HIGH_INDEX,
622 $value
623 );
624
625 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_NUMERIC_GAP_EMPTY_INDEX);
626 $value = $form->getItemByPostVar($postVar)->getValue();
628 $this->questionOBJ->getId(),
629 $gapIndex,
630 self::FB_NUMERIC_GAP_EMPTY_INDEX,
631 $value
632 );
633 }
saveSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index, string $feedback_content)

References buildPostVarForFbFieldPerGapAnswers(), ilPropertyFormGUI\getItemByPostVar(), assClozeGap\numericRangeExists(), and ilAssMultiOptionQuestionFeedback\saveSpecificAnswerFeedbackContent().

Referenced by saveFeedbackFieldsPerGapAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveFbPropsForSelectGap()

ilAssClozeTestFeedback::saveFbPropsForSelectGap ( ilPropertyFormGUI  $form,
assClozeGap  $gap,
int  $gapIndex 
)
protected

Definition at line 562 of file class.ilAssClozeTestFeedback.php.

562 : void
563 {
564 foreach ($gap->getItems($this->randomGroup()->dontShuffle()) as $optIndex => $item) {
565 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, $optIndex);
566 $value = $form->getItemByPostVar($postVar)->getValue();
568 $this->questionOBJ->getId(),
569 $gapIndex,
570 $optIndex,
571 $value
572 );
573 }
574
575 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_SELECT_GAP_EMPTY_INDEX);
576 $value = $form->getItemByPostVar($postVar)->getValue();
578 $this->questionOBJ->getId(),
579 $gapIndex,
580 self::FB_SELECT_GAP_EMPTY_INDEX,
581 $value
582 );
583 }

References buildPostVarForFbFieldPerGapAnswers(), ilPropertyFormGUI\getItemByPostVar(), assClozeGap\getItems(), and ilAssMultiOptionQuestionFeedback\saveSpecificAnswerFeedbackContent().

Referenced by saveFeedbackFieldsPerGapAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveFbPropsForTextGap()

ilAssClozeTestFeedback::saveFbPropsForTextGap ( ilPropertyFormGUI  $form,
assClozeGap  $gap,
int  $gapIndex 
)
protected

Definition at line 530 of file class.ilAssClozeTestFeedback.php.

530 : void
531 {
532 foreach ($gap->getItems($this->randomGroup()->dontShuffle()) as $answerIndex => $item) {
533 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, $answerIndex);
534 $value = $form->getItemByPostVar($postVar)->getValue();
536 $this->questionOBJ->getId(),
537 $gapIndex,
538 $answerIndex,
539 $value
540 );
541 }
542
543 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_TEXT_GAP_NOMATCH_INDEX);
544 $value = $form->getItemByPostVar($postVar)->getValue();
546 $this->questionOBJ->getId(),
547 $gapIndex,
548 self::FB_TEXT_GAP_NOMATCH_INDEX,
549 $value
550 );
551
552 $postVar = $this->buildPostVarForFbFieldPerGapAnswers($gapIndex, self::FB_TEXT_GAP_EMPTY_INDEX);
553 $value = $form->getItemByPostVar($postVar)->getValue();
555 $this->questionOBJ->getId(),
556 $gapIndex,
557 self::FB_TEXT_GAP_EMPTY_INDEX,
558 $value
559 );
560 }

References buildPostVarForFbFieldPerGapAnswers(), ilPropertyFormGUI\getItemByPostVar(), assClozeGap\getItems(), and ilAssMultiOptionQuestionFeedback\saveSpecificAnswerFeedbackContent().

Referenced by saveFeedbackFieldsPerGapAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveFeedbackFieldsPerGapAnswers()

ilAssClozeTestFeedback::saveFeedbackFieldsPerGapAnswers ( ilPropertyFormGUI  $form)
protected

Definition at line 508 of file class.ilAssClozeTestFeedback.php.

508 : void
509 {
510 foreach ($this->questionOBJ->getGaps() as $gapIndex => $gap) {
511 switch ($gap->getType()) {
513
514 $this->saveFbPropsForTextGap($form, $gap, $gapIndex);
515 break;
516
518
519 $this->saveFbPropsForSelectGap($form, $gap, $gapIndex);
520 break;
521
523
524 $this->saveFbPropsForNumericGap($form, $gap, $gapIndex);
525 break;
526 }
527 }
528 }
saveFbPropsForNumericGap(ilPropertyFormGUI $form, assClozeGap $gap, int $gapIndex)
saveFbPropsForTextGap(ilPropertyFormGUI $form, assClozeGap $gap, int $gapIndex)
saveFbPropsForSelectGap(ilPropertyFormGUI $form, assClozeGap $gap, int $gapIndex)

References saveFbPropsForNumericGap(), saveFbPropsForSelectGap(), saveFbPropsForTextGap(), assClozeGap\TYPE_NUMERIC, assClozeGap\TYPE_SELECT, and assClozeGap\TYPE_TEXT.

Referenced by saveSpecificFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveFeedbackFieldsPerGapQuestion()

ilAssClozeTestFeedback::saveFeedbackFieldsPerGapQuestion ( ilPropertyFormGUI  $form)
protected

Definition at line 493 of file class.ilAssClozeTestFeedback.php.

493 : void
494 {
495 foreach ($this->questionOBJ->getGaps() as $gapIndex => $gap) {
496 $postVar = $this->buildPostVarForFbFieldPerGapQuestion($gapIndex);
497 $value = $form->getItemByPostVar($postVar)->getValue();
498
500 $this->questionOBJ->getId(),
501 $gapIndex,
502 self::SINGLE_GAP_FB_ANSWER_INDEX,
503 $value
504 );
505 }
506 }

References buildPostVarForFbFieldPerGapQuestion(), ilPropertyFormGUI\getItemByPostVar(), and ilAssMultiOptionQuestionFeedback\saveSpecificAnswerFeedbackContent().

Referenced by saveSpecificFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSpecificFeedbackMode()

ilAssClozeTestFeedback::saveSpecificFeedbackMode ( int  $questionId,
string  $feedbackMode 
)
protected

saves the given specific feedback mode for the given question id to the db.

(It's stored to dataset of question itself)

Definition at line 664 of file class.ilAssClozeTestFeedback.php.

664 : void
665 {
666 $this->questionOBJ->setFeedbackMode($feedbackMode);
667
668 $this->db->update(
669 $this->questionOBJ->getAdditionalTableName(),
670 ['feedback_mode' => ['text', $feedbackMode]],
671 ['question_fi' => ['integer', $questionId]]
672 );
673 }

Referenced by saveSpecificFormProperties().

+ Here is the caller graph for this function:

◆ saveSpecificFormProperties()

ilAssClozeTestFeedback::saveSpecificFormProperties ( ilPropertyFormGUI  $form)

saves a given form object's SPECIFIC form properties relating to this question type

Reimplemented from ilAssMultiOptionQuestionFeedback.

Definition at line 468 of file class.ilAssClozeTestFeedback.php.

468 : void
469 {
470 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
471 $fbMode = $form->getItemByPostVar('feedback_mode')->getValue();
472
473 if ($fbMode != $this->questionOBJ->getFeedbackMode()) {
474 $this->cleanupSpecificAnswerFeedbacks($this->questionOBJ->getFeedbackMode());
475 }
476
477 $this->saveSpecificFeedbackMode($this->questionOBJ->getId(), $fbMode);
478
479 switch ($this->questionOBJ->getFeedbackMode()) {
481
483 break;
484
486
488 break;
489 }
490 }
491 }
saveFeedbackFieldsPerGapQuestion(ilPropertyFormGUI $form)
saveSpecificFeedbackMode(int $questionId, string $feedbackMode)
saves the given specific feedback mode for the given question id to the db.
saveFeedbackFieldsPerGapAnswers(ilPropertyFormGUI $form)

References cleanupSpecificAnswerFeedbacks(), FB_MODE_GAP_ANSWERS, FB_MODE_GAP_QUESTION, ilPropertyFormGUI\getItemByPostVar(), saveFeedbackFieldsPerGapAnswers(), saveFeedbackFieldsPerGapQuestion(), and saveSpecificFeedbackMode().

+ Here is the call graph for this function:

Field Documentation

◆ FB_MODE_GAP_ANSWERS

const ilAssClozeTestFeedback::FB_MODE_GAP_ANSWERS = 'gapAnswers'

◆ FB_MODE_GAP_QUESTION

const ilAssClozeTestFeedback::FB_MODE_GAP_QUESTION = 'gapQuestion'

constants for different feedback modes (per gap or per gap-answers/options)

Definition at line 34 of file class.ilAssClozeTestFeedback.php.

Referenced by initSpecificFormProperties(), assClozeTest\loadFromDb(), and saveSpecificFormProperties().

◆ FB_NUMERIC_GAP_EMPTY_INDEX

const ilAssClozeTestFeedback::FB_NUMERIC_GAP_EMPTY_INDEX = -1

Definition at line 43 of file class.ilAssClozeTestFeedback.php.

Referenced by completeFbPropsForNumericGap().

◆ FB_NUMERIC_GAP_RANGE_HIT_INDEX

const ilAssClozeTestFeedback::FB_NUMERIC_GAP_RANGE_HIT_INDEX = 1

Definition at line 45 of file class.ilAssClozeTestFeedback.php.

Referenced by completeFbPropsForNumericGap().

◆ FB_NUMERIC_GAP_TOO_HIGH_INDEX

const ilAssClozeTestFeedback::FB_NUMERIC_GAP_TOO_HIGH_INDEX = 3

Definition at line 47 of file class.ilAssClozeTestFeedback.php.

Referenced by completeFbPropsForNumericGap().

◆ FB_NUMERIC_GAP_TOO_LOW_INDEX

const ilAssClozeTestFeedback::FB_NUMERIC_GAP_TOO_LOW_INDEX = 2

Definition at line 46 of file class.ilAssClozeTestFeedback.php.

Referenced by completeFbPropsForNumericGap().

◆ FB_NUMERIC_GAP_VALUE_HIT_INDEX

const ilAssClozeTestFeedback::FB_NUMERIC_GAP_VALUE_HIT_INDEX = 0

Definition at line 44 of file class.ilAssClozeTestFeedback.php.

Referenced by completeFbPropsForNumericGap().

◆ FB_SELECT_GAP_EMPTY_INDEX

const ilAssClozeTestFeedback::FB_SELECT_GAP_EMPTY_INDEX = -1

Definition at line 42 of file class.ilAssClozeTestFeedback.php.

Referenced by completeFbPropsForSelectGap().

◆ FB_TEXT_GAP_EMPTY_INDEX

const ilAssClozeTestFeedback::FB_TEXT_GAP_EMPTY_INDEX = -1

constants for answer indexes in case of FB_MODE_GAP_ANSWERS

Definition at line 40 of file class.ilAssClozeTestFeedback.php.

Referenced by completeFbPropsForTextGap().

◆ FB_TEXT_GAP_NOMATCH_INDEX

const ilAssClozeTestFeedback::FB_TEXT_GAP_NOMATCH_INDEX = -2

Definition at line 41 of file class.ilAssClozeTestFeedback.php.

Referenced by completeFbPropsForTextGap().

◆ SINGLE_GAP_FB_ANSWER_INDEX

const ilAssClozeTestFeedback::SINGLE_GAP_FB_ANSWER_INDEX = -10

Definition at line 49 of file class.ilAssClozeTestFeedback.php.


The documentation for this class was generated from the following file: