ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAssQuestionFeedback Class Reference
+ Inheritance diagram for ilAssQuestionFeedback:
+ Collaboration diagram for ilAssQuestionFeedback:

Public Member Functions

 __construct (assQuestion $questionOBJ, ilCtrl $ctrl, ilDBInterface $db, ilLanguage $lng)
 constructor More...
 
 getGenericFeedbackTestPresentation ($questionId, $solutionCompleted)
 returns the html of GENERIC feedback for the given question id for test presentation (either for the complete solution or for the incomplete solution) More...
 
 getSpecificAnswerFeedbackTestPresentation ($questionId, $questionIndex, $answerIndex)
 returns the html of SPECIFIC feedback for the given question id and answer index for test presentation More...
 
 completeGenericFormProperties (ilPropertyFormGUI $form)
 completes a given form object with the GENERIC form properties required by all question types More...
 
 completeSpecificFormProperties (ilPropertyFormGUI $form)
 completes a given form object with the SPECIFIC form properties required by this question type More...
 
 initGenericFormProperties (ilPropertyFormGUI $form)
 initialises a given form object's GENERIC form properties relating to all question types More...
 
 initSpecificFormProperties (ilPropertyFormGUI $form)
 initialises a given form object's SPECIFIC form properties relating to this question type More...
 
 saveGenericFormProperties (ilPropertyFormGUI $form)
 saves a given form object's GENERIC form properties relating to all question types More...
 
 saveSpecificFormProperties (ilPropertyFormGUI $form)
 saves a given form object's SPECIFIC form properties relating to this question type More...
 
 isSaveableInPageObjectEditingMode ()
 returns the fact wether the feedback editing form is saveable in page object editing or not. More...
 
 getGenericFeedbackContent ($questionId, $solutionCompleted)
 returns the GENERIC feedback content for a given question state. More...
 
 getSpecificAnswerFeedbackContent ($questionId, $questionIndex, $answerIndex)
 returns the SPECIFIC feedback content for a given question id and answer index. More...
 
 getAllSpecificAnswerFeedbackContents ($questionId)
 returns the SPECIFIC feedback content for a given question id and answer index. More...
 
 isSpecificAnswerFeedbackAvailable ($questionId)
 returns the fact wether any specific feedback content is available or not More...
 
 saveGenericFeedbackContent ($questionId, $solutionCompleted, $feedbackContent)
 saves GENERIC feedback content for the given question id to the database. More...
 
 saveSpecificAnswerFeedbackContent ($questionId, $questionIndex, $answerIndex, $feedbackContent)
 saves SPECIFIC feedback content for the given question id and answer index to the database. More...
 
 deleteGenericFeedbacks ($questionId, $isAdditionalContentEditingModePageObject)
 deletes all GENERIC feedback contents (and page objects if required) for the given question id More...
 
 deleteSpecificAnswerFeedbacks ($questionId, $isAdditionalContentEditingModePageObject)
 deletes all SPECIFIC feedback contents for the given question id More...
 
 duplicateFeedback ($originalQuestionId, $duplicateQuestionId)
 duplicates the feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 syncFeedback ($originalQuestionId, $duplicateQuestionId)
 syncs the feedback from a duplicated question back to the original question More...
 
 checkFeedbackParent ($feedbackId)
 
 getClassNameByType ($a_type, $a_gui=false)
 Get class name by type. More...
 
 setPageObjectOutputMode ($a_val)
 Set page object output mode. More...
 
 getPageObjectOutputMode ()
 Get page object output mode. More...
 
 getGenericFeedbackExportPresentation ($questionId, $solutionCompleted)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 getSpecificAnswerFeedbackExportPresentation ($questionId, $questionIndex, $answerIndex)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 importGenericFeedback ($questionId, $solutionCompleted, $feedbackContent)
 imports the given feedback content as generic feedback for the given question id for either the complete or incomplete solution More...
 
 importSpecificAnswerFeedback ($questionId, $questionIndex, $answerIndex, $feedbackContent)
 imports the given feedback content as specific feedback for the given question id and answer index More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator, $questionId)
 

Static Public Member Functions

static isValidFeedbackPageObjectType ($feedbackPageObjectType)
 returns the fact wether the given page object type relates to generic or specific feedback page objects More...
 

Data Fields

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

 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...
 

Protected Attributes

 $questionOBJ = null
 
 $ctrl = null
 
 $db = null
 
 $lng = null
 
 $page_obj_output_mode = "presentation"
 

Private Member Functions

 duplicateGenericFeedback ($originalQuestionId, $duplicateQuestionId)
 duplicates the GENERIC feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 syncGenericFeedback ($originalQuestionId, $duplicateQuestionId)
 syncs the GENERIC feedback from a duplicated question back to the original question More...
 
 getPageObjectEditingLink ($pageObjectType, $pageObjectId)
 returns a link to page object editor for page object with given type and id More...
 
 ensurePageObjectExists ($pageObjectType, $pageObjectId)
 ensures an existing page object with given type and id More...
 

Detailed Description

Definition at line 14 of file class.ilAssQuestionFeedback.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionFeedback::__construct ( assQuestion  $questionOBJ,
ilCtrl  $ctrl,
ilDBInterface  $db,
ilLanguage  $lng 
)
final

constructor

@final @access public

Parameters
assQuestion$questionOBJ
ilCtrl$ctrl
ilDBInterface$db
ilLanguage$lng

Definition at line 94 of file class.ilAssQuestionFeedback.php.

References $ctrl, $db, $lng, and $questionOBJ.

Member Function Documentation

◆ buildFeedbackContentFormProperty()

ilAssQuestionFeedback::buildFeedbackContentFormProperty (   $label,
  $postVar,
  $asNonEditable 
)
finalprotected

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 ...

  • non editable gui
  • textarea input gui

@final @access protected

Parameters
string$label
string$postVar
boolean$asNonEditable
Returns
ilTextAreaInputGUI|ilNonEditableValueGUI $formProperty

Definition at line 276 of file class.ilAssQuestionFeedback.php.

277 {
278 if ($asNonEditable) {
279 require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
280
281 $property = new ilNonEditableValueGUI($label, $postVar, true);
282 } else {
283 require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
284 require_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
285
286 $property = new ilTextAreaInputGUI($label, $postVar);
287 $property->setRequired(false);
288 $property->setRows(10);
289 $property->setCols(80);
290
291 if (!$this->questionOBJ->getPreventRteUsage()) {
292 $property->setUseRte(true);
293 $property->addPlugin("latex");
294 $property->addButton("latex");
295 $property->addButton("pastelatex");
296
297 require_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
298 $property->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
299 $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
300 } else {
301 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
303 $property->setUseTagsForRteOnly(false);
304 }
305
306 $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
307 }
308
309 return $property;
310 }
static getSelfAssessmentTags()
Get tags allowed in question tags in self assessment mode.
This class represents a non editable value in a property form.
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
This class represents a text area property in a property form.

References ilObjAdvancedEditing\_getUsedHTMLTags(), and ilAssSelfAssessmentQuestionFormatter\getSelfAssessmentTags().

Referenced by ilAssClozeTestFeedback\completeFbPropsForNumericGap(), ilAssClozeTestFeedback\completeFbPropsForSelectGap(), ilAssClozeTestFeedback\completeFbPropsForTextGap(), ilAssClozeTestFeedback\completeFormPropsForFeedbackModeGapQuestion(), completeGenericFormProperties(), ilAssConfigurableMultiOptionQuestionFeedback\completeSpecificFormProperties(), and ilAssMultiOptionQuestionFeedback\completeSpecificFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkFeedbackParent()

ilAssQuestionFeedback::checkFeedbackParent (   $feedbackId)
final
Parameters
int$feedbackId
Returns
bool

Definition at line 665 of file class.ilAssQuestionFeedback.php.

666 {
667 if ($this->isGenericFeedbackId($feedbackId)) {
668 return true;
669 }
670
671 if ($this->isSpecificAnswerFeedbackId($feedbackId)) {
672 return true;
673 }
674
675 return false;
676 }
isSpecificAnswerFeedbackId($feedbackId)

References isGenericFeedbackId(), and isSpecificAnswerFeedbackId().

+ Here is the call graph for this function:

◆ completeGenericFormProperties()

ilAssQuestionFeedback::completeGenericFormProperties ( ilPropertyFormGUI  $form)
final

completes a given form object with the GENERIC form properties required by all question types

@final @access public

Parameters
ilPropertyFormGUI$form

Definition at line 150 of file class.ilAssQuestionFeedback.php.

151 {
153 $this->lng->txt('feedback_complete_solution'),
154 'feedback_complete',
155 $this->questionOBJ->isAdditionalContentEditingModePageObject()
156 ));
157
159 $this->lng->txt('feedback_incomplete_solution'),
160 'feedback_incomplete',
161 $this->questionOBJ->isAdditionalContentEditingModePageObject()
162 ));
163 }
buildFeedbackContentFormProperty($label, $postVar, $asNonEditable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
addItem($a_item)
Add Item (Property, SectionHeader).

References ilPropertyFormGUI\addItem(), and buildFeedbackContentFormProperty().

+ Here is the call graph for this function:

◆ completeSpecificFormProperties()

ilAssQuestionFeedback::completeSpecificFormProperties ( ilPropertyFormGUI  $form)
abstract

completes a given form object with the SPECIFIC form properties required by this question type

@abstract @access public

Parameters
ilPropertyFormGUI$form

Reimplemented in ilAssClozeTestFeedback, ilAssConfigurableMultiOptionQuestionFeedback, ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

◆ createPageObject()

ilAssQuestionFeedback::createPageObject (   $pageObjectType,
  $pageObjectId,
  $pageObjectContent 
)
finalprotected

creates a new page object with given page object id and page object type and passed page object content

@final @access protected

Parameters
string$pageObjectType
integer$pageObjectId
string$pageObjectContent

Definition at line 865 of file class.ilAssQuestionFeedback.php.

866 {
867 $cl = $this->getClassNameByType($pageObjectType);
868 require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
869
870 $pageObject = new $cl();
871 $pageObject->setParentId($this->questionOBJ->getId());
872 $pageObject->setId($pageObjectId);
873 $pageObject->setXMLContent($pageObjectContent);
874 $pageObject->createFromXML();
875 }
getClassNameByType($a_type, $a_gui=false)
Get class name by type.

References getClassNameByType().

Referenced by importGenericFeedback(), and ilAssMultiOptionQuestionFeedback\importSpecificAnswerFeedback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteGenericFeedbacks()

ilAssQuestionFeedback::deleteGenericFeedbacks (   $questionId,
  $isAdditionalContentEditingModePageObject 
)
final

deletes all GENERIC feedback contents (and page objects if required) for the given question id

@final @access public

Parameters
integer$questionId
boolean$isAdditionalContentEditingModePageObject

Definition at line 467 of file class.ilAssQuestionFeedback.php.

468 {
469 if ($isAdditionalContentEditingModePageObject) {
472 $this->getGenericFeedbackPageObjectId($questionId, true)
473 );
474
477 $this->getGenericFeedbackPageObjectId($questionId, false)
478 );
479 }
480
481 $this->db->manipulateF(
482 "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
483 array('integer'),
484 array($questionId)
485 );
486 }
getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
returns a useable page object id for generic feedback page objects for the given question id for eith...
getGenericFeedbackPageObjectType()
returns the type for generic feedback page objects defined in local constant
ensurePageObjectDeleted($pageObjectType, $pageObjectId)
ensures a no more existing page object for given type and id

References ensurePageObjectDeleted(), getGenericFeedbackPageObjectId(), and getGenericFeedbackPageObjectType().

+ Here is the call graph for this function:

◆ deleteSpecificAnswerFeedbacks()

ilAssQuestionFeedback::deleteSpecificAnswerFeedbacks (   $questionId,
  $isAdditionalContentEditingModePageObject 
)
abstract

deletes all SPECIFIC feedback contents for the given question id

@abstract @access public

Parameters
integer$questionId
boolean$isAdditionalContentEditingModePageObject

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

◆ duplicateFeedback()

ilAssQuestionFeedback::duplicateFeedback (   $originalQuestionId,
  $duplicateQuestionId 
)
final

duplicates the feedback relating to the given original question id and saves it for the given duplicate question id

@final @access public

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Definition at line 507 of file class.ilAssQuestionFeedback.php.

508 {
509 $this->duplicateGenericFeedback($originalQuestionId, $duplicateQuestionId);
510 $this->duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId);
511 }
duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId)
duplicates the SPECIFIC feedback relating to the given original question id and saves it for the give...
duplicateGenericFeedback($originalQuestionId, $duplicateQuestionId)
duplicates the GENERIC feedback relating to the given original question id and saves it for the given...

References duplicateGenericFeedback(), and duplicateSpecificFeedback().

+ Here is the call graph for this function:

◆ duplicateGenericFeedback()

ilAssQuestionFeedback::duplicateGenericFeedback (   $originalQuestionId,
  $duplicateQuestionId 
)
private

duplicates the GENERIC feedback relating to the given original question id and saves it for the given duplicate question id

@final @access private

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Definition at line 522 of file class.ilAssQuestionFeedback.php.

523 {
524 $res = $this->db->queryF(
525 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
526 array('integer'),
527 array($originalQuestionId)
528 );
529
530 while ($row = $this->db->fetchAssoc($res)) {
531 $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
532
533 $this->db->insert($this->getGenericFeedbackTableName(), array(
534 'feedback_id' => array('integer', $feedbackId),
535 'question_fi' => array('integer', $duplicateQuestionId),
536 'correctness' => array('text', $row['correctness']),
537 'feedback' => array('clob', $row['feedback']),
538 'tstamp' => array('integer', time())
539 ));
540
541 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
542 $pageObjectType = $this->getGenericFeedbackPageObjectType();
543 $this->duplicatePageObject($pageObjectType, $row['feedback_id'], $feedbackId, $duplicateQuestionId);
544 }
545 }
546 }
duplicatePageObject($pageObjectType, $originalPageObjectId, $duplicatePageObjectId, $duplicatePageObjectParentId)
duplicates the page object with given type and original id to new page object with same type and give...
getGenericFeedbackTableName()
returns the table name for specific feedback
foreach($_POST as $key=> $value) $res

References $res, duplicatePageObject(), getGenericFeedbackPageObjectType(), and getGenericFeedbackTableName().

Referenced by duplicateFeedback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicatePageObject()

ilAssQuestionFeedback::duplicatePageObject (   $pageObjectType,
  $originalPageObjectId,
  $duplicatePageObjectId,
  $duplicatePageObjectParentId 
)
finalprotected

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

@final @access protected

Parameters
string$pageObjectType
integer$originalPageObjectId
integer$duplicatePageObjectId
integer$duplicatePageObjectParentId

Definition at line 888 of file class.ilAssQuestionFeedback.php.

889 {
890 $this->ensurePageObjectExists($pageObjectType, $originalPageObjectId);
891
892 $cl = $this->getClassNameByType($pageObjectType);
893 require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
894
895 $pageObject = new $cl($originalPageObjectId);
896 $pageObject->setParentId($duplicatePageObjectParentId);
897 $pageObject->setId($duplicatePageObjectId);
898 $pageObject->createFromXML();
899 }
ensurePageObjectExists($pageObjectType, $pageObjectId)
ensures an existing page object with given type and id

References ensurePageObjectExists(), and getClassNameByType().

Referenced by duplicateGenericFeedback(), and ilAssMultiOptionQuestionFeedback\duplicateSpecificFeedback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicateSpecificFeedback()

ilAssQuestionFeedback::duplicateSpecificFeedback (   $originalQuestionId,
  $duplicateQuestionId 
)
abstractprotected

duplicates the SPECIFIC feedback relating to the given original question id and saves it for the given duplicate question id

@abstract @access protected

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Reimplemented in ilAssClozeTestFeedback, ilAssConfigurableMultiOptionQuestionFeedback, ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

Referenced by duplicateFeedback().

+ Here is the caller graph for this function:

◆ ensurePageObjectDeleted()

ilAssQuestionFeedback::ensurePageObjectDeleted (   $pageObjectType,
  $pageObjectId 
)
finalprotected

ensures a no more existing page object for given type and id

@final @access protected

Parameters
string$pageObjectType
integer$pageObjectId

Definition at line 909 of file class.ilAssQuestionFeedback.php.

910 {
912 include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPage.php");
913 if (ilAssGenFeedbackPage::_exists($pageObjectType, $pageObjectId)) {
914 $pageObject = new ilAssGenFeedbackPage($pageObjectId);
915 $pageObject->delete();
916 }
917 }
919 include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPage.php");
920 if (ilAssSpecFeedbackPage::_exists($pageObjectType, $pageObjectId)) {
921 $pageObject = new ilAssSpecFeedbackPage($pageObjectId);
922 $pageObject->delete();
923 }
924 }
925 }
Generic feedback page object.
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK
type for specific feedback page objects
Specific feedback page object.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.

References ilPageObject\_exists(), PAGE_OBJECT_TYPE_GENERIC_FEEDBACK, and PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK.

Referenced by deleteGenericFeedbacks(), ilAssMultiOptionQuestionFeedback\deleteSpecificAnswerFeedbacks(), and ilAssClozeTestFeedback\deleteSpecificAnswerFeedbacksByIds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensurePageObjectExists()

ilAssQuestionFeedback::ensurePageObjectExists (   $pageObjectType,
  $pageObjectId 
)
private

ensures an existing page object with given type and id

@final @access private

Parameters
string$pageObjectType
integer$pageObjectId

Definition at line 837 of file class.ilAssQuestionFeedback.php.

838 {
840 && !ilAssGenFeedbackPage::_exists($pageObjectType, $pageObjectId, '', true)) {
841 $pageObject = new ilAssGenFeedbackPage();
842 $pageObject->setParentId($this->questionOBJ->getId());
843 $pageObject->setId($pageObjectId);
844 $pageObject->createFromXML();
845 }
847 && !ilAssSpecFeedbackPage::_exists($pageObjectType, $pageObjectId, '', true)) {
848 $pageObject = new ilAssSpecFeedbackPage();
849 $pageObject->setParentId($this->questionOBJ->getId());
850 $pageObject->setId($pageObjectId);
851 $pageObject->createFromXML();
852 }
853 }

References ilPageObject\_exists(), PAGE_OBJECT_TYPE_GENERIC_FEEDBACK, and PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK.

Referenced by duplicatePageObject(), getPageObjectContent(), and getPageObjectXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllSpecificAnswerFeedbackContents()

ilAssQuestionFeedback::getAllSpecificAnswerFeedbackContents (   $questionId)
abstract

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

@abstract @access public

Parameters
integer$questionId
Returns
string $feedbackContent

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

◆ getClassNameByType()

ilAssQuestionFeedback::getClassNameByType (   $a_type,
  $a_gui = false 
)

Get class name by type.

Parameters

return

Definition at line 723 of file class.ilAssQuestionFeedback.php.

724 {
725 $gui = ($a_gui)
726 ? "GUI"
727 : "";
728 include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php");
730 return "ilAssGenFeedbackPage" . $gui;
731 }
733 return "ilAssSpecFeedbackPage" . $gui;
734 }
735 }

References PAGE_OBJECT_TYPE_GENERIC_FEEDBACK, and PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK.

Referenced by createPageObject(), duplicatePageObject(), getPageObjectContent(), getPageObjectEditingLink(), and getPageObjectXML().

+ Here is the caller graph for this function:

◆ getGenericFeedbackContent()

ilAssQuestionFeedback::getGenericFeedbackContent (   $questionId,
  $solutionCompleted 
)
final

returns the GENERIC feedback content for a given question state.

the state is either the completed solution (all answers correct) of the question or at least one incorrect answer.

@final @access public

Parameters
integer$questionId
boolean$solutionCompleted
Returns
string $feedbackContent

Definition at line 323 of file class.ilAssQuestionFeedback.php.

324 {
325 require_once 'Services/RTE/classes/class.ilRTE.php';
326
327 $correctness = $solutionCompleted ? 1 : 0;
328
329 $res = $this->db->queryF(
330 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
331 array('integer', 'text'),
332 array($questionId, $correctness)
333 );
334
335 $feedbackContent = null;
336
337 while ($row = $this->db->fetchAssoc($res)) {
338 $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($row['feedback'], 1);
339 break;
340 }
341
342 return is_null($feedbackContent) ? '' : $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedbackContent);
343 }
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...

References $res, and ilRTE\_replaceMediaObjectImageSrc().

Referenced by getGenericFeedbackExportPresentation(), getGenericFeedbackTestPresentation(), and initGenericFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGenericFeedbackExportPresentation()

ilAssQuestionFeedback::getGenericFeedbackExportPresentation (   $questionId,
  $solutionCompleted 
)

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

@access public

Parameters
integer$questionId
boolean$solutionCompleted
Returns
string $genericFeedbackExportPresentation

Definition at line 1006 of file class.ilAssQuestionFeedback.php.

1007 {
1008 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
1009 $genericFeedbackExportPresentation = $this->getPageObjectXML(
1011 $this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
1012 );
1013 } else {
1014 $genericFeedbackExportPresentation = $this->getGenericFeedbackContent($questionId, $solutionCompleted);
1015 }
1016
1017 return $genericFeedbackExportPresentation;
1018 }
getPageObjectXML($pageObjectType, $pageObjectId)
returns the xml of page object with given type and id
getGenericFeedbackContent($questionId, $solutionCompleted)
returns the GENERIC feedback content for a given question state.

References getGenericFeedbackContent(), getGenericFeedbackPageObjectId(), getGenericFeedbackPageObjectType(), and getPageObjectXML().

+ Here is the call graph for this function:

◆ getGenericFeedbackId()

ilAssQuestionFeedback::getGenericFeedbackId (   $questionId,
  $solutionCompleted 
)
finalprotected

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

@final @access protected

Parameters
integer$questionId
boolean$answerIndex
Returns
string $feedbackId

Definition at line 620 of file class.ilAssQuestionFeedback.php.

621 {
622 $res = $this->db->queryF(
623 "SELECT feedback_id FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
624 array('integer','text'),
625 array($questionId, (int) $solutionCompleted)
626 );
627
628 $feedbackId = null;
629
630 while ($row = $this->db->fetchAssoc($res)) {
631 $feedbackId = $row['feedback_id'];
632 break;
633 }
634
635 return $feedbackId;
636 }

References $res.

Referenced by getGenericFeedbackPageObjectId(), and saveGenericFeedbackContent().

+ Here is the caller graph for this function:

◆ getGenericFeedbackPageObjectId()

ilAssQuestionFeedback::getGenericFeedbackPageObjectId (   $questionId,
  $solutionCompleted 
)
finalprotected

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)

@final @access protected

Parameters
integer$questionId
boolean$solutionCompleted
Returns
integer $pageObjectId

Definition at line 986 of file class.ilAssQuestionFeedback.php.

987 {
988 $pageObjectId = $this->getGenericFeedbackId($questionId, $solutionCompleted);
989
990 if (!$pageObjectId) {
991 $pageObjectId = $this->saveGenericFeedbackContent($questionId, $solutionCompleted, null);
992 }
993
994 return $pageObjectId;
995 }
getGenericFeedbackId($questionId, $solutionCompleted)
returns the SPECIFIC answer feedback ID for a given question id and answer index.
saveGenericFeedbackContent($questionId, $solutionCompleted, $feedbackContent)
saves GENERIC feedback content for the given question id to the database.

References getGenericFeedbackId(), and saveGenericFeedbackContent().

Referenced by deleteGenericFeedbacks(), getGenericFeedbackExportPresentation(), getGenericFeedbackTestPresentation(), importGenericFeedback(), and initGenericFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGenericFeedbackPageObjectType()

ilAssQuestionFeedback::getGenericFeedbackPageObjectType ( )
finalprotected

returns the type for generic feedback page objects defined in local constant

@final @access protected

Returns
string $genericFeedbackPageObjectType

Definition at line 935 of file class.ilAssQuestionFeedback.php.

936 {
938 }

References PAGE_OBJECT_TYPE_GENERIC_FEEDBACK.

Referenced by deleteGenericFeedbacks(), duplicateGenericFeedback(), getGenericFeedbackExportPresentation(), getGenericFeedbackTestPresentation(), importGenericFeedback(), and initGenericFormProperties().

+ Here is the caller graph for this function:

◆ getGenericFeedbackTableName()

ilAssQuestionFeedback::getGenericFeedbackTableName ( )
finalprotected

returns the table name for specific feedback

@final

Returns
string $specificFeedbackTableName

Definition at line 694 of file class.ilAssQuestionFeedback.php.

695 {
697 }
const TABLE_NAME_GENERIC_FEEDBACK
table name for specific feedback

References TABLE_NAME_GENERIC_FEEDBACK.

Referenced by duplicateGenericFeedback(), saveGenericFeedbackContent(), and syncGenericFeedback().

+ Here is the caller graph for this function:

◆ getGenericFeedbackTestPresentation()

ilAssQuestionFeedback::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)

@access public

Parameters
integer$questionId
boolean$solutionCompleted
Returns
string $genericFeedbackTestPresentationHTML

Definition at line 112 of file class.ilAssQuestionFeedback.php.

113 {
114 if ($this->page_obj_output_mode == "edit") {
115 return "";
116 }
117 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
118 $genericFeedbackTestPresentationHTML = $this->getPageObjectContent(
120 $this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
121 );
122 } else {
123 $genericFeedbackTestPresentationHTML = $this->getGenericFeedbackContent($questionId, $solutionCompleted);
124 }
125
126 return $genericFeedbackTestPresentationHTML;
127 }
getPageObjectContent($pageObjectType, $pageObjectId)
returns the content of page object with given type and id

References getGenericFeedbackContent(), getGenericFeedbackPageObjectId(), getGenericFeedbackPageObjectType(), and getPageObjectContent().

+ Here is the call graph for this function:

◆ getPageObjectContent()

ilAssQuestionFeedback::getPageObjectContent (   $pageObjectType,
  $pageObjectId 
)
finalprotected

returns the content of page object with given type and id

@final @access protected

Parameters
string$pageObjectType
integer$pageObjectId
Returns
string $pageObjectContent

Definition at line 789 of file class.ilAssQuestionFeedback.php.

790 {
791 global $DIC;
792 $ilCtrl = $DIC['ilCtrl'];
793
794 $cl = $this->getClassNameByType($pageObjectType, true);
795 require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
796
797 $this->ensurePageObjectExists($pageObjectType, $pageObjectId);
798
799 $mode = ($ilCtrl->isAsynch())
800 ? "presentation"
801 : $this->getPageObjectOutputMode();
802
803 $pageObjectGUI = new $cl($pageObjectId);
804 $pageObjectGUI->setOutputMode($mode);
805
806 return $pageObjectGUI->presentation($mode);
807 }
getPageObjectOutputMode()
Get page object output mode.
global $DIC
Definition: goto.php:24

References $DIC, ensurePageObjectExists(), getClassNameByType(), and getPageObjectOutputMode().

Referenced by getGenericFeedbackTestPresentation(), getPageObjectNonEditableValueHTML(), and ilAssMultiOptionQuestionFeedback\getSpecificAnswerFeedbackTestPresentation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageObjectEditingLink()

ilAssQuestionFeedback::getPageObjectEditingLink (   $pageObjectType,
  $pageObjectId 
)
private

returns a link to page object editor for page object with given type and id

@final @access private

Parameters
string$pageObjectType
integer$pageObjectId
Returns
string $pageObjectEditingLink

Definition at line 748 of file class.ilAssQuestionFeedback.php.

749 {
750 $cl = $this->getClassNameByType($pageObjectType, true);
751 $this->ctrl->setParameterByClass($cl, 'feedback_type', $pageObjectType);
752 $this->ctrl->setParameterByClass($cl, 'feedback_id', $pageObjectId);
753
754 $linkHREF = $this->ctrl->getLinkTargetByClass($cl, 'edit');
755 $linkTEXT = $this->lng->txt('tst_question_feedback_edit_page');
756
757 return "<a href='$linkHREF'>$linkTEXT</a>";
758 }

References getClassNameByType().

Referenced by getPageObjectNonEditableValueHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageObjectNonEditableValueHTML()

ilAssQuestionFeedback::getPageObjectNonEditableValueHTML (   $pageObjectType,
  $pageObjectId 
)
finalprotected

returns html content to be used as value for non editable value form properties in feedback editing form

@final @access protected

Parameters
string$pageObjectType
integer$pageObjectId
Returns
string $nonEditableValueHTML

Definition at line 709 of file class.ilAssQuestionFeedback.php.

710 {
711 $link = $this->getPageObjectEditingLink($pageObjectType, $pageObjectId);
712 $content = $this->getPageObjectContent($pageObjectType, $pageObjectId);
713
714 return "$link<br /><br />$content";
715 }
getPageObjectEditingLink($pageObjectType, $pageObjectId)
returns a link to page object editor for page object with given type and id

References getPageObjectContent(), and getPageObjectEditingLink().

Referenced by ilAssClozeTestFeedback\getSpecificAnswerFeedbackFormValue(), initGenericFormProperties(), ilAssConfigurableMultiOptionQuestionFeedback\initSpecificFormProperties(), and ilAssMultiOptionQuestionFeedback\initSpecificFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageObjectOutputMode()

ilAssQuestionFeedback::getPageObjectOutputMode ( )
final

Get page object output mode.

Returns
string page output mode

Definition at line 775 of file class.ilAssQuestionFeedback.php.

References $page_obj_output_mode.

Referenced by getPageObjectContent().

+ Here is the caller graph for this function:

◆ getPageObjectXML()

ilAssQuestionFeedback::getPageObjectXML (   $pageObjectType,
  $pageObjectId 
)
finalprotected

returns the xml of page object with given type and id

@final @access protected

Parameters
string$pageObjectType
integer$pageObjectId
Returns
string $pageObjectXML

Definition at line 818 of file class.ilAssQuestionFeedback.php.

819 {
820 $cl = $this->getClassNameByType($pageObjectType);
821 require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
822
823 $this->ensurePageObjectExists($pageObjectType, $pageObjectId);
824
825 $pageObject = new $cl($pageObjectId);
826 return $pageObject->getXMLContent();
827 }

References ensurePageObjectExists(), and getClassNameByType().

Referenced by getGenericFeedbackExportPresentation(), ilAssMultiOptionQuestionFeedback\getSpecificAnswerFeedbackExportPresentation(), and ilAssClozeTestFeedback\isSpecificAnswerFeedbackAvailable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackContent()

ilAssQuestionFeedback::getSpecificAnswerFeedbackContent (   $questionId,
  $questionIndex,
  $answerIndex 
)
abstract

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

@abstract @access public

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

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

◆ getSpecificAnswerFeedbackExportPresentation()

ilAssQuestionFeedback::getSpecificAnswerFeedbackExportPresentation (   $questionId,
  $questionIndex,
  $answerIndex 
)
abstract

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

@abstract @access public

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

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

Referenced by isSpecificAnswerFeedbackAvailable().

+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackPageObjectType()

◆ getSpecificAnswerFeedbackTestPresentation()

ilAssQuestionFeedback::getSpecificAnswerFeedbackTestPresentation (   $questionId,
  $questionIndex,
  $answerIndex 
)
abstract

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

@abstract @access public

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

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

◆ importGenericFeedback()

ilAssQuestionFeedback::importGenericFeedback (   $questionId,
  $solutionCompleted,
  $feedbackContent 
)

imports the given feedback content as generic feedback for the given question id for either the complete or incomplete solution

@access public

Parameters
integer$questionId
boolean$solutionCompleted
string$feedbackContent

Definition at line 1042 of file class.ilAssQuestionFeedback.php.

1043 {
1044 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
1045 $pageObjectId = $this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted);
1046 $pageObjectType = $this->getGenericFeedbackPageObjectType();
1047
1048 $this->createPageObject($pageObjectType, $pageObjectId, $feedbackContent);
1049 } else {
1050 $this->saveGenericFeedbackContent($questionId, $solutionCompleted, $feedbackContent);
1051 }
1052 }
createPageObject($pageObjectType, $pageObjectId, $pageObjectContent)
creates a new page object with given page object id and page object type and passed page object conte...

References createPageObject(), getGenericFeedbackPageObjectId(), getGenericFeedbackPageObjectType(), and saveGenericFeedbackContent().

+ Here is the call graph for this function:

◆ importSpecificAnswerFeedback()

ilAssQuestionFeedback::importSpecificAnswerFeedback (   $questionId,
  $questionIndex,
  $answerIndex,
  $feedbackContent 
)
abstract

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

@abstract @access public

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

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

◆ initGenericFormProperties()

ilAssQuestionFeedback::initGenericFormProperties ( ilPropertyFormGUI  $form)
final

initialises a given form object's GENERIC form properties relating to all question types

@final @access public

Parameters
ilPropertyFormGUI$form

Definition at line 183 of file class.ilAssQuestionFeedback.php.

184 {
185 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
186 $pageObjectType = $this->getGenericFeedbackPageObjectType();
187
188 $valueFeedbackSolutionComplete = $this->getPageObjectNonEditableValueHTML(
189 $pageObjectType,
190 $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), true)
191 );
192
193 $valueFeedbackSolutionIncomplete = $this->getPageObjectNonEditableValueHTML(
194 $pageObjectType,
195 $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), false)
196 );
197 } else {
198 $valueFeedbackSolutionComplete = $this->getGenericFeedbackContent(
199 $this->questionOBJ->getId(),
200 true
201 );
202
203 $valueFeedbackSolutionIncomplete = $this->getGenericFeedbackContent(
204 $this->questionOBJ->getId(),
205 false
206 );
207 }
208
209 $form->getItemByPostVar('feedback_complete')->setValue($valueFeedbackSolutionComplete);
210 $form->getItemByPostVar('feedback_incomplete')->setValue($valueFeedbackSolutionIncomplete);
211 }
getPageObjectNonEditableValueHTML($pageObjectType, $pageObjectId)
returns html content to be used as value for non editable value form properties in feedback editing f...
getItemByPostVar($a_post_var)
Get Item by POST variable.

References getGenericFeedbackContent(), getGenericFeedbackPageObjectId(), getGenericFeedbackPageObjectType(), ilPropertyFormGUI\getItemByPostVar(), and getPageObjectNonEditableValueHTML().

+ Here is the call graph for this function:

◆ initSpecificFormProperties()

ilAssQuestionFeedback::initSpecificFormProperties ( ilPropertyFormGUI  $form)
abstract

initialises a given form object's SPECIFIC form properties relating to this question type

@abstract @access public

Parameters
ilPropertyFormGUI$form

Reimplemented in ilAssClozeTestFeedback, ilAssConfigurableMultiOptionQuestionFeedback, ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

◆ isGenericFeedbackId()

ilAssQuestionFeedback::isGenericFeedbackId (   $feedbackId)
protected
Parameters
int$feedbackId
Returns
bool

Definition at line 642 of file class.ilAssQuestionFeedback.php.

643 {
644 $row = $this->db->fetchAssoc($this->db->queryF(
645 "SELECT COUNT(feedback_id) cnt FROM {$this->getGenericFeedbackTableName()}
646 WHERE question_fi = %s AND feedback_id = %s",
647 array('integer','integer'),
648 array($this->questionOBJ->getId(), $feedbackId)
649 ));
650
651
652 return $row['cnt'];
653 }

Referenced by checkFeedbackParent().

+ Here is the caller graph for this function:

◆ isSaveableInPageObjectEditingMode()

ilAssQuestionFeedback::isSaveableInPageObjectEditingMode ( )

returns the fact wether the feedback editing form is saveable in page object editing or not.

by default all properties are edited as page object unless there are additional settings (this method can be overwritten per question type if required)

@access public

Returns
boolean $isSaveableInPageObjectEditingMode

Reimplemented in ilAssClozeTestFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

Definition at line 257 of file class.ilAssQuestionFeedback.php.

258 {
259 return false;
260 }

◆ isSpecificAnswerFeedbackAvailable()

ilAssQuestionFeedback::isSpecificAnswerFeedbackAvailable (   $questionId)

returns the fact wether any specific feedback content is available or not

Parameters
integer$questionId
Returns
bool

Reimplemented in ilAssClozeTestFeedback.

Definition at line 373 of file class.ilAssQuestionFeedback.php.

374 {
375 $res = $this->db->queryF(
376 "SELECT answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
377 ['integer'],
378 [$questionId]
379 );
380
381 $allFeedbackContents = '';
382
383 while ($row = $this->db->fetchAssoc($res)) {
384 $allFeedbackContents .= $this->getSpecificAnswerFeedbackExportPresentation(
385 $this->questionOBJ->getId(),
386 0,
387 $row['answer']
388 );
389 }
390
391 return (bool) strlen(trim(strip_tags($allFeedbackContents)));
392 }
getSpecificAnswerFeedbackExportPresentation($questionId, $questionIndex, $answerIndex)
returns the generic feedback export presentation for given question id either for solution completed ...

References $res, and getSpecificAnswerFeedbackExportPresentation().

+ Here is the call graph for this function:

◆ isSpecificAnswerFeedbackId()

ilAssQuestionFeedback::isSpecificAnswerFeedbackId (   $feedbackId)
abstractprotected
Parameters
int$feedbackId
Returns
bool

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

Referenced by checkFeedbackParent().

+ Here is the caller graph for this function:

◆ isValidFeedbackPageObjectType()

static ilAssQuestionFeedback::isValidFeedbackPageObjectType (   $feedbackPageObjectType)
staticfinal

returns the fact wether the given page object type relates to generic or specific feedback page objects

@final

@access public

Parameters
string$feedbackPageObjectType
Returns
array $validFeedbackPageObjectTypes

Definition at line 963 of file class.ilAssQuestionFeedback.php.

964 {
965 switch ($feedbackPageObjectType) {
968
969 return true;
970 }
971
972 return false;
973 }

References PAGE_OBJECT_TYPE_GENERIC_FEEDBACK, and PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK.

Referenced by ilAssQuestionFeedbackPageObjectCommandForwarder\__construct().

+ Here is the caller graph for this function:

◆ migrateContentForLearningModule()

ilAssQuestionFeedback::migrateContentForLearningModule ( ilAssSelfAssessmentMigrator  $migrator,
  $questionId 
)
Parameters
ilAssSelfAssessmentMigrator$migrator
integer$questionId

Definition at line 1071 of file class.ilAssQuestionFeedback.php.

1072 {
1073 $this->saveGenericFeedbackContent($questionId, true, $migrator->migrateToLmContent(
1074 $this->getGenericFeedbackContent($questionId, true)
1075 ));
1076
1077 $this->saveGenericFeedbackContent($questionId, false, $migrator->migrateToLmContent(
1078 $this->getGenericFeedbackContent($questionId, false)
1079 ));
1080 }

References ilAssSelfAssessmentMigrator\migrateToLmContent(), and saveGenericFeedbackContent().

+ Here is the call graph for this function:

◆ saveGenericFeedbackContent()

ilAssQuestionFeedback::saveGenericFeedbackContent (   $questionId,
  $solutionCompleted,
  $feedbackContent 
)
final

saves GENERIC feedback content for the given question id to the database.

Generic feedback is either feedback for the completed solution (all answers correct) of the question or at least onen incorrect answer.

@final @access public

Parameters
integer$questionId
boolean$solutionCompleted
string$feedbackContent
Returns
integer $feedbackId

Definition at line 406 of file class.ilAssQuestionFeedback.php.

407 {
408 require_once 'Services/RTE/classes/class.ilRTE.php';
409
410 $correctness = $solutionCompleted ? 1 : 0;
411
412 $feedbackId = $this->getGenericFeedbackId($questionId, $solutionCompleted);
413
414 if (strlen($feedbackContent)) {
415 $feedbackContent = $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedbackContent);
416 $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($feedbackContent, 0);
417 }
418
419 if ($feedbackId) {
420 $this->db->update(
422 array(
423 'feedback' => array('clob', $feedbackContent),
424 'tstamp' => array('integer', time())
425 ),
426 array(
427 'feedback_id' => array('integer', $feedbackId)
428 )
429 );
430 } else {
431 $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
432
433 $this->db->insert($this->getGenericFeedbackTableName(), array(
434 'feedback_id' => array('integer', $feedbackId),
435 'question_fi' => array('integer', $questionId),
436 'correctness' => array('text', $correctness), // text ?
437 'feedback' => array('clob', $feedbackContent),
438 'tstamp' => array('integer', time())
439 ));
440 }
441
442 return $feedbackId;
443 }

References ilRTE\_replaceMediaObjectImageSrc(), getGenericFeedbackId(), and getGenericFeedbackTableName().

Referenced by getGenericFeedbackPageObjectId(), importGenericFeedback(), migrateContentForLearningModule(), and saveGenericFormProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveGenericFormProperties()

ilAssQuestionFeedback::saveGenericFormProperties ( ilPropertyFormGUI  $form)
final

saves a given form object's GENERIC form properties relating to all question types

@final @access public

Parameters
ilPropertyFormGUI$form

Definition at line 231 of file class.ilAssQuestionFeedback.php.

232 {
233 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
234 $this->saveGenericFeedbackContent($this->questionOBJ->getId(), false, $form->getInput('feedback_incomplete'));
235 $this->saveGenericFeedbackContent($this->questionOBJ->getId(), true, $form->getInput('feedback_complete'));
236 }
237 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput(), and saveGenericFeedbackContent().

+ Here is the call graph for this function:

◆ saveSpecificAnswerFeedbackContent()

ilAssQuestionFeedback::saveSpecificAnswerFeedbackContent (   $questionId,
  $questionIndex,
  $answerIndex,
  $feedbackContent 
)
abstract

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

@abstract @access public

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

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

◆ saveSpecificFormProperties()

ilAssQuestionFeedback::saveSpecificFormProperties ( ilPropertyFormGUI  $form)
abstract

saves a given form object's SPECIFIC form properties relating to this question type

@abstract @access public

Parameters
ilPropertyFormGUI$form

Reimplemented in ilAssClozeTestFeedback, ilAssConfigurableMultiOptionQuestionFeedback, ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

◆ setPageObjectOutputMode()

ilAssQuestionFeedback::setPageObjectOutputMode (   $a_val)
final

Set page object output mode.

Parameters
string$a_valpage output mode

Definition at line 765 of file class.ilAssQuestionFeedback.php.

766 {
767 $this->page_obj_output_mode = $a_val;
768 }

◆ syncFeedback()

ilAssQuestionFeedback::syncFeedback (   $originalQuestionId,
  $duplicateQuestionId 
)
final

syncs the feedback from a duplicated question back to the original question

@final @access public

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Definition at line 567 of file class.ilAssQuestionFeedback.php.

568 {
569 $this->syncGenericFeedback($originalQuestionId, $duplicateQuestionId);
570 $this->syncSpecificFeedback($originalQuestionId, $duplicateQuestionId);
571 }
syncGenericFeedback($originalQuestionId, $duplicateQuestionId)
syncs the GENERIC feedback from a duplicated question back to the original question
syncSpecificFeedback($originalQuestionId, $duplicateQuestionId)
syncs the SPECIFIC feedback from a duplicated question back to the original question

References syncGenericFeedback(), and syncSpecificFeedback().

+ Here is the call graph for this function:

◆ syncGenericFeedback()

ilAssQuestionFeedback::syncGenericFeedback (   $originalQuestionId,
  $duplicateQuestionId 
)
private

syncs the GENERIC feedback from a duplicated question back to the original question

@final @access private

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Definition at line 581 of file class.ilAssQuestionFeedback.php.

582 {
583 // delete generic feedback of the original question
584 $this->db->manipulateF(
585 "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
586 array('integer'),
587 array($originalQuestionId)
588 );
589
590 // get generic feedback of the actual (duplicated) question
591 $result = $this->db->queryF(
592 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
593 array('integer'),
594 array($duplicateQuestionId)
595 );
596
597 // save generic feedback to the original question
598 while ($row = $this->db->fetchAssoc($result)) {
599 $nextId = $this->db->nextId($this->getGenericFeedbackTableName());
600
601 $this->db->insert($this->getGenericFeedbackTableName(), array(
602 'feedback_id' => array('integer', $nextId),
603 'question_fi' => array('integer', $originalQuestionId),
604 'correctness' => array('text', $row['correctness']),
605 'feedback' => array('clob', $row['feedback']),
606 'tstamp' => array('integer', time())
607 ));
608 }
609 }
$result

References $result, and getGenericFeedbackTableName().

Referenced by syncFeedback().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncSpecificFeedback()

ilAssQuestionFeedback::syncSpecificFeedback (   $originalQuestionId,
  $duplicateQuestionId 
)
abstractprotected

syncs the SPECIFIC feedback from a duplicated question back to the original question

@abstract @access protected

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Reimplemented in ilAssClozeTestFeedback, ilAssConfigurableMultiOptionQuestionFeedback, ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

Referenced by syncFeedback().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilAssQuestionFeedback::$ctrl = null
protected

Definition at line 58 of file class.ilAssQuestionFeedback.php.

Referenced by __construct().

◆ $db

ilAssQuestionFeedback::$db = null
protected

Definition at line 66 of file class.ilAssQuestionFeedback.php.

Referenced by __construct().

◆ $lng

ilAssQuestionFeedback::$lng = null
protected

Definition at line 74 of file class.ilAssQuestionFeedback.php.

Referenced by __construct().

◆ $page_obj_output_mode

ilAssQuestionFeedback::$page_obj_output_mode = "presentation"
protected

Definition at line 82 of file class.ilAssQuestionFeedback.php.

Referenced by getPageObjectOutputMode().

◆ $questionOBJ

ilAssQuestionFeedback::$questionOBJ = null
protected

Definition at line 50 of file class.ilAssQuestionFeedback.php.

Referenced by __construct().

◆ CSS_CLASS_FEEDBACK_CORRECT

◆ CSS_CLASS_FEEDBACK_WRONG

◆ FEEDBACK_SOLUTION_COMPLETE_PAGE_OBJECT_ID

const ilAssQuestionFeedback::FEEDBACK_SOLUTION_COMPLETE_PAGE_OBJECT_ID = 2

id for page object relating to generic complete solution feedback

Definition at line 37 of file class.ilAssQuestionFeedback.php.

◆ FEEDBACK_SOLUTION_INCOMPLETE_PAGE_OBJECT_ID

const ilAssQuestionFeedback::FEEDBACK_SOLUTION_INCOMPLETE_PAGE_OBJECT_ID = 1

id for page object relating to generic incomplete solution feedback

Definition at line 32 of file class.ilAssQuestionFeedback.php.

◆ PAGE_OBJECT_TYPE_GENERIC_FEEDBACK

◆ PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK

◆ TABLE_NAME_GENERIC_FEEDBACK

const ilAssQuestionFeedback::TABLE_NAME_GENERIC_FEEDBACK = 'qpl_fb_generic'

table name for specific feedback

Definition at line 42 of file class.ilAssQuestionFeedback.php.

Referenced by getGenericFeedbackTableName().


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