ILIAS  release_8 Revision v8.24
ilAssMultiOptionQuestionFeedback Class Reference
+ Inheritance diagram for ilAssMultiOptionQuestionFeedback:
+ Collaboration diagram for ilAssMultiOptionQuestionFeedback:

Public Member Functions

 getSpecificAnswerFeedbackTestPresentation (int $questionId, int $questionIndex, int $answerIndex)
 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 $questionId, int $questionIndex, int $answerIndex)
 
 getAllSpecificAnswerFeedbackContents (int $questionId)
 
 saveSpecificAnswerFeedbackContent (int $questionId, int $questionIndex, int $answerIndex, string $feedbackContent)
 
 deleteSpecificAnswerFeedbacks (int $questionId, bool $isAdditionalContentEditingModePageObject)
 
 getAnswerOptionsByAnswerIndex ()
 
 getSpecificAnswerFeedbackExportPresentation (int $questionId, int $questionIndex, int $answerIndex)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 importSpecificAnswerFeedback (int $questionId, int $questionIndex, int $answerIndex, string $feedbackContent)
 
 specificAnswerFeedbackExists ()
 
- Public Member Functions inherited from ilAssQuestionFeedback
 __construct (assQuestion $questionOBJ, ilCtrl $ctrl, ilDBInterface $db, ilLanguage $lng)
 constructor More...
 
 getGenericFeedbackTestPresentation (int $questionId, bool $solutionCompleted)
 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 $questionId, int $questionIndex, int $answerIndex)
 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 $questionId, bool $solutionCompleted)
 returns the GENERIC feedback content for a given question state. More...
 
 getSpecificAnswerFeedbackContent (int $questionId, int $questionIndex, int $answerIndex)
 
 getAllSpecificAnswerFeedbackContents (int $questionId)
 
 isSpecificAnswerFeedbackAvailable (int $questionId)
 
 saveGenericFeedbackContent (int $questionId, bool $solutionCompleted, string $feedbackContent)
 saves GENERIC feedback content for the given question id to the database. More...
 
 saveSpecificAnswerFeedbackContent (int $questionId, int $questionIndex, int $answerIndex, string $feedbackContent)
 
 deleteGenericFeedbacks (int $questionId, bool $isAdditionalContentEditingModePageObject)
 deletes all GENERIC feedback contents (and page objects if required) for the given question id More...
 
 deleteSpecificAnswerFeedbacks (int $questionId, 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...
 
 syncFeedback (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 $questionId, bool $solutionCompleted)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 getSpecificAnswerFeedbackExportPresentation (int $questionId, int $questionIndex, int $answerIndex)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 importGenericFeedback (int $questionId, bool $solutionCompleted, string $feedbackContent)
 imports the given feedback content as generic feedback for the given question id for either the complete or incomplete solution More...
 
 importSpecificAnswerFeedback (int $questionId, int $questionIndex, int $answerIndex, string $feedbackContent)
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator, int $questionId)
 

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

 duplicateSpecificFeedback (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...
 
 syncSpecificFeedback (int $originalQuestionId, int $duplicateQuestionId)
 syncs the SPECIFIC feedback from a duplicated question back to the original question More...
 
 getSpecificAnswerFeedbackId (int $questionId, int $questionIndex, int $answerIndex)
 
 getSpecificFeedbackContentForFeedbackIds (array $feedback_ids)
 
 isSpecificAnswerFeedbackId (int $feedbackId)
 
 getSpecificFeedbackTableName ()
 
 buildAnswerOptionLabel (int $index, $answer)
 
 getSpecificAnswerFeedbackPageObjectId (int $questionId, int $questionIndex, int $answerIndex)
 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 $postVar, bool $asNonEditable)
 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...
 
 duplicateSpecificFeedback (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 $questionId, bool $solutionCompleted)
 returns the SPECIFIC answer feedback ID for a given question id and answer index. More...
 
 isGenericFeedbackId (int $feedbackId)
 
 isSpecificAnswerFeedbackId (int $feedbackId)
 
 syncSpecificFeedback (int $originalQuestionId, int $duplicateQuestionId)
 syncs the SPECIFIC feedback from a duplicated question back to the original question More...
 
 getGenericFeedbackTableName ()
 
 getPageObjectNonEditableValueHTML (string $pageObjectType, int $pageObjectId)
 returns html content to be used as value for non editable value form properties in feedback editing form More...
 
 getPageObjectContent (string $pageObjectType, int $pageObjectId)
 
 getPageObjectXML (string $pageObjectType, int $pageObjectId)
 
 createPageObject (string $pageObjectType, int $pageObjectId, string $pageObjectContent)
 
 duplicatePageObject (string $pageObjectType, int $originalPageObjectId, int $duplicatePageObjectId, int $duplicatePageObjectParentId)
 
 ensurePageObjectDeleted (string $pageObjectType, int $pageObjectId)
 
 getGenericFeedbackPageObjectType ()
 
 getSpecificAnswerFeedbackPageObjectType ()
 
 getGenericFeedbackPageObjectId (int $questionId, bool $solutionCompleted)
 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 32 of file class.ilAssMultiOptionQuestionFeedback.php.

Member Function Documentation

◆ buildAnswerOptionLabel()

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

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

64 : void
65 {
66 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
67 $header = new ilFormSectionHeaderGUI();
68 $header->setTitle($this->lng->txt('feedback_answers'));
69 $form->addItem($header);
70
71 foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
72 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
73 $this->buildAnswerOptionLabel($index, $answer),
74 true
75 );
76
77 $propertyPostVar = "feedback_answer_$index";
78
80 $propertyLabel,
81 $propertyPostVar,
82 $this->questionOBJ->isAdditionalContentEditingModePageObject()
83 ));
84 }
85 }
86 }
buildFeedbackContentFormProperty(string $label, string $postVar, bool $asNonEditable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$index
Definition: metadata.php:145

References $index, ilPropertyFormGUI\addItem(), buildAnswerOptionLabel(), ilAssQuestionFeedback\buildFeedbackContentFormProperty(), getAnswerOptionsByAnswerIndex(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ deleteSpecificAnswerFeedbacks()

ilAssMultiOptionQuestionFeedback::deleteSpecificAnswerFeedbacks ( int  $questionId,
bool  $isAdditionalContentEditingModePageObject 
)

Reimplemented from ilAssQuestionFeedback.

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

207 : void
208 {
209 if ($isAdditionalContentEditingModePageObject) {
210 require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssSpecificFeedbackIdentifierList.php';
211 $feedbackIdentifiers = new ilAssSpecificFeedbackIdentifierList();
212 $feedbackIdentifiers->load($questionId);
213
214 foreach ($feedbackIdentifiers as $identifier) {
217 $identifier->getFeedbackId()
218 );
219 }
220 }
221
222 $this->db->manipulateF(
223 "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
224 ['integer'],
225 [$questionId]
226 );
227 }
ensurePageObjectDeleted(string $pageObjectType, int $pageObjectId)

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

+ Here is the call graph for this function:

◆ duplicateSpecificFeedback()

ilAssMultiOptionQuestionFeedback::duplicateSpecificFeedback ( 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 229 of file class.ilAssMultiOptionQuestionFeedback.php.

229 : void
230 {
231 $res = $this->db->queryF(
232 "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
233 ['integer'],
234 [$originalQuestionId]
235 );
236
237 while ($row = $this->db->fetchAssoc($res)) {
238 $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
239
240 $this->db->insert($this->getSpecificFeedbackTableName(), [
241 'feedback_id' => ['integer', $nextId],
242 'question_fi' => ['integer', $duplicateQuestionId],
243 'question' => ['integer', $row['question']],
244 'answer' => ['integer', $row['answer']],
245 'feedback' => ['text', $row['feedback']],
246 'tstamp' => ['integer', time()]
247 ]);
248
249 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
250 $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
251 $this->duplicatePageObject($pageObjectType, $row['feedback_id'], $nextId, $duplicateQuestionId);
252 }
253 }
254 }
duplicatePageObject(string $pageObjectType, int $originalPageObjectId, int $duplicatePageObjectId, int $duplicatePageObjectParentId)
$res
Definition: ltiservices.php:69

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

+ Here is the call graph for this function:

◆ getAllSpecificAnswerFeedbackContents()

ilAssMultiOptionQuestionFeedback::getAllSpecificAnswerFeedbackContents ( int  $questionId)

Reimplemented from ilAssQuestionFeedback.

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

150 : string
151 {
152 require_once 'Services/RTE/classes/class.ilRTE.php';
153
154 $res = $this->db->queryF(
155 "SELECT feedback FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
156 ['integer'],
157 [$questionId]
158 );
159
160 $allFeedbackContents = '';
161
162 while ($row = $this->db->fetchAssoc($res)) {
163 $allFeedbackContents .= ilRTE::_replaceMediaObjectImageSrc($row['feedback'] ?? '', 1);
164 }
165
166 return $allFeedbackContents;
167 }
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().

+ Here is the call graph for this function:

◆ getAnswerOptionsByAnswerIndex()

◆ getSpecificAnswerFeedbackContent()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackContent ( int  $questionId,
int  $questionIndex,
int  $answerIndex 
)

Reimplemented from ilAssQuestionFeedback.

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

126 : string
127 {
128 require_once 'Services/RTE/classes/class.ilRTE.php';
129
130 $res = $this->db->queryF(
131 "SELECT * FROM {$this->getSpecificFeedbackTableName()}
132 WHERE question_fi = %s AND question = %s AND answer = %s",
133 ['integer', 'integer', 'integer'],
134 [$questionId, $questionIndex, $answerIndex]
135 );
136
137 $feedbackContent = '';
138
139 if ($this->db->numRows($res) > 0) {
140 $row = $this->db->fetchAssoc($res);
141 $feedbackContent = ilRTE::_replaceMediaObjectImageSrc(
142 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($row['feedback'] ?? ''),
143 1
144 );
145 }
146
147 return $feedbackContent;
148 }

References $res, and ilRTE\_replaceMediaObjectImageSrc().

Referenced by getSpecificAnswerFeedbackExportPresentation(), ilAssClozeTestFeedback\getSpecificAnswerFeedbackFormValue(), 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  $questionId,
int  $questionIndex,
int  $answerIndex 
)

returns the generic feedback export presentation for given question id either for solution completed or incompleted

Reimplemented from ilAssQuestionFeedback.

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

362 : string
363 {
364 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
365 $specificAnswerFeedbackExportPresentation = $this->getPageObjectXML(
367 $this->getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
368 );
369 } else {
370 $specificAnswerFeedbackExportPresentation = $this->getSpecificAnswerFeedbackContent(
371 $questionId,
372 $questionIndex,
373 $answerIndex
374 );
375 }
376
377 return $specificAnswerFeedbackExportPresentation;
378 }
getSpecificAnswerFeedbackContent(int $questionId, int $questionIndex, int $answerIndex)
getSpecificAnswerFeedbackPageObjectId(int $questionId, int $questionIndex, int $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
getPageObjectXML(string $pageObjectType, int $pageObjectId)

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

Referenced by specificAnswerFeedbackExists().

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

◆ getSpecificAnswerFeedbackId()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackId ( int  $questionId,
int  $questionIndex,
int  $answerIndex 
)
finalprotected

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

287 : int
288 {
289 $res = $this->db->queryF(
290 "SELECT feedback_id FROM {$this->getSpecificFeedbackTableName()}
291 WHERE question_fi = %s AND question = %s AND answer = %s",
292 ['integer', 'integer', 'integer'],
293 [$questionId, $questionIndex, $answerIndex]
294 );
295
296 $row = $this->db->fetchAssoc($res);
297 return $row['feedback_id'] ?? -1;
298 }

References $res.

Referenced by getSpecificAnswerFeedbackPageObjectId(), and saveSpecificAnswerFeedbackContent().

+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackPageObjectId()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackPageObjectId ( int  $questionId,
int  $questionIndex,
int  $answerIndex 
)
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 351 of file class.ilAssMultiOptionQuestionFeedback.php.

351 : int
352 {
353 $pageObjectId = $this->getSpecificAnswerFeedbackId($questionId, $questionIndex, $answerIndex);
354
355 if ($pageObjectId === -1) {
356 $pageObjectId = $this->saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, '');
357 }
358
359 return $pageObjectId;
360 }
saveSpecificAnswerFeedbackContent(int $questionId, int $questionIndex, int $answerIndex, string $feedbackContent)
getSpecificAnswerFeedbackId(int $questionId, int $questionIndex, int $answerIndex)

References getSpecificAnswerFeedbackId(), and saveSpecificAnswerFeedbackContent().

Referenced by getSpecificAnswerFeedbackExportPresentation(), ilAssClozeTestFeedback\getSpecificAnswerFeedbackFormValue(), 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  $questionId,
int  $questionIndex,
int  $answerIndex 
)

returns the html of SPECIFIC feedback for the given question id and answer index for test presentation

Reimplemented from ilAssQuestionFeedback.

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

43 : string
44 {
45 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
46 return $this->cleanupPageContent(
49 $this->getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
50 )
51 );
52 }
54 $questionId,
55 $questionIndex,
56 $answerIndex
57 );
58 }
getPageObjectContent(string $pageObjectType, int $pageObjectId)

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

Referenced by ilAssClozeTestFeedback\determineTestOutputGapFeedback().

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

◆ getSpecificFeedbackContentForFeedbackIds()

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

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

305 : array
306 {
307 $res = $this->db->query(
308 "SELECT feedback_id, feedback FROM {$this->getSpecificFeedbackTableName()} WHERE "
309 . $this->db->in('feedback_id', $feedback_ids, false, ilDBConstants::T_INTEGER)
310 );
311
312 $content = [];
313 while ($row = $this->db->fetchAssoc($res)) {
314 $content[$row['feedback_id']] = $row['feedback'];
315 }
316 return $content;
317 }

References $res, and ilDBConstants\T_INTEGER.

Referenced by ilAssClozeTestFeedback\isSpecificAnswerFeedbackAvailable().

+ Here is the caller graph for this function:

◆ getSpecificFeedbackTableName()

ilAssMultiOptionQuestionFeedback::getSpecificFeedbackTableName ( )
finalprotected

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

331 : string
332 {
334 }
const TABLE_NAME_SPECIFIC_FEEDBACK
table name for specific feedback

References TABLE_NAME_SPECIFIC_FEEDBACK.

Referenced by duplicateSpecificFeedback(), saveSpecificAnswerFeedbackContent(), and syncSpecificFeedback().

+ Here is the caller graph for this function:

◆ importSpecificAnswerFeedback()

ilAssMultiOptionQuestionFeedback::importSpecificAnswerFeedback ( int  $questionId,
int  $questionIndex,
int  $answerIndex,
string  $feedbackContent 
)

Reimplemented from ilAssQuestionFeedback.

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

380 : void
381 {
382 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
383 $pageObjectId = $this->getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex);
384 $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
385
386 $this->createPageObject($pageObjectType, $pageObjectId, $feedbackContent);
387 } else {
388 $this->saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, $feedbackContent);
389 }
390 }
createPageObject(string $pageObjectType, int $pageObjectId, string $pageObjectContent)

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

92 : void
93 {
94 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
95 foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
96 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
99 $this->getSpecificAnswerFeedbackPageObjectId($this->questionOBJ->getId(), 0, $index)
100 );
101 } else {
102 $value = $this->questionOBJ->prepareTextareaOutput(
103 $this->getSpecificAnswerFeedbackContent($this->questionOBJ->getId(), 0, $index)
104 );
105 }
106
107 $form->getItemByPostVar("feedback_answer_$index")->setValue($value);
108 }
109 }
110 }
getPageObjectNonEditableValueHTML(string $pageObjectType, int $pageObjectId)
returns html content to be used as value for non editable value form properties in feedback editing f...
getItemByPostVar(string $a_post_var)

References $index, getAnswerOptionsByAnswerIndex(), ilPropertyFormGUI\getItemByPostVar(), ilAssQuestionFeedback\getPageObjectNonEditableValueHTML(), getSpecificAnswerFeedbackContent(), getSpecificAnswerFeedbackPageObjectId(), and ilAssQuestionFeedback\getSpecificAnswerFeedbackPageObjectType().

+ Here is the call graph for this function:

◆ isSpecificAnswerFeedbackId()

ilAssMultiOptionQuestionFeedback::isSpecificAnswerFeedbackId ( int  $feedbackId)
protected

Reimplemented from ilAssQuestionFeedback.

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

319 : bool
320 {
321 $row = $this->db->fetchAssoc($this->db->queryF(
322 "SELECT COUNT(feedback_id) cnt FROM {$this->getSpecificFeedbackTableName()}
323 WHERE question_fi = %s AND feedback_id = %s",
324 ['integer', 'integer'],
325 [$this->questionOBJ->getId(), $feedbackId]
326 ));
327
328 return (bool) $row['cnt'];
329 }

◆ saveSpecificAnswerFeedbackContent()

ilAssMultiOptionQuestionFeedback::saveSpecificAnswerFeedbackContent ( int  $questionId,
int  $questionIndex,
int  $answerIndex,
string  $feedbackContent 
)

Reimplemented from ilAssQuestionFeedback.

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

169 : int
170 {
171 if ($feedbackContent !== '') {
172 $feedbackContent = ilRTE::_replaceMediaObjectImageSrc(
173 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedbackContent),
174 0
175 );
176 }
177
178 $feedbackId = $this->getSpecificAnswerFeedbackId($questionId, $questionIndex, $answerIndex);
179
180 if ($feedbackId !== -1) {
181 $this->db->update(
183 [
184 'feedback' => ['text', $feedbackContent],
185 'tstamp' => ['integer', time()]
186 ],
187 [
188 'feedback_id' => ['integer', $feedbackId],
189 ]
190 );
191 } else {
192 $feedbackId = $this->db->nextId($this->getSpecificFeedbackTableName());
193
194 $this->db->insert($this->getSpecificFeedbackTableName(), [
195 'feedback_id' => ['integer', $feedbackId],
196 'question_fi' => ['integer', $questionId],
197 'question' => ['integer', $questionIndex],
198 'answer' => ['integer', $answerIndex],
199 'feedback' => ['text', $feedbackContent],
200 'tstamp' => ['integer', time()]
201 ]);
202 }
203
204 return $feedbackId;
205 }

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

112 : void
113 {
114 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
115 foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
117 $this->questionOBJ->getId(),
118 0,
119 $index,
120 (string) ($form->getInput("feedback_answer_$index") ?? '')
121 );
122 }
123 }
124 }
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 $index, getAnswerOptionsByAnswerIndex(), ilPropertyFormGUI\getInput(), and saveSpecificAnswerFeedbackContent().

+ Here is the call graph for this function:

◆ specificAnswerFeedbackExists()

ilAssMultiOptionQuestionFeedback::specificAnswerFeedbackExists ( )

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

392 : bool
393 {
394 $res = $this->db->queryF(
395 "SELECT answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
396 ['integer'],
397 [$this->questionOBJ->getId()]
398 );
399
400 $allFeedbackContents = '';
401
402 while ($row = $this->db->fetchAssoc($res)) {
403 $allFeedbackContents .= $this->getSpecificAnswerFeedbackExportPresentation(
404 $this->questionOBJ->getId(),
405 0,
406 $row['answer']
407 );
408 }
409
410 return (bool) strlen(trim(strip_tags($allFeedbackContents)));
411 }
getSpecificAnswerFeedbackExportPresentation(int $questionId, int $questionIndex, int $answerIndex)
returns the generic feedback export presentation for given question id either for solution completed ...

References $res, and getSpecificAnswerFeedbackExportPresentation().

+ Here is the call graph for this function:

◆ syncSpecificFeedback()

ilAssMultiOptionQuestionFeedback::syncSpecificFeedback ( int  $originalQuestionId,
int  $duplicateQuestionId 
)
protected

syncs the SPECIFIC feedback from a duplicated question back to the original question

Reimplemented from ilAssQuestionFeedback.

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

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

256 : void
257 {
258 // delete specific feedback of the original
259 $this->db->manipulateF(
260 "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
261 ['integer'],
262 [$originalQuestionId]
263 );
264
265 // get specific feedback of the actual question
266 $res = $this->db->queryF(
267 "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
268 ['integer'],
269 [$duplicateQuestionId]
270 );
271
272 // save specific feedback to the original
273 while ($row = $this->db->fetchAssoc($res)) {
274 $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
275
276 $this->db->insert($this->getSpecificFeedbackTableName(), [
277 'feedback_id' => ['integer', $nextId],
278 'question_fi' => ['integer', $originalQuestionId],
279 'question' => ['integer', $row['question']],
280 'answer' => ['integer', $row['answer']],
281 'feedback' => ['text', $row['feedback']],
282 'tstamp' => ['integer', time()]
283 ]);
284 }
285 }

References $res, and getSpecificFeedbackTableName().

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