ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAssMultiOptionQuestionFeedback Class Reference
+ Inheritance diagram for ilAssMultiOptionQuestionFeedback:
+ Collaboration diagram for ilAssMultiOptionQuestionFeedback:

Public Member Functions

 getSpecificAnswerFeedbackTestPresentation ($questionId, $questionIndex, $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 ($questionId, $questionIndex, $answerIndex)
 returns the SPECIFIC answer feedback content for a given question id and answer index. More...
 
 getAllSpecificAnswerFeedbackContents ($questionId)
 returns the SPECIFIC feedback content for a given question id and answer index. More...
 
 saveSpecificAnswerFeedbackContent ($questionId, $questionIndex, $answerIndex, $feedbackContent)
 saves SPECIFIC answer feedback content for the given question id and answer index to the database. More...
 
 deleteSpecificAnswerFeedbacks ($questionId, $isAdditionalContentEditingModePageObject)
 deletes all SPECIFIC answer feedback contents (and page objects if required) for the given question id More...
 
 getAnswerOptionsByAnswerIndex ()
 returns the answer options mapped by answer index (can be overwritten by concrete question type class) More...
 
 getSpecificAnswerFeedbackExportPresentation ($questionId, $questionIndex, $answerIndex)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 importSpecificAnswerFeedback ($questionId, $questionIndex, $answerIndex, $feedbackContent)
 imports the given feedback content as specific feedback for the given question id and answer index More...
 
 specificAnswerFeedbackExists ()
 
- Public Member Functions inherited from ilAssQuestionFeedback
 __construct (assQuestion $questionOBJ, ilCtrl $ctrl, ilDBInterface $db, ilLanguage $lng)
 constructor More...
 
 getGenericFeedbackTestPresentation ($questionId, $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 ($questionId, $questionIndex, $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 ($questionId, $solutionCompleted)
 returns the GENERIC feedback content for a given question state. More...
 
 getSpecificAnswerFeedbackContent ($questionId, $questionIndex, $answerIndex)
 returns the SPECIFIC feedback content for a given question id and answer index. More...
 
 getAllSpecificAnswerFeedbackContents ($questionId)
 returns the SPECIFIC feedback content for a given question id and answer index. More...
 
 isSpecificAnswerFeedbackAvailable ($questionId)
 returns the fact wether any specific feedback content is available or not More...
 
 saveGenericFeedbackContent ($questionId, $solutionCompleted, $feedbackContent)
 saves GENERIC feedback content for the given question id to the database. More...
 
 saveSpecificAnswerFeedbackContent ($questionId, $questionIndex, $answerIndex, $feedbackContent)
 saves SPECIFIC feedback content for the given question id and answer index to the database. More...
 
 deleteGenericFeedbacks ($questionId, $isAdditionalContentEditingModePageObject)
 deletes all GENERIC feedback contents (and page objects if required) for the given question id More...
 
 deleteSpecificAnswerFeedbacks ($questionId, $isAdditionalContentEditingModePageObject)
 deletes all SPECIFIC feedback contents for the given question id More...
 
 duplicateFeedback ($originalQuestionId, $duplicateQuestionId)
 duplicates the feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 syncFeedback ($originalQuestionId, $duplicateQuestionId)
 syncs the feedback from a duplicated question back to the original question More...
 
 checkFeedbackParent ($feedbackId)
 
 getClassNameByType ($a_type, $a_gui=false)
 Get class name by type. More...
 
 setPageObjectOutputMode ($a_val)
 Set page object output mode. More...
 
 getPageObjectOutputMode ()
 Get page object output mode. More...
 
 getGenericFeedbackExportPresentation ($questionId, $solutionCompleted)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 getSpecificAnswerFeedbackExportPresentation ($questionId, $questionIndex, $answerIndex)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 importGenericFeedback ($questionId, $solutionCompleted, $feedbackContent)
 imports the given feedback content as generic feedback for the given question id for either the complete or incomplete solution More...
 
 importSpecificAnswerFeedback ($questionId, $questionIndex, $answerIndex, $feedbackContent)
 imports the given feedback content as specific feedback for the given question id and answer index More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator, $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'
 table name for specific feedback More...
 

Protected Member Functions

 duplicateSpecificFeedback ($originalQuestionId, $duplicateQuestionId)
 duplicates the SPECIFIC feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 syncSpecificFeedback ($originalQuestionId, $duplicateQuestionId)
 syncs the SPECIFIC feedback from a duplicated question back to the original question More...
 
 getSpecificAnswerFeedbackId ($questionId, $questionIndex, $answerIndex)
 returns the SPECIFIC answer feedback ID for a given question id and answer index. More...
 
 getSpecificFeedbackContentForFeedbackIds (array $feedback_ids)
 
 isSpecificAnswerFeedbackId ($feedbackId)
 
 getSpecificFeedbackTableName ()
 returns the table name for specific feedback More...
 
 buildAnswerOptionLabel ($index, $answer)
 builds an answer option label from given (mixed type) index and answer (can be overwritten by concrete question types) More...
 
 getSpecificAnswerFeedbackPageObjectId ($questionId, $questionIndex, $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 ($label, $postVar, $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 ($originalQuestionId, $duplicateQuestionId)
 duplicates the SPECIFIC feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 getGenericFeedbackId ($questionId, $solutionCompleted)
 returns the SPECIFIC answer feedback ID for a given question id and answer index. More...
 
 isGenericFeedbackId ($feedbackId)
 
 isSpecificAnswerFeedbackId ($feedbackId)
 
 syncSpecificFeedback ($originalQuestionId, $duplicateQuestionId)
 syncs the SPECIFIC feedback from a duplicated question back to the original question More...
 
 getGenericFeedbackTableName ()
 returns the table name for specific feedback More...
 
 getPageObjectNonEditableValueHTML ($pageObjectType, $pageObjectId)
 returns html content to be used as value for non editable value form properties in feedback editing form More...
 
 getPageObjectContent ($pageObjectType, $pageObjectId)
 returns the content of page object with given type and id More...
 
 getPageObjectXML ($pageObjectType, $pageObjectId)
 returns the xml of page object with given type and id More...
 
 createPageObject ($pageObjectType, $pageObjectId, $pageObjectContent)
 creates a new page object with given page object id and page object type and passed page object content More...
 
 duplicatePageObject ($pageObjectType, $originalPageObjectId, $duplicatePageObjectId, $duplicatePageObjectParentId)
 duplicates the page object with given type and original id to new page object with same type and given duplicate id and duplicate parent id More...
 
 ensurePageObjectDeleted ($pageObjectType, $pageObjectId)
 ensures a no more existing page object for given type and id More...
 
 getGenericFeedbackPageObjectType ()
 returns the type for generic feedback page objects defined in local constant More...
 
 getSpecificAnswerFeedbackPageObjectType ()
 returns the type for specific feedback page objects defined in local constant More...
 
 getGenericFeedbackPageObjectId ($questionId, $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...
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

◆ buildAnswerOptionLabel()

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

builds an answer option label from given (mixed type) index and answer (can be overwritten by concrete question types)

@access protected

Parameters
integer$index
mixed$answer
Returns
string $answerOptionLabel

Reimplemented in ilAssErrorTextFeedback, ilAssImagemapQuestionFeedback, ilAssKprimChoiceFeedback, ilAssMatchingQuestionFeedback, ilAssMultipleChoiceFeedback, ilAssOrderingHorizontalFeedback, ilAssSingleChoiceFeedback, ilAssTextQuestionFeedback, ilAssLongMenuFeedback, and ilAssOrderingQuestionFeedback.

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

426 {
427 return $answer->getAnswertext();
428 }

Referenced by ilAssConfigurableMultiOptionQuestionFeedback\completeSpecificFormProperties(), and completeSpecificFormProperties().

+ Here is the caller graph for this function:

◆ completeSpecificFormProperties()

ilAssMultiOptionQuestionFeedback::completeSpecificFormProperties ( ilPropertyFormGUI  $form)

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

@access public

Parameters
ilPropertyFormGUI$form

Reimplemented from ilAssQuestionFeedback.

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

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

60 {
61 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
62 $header = new ilFormSectionHeaderGUI();
63 $header->setTitle($this->lng->txt('feedback_answers'));
64 $form->addItem($header);
65
66 foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
67 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
68 $this->buildAnswerOptionLabel($index, $answer),
69 true
70 );
71
72 $propertyPostVar = "feedback_answer_$index";
73
75 $propertyLabel,
76 $propertyPostVar,
77 $this->questionOBJ->isAdditionalContentEditingModePageObject()
78 ));
79 }
80 }
81 }
getAnswerOptionsByAnswerIndex()
returns the answer options mapped by answer index (can be overwritten by concrete question type class...
buildAnswerOptionLabel($index, $answer)
builds an answer option label from given (mixed type) index and answer (can be overwritten by concret...
buildFeedbackContentFormProperty($label, $postVar, $asNonEditable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
This class represents a section header in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
$index
Definition: metadata.php:128

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

+ Here is the call graph for this function:

◆ deleteSpecificAnswerFeedbacks()

ilAssMultiOptionQuestionFeedback::deleteSpecificAnswerFeedbacks (   $questionId,
  $isAdditionalContentEditingModePageObject 
)

deletes all SPECIFIC answer feedback contents (and page objects if required) for the given question id

@access public

Parameters
integer$questionId
boolean$isAdditionalContentEditingModePageObject

Reimplemented from ilAssQuestionFeedback.

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

245 {
246 if ($isAdditionalContentEditingModePageObject) {
247 require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssSpecificFeedbackIdentifierList.php';
248 $feedbackIdentifiers = new ilAssSpecificFeedbackIdentifierList();
249 $feedbackIdentifiers->load($questionId);
250
251 foreach ($feedbackIdentifiers as $identifier) {
254 $identifier->getFeedbackId()
255 );
256 }
257 }
258
259 $this->db->manipulateF(
260 "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
261 array('integer'),
262 array($questionId)
263 );
264 }
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
ensurePageObjectDeleted($pageObjectType, $pageObjectId)
ensures a no more existing page object for given type and id

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

+ Here is the call graph for this function:

◆ duplicateSpecificFeedback()

ilAssMultiOptionQuestionFeedback::duplicateSpecificFeedback (   $originalQuestionId,
  $duplicateQuestionId 
)
protected

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

@access protected

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Reimplemented from ilAssQuestionFeedback.

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

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

275 {
276 $res = $this->db->queryF(
277 "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
278 array('integer'),
279 array($originalQuestionId)
280 );
281
282 while ($row = $this->db->fetchAssoc($res)) {
283 $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
284
285 $this->db->insert($this->getSpecificFeedbackTableName(), array(
286 'feedback_id' => array('integer', $nextId),
287 'question_fi' => array('integer', $duplicateQuestionId),
288 'question' => array('integer', $row['question']),
289 'answer' => array('integer', $row['answer']),
290 'feedback' => array('text', $row['feedback']),
291 'tstamp' => array('integer', time())
292 ));
293
294 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
295 $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
296 $this->duplicatePageObject($pageObjectType, $row['feedback_id'], $nextId, $duplicateQuestionId);
297 }
298 }
299 }
getSpecificFeedbackTableName()
returns the table name for specific feedback
duplicatePageObject($pageObjectType, $originalPageObjectId, $duplicatePageObjectId, $duplicatePageObjectParentId)
duplicates the page object with given type and original id to new page object with same type and give...
foreach($_POST as $key=> $value) $res

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

+ Here is the call graph for this function:

◆ getAllSpecificAnswerFeedbackContents()

ilAssMultiOptionQuestionFeedback::getAllSpecificAnswerFeedbackContents (   $questionId)

returns the SPECIFIC feedback content for a given question id and answer index.

@abstract @access public

Parameters
integer$questionId
Returns
string $feedbackContent

Reimplemented from ilAssQuestionFeedback.

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

171 {
172 require_once 'Services/RTE/classes/class.ilRTE.php';
173
174 $res = $this->db->queryF(
175 "SELECT feedback FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
176 array('integer'),
177 array($questionId)
178 );
179
180 $allFeedbackContents = '';
181
182 while ($row = $this->db->fetchAssoc($res)) {
183 $allFeedbackContents .= ilRTE::_replaceMediaObjectImageSrc($row['feedback'], 1);
184 }
185
186 return $allFeedbackContents;
187 }
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
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:

◆ getAnswerOptionsByAnswerIndex()

ilAssMultiOptionQuestionFeedback::getAnswerOptionsByAnswerIndex ( )

returns the answer options mapped by answer index (can be overwritten by concrete question type class)

Returns
array $answerOptionsByAnswerIndex

Reimplemented in ilAssErrorTextFeedback, ilAssLongMenuFeedback, ilAssMatchingQuestionFeedback, ilAssOrderingHorizontalFeedback, and ilAssOrderingQuestionFeedback.

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

412 {
413 return $this->questionOBJ->getAnswers();
414 }

Referenced by ilAssConfigurableMultiOptionQuestionFeedback\completeSpecificFormProperties(), completeSpecificFormProperties(), ilAssConfigurableMultiOptionQuestionFeedback\initSpecificFormProperties(), initSpecificFormProperties(), ilAssConfigurableMultiOptionQuestionFeedback\saveSpecificFormProperties(), and saveSpecificFormProperties().

+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackContent()

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

returns the SPECIFIC answer feedback content for a given question id and answer index.

@access public

Parameters
integer$questionId
integer$questionIndex
integer$answerIndex
Returns
string $feedbackContent

Reimplemented from ilAssQuestionFeedback.

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

141 {
142 require_once 'Services/RTE/classes/class.ilRTE.php';
143
144 $res = $this->db->queryF(
145 "SELECT * FROM {$this->getSpecificFeedbackTableName()}
146 WHERE question_fi = %s AND question = %s AND answer = %s",
147 array('integer','integer','integer'),
148 array($questionId, $questionIndex, $answerIndex)
149 );
150
151 $feedbackContent = '';
152 while ($row = $this->db->fetchAssoc($res)) {
153 if (array_key_exists('feedback', $row) && $row['feedback'] !== null) {
154 $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($this->questionOBJ->getHtmlQuestionContentPurifier()->purify($row['feedback']), 1);
155 break;
156 }
157 }
158
159 return $feedbackContent;
160 }

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 (   $questionId,
  $questionIndex,
  $answerIndex 
)

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

@access public

Parameters
integer$questionId
integer$questionIndex
integer$answerIndex
Returns
string $specificAnswerFeedbackExportPresentation

Reimplemented from ilAssQuestionFeedback.

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

464 {
465 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
466 $specificAnswerFeedbackExportPresentation = $this->getPageObjectXML(
468 $this->getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
469 );
470 } else {
471 $specificAnswerFeedbackExportPresentation = $this->getSpecificAnswerFeedbackContent(
472 $questionId,
473 $questionIndex,
474 $answerIndex
475 );
476 }
477
478 return $specificAnswerFeedbackExportPresentation;
479 }
getSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex)
returns the SPECIFIC answer feedback content for a given question id and answer index.
getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
getPageObjectXML($pageObjectType, $pageObjectId)
returns the xml of page object with given type and id

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

+ Here is the call graph for this function:

◆ getSpecificAnswerFeedbackId()

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

returns the SPECIFIC answer feedback ID for a given question id and answer index.

@final @access protected

Parameters
integer$questionId
boolean$answerIndex
Returns
string $feedbackId

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

349 {
350 $res = $this->db->queryF(
351 "SELECT feedback_id FROM {$this->getSpecificFeedbackTableName()}
352 WHERE question_fi = %s AND question = %s AND answer = %s",
353 array('integer','integer','integer'),
354 array($questionId, $questionIndex, $answerIndex)
355 );
356 $row = $this->db->fetchAssoc($res);
357 return $row['feedback_id'] ?? null;
358 }

References $res.

Referenced by getSpecificAnswerFeedbackPageObjectId(), and saveSpecificAnswerFeedbackContent().

+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackPageObjectId()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackPageObjectId (   $questionId,
  $questionIndex,
  $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)

@final @access protected

Parameters
integer$questionId
integer$questionIndex
integer$answerIndex
Returns
integer $pageObjectId

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

443 {
444 $pageObjectId = $this->getSpecificAnswerFeedbackId($questionId, $questionIndex, $answerIndex);
445
446 if (!$pageObjectId) {
447 $pageObjectId = $this->saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, null);
448 }
449
450 return $pageObjectId;
451 }
getSpecificAnswerFeedbackId($questionId, $questionIndex, $answerIndex)
returns the SPECIFIC answer feedback ID for a given question id and answer index.
saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, $feedbackContent)
saves SPECIFIC answer feedback content for the given question id and answer index to the database.

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 (   $questionId,
  $questionIndex,
  $answerIndex 
)

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

@access public

Parameters
integer$questionId
integer$questionIndex
integer$answerIndex
Returns
string $specificAnswerFeedbackTestPresentationHTML

Reimplemented from ilAssQuestionFeedback.

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

35 {
36 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
37 $specificAnswerFeedbackTestPresentationHTML = $this->getPageObjectContent(
39 $this->getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
40 );
41 } else {
42 $specificAnswerFeedbackTestPresentationHTML = $this->getSpecificAnswerFeedbackContent(
43 $questionId,
44 $questionIndex,
45 $answerIndex
46 );
47 }
48
49 return $specificAnswerFeedbackTestPresentationHTML;
50 }
getPageObjectContent($pageObjectType, $pageObjectId)
returns the content of page object with given type and id

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

364 : array
365 {
366 $res = $this->db->query(
367 "SELECT feedback_id, feedback FROM {$this->getSpecificFeedbackTableName()} WHERE "
368 . $this->db->in('feedback_id', $feedback_ids, false, ilDBConstants::T_INTEGER)
369 );
370
371 $content = [];
372 while ($row = $this->db->fetchAssoc($res)) {
373 $content[$row['feedback_id']] = $row['feedback'];
374 }
375 return $content;
376 }

References $res, and ilDBConstants\T_INTEGER.

Referenced by ilAssClozeTestFeedback\isSpecificAnswerFeedbackAvailable().

+ Here is the caller graph for this function:

◆ getSpecificFeedbackTableName()

ilAssMultiOptionQuestionFeedback::getSpecificFeedbackTableName ( )
finalprotected

returns the table name for specific feedback

@final

Returns
string $specificFeedbackTableName

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

401 {
403 }
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 (   $questionId,
  $questionIndex,
  $answerIndex,
  $feedbackContent 
)

imports the given feedback content as specific feedback for the given question id and answer index

@access public

Parameters
integer$questionId
integer$questionIndex
integer$answerIndex
string$feedbackContent

Reimplemented from ilAssQuestionFeedback.

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

492 {
493 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
494 $pageObjectId = $this->getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex);
495 $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
496
497 $this->createPageObject($pageObjectType, $pageObjectId, $feedbackContent);
498 } else {
499 $this->saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, $feedbackContent);
500 }
501 }
createPageObject($pageObjectType, $pageObjectId, $pageObjectContent)
creates a new page object with given page object id and page object type and passed page object conte...

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

@access public

Parameters
ilPropertyFormGUI$form

Reimplemented from ilAssQuestionFeedback.

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

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

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

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

+ Here is the call graph for this function:

◆ isSpecificAnswerFeedbackId()

ilAssMultiOptionQuestionFeedback::isSpecificAnswerFeedbackId (   $feedbackId)
protected
Parameters
int$feedbackId
Returns
bool

Reimplemented from ilAssQuestionFeedback.

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

382 : bool
383 {
384 $row = $this->db->fetchAssoc($this->db->queryF(
385 "SELECT COUNT(feedback_id) cnt FROM {$this->getSpecificFeedbackTableName()}
386 WHERE question_fi = %s AND feedback_id = %s",
387 array('integer' ,'integer'),
388 array($this->questionOBJ->getId(), $feedbackId)
389 ));
390
391 return (bool) $row['cnt'];
392 }

◆ saveSpecificAnswerFeedbackContent()

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

saves SPECIFIC answer feedback content for the given question id and answer index to the database.

@access public

Parameters
integer$questionId
integer$questionIndex
integer$answerIndex
string$feedbackContent
Returns
integer $feedbackId

Reimplemented from ilAssQuestionFeedback.

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

200 {
201 require_once 'Services/RTE/classes/class.ilRTE.php';
202
203 if (strlen($feedbackContent)) {
204 $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedbackContent), 0);
205 }
206
207 $feedbackId = $this->getSpecificAnswerFeedbackId($questionId, $questionIndex, $answerIndex);
208
209 if ($feedbackId) {
210 $this->db->update(
212 array(
213 'feedback' => array('text', $feedbackContent),
214 'tstamp' => array('integer', time())
215 ),
216 array(
217 'feedback_id' => array('integer', $feedbackId),
218 )
219 );
220 } else {
221 $feedbackId = $this->db->nextId($this->getSpecificFeedbackTableName());
222
223 $this->db->insert($this->getSpecificFeedbackTableName(), array(
224 'feedback_id' => array('integer', $feedbackId),
225 'question_fi' => array('integer', $questionId),
226 'question' => array('integer', $questionIndex),
227 'answer' => array('integer', $answerIndex),
228 'feedback' => array('text', $feedbackContent),
229 'tstamp' => array('integer', time())
230 ));
231 }
232
233 return $feedbackId;
234 }

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

@access public

Parameters
ilPropertyFormGUI$form

Reimplemented from ilAssQuestionFeedback.

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

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

118 {
119 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
120 foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
122 $this->questionOBJ->getId(),
123 0,
124 $index,
125 $form->getInput("feedback_answer_$index")
126 );
127 }
128 }
129 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

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

+ Here is the call graph for this function:

◆ specificAnswerFeedbackExists()

ilAssMultiOptionQuestionFeedback::specificAnswerFeedbackExists ( )

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

504 {
505 return (bool) strlen(
506 $this->getAllSpecificAnswerFeedbackContents($this->questionOBJ->getId())
507 );
508 }
getAllSpecificAnswerFeedbackContents($questionId)
returns the SPECIFIC feedback content for a given question id and answer index.

References getAllSpecificAnswerFeedbackContents().

+ Here is the call graph for this function:

◆ syncSpecificFeedback()

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

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

@access protected

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Reimplemented from ilAssQuestionFeedback.

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

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

309 {
310 // delete specific feedback of the original
311 $this->db->manipulateF(
312 "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
313 array('integer'),
314 array($originalQuestionId)
315 );
316
317 // get specific feedback of the actual question
318 $res = $this->db->queryF(
319 "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
320 array('integer'),
321 array($duplicateQuestionId)
322 );
323
324 // save specific feedback to the original
325 while ($row = $this->db->fetchAssoc($res)) {
326 $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
327
328 $this->db->insert($this->getSpecificFeedbackTableName(), array(
329 'feedback_id' => array('integer', $nextId),
330 'question_fi' => array('integer', $originalQuestionId),
331 'question' => array('integer',$row['question']),
332 'answer' => array('integer',$row['answer']),
333 'feedback' => array('text',$row['feedback']),
334 'tstamp' => array('integer',time())
335 ));
336 }
337 }

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: