ILIAS  trunk Revision v5.2.0beta1-34132-g2d4d73d4a0
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)
 
 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)
 
 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...
 
 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 $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)
 

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 $original_question_id, int $duplicate_question_id)
 
 syncSpecificFeedback (int $original_question_id, int $duplicate_question_id)
 
 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...
 
 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 $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)
 
 syncSpecificFeedback (int $originalQuestionId, int $duplicateQuestionId)
 syncs the SPECIFIC feedback from a duplicated question back to the original question More...
 
 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...
 
 getPageObjectContent (string $page_object_type, int $page_object_id)
 
 getPageObjectXML (string $page_object_type, int $page_object_id)
 
 createPageObject (string $page_object_type, int $page_object_id, string $page_object_content)
 
 duplicatePageObject (string $page_object_type, int $original_page_object_id, int $duplicate_page_object_id, int $duplicate_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

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

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

350  : string
351  {
352  return $answer->getAnswertext();
353  }
+ 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

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

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

61  : void
62  {
63  if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
64  $header = new ilFormSectionHeaderGUI();
65  $header->setTitle($this->lng->txt('feedback_answers'));
66  $form->addItem($header);
67 
68  foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
70  $this->buildAnswerOptionLabel($index, $answer),
71  true
72  );
73 
74  $propertyPostVar = "feedback_answer_$index";
75 
77  $propertyLabel,
78  $propertyPostVar,
79  $this->questionOBJ->isAdditionalContentEditingModePageObject()
80  ));
81  }
82  }
83  }
buildFeedbackContentFormProperty(string $label, string $post_var, bool $as_non_editable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:

◆ deleteSpecificAnswerFeedbacks()

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

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

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

217  : void
218  {
219  if ($is_additional_content_editing_mode_page_object) {
220  $feedback_identifiers = new ilAssSpecificFeedbackIdentifierList();
221  $feedback_identifiers->load($question_id);
222 
223  foreach ($feedback_identifiers as $identifier) {
226  $identifier->getFeedbackId()
227  );
228  }
229  }
230 
231  $this->db->manipulateF(
232  "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
233  ['integer'],
234  [$question_id]
235  );
236  }
ensurePageObjectDeleted(string $page_object_type, int $page_object_id)
+ Here is the call graph for this function:

◆ duplicateSpecificFeedback()

ilAssMultiOptionQuestionFeedback::duplicateSpecificFeedback ( int  $original_question_id,
int  $duplicate_question_id 
)
protected

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

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

238  : void
239  {
240  $res = $this->db->queryF(
241  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
242  ['integer'],
243  [$original_question_id]
244  );
245 
246  while ($row = $this->db->fetchAssoc($res)) {
247  $next_id = $this->db->nextId($this->getSpecificFeedbackTableName());
248 
249  $this->db->insert($this->getSpecificFeedbackTableName(), [
250  'feedback_id' => ['integer', $next_id],
251  'question_fi' => ['integer', $duplicate_question_id],
252  'question' => ['integer', $row['question']],
253  'answer' => ['integer', $row['answer']],
254  'feedback' => ['text', $row['feedback']],
255  'tstamp' => ['integer', time()]
256  ]);
257 
258  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
259  $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
260  $this->duplicatePageObject($pageObjectType, $row['feedback_id'], $next_id, $duplicate_question_id);
261  }
262  }
263  }
$res
Definition: ltiservices.php:67
duplicatePageObject(string $page_object_type, int $original_page_object_id, int $duplicate_page_object_id, int $duplicate_page_object_parent_id)
+ Here is the call graph for this function:

◆ getAllSpecificAnswerFeedbackContents()

ilAssMultiOptionQuestionFeedback::getAllSpecificAnswerFeedbackContents ( int  $question_id)

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

References $res, and ilRTE\_replaceMediaObjectImageSrc().

Referenced by specificAnswerFeedbackExists().

145  : string
146  {
147  $res = $this->db->queryF(
148  "SELECT feedback FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
149  ['integer'],
150  [$question_id]
151  );
152 
153  $allFeedbackContents = '';
154 
155  while ($row = $this->db->fetchAssoc($res)) {
156  $allFeedbackContents .= ilRTE::_replaceMediaObjectImageSrc($row['feedback'] ?? '', 1);
157  }
158 
159  return $allFeedbackContents;
160  }
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...
$res
Definition: ltiservices.php:67
+ 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 162 of file class.ilAssMultiOptionQuestionFeedback.php.

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

Referenced by specificAnswerFeedbackExists().

162  : string
163  {
164  $feedback_identifiers = new ilAssSpecificFeedbackIdentifierList();
165  $feedback_identifiers->load($question_id);
166 
167  $all_feedback_content = '';
168  foreach ($feedback_identifiers as $identifier) {
169  $feedback_content = $this->getPageObjectContent(
171  $identifier->getFeedbackId()
172  );
173  $all_feedback_content .= $this->cleanupPageContent($feedback_content);
174  }
175 
176  return $all_feedback_content;
177  }
getPageObjectContent(string $page_object_type, int $page_object_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAnswerOptionsByAnswerIndex()

ilAssMultiOptionQuestionFeedback::getAnswerOptionsByAnswerIndex ( )

◆ getSpecificAnswerFeedbackContent()

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

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

References $res, and ilRTE\_replaceMediaObjectImageSrc().

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

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

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

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

371  : string
372  {
373  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
374  return $this->getPageObjectXML(
376  $this->getSpecificAnswerFeedbackPageObjectId($question_id, $question_index, $answer_index)
377  );
378  }
379 
380  return $this->getSpecificAnswerFeedbackContent(
381  $question_id,
382  $question_index,
383  $answer_index
384  );
385  }
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)
getSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index)
+ Here is the call graph for this function:

◆ getSpecificAnswerFeedbackId()

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

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

References $res.

Referenced by getSpecificAnswerFeedbackPageObjectId(), and saveSpecificAnswerFeedbackContent().

296  : int
297  {
298  $res = $this->db->queryF(
299  "SELECT feedback_id FROM {$this->getSpecificFeedbackTableName()}
300  WHERE question_fi = %s AND question = %s AND answer = %s",
301  ['integer', 'integer', 'integer'],
302  [$question_id, $question_index, $answer_index]
303  );
304 
305  $row = $this->db->fetchAssoc($res);
306  return $row['feedback_id'] ?? -1;
307  }
$res
Definition: ltiservices.php:67
+ 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 360 of file class.ilAssMultiOptionQuestionFeedback.php.

References getSpecificAnswerFeedbackId(), and saveSpecificAnswerFeedbackContent().

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

360  : int
361  {
362  $page_object_id = $this->getSpecificAnswerFeedbackId($question_id, $question_index, $answer_index);
363 
364  if ($page_object_id === -1) {
365  $page_object_id = $this->saveSpecificAnswerFeedbackContent($question_id, $question_index, $answer_index, '');
366  }
367 
368  return $page_object_id;
369  }
getSpecificAnswerFeedbackId(int $question_id, int $question_index, int $answer_index)
saveSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index, string $feedback_content)
+ 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

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

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

Referenced by ilAssClozeTestFeedback\determineTestOutputGapFeedback().

41  : string
42  {
43  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
44  return $this->getPageObjectContent(
46  $this->getSpecificAnswerFeedbackPageObjectId($question_id, $question_index, $answer_index)
47  );
48  }
49 
51  $question_id,
52  $question_index,
53  $answer_index
54  );
55  }
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 ...
getPageObjectContent(string $page_object_type, int $page_object_id)
getSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index)
+ 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 314 of file class.ilAssMultiOptionQuestionFeedback.php.

References $res, and ilDBConstants\T_INTEGER.

Referenced by ilAssClozeTestFeedback\isSpecificAnswerFeedbackAvailable().

314  : array
315  {
316  $res = $this->db->query(
317  "SELECT feedback_id, feedback FROM {$this->getSpecificFeedbackTableName()} WHERE "
318  . $this->db->in('feedback_id', $feedback_ids, false, ilDBConstants::T_INTEGER)
319  );
320 
321  $content = [];
322  while($row = $this->db->fetchAssoc($res)) {
323  $content[$row['feedback_id']] = $row['feedback'];
324  }
325  return $content;
326  }
$res
Definition: ltiservices.php:67
+ Here is the caller graph for this function:

◆ getSpecificFeedbackTableName()

ilAssMultiOptionQuestionFeedback::getSpecificFeedbackTableName ( )
finalprotected

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

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

340  : string
341  {
342  return self::TABLE_NAME_SPECIFIC_FEEDBACK;
343  }
+ Here is the caller graph for this function:

◆ importSpecificAnswerFeedback()

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

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

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

387  : void
388  {
389  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
390  $page_object_id = $this->getSpecificAnswerFeedbackPageObjectId($question_id, $question_index, $answer_index);
391  $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
392 
393  $this->createPageObject($pageObjectType, $page_object_id, $feedback_content);
394  } else {
395  $this->saveSpecificAnswerFeedbackContent($question_id, $question_index, $answer_index, $feedback_content);
396  }
397  }
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 ...
createPageObject(string $page_object_type, int $page_object_id, string $page_object_content)
saveSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index, string $feedback_content)
+ 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

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

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

89  : void
90  {
91  if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
92  foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
93  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
94  $value = $this->getPageObjectNonEditableValueHTML(
96  $this->getSpecificAnswerFeedbackPageObjectId($this->questionOBJ->getId(), 0, $index)
97  );
98  } else {
100  $this->getSpecificAnswerFeedbackContent($this->questionOBJ->getId(), 0, $index)
101  );
102  }
103 
104  $form->getItemByPostVar("feedback_answer_$index")->setValue($value);
105  }
106  }
107  }
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 ...
getItemByPostVar(string $a_post_var)
getSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index)
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...
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...
+ Here is the call graph for this function:

◆ isSpecificAnswerFeedbackId()

ilAssMultiOptionQuestionFeedback::isSpecificAnswerFeedbackId ( int  $feedback_id)
protected

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

328  : bool
329  {
330  $row = $this->db->fetchAssoc($this->db->queryF(
331  "SELECT COUNT(feedback_id) cnt FROM {$this->getSpecificFeedbackTableName()}
332  WHERE question_fi = %s AND feedback_id = %s",
333  ['integer', 'integer'],
334  [$this->questionOBJ->getId(), $feedback_id]
335  ));
336 
337  return (bool) $row['cnt'];
338  }

◆ saveSpecificAnswerFeedbackContent()

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

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

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

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

179  : int
180  {
181  if ($feedback_content !== '') {
182  $feedback_content = ilRTE::_replaceMediaObjectImageSrc(
183  $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedback_content),
184  0
185  );
186  }
187 
188  $feedback_id = $this->getSpecificAnswerFeedbackId($question_id, $question_index, $answer_index);
189 
190  if ($feedback_id !== -1) {
191  $this->db->update(
193  [
194  'feedback' => ['text', $feedback_content],
195  'tstamp' => ['integer', time()]
196  ],
197  [
198  'feedback_id' => ['integer', $feedback_id],
199  ]
200  );
201  } else {
202  $feedback_id = $this->db->nextId($this->getSpecificFeedbackTableName());
203 
204  $this->db->insert($this->getSpecificFeedbackTableName(), [
205  'feedback_id' => ['integer', $feedback_id],
206  'question_fi' => ['integer', $question_id],
207  'question' => ['integer', $question_index],
208  'answer' => ['integer', $answer_index],
209  'feedback' => ['text', $feedback_content],
210  'tstamp' => ['integer', time()]
211  ]);
212  }
213 
214  return $feedback_id;
215  }
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...
getSpecificAnswerFeedbackId(int $question_id, int $question_index, int $answer_index)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSpecificFormProperties()

ilAssMultiOptionQuestionFeedback::saveSpecificFormProperties ( ilPropertyFormGUI  $form)

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

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

109  : void
110  {
111  if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
112  foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
114  $this->questionOBJ->getId(),
115  0,
116  $index,
117  (string) ($form->getInput("feedback_answer_$index") ?? '')
118  );
119  }
120  }
121  }
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-...
saveSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index, string $feedback_content)
+ Here is the call graph for this function:

◆ specificAnswerFeedbackExists()

ilAssMultiOptionQuestionFeedback::specificAnswerFeedbackExists ( )

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

References getAllSpecificAnswerFeedbackContents(), and getAllSpecificAnswerPageEditorFeedbackContents().

399  : bool
400  {
401  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
402  $all_feedback_content = $this->getAllSpecificAnswerPageEditorFeedbackContents($this->questionOBJ->getId());
403  } else {
404  $all_feedback_content = $this->getAllSpecificAnswerFeedbackContents($this->questionOBJ->getId());
405  }
406 
407  return $all_feedback_content !== '';
408  }
+ Here is the call graph for this function:

◆ syncSpecificFeedback()

ilAssMultiOptionQuestionFeedback::syncSpecificFeedback ( int  $original_question_id,
int  $duplicate_question_id 
)
protected

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

References $res, and getSpecificFeedbackTableName().

265  : void
266  {
267  // delete specific feedback of the original
268  $this->db->manipulateF(
269  "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
270  ['integer'],
271  [$original_question_id]
272  );
273 
274  // get specific feedback of the actual question
275  $res = $this->db->queryF(
276  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
277  ['integer'],
278  [$duplicate_question_id]
279  );
280 
281  // save specific feedback to the original
282  while ($row = $this->db->fetchAssoc($res)) {
283  $next_id = $this->db->nextId($this->getSpecificFeedbackTableName());
284 
285  $this->db->insert($this->getSpecificFeedbackTableName(), [
286  'feedback_id' => ['integer', $next_id],
287  'question_fi' => ['integer', $original_question_id],
288  'question' => ['integer', $row['question']],
289  'answer' => ['integer', $row['answer']],
290  'feedback' => ['text', $row['feedback']],
291  'tstamp' => ['integer', time()]
292  ]);
293  }
294  }
$res
Definition: ltiservices.php:67
+ Here is the call graph for this function:

Field Documentation

◆ TABLE_NAME_SPECIFIC_FEEDBACK

const ilAssMultiOptionQuestionFeedback::TABLE_NAME_SPECIFIC_FEEDBACK = 'qpl_fb_specific'

table name for specific feedback

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

Referenced by ilAssSpecificFeedbackIdentifierList\getSpecificFeedbackTableName().


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