ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 645 of file class.ilAssQuestionFeedback.php.

646 {
647 if ($this->isGenericFeedbackId($feedbackId)) {
648 return true;
649 }
650
651 if ($this->isSpecificAnswerFeedbackId($feedbackId)) {
652 return true;
653 }
654
655 return false;
656 }
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...
if(isset($_POST['submit'])) $form

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

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

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

488 {
489 $this->duplicateGenericFeedback($originalQuestionId, $duplicateQuestionId);
490 $this->duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId);
491 }
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 
)
finalprivate

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

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

References $res, $row, 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 872 of file class.ilAssQuestionFeedback.php.

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

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

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

ensures an existing page object with given type and id

@final @access private

Parameters
string$pageObjectType
integer$pageObjectId

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

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

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

704 {
705 $gui = ($a_gui)
706 ? "GUI"
707 : "";
708 include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php");
710 return "ilAssGenFeedbackPage" . $gui;
711 }
713 return "ilAssSpecFeedbackPage" . $gui;
714 }
715 }
$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 $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, $row, 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 988 of file class.ilAssQuestionFeedback.php.

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

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

References $res, and $row.

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

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

918 {
920 }

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

675 {
677 }
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 769 of file class.ilAssQuestionFeedback.php.

770 {
771 global $DIC;
772 $ilCtrl = $DIC['ilCtrl'];
773
774 $cl = $this->getClassNameByType($pageObjectType, true);
775 require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
776
777 $this->ensurePageObjectExists($pageObjectType, $pageObjectId);
778
779 $mode = ($ilCtrl->isAsynch())
780 ? "presentation"
781 : $this->getPageObjectOutputMode();
782
783 $pageObjectGUI = new $cl($pageObjectId);
784 $pageObjectGUI->setOutputMode($mode);
785
786 return $pageObjectGUI->presentation($mode);
787 }
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
global $DIC
Definition: saml.php:7

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 
)
finalprivate

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

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

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

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

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

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

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

References $form, getGenericFeedbackContent(), getGenericFeedbackPageObjectId(), getGenericFeedbackPageObjectType(), 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 622 of file class.ilAssQuestionFeedback.php.

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

References $row.

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

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

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

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

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 = ilRTE::_replaceMediaObjectImageSrc($feedbackContent, 0);
397 }
398
399 if ($feedbackId) {
400 $this->db->update(
402 array(
403 'feedback' => array('clob', $feedbackContent),
404 'tstamp' => array('integer', time())
405 ),
406 array(
407 'feedback_id' => array('integer', $feedbackId)
408 )
409 );
410 } else {
411 $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
412
413 $this->db->insert($this->getGenericFeedbackTableName(), array(
414 'feedback_id' => array('integer', $feedbackId),
415 'question_fi' => array('integer', $questionId),
416 'correctness' => array('text', $correctness), // text ?
417 'feedback' => array('clob', $feedbackContent),
418 'tstamp' => array('integer', time())
419 ));
420 }
421
422 return $feedbackId;
423 }

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 }

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

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

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

548 {
549 $this->syncGenericFeedback($originalQuestionId, $duplicateQuestionId);
550 $this->syncSpecificFeedback($originalQuestionId, $duplicateQuestionId);
551 }
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 
)
finalprivate

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

@final @access private

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

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

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

References $result, $row, 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: