ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 getAllSpecificAnswerFeedbackContents ($questionId)
 returns the SPECIFIC 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...
 
 getAnswerOptionsByAnswerIndex ()
 returns the answer options mapped by answer index (can be overwritten by concrete question type class) 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, 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, $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...
 
 getAllSpecificAnswerFeedbackContents ($questionId)
 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...
 
 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, $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...
 
 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, $answerIndex)
 returns the SPECIFIC answer feedback ID for a given question id and answer index. More...
 
 isSpecificAnswerFeedbackId ($feedbackId)
 
 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...
 
 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...
 
 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 426 of file class.ilAssMultiOptionQuestionFeedback.php.

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

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

60  {
61  if( !$this->questionOBJ->getSelfAssessmentEditingMode() )
62  {
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...
$header
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 243 of file class.ilAssMultiOptionQuestionFeedback.php.

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

244  {
245  if( $isAdditionalContentEditingModePageObject )
246  {
247  foreach( $this->getSpecificAnswerFeedbackIdByAnswerIndexMap($questionId) as $answerIndex => $pageObjectId )
248  {
250  }
251  }
252 
253  $this->db->manipulateF(
254  "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
255  array('integer'), array($questionId)
256  );
257  }
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
Create styles array
The data for the language used.
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 266 of file class.ilAssMultiOptionQuestionFeedback.php.

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

267  {
268  $res = $this->db->queryF(
269  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
270  array('integer'), array($originalQuestionId)
271  );
272 
273  while( $row = $this->db->fetchAssoc($res) )
274  {
275  $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
276 
277  $this->db->insert($this->getSpecificFeedbackTableName(), array(
278  'feedback_id' => array('integer', $nextId),
279  'question_fi' => array('integer', $duplicateQuestionId),
280  'answer' => array('integer', $row['answer']),
281  'feedback' => array('text', $row['feedback']),
282  'tstamp' => array('integer', time())
283  ));
284 
285  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
286  {
287  $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
288  $this->duplicatePageObject($pageObjectType, $row['feedback_id'], $nextId, $duplicateQuestionId);
289  }
290  }
291  }
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...
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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 168 of file class.ilAssMultiOptionQuestionFeedback.php.

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

169  {
170  require_once 'Services/RTE/classes/class.ilRTE.php';
171 
172  $res = $this->db->queryF(
173  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
174  array('integer'), array($questionId)
175  );
176 
177  $allFeedbackContents = '';
178 
179  while( $row = $this->db->fetchAssoc($res) )
180  {
181  $allFeedbackContents .= ilRTE::_replaceMediaObjectImageSrc($row['feedback'], 1);
182  }
183 
184  return $allFeedbackContents;
185  }
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...
Create styles array
The data for the language used.
+ Here is the call 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 412 of file class.ilAssMultiOptionQuestionFeedback.php.

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

413  {
414  return $this->questionOBJ->getAnswers();
415  }
+ 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, ilRTE\_replaceMediaObjectImageSrc(), and array.

Referenced by getSpecificAnswerFeedbackExportPresentation(), getSpecificAnswerFeedbackTestPresentation(), initSpecificFormProperties(), and ilAssConfigurableMultiOptionQuestionFeedback\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, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
Create styles array
The data for the language used.
+ 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 463 of file class.ilAssMultiOptionQuestionFeedback.php.

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

Referenced by specificAnswerFeedbackExists().

464  {
465  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
466  {
467  $specificAnswerFeedbackExportPresentation = $this->getPageObjectXML(
469  $this->getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex)
470  );
471  }
472  else
473  {
474  $specificAnswerFeedbackExportPresentation = $this->getSpecificAnswerFeedbackContent(
475  $questionId, $answerIndex
476  );
477  }
478 
479  return $specificAnswerFeedbackExportPresentation;
480  }
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 336 of file class.ilAssMultiOptionQuestionFeedback.php.

References $res, $row, and array.

Referenced by getSpecificAnswerFeedbackPageObjectId(), and saveSpecificAnswerFeedbackContent().

337  {
338  $res = $this->db->queryF(
339  "SELECT feedback_id FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s AND answer = %s",
340  array('integer','integer'), array($questionId, $answerIndex)
341  );
342 
343  $feedbackId = null;
344 
345  while( $row = $this->db->fetchAssoc($res) )
346  {
347  $feedbackId = $row['feedback_id'];
348  break;
349  }
350 
351  return $feedbackId;
352  }
Create styles array
The data for the language used.
+ 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 378 of file class.ilAssMultiOptionQuestionFeedback.php.

References $res, $row, and array.

Referenced by deleteSpecificAnswerFeedbacks().

379  {
380  $res = $this->db->queryF(
381  "SELECT feedback_id, answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
382  array('integer'), array($questionId)
383  );
384 
385  $feedbackIdByAnswerIndexMap = array();
386 
387  while( $row = $this->db->fetchAssoc($res) )
388  {
389  $feedbackIdByAnswerIndexMap[ $row['answer'] ] = $row['feedback_id'];
390  }
391 
392  return $feedbackIdByAnswerIndexMap;
393  }
Create styles array
The data for the language used.
+ 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 442 of file class.ilAssMultiOptionQuestionFeedback.php.

References getSpecificAnswerFeedbackId(), and saveSpecificAnswerFeedbackContent().

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

443  {
444  $pageObjectId = $this->getSpecificAnswerFeedbackId($questionId, $answerIndex);
445 
446  if( !$pageObjectId )
447  {
448  $pageObjectId = $this->saveSpecificAnswerFeedbackContent($questionId, $answerIndex, null);
449  }
450 
451  return $pageObjectId;
452  }
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 401 of file class.ilAssMultiOptionQuestionFeedback.php.

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

402  {
403  return self::TABLE_NAME_SPECIFIC_FEEDBACK;
404  }
+ 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 491 of file class.ilAssMultiOptionQuestionFeedback.php.

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

492  {
493  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
494  {
495  $pageObjectId = $this->getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex);
496  $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
497 
498  $this->createPageObject($pageObjectType, $pageObjectId, $feedbackContent);
499  }
500  else
501  {
502  $this->saveSpecificAnswerFeedbackContent($questionId, $answerIndex, $feedbackContent);
503  }
504  }
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:

◆ isSpecificAnswerFeedbackId()

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

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

References $row, and array.

359  {
360  $row = $this->db->fetchAssoc($this->db->queryF(
361  "SELECT COUNT(feedback_id) cnt FROM {$this->getSpecificFeedbackTableName()}
362  WHERE question_fi = %s AND feedback_id = %s",
363  array('integer', 'integer'), array($this->questionOBJ->getId(), $feedbackId)
364  ));
365 
366  return (bool)$row['cnt'];
367  }
Create styles array
The data for the language used.

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

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

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

197  {
198  require_once 'Services/RTE/classes/class.ilRTE.php';
199 
200  if( strlen($feedbackContent) )
201  {
202  $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($feedbackContent, 0);
203  }
204 
205  $feedbackId = $this->getSpecificAnswerFeedbackId($questionId, $answerIndex);
206 
207  if( $feedbackId )
208  {
209  $this->db->update($this->getSpecificFeedbackTableName(),
210  array(
211  'feedback' => array('text', $feedbackContent),
212  'tstamp' => array('integer', time())
213  ),
214  array(
215  'feedback_id' => array('integer', $feedbackId),
216  )
217  );
218  }
219  else
220  {
221  $feedbackId = $this->db->nextId($this->getSpecificFeedbackTableName());
222 
223  $this->db->insert($this->getSpecificFeedbackTableName(), array(
224  'feedback_id' => array('integer', $feedbackId),
225  'question_fi' => array('integer', $questionId),
226  'answer' => array('integer', $answerIndex),
227  'feedback' => array('text', $feedbackContent),
228  'tstamp' => array('integer', time())
229  ));
230  }
231 
232  return $feedbackId;
233  }
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, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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 506 of file class.ilAssMultiOptionQuestionFeedback.php.

References getSpecificAnswerFeedbackExportPresentation().

507  {
508  foreach($answerIndexes as $answerIndex)
509  {
510  $fb = $this->getSpecificAnswerFeedbackExportPresentation($this->questionOBJ->getId(), $answerIndex);
511 
512  if( strlen($fb) )
513  {
514  return true;
515  }
516  }
517 
518  return false;
519  }
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 300 of file class.ilAssMultiOptionQuestionFeedback.php.

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

301  {
302  // delete specific feedback of the original
303  $this->db->manipulateF(
304  "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s", array('integer'), array($originalQuestionId)
305  );
306 
307  // get specific feedback of the actual question
308  $res = $this->db->queryF(
309  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s", array('integer'), array($duplicateQuestionId)
310  );
311 
312  // save specific feedback to the original
313  while( $row = $this->db->fetchAssoc($res) )
314  {
315  $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
316 
317  $this->db->insert($this->getSpecificFeedbackTableName(), array(
318  'feedback_id' => array('integer', $nextId),
319  'question_fi' => array('integer', $originalQuestionId),
320  'answer' => array('integer',$row['answer']),
321  'feedback' => array('text',$row['feedback']),
322  'tstamp' => array('integer',time())
323  ));
324  }
325  }
getSpecificFeedbackTableName()
returns the table name for specific feedback
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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: