ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 273 of file class.ilAssQuestionFeedback.php.

274 {
275 if ($asNonEditable) {
276 require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
277
278 $property = new ilNonEditableValueGUI($label, $postVar, true);
279 } else {
280 require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
281 require_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
282
283 $property = new ilTextAreaInputGUI($label, $postVar);
284 $property->setRequired(false);
285 $property->setRows(10);
286 $property->setCols(80);
287
288 if (!$this->questionOBJ->getPreventRteUsage()) {
289 $property->setUseRte(true);
290 $property->addPlugin("latex");
291 $property->addButton("latex");
292 $property->addButton("pastelatex");
293
294 require_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
295 $property->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
296 $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
297 } else {
298 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
300 $property->setUseTagsForRteOnly(false);
301 }
302
303 $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
304 }
305
306 return $property;
307 }
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 646 of file class.ilAssQuestionFeedback.php.

647 {
648 if ($this->isGenericFeedbackId($feedbackId)) {
649 return true;
650 }
651
652 if ($this->isSpecificAnswerFeedbackId($feedbackId)) {
653 return true;
654 }
655
656 return false;
657 }
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 147 of file class.ilAssQuestionFeedback.php.

148 {
150 $this->lng->txt('feedback_complete_solution'),
151 'feedback_complete',
152 $this->questionOBJ->isAdditionalContentEditingModePageObject()
153 ));
154
156 $this->lng->txt('feedback_incomplete_solution'),
157 'feedback_incomplete',
158 $this->questionOBJ->isAdditionalContentEditingModePageObject()
159 ));
160 }
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 850 of file class.ilAssQuestionFeedback.php.

851 {
852 $cl = $this->getClassNameByType($pageObjectType);
853 require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
854
855 $pageObject = new $cl();
856 $pageObject->setParentId($this->questionOBJ->getId());
857 $pageObject->setId($pageObjectId);
858 $pageObject->setXMLContent($pageObjectContent);
859 $pageObject->createFromXML();
860 }
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 448 of file class.ilAssQuestionFeedback.php.

449 {
450 if ($isAdditionalContentEditingModePageObject) {
453 $this->getGenericFeedbackPageObjectId($questionId, true)
454 );
455
458 $this->getGenericFeedbackPageObjectId($questionId, false)
459 );
460 }
461
462 $this->db->manipulateF(
463 "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
464 array('integer'),
465 array($questionId)
466 );
467 }
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 488 of file class.ilAssQuestionFeedback.php.

489 {
490 $this->duplicateGenericFeedback($originalQuestionId, $duplicateQuestionId);
491 $this->duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId);
492 }
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 503 of file class.ilAssQuestionFeedback.php.

504 {
505 $res = $this->db->queryF(
506 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
507 array('integer'),
508 array($originalQuestionId)
509 );
510
511 while ($row = $this->db->fetchAssoc($res)) {
512 $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
513
514 $this->db->insert($this->getGenericFeedbackTableName(), array(
515 'feedback_id' => array('integer', $feedbackId),
516 'question_fi' => array('integer', $duplicateQuestionId),
517 'correctness' => array('text', $row['correctness']),
518 'feedback' => array('clob', $row['feedback']),
519 'tstamp' => array('integer', time())
520 ));
521
522 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
523 $pageObjectType = $this->getGenericFeedbackPageObjectType();
524 $this->duplicatePageObject($pageObjectType, $row['feedback_id'], $feedbackId, $duplicateQuestionId);
525 }
526 }
527 }
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 873 of file class.ilAssQuestionFeedback.php.

874 {
875 $cl = $this->getClassNameByType($pageObjectType);
876 require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
877
878 $pageObject = new $cl($originalPageObjectId);
879 $pageObject->setParentId($duplicatePageObjectParentId);
880 $pageObject->setId($duplicatePageObjectId);
881 $pageObject->createFromXML();
882 }

References 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 892 of file class.ilAssQuestionFeedback.php.

893 {
895 include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPage.php");
896 if (ilAssGenFeedbackPage::_exists($pageObjectType, $pageObjectId)) {
897 $pageObject = new ilAssGenFeedbackPage($pageObjectId);
898 $pageObject->delete();
899 }
900 }
902 include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPage.php");
903 if (ilAssSpecFeedbackPage::_exists($pageObjectType, $pageObjectId)) {
904 $pageObject = new ilAssSpecFeedbackPage($pageObjectId);
905 $pageObject->delete();
906 }
907 }
908 }
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 818 of file class.ilAssQuestionFeedback.php.

819 {
821 include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPage.php");
822 if (!ilAssGenFeedbackPage::_exists($pageObjectType, $pageObjectId)) {
823 $pageObject = new ilAssGenFeedbackPage();
824 $pageObject->setParentId($this->questionOBJ->getId());
825 $pageObject->setId($pageObjectId);
826 $pageObject->createFromXML();
827 }
828 }
830 include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPage.php");
831 if (!ilAssSpecFeedbackPage::_exists($pageObjectType, $pageObjectId)) {
832 $pageObject = new ilAssSpecFeedbackPage();
833 $pageObject->setParentId($this->questionOBJ->getId());
834 $pageObject->setId($pageObjectId);
835 $pageObject->createFromXML();
836 }
837 }
838 }

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

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

Referenced by isSpecificAnswerFeedbackAvailable().

+ Here is the caller graph for this function:

◆ getClassNameByType()

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

Get class name by type.

Parameters

return

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

705 {
706 $gui = ($a_gui)
707 ? "GUI"
708 : "";
709 include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php");
711 return "ilAssGenFeedbackPage" . $gui;
712 }
714 return "ilAssSpecFeedbackPage" . $gui;
715 }
716 }
$a_type
Definition: workflow.php:92

References $a_type, 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 320 of file class.ilAssQuestionFeedback.php.

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

990 {
991 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
992 $genericFeedbackExportPresentation = $this->getPageObjectXML(
994 $this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
995 );
996 } else {
997 $genericFeedbackExportPresentation = $this->getGenericFeedbackContent($questionId, $solutionCompleted);
998 }
999
1000 return $genericFeedbackExportPresentation;
1001 }
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 601 of file class.ilAssQuestionFeedback.php.

602 {
603 $res = $this->db->queryF(
604 "SELECT feedback_id FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
605 array('integer','text'),
606 array($questionId, (int) $solutionCompleted)
607 );
608
609 $feedbackId = null;
610
611 while ($row = $this->db->fetchAssoc($res)) {
612 $feedbackId = $row['feedback_id'];
613 break;
614 }
615
616 return $feedbackId;
617 }

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 969 of file class.ilAssQuestionFeedback.php.

970 {
971 $pageObjectId = $this->getGenericFeedbackId($questionId, $solutionCompleted);
972
973 if (!$pageObjectId) {
974 $pageObjectId = $this->saveGenericFeedbackContent($questionId, $solutionCompleted, null);
975 }
976
977 return $pageObjectId;
978 }
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 918 of file class.ilAssQuestionFeedback.php.

919 {
921 }

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 675 of file class.ilAssQuestionFeedback.php.

676 {
678 }
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->questionOBJ->isAdditionalContentEditingModePageObject()) {
115 $genericFeedbackTestPresentationHTML = $this->getPageObjectContent(
117 $this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
118 );
119 } else {
120 $genericFeedbackTestPresentationHTML = $this->getGenericFeedbackContent($questionId, $solutionCompleted);
121 }
122
123 return $genericFeedbackTestPresentationHTML;
124 }
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 770 of file class.ilAssQuestionFeedback.php.

771 {
772 global $DIC;
773 $ilCtrl = $DIC['ilCtrl'];
774
775 $cl = $this->getClassNameByType($pageObjectType, true);
776 require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
777
778 $this->ensurePageObjectExists($pageObjectType, $pageObjectId);
779
780 $mode = ($ilCtrl->isAsynch())
781 ? "presentation"
782 : $this->getPageObjectOutputMode();
783
784 $pageObjectGUI = new $cl($pageObjectId);
785 $pageObjectGUI->setOutputMode($mode);
786
787 return $pageObjectGUI->presentation($mode);
788 }
getPageObjectOutputMode()
Get page object output mode.
ensurePageObjectExists($pageObjectType, $pageObjectId)
ensures an existing page object with given type and id
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46

References $DIC, $ilCtrl, 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 729 of file class.ilAssQuestionFeedback.php.

730 {
731 $cl = $this->getClassNameByType($pageObjectType, true);
732 $this->ctrl->setParameterByClass($cl, 'feedback_type', $pageObjectType);
733 $this->ctrl->setParameterByClass($cl, 'feedback_id', $pageObjectId);
734
735 $linkHREF = $this->ctrl->getLinkTargetByClass($cl, 'edit');
736 $linkTEXT = $this->lng->txt('tst_question_feedback_edit_page');
737
738 return "<a href='$linkHREF'>$linkTEXT</a>";
739 }

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 690 of file class.ilAssQuestionFeedback.php.

691 {
692 $link = $this->getPageObjectEditingLink($pageObjectType, $pageObjectId);
693 $content = $this->getPageObjectContent($pageObjectType, $pageObjectId);
694
695 return "$link<br /><br />$content";
696 }
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 756 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 799 of file class.ilAssQuestionFeedback.php.

800 {
801 $cl = $this->getClassNameByType($pageObjectType);
802 require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
803
804 $this->ensurePageObjectExists($pageObjectType, $pageObjectId);
805
806 $pageObject = new $cl($pageObjectId);
807 return $pageObject->getXMLContent();
808 }

References ensurePageObjectExists(), and getClassNameByType().

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

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

◆ 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 1025 of file class.ilAssQuestionFeedback.php.

1026 {
1027 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
1028 $pageObjectId = $this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted);
1029 $pageObjectType = $this->getGenericFeedbackPageObjectType();
1030
1031 $this->createPageObject($pageObjectType, $pageObjectId, $feedbackContent);
1032 } else {
1033 $this->saveGenericFeedbackContent($questionId, $solutionCompleted, $feedbackContent);
1034 }
1035 }
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 180 of file class.ilAssQuestionFeedback.php.

181 {
182 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
183 $pageObjectType = $this->getGenericFeedbackPageObjectType();
184
185 $valueFeedbackSolutionComplete = $this->getPageObjectNonEditableValueHTML(
186 $pageObjectType,
187 $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), true)
188 );
189
190 $valueFeedbackSolutionIncomplete = $this->getPageObjectNonEditableValueHTML(
191 $pageObjectType,
192 $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), false)
193 );
194 } else {
195 $valueFeedbackSolutionComplete = $this->getGenericFeedbackContent(
196 $this->questionOBJ->getId(),
197 true
198 );
199
200 $valueFeedbackSolutionIncomplete = $this->getGenericFeedbackContent(
201 $this->questionOBJ->getId(),
202 false
203 );
204 }
205
206 $form->getItemByPostVar('feedback_complete')->setValue($valueFeedbackSolutionComplete);
207 $form->getItemByPostVar('feedback_incomplete')->setValue($valueFeedbackSolutionIncomplete);
208 }
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 623 of file class.ilAssQuestionFeedback.php.

624 {
625 $row = $this->db->fetchAssoc($this->db->queryF(
626 "SELECT COUNT(feedback_id) cnt FROM {$this->getGenericFeedbackTableName()}
627 WHERE question_fi = %s AND feedback_id = %s",
628 array('integer','integer'),
629 array($this->questionOBJ->getId(), $feedbackId)
630 ));
631
632
633 return $row['cnt'];
634 }

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 254 of file class.ilAssQuestionFeedback.php.

255 {
256 return false;
257 }

◆ isSpecificAnswerFeedbackAvailable()

ilAssQuestionFeedback::isSpecificAnswerFeedbackAvailable (   $questionId)

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

Parameters
integer$questionId
Returns
bool

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

371 {
372 return (bool) strlen($this->getAllSpecificAnswerFeedbackContents($questionId));
373 }
getAllSpecificAnswerFeedbackContents($questionId)
returns the SPECIFIC feedback content for a given question id and answer index.

References getAllSpecificAnswerFeedbackContents().

+ 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 946 of file class.ilAssQuestionFeedback.php.

947 {
948 switch ($feedbackPageObjectType) {
951
952 return true;
953 }
954
955 return false;
956 }

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 1054 of file class.ilAssQuestionFeedback.php.

1055 {
1056 $this->saveGenericFeedbackContent($questionId, true, $migrator->migrateToLmContent(
1057 $this->getGenericFeedbackContent($questionId, true)
1058 ));
1059
1060 $this->saveGenericFeedbackContent($questionId, false, $migrator->migrateToLmContent(
1061 $this->getGenericFeedbackContent($questionId, false)
1062 ));
1063 }

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 387 of file class.ilAssQuestionFeedback.php.

388 {
389 require_once 'Services/RTE/classes/class.ilRTE.php';
390
391 $correctness = $solutionCompleted ? 1 : 0;
392
393 $feedbackId = $this->getGenericFeedbackId($questionId, $solutionCompleted);
394
395 if (strlen($feedbackContent)) {
396 $feedbackContent = $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedbackContent);
397 $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($feedbackContent, 0);
398 }
399
400 if ($feedbackId) {
401 $this->db->update(
403 array(
404 'feedback' => array('clob', $feedbackContent),
405 'tstamp' => array('integer', time())
406 ),
407 array(
408 'feedback_id' => array('integer', $feedbackId)
409 )
410 );
411 } else {
412 $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
413
414 $this->db->insert($this->getGenericFeedbackTableName(), array(
415 'feedback_id' => array('integer', $feedbackId),
416 'question_fi' => array('integer', $questionId),
417 'correctness' => array('text', $correctness), // text ?
418 'feedback' => array('clob', $feedbackContent),
419 'tstamp' => array('integer', time())
420 ));
421 }
422
423 return $feedbackId;
424 }

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 228 of file class.ilAssQuestionFeedback.php.

229 {
230 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
231 $this->saveGenericFeedbackContent($this->questionOBJ->getId(), false, $form->getInput('feedback_incomplete'));
232 $this->saveGenericFeedbackContent($this->questionOBJ->getId(), true, $form->getInput('feedback_complete'));
233 }
234 }
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 746 of file class.ilAssQuestionFeedback.php.

747 {
748 $this->page_obj_output_mode = $a_val;
749 }

◆ 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 548 of file class.ilAssQuestionFeedback.php.

549 {
550 $this->syncGenericFeedback($originalQuestionId, $duplicateQuestionId);
551 $this->syncSpecificFeedback($originalQuestionId, $duplicateQuestionId);
552 }
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 562 of file class.ilAssQuestionFeedback.php.

563 {
564 // delete generic feedback of the original question
565 $this->db->manipulateF(
566 "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
567 array('integer'),
568 array($originalQuestionId)
569 );
570
571 // get generic feedback of the actual (duplicated) question
572 $result = $this->db->queryF(
573 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
574 array('integer'),
575 array($duplicateQuestionId)
576 );
577
578 // save generic feedback to the original question
579 while ($row = $this->db->fetchAssoc($result)) {
580 $nextId = $this->db->nextId($this->getGenericFeedbackTableName());
581
582 $this->db->insert($this->getGenericFeedbackTableName(), array(
583 'feedback_id' => array('integer', $nextId),
584 'question_fi' => array('integer', $originalQuestionId),
585 'correctness' => array('text', $row['correctness']),
586 'feedback' => array('clob', $row['feedback']),
587 'tstamp' => array('integer', time())
588 ));
589 }
590 }
$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: