ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 419 of file class.ilAssMultiOptionQuestionFeedback.php.

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

420  {
421  return $answer->getAnswertext();
422  }
+ 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 57 of file class.ilAssMultiOptionQuestionFeedback.php.

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

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

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

235  {
236  if ($isAdditionalContentEditingModePageObject) {
237  foreach ($this->getSpecificAnswerFeedbackIdByAnswerIndexMap($questionId) as $answerIndex => $pageObjectId) {
239  }
240  }
241 
242  $this->db->manipulateF(
243  "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
244  array('integer'),
245  array($questionId)
246  );
247  }
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 256 of file class.ilAssMultiOptionQuestionFeedback.php.

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

257  {
258  $res = $this->db->queryF(
259  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
260  array('integer'),
261  array($originalQuestionId)
262  );
263 
264  while ($row = $this->db->fetchAssoc($res)) {
265  $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
266 
267  $this->db->insert($this->getSpecificFeedbackTableName(), array(
268  'feedback_id' => array('integer', $nextId),
269  'question_fi' => array('integer', $duplicateQuestionId),
270  'answer' => array('integer', $row['answer']),
271  'feedback' => array('text', $row['feedback']),
272  'tstamp' => array('integer', time())
273  ));
274 
275  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
276  $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
277  $this->duplicatePageObject($pageObjectType, $row['feedback_id'], $nextId, $duplicateQuestionId);
278  }
279  }
280  }
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...
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 162 of file class.ilAssMultiOptionQuestionFeedback.php.

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

163  {
164  require_once 'Services/RTE/classes/class.ilRTE.php';
165 
166  $res = $this->db->queryF(
167  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
168  array('integer'),
169  array($questionId)
170  );
171 
172  $allFeedbackContents = '';
173 
174  while ($row = $this->db->fetchAssoc($res)) {
175  $allFeedbackContents .= ilRTE::_replaceMediaObjectImageSrc($row['feedback'], 1);
176  }
177 
178  return $allFeedbackContents;
179  }
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
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 405 of file class.ilAssMultiOptionQuestionFeedback.php.

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

406  {
407  return $this->questionOBJ->getAnswers();
408  }
+ 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 136 of file class.ilAssMultiOptionQuestionFeedback.php.

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

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

137  {
138  require_once 'Services/RTE/classes/class.ilRTE.php';
139 
140  $res = $this->db->queryF(
141  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s AND answer = %s",
142  array('integer','integer'),
143  array($questionId, $answerIndex)
144  );
145 
146  while ($row = $this->db->fetchAssoc($res)) {
147  $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($row['feedback'], 1);
148  break;
149  }
150 
151  return $feedbackContent;
152  }
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
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 455 of file class.ilAssMultiOptionQuestionFeedback.php.

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

Referenced by specificAnswerFeedbackExists().

456  {
457  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
458  $specificAnswerFeedbackExportPresentation = $this->getPageObjectXML(
460  $this->getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex)
461  );
462  } else {
463  $specificAnswerFeedbackExportPresentation = $this->getSpecificAnswerFeedbackContent(
464  $questionId,
465  $answerIndex
466  );
467  }
468 
469  return $specificAnswerFeedbackExportPresentation;
470  }
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 328 of file class.ilAssMultiOptionQuestionFeedback.php.

References $res, $row, and array.

Referenced by getSpecificAnswerFeedbackPageObjectId(), and saveSpecificAnswerFeedbackContent().

329  {
330  $res = $this->db->queryF(
331  "SELECT feedback_id FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s AND answer = %s",
332  array('integer','integer'),
333  array($questionId, $answerIndex)
334  );
335 
336  $feedbackId = null;
337 
338  while ($row = $this->db->fetchAssoc($res)) {
339  $feedbackId = $row['feedback_id'];
340  break;
341  }
342 
343  return $feedbackId;
344  }
foreach($_POST as $key=> $value) $res
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 371 of file class.ilAssMultiOptionQuestionFeedback.php.

References $res, $row, and array.

Referenced by deleteSpecificAnswerFeedbacks().

372  {
373  $res = $this->db->queryF(
374  "SELECT feedback_id, answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
375  array('integer'),
376  array($questionId)
377  );
378 
379  $feedbackIdByAnswerIndexMap = array();
380 
381  while ($row = $this->db->fetchAssoc($res)) {
382  $feedbackIdByAnswerIndexMap[ $row['answer'] ] = $row['feedback_id'];
383  }
384 
385  return $feedbackIdByAnswerIndexMap;
386  }
foreach($_POST as $key=> $value) $res
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 435 of file class.ilAssMultiOptionQuestionFeedback.php.

References getSpecificAnswerFeedbackId(), and saveSpecificAnswerFeedbackContent().

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

436  {
437  $pageObjectId = $this->getSpecificAnswerFeedbackId($questionId, $answerIndex);
438 
439  if (!$pageObjectId) {
440  $pageObjectId = $this->saveSpecificAnswerFeedbackContent($questionId, $answerIndex, null);
441  }
442 
443  return $pageObjectId;
444  }
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  $specificAnswerFeedbackTestPresentationHTML = $this->getPageObjectContent(
38  $this->getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex)
39  );
40  } else {
41  $specificAnswerFeedbackTestPresentationHTML = $this->getSpecificAnswerFeedbackContent(
42  $questionId,
43  $answerIndex
44  );
45  }
46 
47  return $specificAnswerFeedbackTestPresentationHTML;
48  }
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 394 of file class.ilAssMultiOptionQuestionFeedback.php.

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

395  {
396  return self::TABLE_NAME_SPECIFIC_FEEDBACK;
397  }
+ 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 481 of file class.ilAssMultiOptionQuestionFeedback.php.

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

482  {
483  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
484  $pageObjectId = $this->getSpecificAnswerFeedbackPageObjectId($questionId, $answerIndex);
485  $pageObjectType = $this->getSpecificAnswerFeedbackPageObjectType();
486 
487  $this->createPageObject($pageObjectType, $pageObjectId, $feedbackContent);
488  } else {
489  $this->saveSpecificAnswerFeedbackContent($questionId, $answerIndex, $feedbackContent);
490  }
491  }
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 88 of file class.ilAssMultiOptionQuestionFeedback.php.

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

89  {
90  if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
91  foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
92  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
93  $value = $this->getPageObjectNonEditableValueHTML(
95  $this->getSpecificAnswerFeedbackPageObjectId($this->questionOBJ->getId(), $index)
96  );
97  } else {
98  $value = $this->questionOBJ->prepareTextareaOutput(
99  $this->getSpecificAnswerFeedbackContent($this->questionOBJ->getId(), $index)
100  );
101  }
102 
103  $form->getItemByPostVar("feedback_answer_$index")->setValue($value);
104  }
105  }
106  }
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, $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 350 of file class.ilAssMultiOptionQuestionFeedback.php.

References $row, and array.

351  {
352  $row = $this->db->fetchAssoc($this->db->queryF(
353  "SELECT COUNT(feedback_id) cnt FROM {$this->getSpecificFeedbackTableName()}
354  WHERE question_fi = %s AND feedback_id = %s",
355  array('integer', 'integer'),
356  array($this->questionOBJ->getId(), $feedbackId)
357  ));
358 
359  return (bool) $row['cnt'];
360  }
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 190 of file class.ilAssMultiOptionQuestionFeedback.php.

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

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

191  {
192  require_once 'Services/RTE/classes/class.ilRTE.php';
193 
194  if (strlen($feedbackContent)) {
195  $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($feedbackContent, 0);
196  }
197 
198  $feedbackId = $this->getSpecificAnswerFeedbackId($questionId, $answerIndex);
199 
200  if ($feedbackId) {
201  $this->db->update(
203  array(
204  'feedback' => array('text', $feedbackContent),
205  'tstamp' => array('integer', time())
206  ),
207  array(
208  'feedback_id' => array('integer', $feedbackId),
209  )
210  );
211  } else {
212  $feedbackId = $this->db->nextId($this->getSpecificFeedbackTableName());
213 
214  $this->db->insert($this->getSpecificFeedbackTableName(), array(
215  'feedback_id' => array('integer', $feedbackId),
216  'question_fi' => array('integer', $questionId),
217  'answer' => array('integer', $answerIndex),
218  'feedback' => array('text', $feedbackContent),
219  'tstamp' => array('integer', time())
220  ));
221  }
222 
223  return $feedbackId;
224  }
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 115 of file class.ilAssMultiOptionQuestionFeedback.php.

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

116  {
117  if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
118  foreach ($this->getAnswerOptionsByAnswerIndex() as $index => $answer) {
120  $this->questionOBJ->getId(),
121  $index,
122  $form->getInput("feedback_answer_$index")
123  );
124  }
125  }
126  }
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...
$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 (   $answerIndexes)

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

References getSpecificAnswerFeedbackExportPresentation().

494  {
495  foreach ($answerIndexes as $answerIndex) {
496  $fb = $this->getSpecificAnswerFeedbackExportPresentation($this->questionOBJ->getId(), $answerIndex);
497 
498  if (strlen($fb)) {
499  return true;
500  }
501  }
502 
503  return false;
504  }
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 289 of file class.ilAssMultiOptionQuestionFeedback.php.

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

290  {
291  // delete specific feedback of the original
292  $this->db->manipulateF(
293  "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
294  array('integer'),
295  array($originalQuestionId)
296  );
297 
298  // get specific feedback of the actual question
299  $res = $this->db->queryF(
300  "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
301  array('integer'),
302  array($duplicateQuestionId)
303  );
304 
305  // save specific feedback to the original
306  while ($row = $this->db->fetchAssoc($res)) {
307  $nextId = $this->db->nextId($this->getSpecificFeedbackTableName());
308 
309  $this->db->insert($this->getSpecificFeedbackTableName(), array(
310  'feedback_id' => array('integer', $nextId),
311  'question_fi' => array('integer', $originalQuestionId),
312  'answer' => array('integer',$row['answer']),
313  'feedback' => array('text',$row['feedback']),
314  'tstamp' => array('integer',time())
315  ));
316  }
317  }
getSpecificFeedbackTableName()
returns the table name for specific feedback
foreach($_POST as $key=> $value) $res
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: