ILIAS  release_4-4 Revision
ilAssMultiOptionQuestionFeedback Class Reference
+ Inheritance diagram for ilAssMultiOptionQuestionFeedback:
+ Collaboration diagram for ilAssMultiOptionQuestionFeedback:

Public Member Functions

 getSpecificAnswerFeedbackTestPresentation ($questionId, $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, $answerIndex)
 returns the SPECIFIC answer feedback content for a given question id and answer index. More...
 
 saveSpecificAnswerFeedbackContent ($questionId, $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...
 
 getSpecificAnswerFeedbackExportPresentation ($questionId, $answerIndex)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 importSpecificAnswerFeedback ($questionId, $answerIndex, $feedbackContent)
 imports the given feedback content as specific feedback for the given question id and answer index More...
 
 specificAnswerFeedbackExists ($answerIndexes)
 
- Public Member Functions inherited from ilAssQuestionFeedback
 __construct (assQuestion $questionOBJ, ilCtrl $ctrl, ilDB $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, $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, $answerIndex)
 returns the SPECIFIC feedback content for a given question id and answer index. More...
 
 saveGenericFeedbackContent ($questionId, $solutionCompleted, $feedbackContent)
 saves GENERIC feedback content for the given question id to the database. More...
 
 saveSpecificAnswerFeedbackContent ($questionId, $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...
 
 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, $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, $answerIndex, $feedbackContent)
 imports the given feedback content as specific feedback for the given question id and answer index More...
 

Data Fields

const TABLE_NAME_SPECIFIC_FEEDBACK = 'qpl_fb_specific'
 table name for specific feedback More...
 
- Data Fields inherited from ilAssQuestionFeedback
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, $answerIndex)
 returns the SPECIFIC answer feedback ID for a given question id and answer index. More...
 
 getSpecificAnswerFeedbackIdByAnswerIndexMap ($questionId)
 returns an array mapping feedback ids to answer indexes for all answer options of question More...
 
 getSpecificFeedbackTableName ()
 returns the table name for specific feedback More...
 
 getAnswerOptionsByAnswerIndex ()
 returns the answer options mapped by answer index (can be overwritten by concrete question type class) 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, $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...
 
 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 384 of file class.ilAssMultiOptionQuestionFeedback.php.

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

385  {
386  return $answer->getAnswertext();
387  }
+ 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 ilPropertyFormGUI\addItem(), buildAnswerOptionLabel(), ilAssQuestionFeedback\buildFeedbackContentFormProperty(), and getAnswerOptionsByAnswerIndex().

60  {
61  if( !$this->questionOBJ->getSelfAssessmentEditingMode() )
62  {
63  $header = new ilFormSectionHeaderGUI();
64  $header->setTitle($this->lng->txt('feedback_answers'));
65  $form->addItem($header);
66 
67  foreach( $this->getAnswerOptionsByAnswerIndex() as $index => $answer )
68  {
69  $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
70  $this->buildAnswerOptionLabel($index, $answer), true
71  );
72 
73  $propertyPostVar = "feedback_answer_$index";
74 
76  $propertyLabel , $propertyPostVar, $this->questionOBJ->isAdditionalContentEditingModePageObject()
77  ));
78  }
79  }
80  }
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).
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 216 of file class.ilAssMultiOptionQuestionFeedback.php.

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

217  {
218  if( $isAdditionalContentEditingModePageObject )
219  {
220  foreach( $this->getSpecificAnswerFeedbackIdByAnswerIndexMap($questionId) as $answerIndex => $pageObjectId )
221  {
223  }
224  }
225 
226  $this->db->manipulateF(
227  "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
228  array('integer'), array($questionId)
229  );
230  }
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
getSpecificAnswerFeedbackIdByAnswerIndexMap($questionId)
returns an array mapping feedback ids to answer indexes for all answer options of question ...
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 239 of file class.ilAssMultiOptionQuestionFeedback.php.

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

240  {
241  $res = $this->db->queryF(
242  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
243  array('integer'), array($originalQuestionId)
244  );
245 
246  while( $row = $this->db->fetchAssoc($res) )
247  {
248  $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
249 
250  $this->db->insert($this->getSpecificFeedbackTableName(), array(
251  'feedback_id' => array('integer', $nextId),
252  'question_fi' => array('integer', $duplicateQuestionId),
253  'answer' => array('integer', $row['answer']),
254  'feedback' => array('text', $row['feedback']),
255  'tstamp' => array('integer', time())
256  ));
257 
258  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
259  {
260  $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
261  $this->duplicatePageObject($pageObjectType, $row['feedback_id'], $nextId, $duplicateQuestionId);
262  }
263  }
264  }
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
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...
+ Here is the call graph for this function:

◆ getAnswerOptionsByAnswerIndex()

ilAssMultiOptionQuestionFeedback::getAnswerOptionsByAnswerIndex ( )
protected

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

Returns
array $answerOptionsByAnswerIndex

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

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

371  {
372  return $this->questionOBJ->getAnswers();
373  }
+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackContent()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackContent (   $questionId,
  $answerIndex 
)

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

public

Parameters
integer$questionId
boolean$answerIndex
Returns
string $feedbackContent

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

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

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

143  {
144  require_once 'Services/RTE/classes/class.ilRTE.php';
145 
146  $res = $this->db->queryF(
147  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s AND answer = %s",
148  array('integer','integer'), array($questionId, $answerIndex)
149  );
150 
151  while( $row = $this->db->fetchAssoc($res) )
152  {
153  $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($row['feedback'], 1);
154  break;
155  }
156 
157  return $feedbackContent;
158  }
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackExportPresentation()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackExportPresentation (   $questionId,
  $answerIndex 
)

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

public

Parameters
integer$questionId
integer$answerIndex
Returns
string $specificAnswerFeedbackExportPresentation

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

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

Referenced by specificAnswerFeedbackExists().

422  {
423  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
424  {
425  $specificAnswerFeedbackExportPresentation = $this->getPageObjectXML(
427  $this->getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex)
428  );
429  }
430  else
431  {
432  $specificAnswerFeedbackExportPresentation = $this->getSpecificAnswerFeedbackContent(
433  $questionId, $answerIndex
434  );
435  }
436 
437  return $specificAnswerFeedbackExportPresentation;
438  }
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
getSpecificAnswerFeedbackContent($questionId, $answerIndex)
returns the SPECIFIC answer feedback content for a given question id and answer index.
getSpecificAnswerFeedbackPageObjectId($questionId, $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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackId()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackId (   $questionId,
  $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 309 of file class.ilAssMultiOptionQuestionFeedback.php.

References $res, and $row.

Referenced by getSpecificAnswerFeedbackPageObjectId(), and saveSpecificAnswerFeedbackContent().

310  {
311  $res = $this->db->queryF(
312  "SELECT feedback_id FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s AND answer = %s",
313  array('integer','integer'), array($questionId, $answerIndex)
314  );
315 
316  $feedbackId = null;
317 
318  while( $row = $this->db->fetchAssoc($res) )
319  {
320  $feedbackId = $row['feedback_id'];
321  break;
322  }
323 
324  return $feedbackId;
325  }
+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackIdByAnswerIndexMap()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackIdByAnswerIndexMap (   $questionId)
finalprotected

returns an array mapping feedback ids to answer indexes for all answer options of question

protected

Parameters
integer$questionId
Returns
array $feedbackIdByAnswerIndexMap

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

References $res, and $row.

Referenced by deleteSpecificAnswerFeedbacks().

337  {
338  $res = $this->db->queryF(
339  "SELECT feedback_id, answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
340  array('integer'), array($questionId)
341  );
342 
343  $feedbackIdByAnswerIndexMap = array();
344 
345  while( $row = $this->db->fetchAssoc($res) )
346  {
347  $feedbackIdByAnswerIndexMap[ $row['answer'] ] = $row['feedback_id'];
348  }
349 
350  return $feedbackIdByAnswerIndexMap;
351  }
+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackPageObjectId()

ilAssMultiOptionQuestionFeedback::getSpecificAnswerFeedbackPageObjectId (   $questionId,
  $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$answerIndex
Returns
integer $pageObjectId

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

References getSpecificAnswerFeedbackId(), and saveSpecificAnswerFeedbackContent().

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

401  {
402  $pageObjectId = $this->getSpecificAnswerFeedbackId($questionId, $answerIndex);
403 
404  if( !$pageObjectId )
405  {
406  $pageObjectId = $this->saveSpecificAnswerFeedbackContent($questionId, $answerIndex, null);
407  }
408 
409  return $pageObjectId;
410  }
saveSpecificAnswerFeedbackContent($questionId, $answerIndex, $feedbackContent)
saves SPECIFIC answer feedback content for the given question id and answer index to the database...
getSpecificAnswerFeedbackId($questionId, $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,
  $answerIndex 
)

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

public

Parameters
integer$questionId
integer$answerIndex
Returns
string $specificAnswerFeedbackTestPresentationHTML

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

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

34  {
35  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
36  {
37  $specificAnswerFeedbackTestPresentationHTML = $this->getPageObjectContent(
39  $this->getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex)
40  );
41  }
42  else
43  {
44  $specificAnswerFeedbackTestPresentationHTML = $this->getSpecificAnswerFeedbackContent(
45  $questionId, $answerIndex
46  );
47  }
48 
49  return $specificAnswerFeedbackTestPresentationHTML;
50  }
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, $answerIndex)
returns the SPECIFIC answer feedback content for a given question id and answer index.
getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
+ Here is the call graph for this function:

◆ getSpecificFeedbackTableName()

ilAssMultiOptionQuestionFeedback::getSpecificFeedbackTableName ( )
finalprotected

returns the table name for specific feedback

Returns
string $specificFeedbackTableName

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

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

360  {
361  return self::TABLE_NAME_SPECIFIC_FEEDBACK;
362  }
+ Here is the caller graph for this function:

◆ importSpecificAnswerFeedback()

ilAssMultiOptionQuestionFeedback::importSpecificAnswerFeedback (   $questionId,
  $answerIndex,
  $feedbackContent 
)

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

public

Parameters
integer$questionId
integer$answerIndex
string$feedbackContent

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

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

450  {
451  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
452  {
453  $pageObjectId = $this->getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex);
454  $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
455 
456  $this->createPageObject($pageObjectType, $pageObjectId, $feedbackContent);
457  }
458  else
459  {
460  $this->saveSpecificAnswerFeedbackContent($questionId, $answerIndex, $feedbackContent);
461  }
462  }
createPageObject($pageObjectType, $pageObjectId, $pageObjectContent)
creates a new page object with given page object id and page object type and passed page object conte...
saveSpecificAnswerFeedbackContent($questionId, $answerIndex, $feedbackContent)
saves SPECIFIC answer feedback content for the given question id and answer index to the database...
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
+ 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 89 of file class.ilAssMultiOptionQuestionFeedback.php.

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

90  {
91  if (!$this->questionOBJ->getSelfAssessmentEditingMode())
92  {
93  foreach( $this->getAnswerOptionsByAnswerIndex() as $index => $answer )
94  {
95  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
96  {
97  $value = $this->getPageObjectNonEditableValueHTML(
99  $this->getSpecificAnswerFeedbackPageObjectId($this->questionOBJ->getId(), $index)
100  );
101  }
102  else
103  {
104  $value = $this->questionOBJ->prepareTextareaOutput(
105  $this->getSpecificAnswerFeedbackContent($this->questionOBJ->getId(), $index)
106  );
107  }
108 
109  $form->getItemByPostVar("feedback_answer_$index")->setValue($value);
110  }
111  }
112  }
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
getSpecificAnswerFeedbackContent($questionId, $answerIndex)
returns the SPECIFIC answer feedback content for a given question id and answer index.
getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
+ Here is the call graph for this function:

◆ saveSpecificAnswerFeedbackContent()

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

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

public

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

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

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

Referenced by getSpecificAnswerFeedbackPageObjectId(), importSpecificAnswerFeedback(), ilAssConfigurableMultiOptionQuestionFeedback\saveSpecificFormProperties(), and saveSpecificFormProperties().

170  {
171  require_once 'Services/RTE/classes/class.ilRTE.php';
172 
173  if( strlen($feedbackContent) )
174  {
175  $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($feedbackContent, 0);
176  }
177 
178  $feedbackId = $this->getSpecificAnswerFeedbackId($questionId, $answerIndex);
179 
180  if( $feedbackId )
181  {
182  $this->db->update($this->getSpecificFeedbackTableName(),
183  array(
184  'feedback' => array('text', $feedbackContent),
185  'tstamp' => array('integer', time())
186  ),
187  array(
188  'feedback_id' => array('integer', $feedbackId),
189  )
190  );
191  }
192  else
193  {
194  $feedbackId = $this->db->nextId($this->getSpecificFeedbackTableName());
195 
196  $this->db->insert($this->getSpecificFeedbackTableName(), array(
197  'feedback_id' => array('integer', $feedbackId),
198  'question_fi' => array('integer', $questionId),
199  'answer' => array('integer', $answerIndex),
200  'feedback' => array('text', $feedbackContent),
201  'tstamp' => array('integer', time())
202  ));
203  }
204 
205  return $feedbackId;
206  }
getSpecificAnswerFeedbackId($questionId, $answerIndex)
returns the SPECIFIC answer feedback ID for a given question id and answer index. ...
getSpecificFeedbackTableName()
returns the table name for specific feedback
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
+ 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 121 of file class.ilAssMultiOptionQuestionFeedback.php.

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

122  {
123  if( !$this->questionOBJ->isAdditionalContentEditingModePageObject() )
124  {
125  foreach( $this->getAnswerOptionsByAnswerIndex() as $index => $answer )
126  {
128  $this->questionOBJ->getId(), $index, $form->getInput("feedback_answer_$index")
129  );
130  }
131  }
132  }
getAnswerOptionsByAnswerIndex()
returns the answer options mapped by answer index (can be overwritten by concrete question type class...
saveSpecificAnswerFeedbackContent($questionId, $answerIndex, $feedbackContent)
saves SPECIFIC answer feedback content for the given question id and answer index to the database...
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 (   $answerIndexes)

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

References getSpecificAnswerFeedbackExportPresentation().

465  {
466  foreach($answerIndexes as $answerIndex)
467  {
468  $fb = $this->getSpecificAnswerFeedbackExportPresentation($this->questionOBJ->getId(), $answerIndex);
469 
470  if( strlen($fb) )
471  {
472  return true;
473  }
474  }
475 
476  return false;
477  }
getSpecificAnswerFeedbackExportPresentation($questionId, $answerIndex)
returns the generic feedback export presentation for given question id either for solution completed ...
+ 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 273 of file class.ilAssMultiOptionQuestionFeedback.php.

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

274  {
275  // delete specific feedback of the original
276  $this->db->manipulateF(
277  "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s", array('integer'), array($originalQuestionId)
278  );
279 
280  // get specific feedback of the actual question
281  $res = $this->db->queryF(
282  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s", array('integer'), array($duplicateQuestionId)
283  );
284 
285  // save specific feedback to the original
286  while( $row = $this->db->fetchAssoc($res) )
287  {
288  $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
289 
290  $this->db->insert($this->getSpecificFeedbackTableName(), array(
291  'feedback_id' => array('integer', $nextId),
292  'question_fi' => array('integer', $originalQuestionId),
293  'answer' => array('integer',$row['answer']),
294  'feedback' => array('text',$row['feedback']),
295  'tstamp' => array('integer',time())
296  ));
297  }
298  }
getSpecificFeedbackTableName()
returns the table name for specific feedback
+ 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.


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