ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 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)

protected

Parameters
integer$index
mixed$answer
Returns
string $answerOptionLabel

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

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

412  {
413  return $answer->getAnswertext();
414  }
+ 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

public

Parameters
ilPropertyFormGUI$form

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

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

60  {
61  if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
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...
This class represents a section header in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
$index
Definition: metadata.php:60
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...
+ 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

public

Parameters
integer$questionId
boolean$isAdditionalContentEditingModePageObject

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

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

242  {
243  if ($isAdditionalContentEditingModePageObject) {
244  require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssSpecificFeedbackIdentifierList.php';
245  $feedbackIdentifiers = new ilAssSpecificFeedbackIdentifierList();
246  $feedbackIdentifiers->load($questionId);
247 
248  foreach ($feedbackIdentifiers as $identifier) {
251  $identifier->getFeedbackId()
252  );
253  }
254  }
255 
256  $this->db->manipulateF(
257  "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
258  array('integer'),
259  array($questionId)
260  );
261  }
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
+ 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

protected

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

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

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

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

public

Parameters
integer$questionId
Returns
string $feedbackContent

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

References $res, $row, and ilRTE\_replaceMediaObjectImageSrc().

Referenced by specificAnswerFeedbackExists().

168  {
169  require_once 'Services/RTE/classes/class.ilRTE.php';
170 
171  $res = $this->db->queryF(
172  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
173  array('integer'),
174  array($questionId)
175  );
176 
177  $allFeedbackContents = '';
178 
179  while ($row = $this->db->fetchAssoc($res)) {
180  $allFeedbackContents .= ilRTE::_replaceMediaObjectImageSrc($row['feedback'], 1);
181  }
182 
183  return $allFeedbackContents;
184  }
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...
foreach($_POST as $key=> $value) $res
$row
+ 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

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

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

398  {
399  return $this->questionOBJ->getAnswers();
400  }
+ 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.

public

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

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

References $res, $row, and ilRTE\_replaceMediaObjectImageSrc().

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

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  while ($row = $this->db->fetchAssoc($res)) {
152  $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($row['feedback'], 1);
153  break;
154  }
155 
156  return $feedbackContent;
157  }
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...
foreach($_POST as $key=> $value) $res
$row
+ 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

public

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

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

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

450  {
451  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
452  $specificAnswerFeedbackExportPresentation = $this->getPageObjectXML(
454  $this->getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
455  );
456  } else {
457  $specificAnswerFeedbackExportPresentation = $this->getSpecificAnswerFeedbackContent(
458  $questionId,
459  $questionIndex,
460  $answerIndex
461  );
462  }
463 
464  return $specificAnswerFeedbackExportPresentation;
465  }
getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
getPageObjectXML($pageObjectType, $pageObjectId)
returns the xml of page object with given type and id
getSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex)
returns the SPECIFIC answer feedback content for a given question id and answer index.
+ 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.

protected

Parameters
integer$questionId
boolean$answerIndex
Returns
string $feedbackId

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

References $res, and $row.

Referenced by getSpecificAnswerFeedbackPageObjectId(), and saveSpecificAnswerFeedbackContent().

346  {
347  $res = $this->db->queryF(
348  "SELECT feedback_id FROM {$this->getSpecificFeedbackTableName()}
349  WHERE question_fi = %s AND question = %s AND answer = %s",
350  array('integer','integer','integer'),
351  array($questionId, $questionIndex, $answerIndex)
352  );
353 
354  $feedbackId = null;
355 
356  while ($row = $this->db->fetchAssoc($res)) {
357  $feedbackId = $row['feedback_id'];
358  break;
359  }
360 
361  return $feedbackId;
362  }
foreach($_POST as $key=> $value) $res
$row
+ 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)

protected

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

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

References getSpecificAnswerFeedbackId(), and saveSpecificAnswerFeedbackContent().

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

429  {
430  $pageObjectId = $this->getSpecificAnswerFeedbackId($questionId, $questionIndex, $answerIndex);
431 
432  if (!$pageObjectId) {
433  $pageObjectId = $this->saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, null);
434  }
435 
436  return $pageObjectId;
437  }
saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, $feedbackContent)
saves SPECIFIC answer feedback content for the given question id and answer index to the database...
getSpecificAnswerFeedbackId($questionId, $questionIndex, $answerIndex)
returns the SPECIFIC answer feedback ID for a given question id and answer index. ...
+ 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

public

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

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

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

Referenced by ilAssClozeTestFeedback\determineTestOutputGapFeedback().

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  }
getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
getPageObjectContent($pageObjectType, $pageObjectId)
returns the content of page object with given type and id
getSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex)
returns the SPECIFIC answer feedback content for a given question id and answer index.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSpecificFeedbackTableName()

ilAssMultiOptionQuestionFeedback::getSpecificFeedbackTableName ( )
finalprotected

returns the table name for specific feedback

Returns
string $specificFeedbackTableName

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

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

387  {
388  return self::TABLE_NAME_SPECIFIC_FEEDBACK;
389  }
+ 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

public

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

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

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

478  {
479  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
480  $pageObjectId = $this->getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex);
481  $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
482 
483  $this->createPageObject($pageObjectType, $pageObjectId, $feedbackContent);
484  } else {
485  $this->saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, $feedbackContent);
486  }
487  }
createPageObject($pageObjectType, $pageObjectId, $pageObjectContent)
creates a new page object with given page object id and page object type and passed page object conte...
getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, $feedbackContent)
saves SPECIFIC answer feedback content for the given question id and answer index to the database...
+ 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

public

Parameters
ilPropertyFormGUI$form

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

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

91  {
92  if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
93  foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
94  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
95  $value = $this->getPageObjectNonEditableValueHTML(
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  }
getSpecificAnswerFeedbackPageObjectId($questionId, $questionIndex, $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
getAnswerOptionsByAnswerIndex()
returns the answer options mapped by answer index (can be overwritten by concrete question type class...
getItemByPostVar($a_post_var)
Get Item by POST variable.
getPageObjectNonEditableValueHTML($pageObjectType, $pageObjectId)
returns html content to be used as value for non editable value form properties in feedback editing f...
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
$index
Definition: metadata.php:60
getSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex)
returns the SPECIFIC answer feedback content for a given question id and answer index.
+ Here is the call graph for this function:

◆ isSpecificAnswerFeedbackId()

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

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

References $row.

369  {
370  $row = $this->db->fetchAssoc($this->db->queryF(
371  "SELECT COUNT(feedback_id) cnt FROM {$this->getSpecificFeedbackTableName()}
372  WHERE question_fi = %s AND feedback_id = %s",
373  array('integer' ,'integer'),
374  array($this->questionOBJ->getId(), $feedbackId)
375  ));
376 
377  return (bool) $row['cnt'];
378  }
$row

◆ saveSpecificAnswerFeedbackContent()

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

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

public

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

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

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

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

197  {
198  require_once 'Services/RTE/classes/class.ilRTE.php';
199 
200  if (strlen($feedbackContent)) {
201  $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($feedbackContent, 0);
202  }
203 
204  $feedbackId = $this->getSpecificAnswerFeedbackId($questionId, $questionIndex, $answerIndex);
205 
206  if ($feedbackId) {
207  $this->db->update(
209  array(
210  'feedback' => array('text', $feedbackContent),
211  'tstamp' => array('integer', time())
212  ),
213  array(
214  'feedback_id' => array('integer', $feedbackId),
215  )
216  );
217  } else {
218  $feedbackId = $this->db->nextId($this->getSpecificFeedbackTableName());
219 
220  $this->db->insert($this->getSpecificFeedbackTableName(), array(
221  'feedback_id' => array('integer', $feedbackId),
222  'question_fi' => array('integer', $questionId),
223  'question' => array('integer', $questionIndex),
224  'answer' => array('integer', $answerIndex),
225  'feedback' => array('text', $feedbackContent),
226  'tstamp' => array('integer', time())
227  ));
228  }
229 
230  return $feedbackId;
231  }
getSpecificFeedbackTableName()
returns the table name for specific feedback
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...
getSpecificAnswerFeedbackId($questionId, $questionIndex, $answerIndex)
returns the SPECIFIC answer feedback ID for a given question id and answer index. ...
+ 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

public

Parameters
ilPropertyFormGUI$form

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

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

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  }
getAnswerOptionsByAnswerIndex()
returns the answer options mapped by answer index (can be overwritten by concrete question type class...
saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, $feedbackContent)
saves SPECIFIC answer feedback content for the given question id and answer index to the database...
$index
Definition: metadata.php:60
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ specificAnswerFeedbackExists()

ilAssMultiOptionQuestionFeedback::specificAnswerFeedbackExists ( )

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

References getAllSpecificAnswerFeedbackContents().

490  {
491  return (bool) strlen(
492  $this->getAllSpecificAnswerFeedbackContents($this->questionOBJ->getId())
493  );
494  }
getAllSpecificAnswerFeedbackContents($questionId)
returns the SPECIFIC feedback content for a given question id and answer index.
+ 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

protected

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

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

References $res, $row, and getSpecificFeedbackTableName().

306  {
307  // delete specific feedback of the original
308  $this->db->manipulateF(
309  "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
310  array('integer'),
311  array($originalQuestionId)
312  );
313 
314  // get specific feedback of the actual question
315  $res = $this->db->queryF(
316  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
317  array('integer'),
318  array($duplicateQuestionId)
319  );
320 
321  // save specific feedback to the original
322  while ($row = $this->db->fetchAssoc($res)) {
323  $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
324 
325  $this->db->insert($this->getSpecificFeedbackTableName(), array(
326  'feedback_id' => array('integer', $nextId),
327  'question_fi' => array('integer', $originalQuestionId),
328  'question' => array('integer',$row['question']),
329  'answer' => array('integer',$row['answer']),
330  'feedback' => array('text',$row['feedback']),
331  'tstamp' => array('integer',time())
332  ));
333  }
334  }
getSpecificFeedbackTableName()
returns the table name for specific feedback
foreach($_POST as $key=> $value) $res
$row
+ 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 22 of file class.ilAssMultiOptionQuestionFeedback.php.

Referenced by ilAssSpecificFeedbackIdentifierList\getSpecificFeedbackTableName().


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