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

Public Member Functions

 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 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

 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)
 

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 30 of file class.ilAssMultiOptionQuestionFeedback.php.

Member Function Documentation

◆ buildAnswerOptionLabel()

ilAssMultiOptionQuestionFeedback::buildAnswerOptionLabel ( int  $index,
  $answer 
)
protected

◆ cloneSpecificFeedback()

ilAssMultiOptionQuestionFeedback::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 ilAssQuestionFeedback.

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

Definition at line 240 of file class.ilAssMultiOptionQuestionFeedback.php.

240 : void
241 {
242 // delete specific feedback of the original
243 $this->db->manipulateF(
244 "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
245 ['integer'],
246 [$source_question_id]
247 );
248
249 // get specific feedback of the actual question
250 $res = $this->db->queryF(
251 "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
252 ['integer'],
253 [$target_question_id]
254 );
255
256 // save specific feedback to the original
257 while ($row = $this->db->fetchAssoc($res)) {
258 $next_id = $this->db->nextId($this->getSpecificFeedbackTableName());
259
260 $this->db->insert($this->getSpecificFeedbackTableName(), [
261 'feedback_id' => ['integer', $next_id],
262 'question_fi' => ['integer', $source_question_id],
263 'question' => ['integer', $row['question']],
264 'answer' => ['integer', $row['answer']],
265 'feedback' => ['text', $row['feedback']],
266 'tstamp' => ['integer', time()]
267 ]);
268
269 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
270 $page_object_type = $this->getSpecificAnswerFeedbackPageObjectType();
271 $this->clonePageObject($page_object_type, $row['feedback_id'], $next_id, $target_question_id);
272 }
273 }
274 }
clonePageObject(string $page_object_type, int $source_page_object_id, int $target_page_object_id, int $target_page_object_parent_id)
$res
Definition: ltiservices.php:69

References $res, ilAssQuestionFeedback\clonePageObject(), ilAssQuestionFeedback\getSpecificAnswerFeedbackPageObjectType(), and getSpecificFeedbackTableName().

+ Here is the call graph for this function:

◆ completeSpecificFormProperties()

ilAssMultiOptionQuestionFeedback::completeSpecificFormProperties ( ilPropertyFormGUI  $form)

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

Reimplemented from ilAssQuestionFeedback.

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

Definition at line 63 of file class.ilAssMultiOptionQuestionFeedback.php.

63 : void
64 {
65 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
66 $header = new ilFormSectionHeaderGUI();
67 $header->setTitle($this->lng->txt('feedback_answers'));
68 $form->addItem($header);
69
70 foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
72 $this->buildAnswerOptionLabel($index, $answer),
73 true
74 );
75
76 $propertyPostVar = "feedback_answer_$index";
77
79 $propertyLabel,
80 $propertyPostVar,
81 $this->questionOBJ->isAdditionalContentEditingModePageObject()
82 ));
83 }
84 }
85 }
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...
This class represents a section header in a property form.
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 ilPropertyFormGUI\addItem(), buildAnswerOptionLabel(), ilAssQuestionFeedback\buildFeedbackContentFormProperty(), getAnswerOptionsByAnswerIndex(), ILIAS\Repository\lng(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

+ Here is the call graph for this function:

◆ deleteSpecificAnswerFeedbacks()

ilAssMultiOptionQuestionFeedback::deleteSpecificAnswerFeedbacks ( int  $question_id,
bool  $is_additional_content_editing_mode_page_object 
)

Reimplemented from ilAssQuestionFeedback.

Definition at line 219 of file class.ilAssMultiOptionQuestionFeedback.php.

219 : void
220 {
221 if ($is_additional_content_editing_mode_page_object) {
222 $feedback_identifiers = new ilAssSpecificFeedbackIdentifierList();
223 $feedback_identifiers->load($question_id);
224
225 foreach ($feedback_identifiers as $identifier) {
228 $identifier->getFeedbackId()
229 );
230 }
231 }
232
233 $this->db->manipulateF(
234 "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
235 ['integer'],
236 [$question_id]
237 );
238 }
ensurePageObjectDeleted(string $page_object_type, int $page_object_id)

References ilAssQuestionFeedback\ensurePageObjectDeleted(), and ilAssQuestionFeedback\getSpecificAnswerFeedbackPageObjectType().

+ Here is the call graph for this function:

◆ getAllSpecificAnswerFeedbackContents()

ilAssMultiOptionQuestionFeedback::getAllSpecificAnswerFeedbackContents ( int  $question_id)

Reimplemented from ilAssQuestionFeedback.

Definition at line 147 of file class.ilAssMultiOptionQuestionFeedback.php.

147 : string
148 {
149 $res = $this->db->queryF(
150 "SELECT feedback FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
151 ['integer'],
152 [$question_id]
153 );
154
155 $allFeedbackContents = '';
156
157 while ($row = $this->db->fetchAssoc($res)) {
158 $allFeedbackContents .= ilRTE::_replaceMediaObjectImageSrc($row['feedback'] ?? '', 1);
159 }
160
161 return $allFeedbackContents;
162 }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...

References $res, and ilRTE\_replaceMediaObjectImageSrc().

Referenced by specificAnswerFeedbackExists().

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

◆ getAllSpecificAnswerPageEditorFeedbackContents()

ilAssMultiOptionQuestionFeedback::getAllSpecificAnswerPageEditorFeedbackContents ( int  $question_id)

Definition at line 164 of file class.ilAssMultiOptionQuestionFeedback.php.

164 : string
165 {
166 $feedback_identifiers = new ilAssSpecificFeedbackIdentifierList();
167 $feedback_identifiers->load($question_id);
168
169 $all_feedback_content = '';
170 foreach ($feedback_identifiers as $identifier) {
171 $feedback_content = $this->getPageObjectContent(
173 $identifier->getFeedbackId()
174 );
175 $all_feedback_content .= $this->cleanupPageContent($feedback_content);
176 }
177
178 return $all_feedback_content;
179 }

References ilAssQuestionFeedback\cleanupPageContent(), and ilAssQuestionFeedback\getSpecificAnswerFeedbackPageObjectType().

Referenced by specificAnswerFeedbackExists().

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

◆ getAnswerOptionsByAnswerIndex()

◆ getSpecificAnswerFeedbackContent()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackContent ( int  $question_id,
int  $question_index,
int  $answer_index 
)

Reimplemented from ilAssQuestionFeedback.

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

125 : string
126 {
127 $res = $this->db->queryF(
128 "SELECT * FROM {$this->getSpecificFeedbackTableName()}
129 WHERE question_fi = %s AND question = %s AND answer = %s",
130 ['integer', 'integer', 'integer'],
131 [$question_id, $question_index, $answer_index]
132 );
133
134 $feedback_content = '';
135
136 if ($this->db->numRows($res) > 0) {
137 $row = $this->db->fetchAssoc($res);
138 $feedback_content = ilRTE::_replaceMediaObjectImageSrc(
139 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($row['feedback'] ?? ''),
140 1
141 );
142 }
143
144 return $feedback_content;
145 }

References $res, and ilRTE\_replaceMediaObjectImageSrc().

Referenced by getSpecificAnswerFeedbackExportPresentation(), getSpecificAnswerFeedbackTestPresentation(), ilAssConfigurableMultiOptionQuestionFeedback\initSpecificFormProperties(), and initSpecificFormProperties().

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

◆ getSpecificAnswerFeedbackExportPresentation()

ilAssMultiOptionQuestionFeedback::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

Reimplemented from ilAssQuestionFeedback.

Definition at line 351 of file class.ilAssMultiOptionQuestionFeedback.php.

351 : string
352 {
353 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
354 return $this->getPageObjectXML(
356 $this->getSpecificAnswerFeedbackPageObjectId($question_id, $question_index, $answer_index)
357 );
358 }
359
361 $question_id,
362 $question_index,
363 $answer_index
364 );
365 }
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 ...
getPageObjectXML(string $page_object_type, int $page_object_id)

References ilAssQuestionFeedback\getPageObjectXML(), getSpecificAnswerFeedbackContent(), getSpecificAnswerFeedbackPageObjectId(), and ilAssQuestionFeedback\getSpecificAnswerFeedbackPageObjectType().

+ Here is the call graph for this function:

◆ getSpecificAnswerFeedbackId()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackId ( int  $question_id,
int  $question_index,
int  $answer_index 
)
finalprotected

Definition at line 276 of file class.ilAssMultiOptionQuestionFeedback.php.

276 : int
277 {
278 $res = $this->db->queryF(
279 "SELECT feedback_id FROM {$this->getSpecificFeedbackTableName()}
280 WHERE question_fi = %s AND question = %s AND answer = %s",
281 ['integer', 'integer', 'integer'],
282 [$question_id, $question_index, $answer_index]
283 );
284
285 $row = $this->db->fetchAssoc($res);
286 return $row['feedback_id'] ?? -1;
287 }

References $res.

Referenced by getSpecificAnswerFeedbackPageObjectId(), and saveSpecificAnswerFeedbackContent().

+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackPageObjectId()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackPageObjectId ( int  $question_id,
int  $question_index,
int  $answer_index 
)
finalprotected

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)

Definition at line 340 of file class.ilAssMultiOptionQuestionFeedback.php.

340 : int
341 {
342 $page_object_id = $this->getSpecificAnswerFeedbackId($question_id, $question_index, $answer_index);
343
344 if ($page_object_id === -1) {
345 $page_object_id = $this->saveSpecificAnswerFeedbackContent($question_id, $question_index, $answer_index, '');
346 }
347
348 return $page_object_id;
349 }
getSpecificAnswerFeedbackId(int $question_id, int $question_index, int $answer_index)
saveSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index, string $feedback_content)

References getSpecificAnswerFeedbackId(), and saveSpecificAnswerFeedbackContent().

Referenced by getSpecificAnswerFeedbackExportPresentation(), getSpecificAnswerFeedbackTestPresentation(), importSpecificAnswerFeedback(), ilAssConfigurableMultiOptionQuestionFeedback\initSpecificFormProperties(), and initSpecificFormProperties().

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

◆ getSpecificAnswerFeedbackTestPresentation()

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

Reimplemented from ilAssQuestionFeedback.

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

41 : string
42 {
43 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
44 return $this->cleanupPageContent(
45 $this->getPageObjectContent(
47 $this->getSpecificAnswerFeedbackPageObjectId($question_id, $question_index, $answer_index)
48 )
49 );
50 }
51
53 $question_id,
54 $question_index,
55 $answer_index
56 );
57 }

References ilAssQuestionFeedback\cleanupPageContent(), getSpecificAnswerFeedbackContent(), getSpecificAnswerFeedbackPageObjectId(), and ilAssQuestionFeedback\getSpecificAnswerFeedbackPageObjectType().

+ Here is the call graph for this function:

◆ getSpecificFeedbackContentForFeedbackIds()

ilAssMultiOptionQuestionFeedback::getSpecificFeedbackContentForFeedbackIds ( array  $feedback_ids)
protected
Parameters
array<int>$feedback_ids
Returns
array<int, string>

Definition at line 294 of file class.ilAssMultiOptionQuestionFeedback.php.

294 : array
295 {
296 $res = $this->db->query(
297 "SELECT feedback_id, feedback FROM {$this->getSpecificFeedbackTableName()} WHERE "
298 . $this->db->in('feedback_id', $feedback_ids, false, ilDBConstants::T_INTEGER)
299 );
300
301 $content = [];
302 while ($row = $this->db->fetchAssoc($res)) {
303 $content[$row['feedback_id']] = $row['feedback'];
304 }
305 return $content;
306 }

References $res, and ilDBConstants\T_INTEGER.

◆ getSpecificFeedbackTableName()

ilAssMultiOptionQuestionFeedback::getSpecificFeedbackTableName ( )
finalprotected

Definition at line 320 of file class.ilAssMultiOptionQuestionFeedback.php.

320 : string
321 {
323 }
const TABLE_NAME_SPECIFIC_FEEDBACK
table name for specific feedback

References TABLE_NAME_SPECIFIC_FEEDBACK.

Referenced by cloneSpecificFeedback(), and saveSpecificAnswerFeedbackContent().

+ Here is the caller graph for this function:

◆ importSpecificAnswerFeedback()

ilAssMultiOptionQuestionFeedback::importSpecificAnswerFeedback ( int  $question_id,
int  $question_index,
int  $answer_index,
string  $feedback_content 
)

Reimplemented from ilAssQuestionFeedback.

Definition at line 367 of file class.ilAssMultiOptionQuestionFeedback.php.

367 : void
368 {
369 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
370 $page_object_id = $this->getSpecificAnswerFeedbackPageObjectId($question_id, $question_index, $answer_index);
371 $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
372
373 $this->createPageObject($pageObjectType, $page_object_id, $feedback_content);
374 } else {
375 $this->saveSpecificAnswerFeedbackContent($question_id, $question_index, $answer_index, $feedback_content);
376 }
377 }
createPageObject(string $page_object_type, int $page_object_id, string $page_object_content)

References ilAssQuestionFeedback\createPageObject(), getSpecificAnswerFeedbackPageObjectId(), ilAssQuestionFeedback\getSpecificAnswerFeedbackPageObjectType(), and saveSpecificAnswerFeedbackContent().

+ Here is the call graph for this function:

◆ initSpecificFormProperties()

ilAssMultiOptionQuestionFeedback::initSpecificFormProperties ( ilPropertyFormGUI  $form)

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

Reimplemented from ilAssQuestionFeedback.

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

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

91 : void
92 {
93 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
94 foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
95 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
98 $this->getSpecificAnswerFeedbackPageObjectId($this->questionOBJ->getId(), 0, $index)
99 );
100 } else {
102 $this->getSpecificAnswerFeedbackContent($this->questionOBJ->getId(), 0, $index)
103 );
104 }
105
106 $form->getItemByPostVar("feedback_answer_$index")->setValue($value);
107 }
108 }
109 }
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...
getItemByPostVar(string $a_post_var)

References getAnswerOptionsByAnswerIndex(), ilPropertyFormGUI\getItemByPostVar(), ilAssQuestionFeedback\getPageObjectNonEditableValueHTML(), getSpecificAnswerFeedbackContent(), getSpecificAnswerFeedbackPageObjectId(), ilAssQuestionFeedback\getSpecificAnswerFeedbackPageObjectType(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

+ Here is the call graph for this function:

◆ isSpecificAnswerFeedbackId()

ilAssMultiOptionQuestionFeedback::isSpecificAnswerFeedbackId ( int  $feedback_id)
protected

Reimplemented from ilAssQuestionFeedback.

Definition at line 308 of file class.ilAssMultiOptionQuestionFeedback.php.

308 : bool
309 {
310 $row = $this->db->fetchAssoc($this->db->queryF(
311 "SELECT COUNT(feedback_id) cnt FROM {$this->getSpecificFeedbackTableName()}
312 WHERE question_fi = %s AND feedback_id = %s",
313 ['integer', 'integer'],
314 [$this->questionOBJ->getId(), $feedback_id]
315 ));
316
317 return (bool) $row['cnt'];
318 }

◆ saveSpecificAnswerFeedbackContent()

ilAssMultiOptionQuestionFeedback::saveSpecificAnswerFeedbackContent ( int  $question_id,
int  $question_index,
int  $answer_index,
string  $feedback_content 
)

Reimplemented from ilAssQuestionFeedback.

Definition at line 181 of file class.ilAssMultiOptionQuestionFeedback.php.

181 : int
182 {
183 if ($feedback_content !== '') {
184 $feedback_content = ilRTE::_replaceMediaObjectImageSrc(
185 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedback_content),
186 0
187 );
188 }
189
190 $feedback_id = $this->getSpecificAnswerFeedbackId($question_id, $question_index, $answer_index);
191
192 if ($feedback_id !== -1) {
193 $this->db->update(
195 [
196 'feedback' => ['text', $feedback_content],
197 'tstamp' => ['integer', time()]
198 ],
199 [
200 'feedback_id' => ['integer', $feedback_id],
201 ]
202 );
203 } else {
204 $feedback_id = $this->db->nextId($this->getSpecificFeedbackTableName());
205
206 $this->db->insert($this->getSpecificFeedbackTableName(), [
207 'feedback_id' => ['integer', $feedback_id],
208 'question_fi' => ['integer', $question_id],
209 'question' => ['integer', $question_index],
210 'answer' => ['integer', $answer_index],
211 'feedback' => ['text', $feedback_content],
212 'tstamp' => ['integer', time()]
213 ]);
214 }
215
216 return $feedback_id;
217 }

References ilRTE\_replaceMediaObjectImageSrc(), getSpecificAnswerFeedbackId(), and getSpecificFeedbackTableName().

Referenced by getSpecificAnswerFeedbackPageObjectId(), importSpecificAnswerFeedback(), ilAssClozeTestFeedback\saveFbPropsForNumericGap(), ilAssClozeTestFeedback\saveFbPropsForSelectGap(), ilAssClozeTestFeedback\saveFbPropsForTextGap(), ilAssClozeTestFeedback\saveFeedbackFieldsPerGapQuestion(), ilAssConfigurableMultiOptionQuestionFeedback\saveSpecificFormProperties(), and saveSpecificFormProperties().

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

◆ saveSpecificFormProperties()

ilAssMultiOptionQuestionFeedback::saveSpecificFormProperties ( ilPropertyFormGUI  $form)

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

Reimplemented from ilAssQuestionFeedback.

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

Definition at line 111 of file class.ilAssMultiOptionQuestionFeedback.php.

111 : void
112 {
113 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
114 foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
116 $this->questionOBJ->getId(),
117 0,
118 $index,
119 (string) ($form->getInput("feedback_answer_$index") ?? '')
120 );
121 }
122 }
123 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...

References getAnswerOptionsByAnswerIndex(), ilPropertyFormGUI\getInput(), and saveSpecificAnswerFeedbackContent().

+ Here is the call graph for this function:

◆ specificAnswerFeedbackExists()

ilAssMultiOptionQuestionFeedback::specificAnswerFeedbackExists ( )

Definition at line 379 of file class.ilAssMultiOptionQuestionFeedback.php.

379 : bool
380 {
381 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
382 $all_feedback_content = $this->getAllSpecificAnswerPageEditorFeedbackContents($this->questionOBJ->getId());
383 } else {
384 $all_feedback_content = $this->getAllSpecificAnswerFeedbackContents($this->questionOBJ->getId());
385 }
386
387 return $all_feedback_content !== '';
388 }

References getAllSpecificAnswerFeedbackContents(), and getAllSpecificAnswerPageEditorFeedbackContents().

+ Here is the call graph for this function:

Field Documentation

◆ TABLE_NAME_SPECIFIC_FEEDBACK

const ilAssMultiOptionQuestionFeedback::TABLE_NAME_SPECIFIC_FEEDBACK = 'qpl_fb_specific'

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