ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 (int $question_id, bool $solution_completed)
 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 (int $question_id, int $question_index, int $answer_index)
 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 (int $question_id, bool $solution_completed)
 returns the GENERIC feedback content for a given question state. More...
 
 getSpecificAnswerFeedbackContent (int $question_id, int $question_index, int $answer_index)
 
 getAllSpecificAnswerFeedbackContents (int $question_id)
 
 isSpecificAnswerFeedbackAvailable (int $question_id)
 
 saveGenericFeedbackContent (int $question_id, bool $solution_completed, string $feedback_content)
 saves GENERIC feedback content for the given question id to the database. More...
 
 saveSpecificAnswerFeedbackContent (int $question_id, int $question_index, int $answer_index, string $feedback_content)
 
 deleteGenericFeedbacks (int $question_id, bool $isAdditionalContentEditingModePageObject)
 deletes all GENERIC feedback contents (and page objects if required) for the given question id More...
 
 deleteSpecificAnswerFeedbacks (int $question_id, bool $isAdditionalContentEditingModePageObject)
 
 duplicateFeedback (int $originalQuestionId, int $duplicateQuestionId)
 duplicates the feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 syncFeedback (int $originalQuestionId, int $duplicateQuestionId)
 syncs the feedback from a duplicated question back to the original question More...
 
 checkFeedbackParent (int $feedbackId)
 
 getClassNameByType (string $a_type, bool $a_gui=false)
 
 setPageObjectOutputMode (string $page_obj_output_mode)
 
 getPageObjectOutputMode ()
 
 getGenericFeedbackExportPresentation (int $question_id, bool $solution_completed)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 getSpecificAnswerFeedbackExportPresentation (int $question_id, int $question_index, int $answer_index)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 importGenericFeedback (int $question_id, bool $solution_completed, string $feedback_content)
 imports the given feedback content as generic feedback for the given question id for either the complete or incomplete solution More...
 
 importSpecificAnswerFeedback (int $question_id, int $question_index, int $answer_index, string $feedback_content)
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator, int $question_id)
 
 createFeedbackPages (string $mode)
 

Static Public Member Functions

static isValidFeedbackPageObjectType (string $feedbackPageObjectType)
 returns the fact whether 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'
 

Protected Member Functions

 buildFeedbackContentFormProperty (string $label, string $post_var, bool $as_non_editable)
 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 (int $originalQuestionId, int $duplicateQuestionId)
 duplicates the SPECIFIC feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 getGenericFeedbackId (int $question_id, bool $solution_completed)
 returns the SPECIFIC answer feedback ID for a given question id and answer index. More...
 
 isGenericFeedbackId (int $feedbackId)
 
 isSpecificAnswerFeedbackId (int $feedbackId)
 
 syncSpecificFeedback (int $originalQuestionId, int $duplicateQuestionId)
 syncs the SPECIFIC feedback from a duplicated question back to the original question More...
 
 getGenericFeedbackTableName ()
 
 getPageObjectNonEditableValueHTML (string $page_object_type, int $page_object_id)
 returns html content to be used as value for non editable value form properties in feedback editing form More...
 
 getPageObjectXML (string $page_object_type, int $page_object_id)
 
 createPageObject (string $page_object_type, int $page_object_id, string $page_object_content)
 
 duplicatePageObject (string $page_object_type, int $original_page_object_id, int $duplicate_page_object_id, int $duplicate_page_object_parent_id)
 
 ensurePageObjectDeleted (string $page_object_type, int $page_object_id)
 
 getGenericFeedbackPageObjectType ()
 
 getSpecificAnswerFeedbackPageObjectType ()
 
 getGenericFeedbackPageObjectId (int $question_id, bool $solution_completed)
 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...
 
 cleanupPageContent (string $content)
 

Protected Attributes

assQuestion $questionOBJ
 
ilCtrl $ctrl
 
ilDBInterface $db
 
ilLanguage $lng
 
string $page_obj_output_mode = "presentation"
 

Private Member Functions

 duplicateGenericFeedback (int $originalQuestionId, int $duplicateQuestionId)
 duplicates the GENERIC feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 syncGenericFeedback (int $originalQuestionId, int $duplicateQuestionId)
 syncs the GENERIC feedback from a duplicated question back to the original question More...
 
 getPageObjectEditingLink (string $page_object_type, int $page_object_id)
 
 ensurePageObjectExists (string $page_object_type, int $page_object_id)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

constructor

public

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

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

References $ctrl, $db, $lng, $questionOBJ, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildFeedbackContentFormProperty()

ilAssQuestionFeedback::buildFeedbackContentFormProperty ( string  $label,
string  $post_var,
bool  $as_non_editable 
)
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
    Returns
    ilTextAreaInputGUI|ilNonEditableValueGUI

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

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

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

245  {
246  if ($as_non_editable) {
247  $property = new ilNonEditableValueGUI($label, $post_var, true);
248  } else {
249  $property = new ilTextAreaInputGUI($label, $post_var);
250  $property->setRequired(false);
251  $property->setRows(10);
252  $property->setCols(80);
253 
254  if (!$this->questionOBJ->getPreventRteUsage()) {
255  $property->setUseRte(true);
256  $property->addPlugin("latex");
257  $property->addButton("latex");
258  $property->addButton("pastelatex");
259 
260  $property->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
261  $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
262  } else {
264  $property->setUseTagsForRteOnly(false);
265  }
266 
267  $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
268  }
269 
270  return $property;
271  }
static getSelfAssessmentTags()
Get tags allowed in question tags in self assessment mode.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkFeedbackParent()

ilAssQuestionFeedback::checkFeedbackParent ( int  $feedbackId)
final

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

References isGenericFeedbackId(), isSpecificAnswerFeedbackId(), and syncSpecificFeedback().

515  : bool
516  {
517  if ($this->isGenericFeedbackId($feedbackId)) {
518  return true;
519  }
520 
521  if ($this->isSpecificAnswerFeedbackId($feedbackId)) {
522  return true;
523  }
524 
525  return false;
526  }
isSpecificAnswerFeedbackId(int $feedbackId)
+ Here is the call graph for this function:

◆ cleanupPageContent()

ilAssQuestionFeedback::cleanupPageContent ( string  $content)
protected

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

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

758  : string
759  {
760  $doc = new DOMDocument('1.0', 'UTF-8');
761  if (@$doc->loadHTML('<html><body>' . $content . '</body></html>')) {
762  $xpath = new DOMXPath($doc);
763  $nodes_after_comments = $xpath->query('//comment()/following-sibling::*[1]');
764  foreach ($nodes_after_comments as $node_after_comments) {
765  if (trim($node_after_comments->nodeValue) === ''
766  && $node_after_comments->childElementCount === 0) {
767  return '';
768  }
769  }
770  }
771  return $content;
772  }
+ Here is the caller 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

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

References ilPropertyFormGUI\addItem(), buildFeedbackContentFormProperty(), completeSpecificFormProperties(), and ILIAS\Repository\lng().

121  : void
122  {
124  $this->lng->txt('feedback_complete_solution'),
125  'feedback_complete',
126  $this->questionOBJ->isAdditionalContentEditingModePageObject()
127  ));
128 
130  $this->lng->txt('feedback_incomplete_solution'),
131  'feedback_incomplete',
132  $this->questionOBJ->isAdditionalContentEditingModePageObject()
133  ));
134  }
buildFeedbackContentFormProperty(string $label, string $post_var, bool $as_non_editable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
+ Here is the call graph for this function:

◆ completeSpecificFormProperties()

ilAssQuestionFeedback::completeSpecificFormProperties ( ilPropertyFormGUI  $form)
abstract

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

public

Parameters
ilPropertyFormGUI$form

Referenced by completeGenericFormProperties().

+ Here is the caller graph for this function:

◆ createFeedbackPages()

ilAssQuestionFeedback::createFeedbackPages ( string  $mode)

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

References ensurePageObjectExists(), getPageObjectEditingLink(), PAGE_OBJECT_TYPE_GENERIC_FEEDBACK, and saveGenericFeedbackContent().

774  : string
775  {
777  $page_object_id_complete = $this->saveGenericFeedbackContent(
778  $this->questionOBJ->getId(),
779  true,
780  ''
781  );
782  $this->ensurePageObjectExists($page_object_type, $page_object_id_complete);
783 
784  $page_object_id_incomplete = $this->saveGenericFeedbackContent(
785  $this->questionOBJ->getId(),
786  false,
787  ''
788  );
789  $this->ensurePageObjectExists($page_object_type, $page_object_id_incomplete);
790 
791  $page_object_id = ($mode === 'complete') ? $page_object_id_complete : $page_object_id_incomplete;
792  return $this->getPageObjectEditingLink(
793  $page_object_type,
794  $page_object_id
795  );
796  }
saveGenericFeedbackContent(int $question_id, bool $solution_completed, string $feedback_content)
saves GENERIC feedback content for the given question id to the database.
ensurePageObjectExists(string $page_object_type, int $page_object_id)
getPageObjectEditingLink(string $page_object_type, int $page_object_id)
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
+ Here is the call graph for this function:

◆ createPageObject()

ilAssQuestionFeedback::createPageObject ( string  $page_object_type,
int  $page_object_id,
string  $page_object_content 
)
finalprotected

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

References getClassNameByType().

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

626  : void
627  {
628  $cl = $this->getClassNameByType($page_object_type);
629 
630  $pageObject = new $cl();
631  $pageObject->setParentId($this->questionOBJ->getId());
632  $pageObject->setId($page_object_id);
633  $pageObject->setXMLContent($page_object_content);
634  $pageObject->createFromXML();
635  }
getClassNameByType(string $a_type, bool $a_gui=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteGenericFeedbacks()

ilAssQuestionFeedback::deleteGenericFeedbacks ( int  $question_id,
bool  $isAdditionalContentEditingModePageObject 
)
final

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

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

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

369  : void
370  {
371  if ($isAdditionalContentEditingModePageObject) {
374  $this->getGenericFeedbackPageObjectId($question_id, true)
375  );
376 
379  $this->getGenericFeedbackPageObjectId($question_id, false)
380  );
381  }
382 
383  $this->db->manipulateF(
384  "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
385  ['integer'],
386  [$question_id]
387  );
388  }
ensurePageObjectDeleted(string $page_object_type, int $page_object_id)
getGenericFeedbackPageObjectId(int $question_id, bool $solution_completed)
returns a useable page object id for generic feedback page objects for the given question id for eith...
+ Here is the call graph for this function:

◆ deleteSpecificAnswerFeedbacks()

ilAssQuestionFeedback::deleteSpecificAnswerFeedbacks ( int  $question_id,
bool  $isAdditionalContentEditingModePageObject 
)
abstract

Referenced by deleteGenericFeedbacks().

+ Here is the caller graph for this function:

◆ duplicateFeedback()

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

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

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

References duplicateGenericFeedback(), and duplicateSpecificFeedback().

396  : void
397  {
398  $this->duplicateGenericFeedback($originalQuestionId, $duplicateQuestionId);
399  $this->duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId);
400  }
duplicateSpecificFeedback(int $originalQuestionId, int $duplicateQuestionId)
duplicates the SPECIFIC feedback relating to the given original question id and saves it for the give...
duplicateGenericFeedback(int $originalQuestionId, int $duplicateQuestionId)
duplicates the GENERIC feedback relating to the given original question id and saves it for the given...
+ Here is the call graph for this function:

◆ duplicateGenericFeedback()

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

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

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

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

Referenced by duplicateFeedback().

406  : void
407  {
408  $res = $this->db->queryF(
409  "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
410  ['integer'],
411  [$originalQuestionId]
412  );
413 
414  while ($row = $this->db->fetchAssoc($res)) {
415  $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
416 
417  $this->db->insert($this->getGenericFeedbackTableName(), [
418  'feedback_id' => ['integer', $feedbackId],
419  'question_fi' => ['integer', $duplicateQuestionId],
420  'correctness' => ['text', $row['correctness']],
421  'feedback' => ['clob', $row['feedback']],
422  'tstamp' => ['integer', time()]
423  ]);
424 
425  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
426  $page_object_type = $this->getGenericFeedbackPageObjectType();
427  $this->duplicatePageObject($page_object_type, $row['feedback_id'], $feedbackId, $duplicateQuestionId);
428  }
429  }
430  }
$res
Definition: ltiservices.php:69
duplicatePageObject(string $page_object_type, int $original_page_object_id, int $duplicate_page_object_id, int $duplicate_page_object_parent_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicatePageObject()

ilAssQuestionFeedback::duplicatePageObject ( string  $page_object_type,
int  $original_page_object_id,
int  $duplicate_page_object_id,
int  $duplicate_page_object_parent_id 
)
finalprotected

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

References ensurePageObjectExists(), and getClassNameByType().

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

637  : void
638  {
639  $this->ensurePageObjectExists($page_object_type, $original_page_object_id);
640 
641  $cl = $this->getClassNameByType($page_object_type);
642 
643  $pageObject = new $cl($original_page_object_id);
644  $pageObject->setParentId($duplicate_page_object_parent_id);
645  $pageObject->setId($duplicate_page_object_id);
646  $pageObject->createFromXML();
647  }
ensurePageObjectExists(string $page_object_type, int $page_object_id)
getClassNameByType(string $a_type, bool $a_gui=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicateSpecificFeedback()

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

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

Referenced by duplicateFeedback(), and duplicateGenericFeedback().

+ Here is the caller graph for this function:

◆ ensurePageObjectDeleted()

ilAssQuestionFeedback::ensurePageObjectDeleted ( string  $page_object_type,
int  $page_object_id 
)
finalprotected

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

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

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

649  : void
650  {
651  if ($page_object_id === -1) {
652  return;
653  }
654 
656  if (ilAssGenFeedbackPage::_exists($page_object_type, $page_object_id)) {
657  $pageObject = new ilAssGenFeedbackPage($page_object_id);
658  $pageObject->delete();
659  }
660  }
662  if (ilAssSpecFeedbackPage::_exists($page_object_type, $page_object_id)) {
663  $pageObject = new ilAssSpecFeedbackPage($page_object_id);
664  $pageObject->delete();
665  }
666  }
667  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK
type for specific feedback page objects
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensurePageObjectExists()

ilAssQuestionFeedback::ensurePageObjectExists ( string  $page_object_type,
int  $page_object_id 
)
private

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

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

Referenced by createFeedbackPages(), duplicatePageObject(), getPageObjectOutputMode(), getPageObjectXML(), and initGenericFormProperties().

608  : void
609  {
611  && !ilAssGenFeedbackPage::_exists($page_object_type, $page_object_id, '', true)) {
612  $pageObject = new ilAssGenFeedbackPage();
613  $pageObject->setParentId($this->questionOBJ->getId());
614  $pageObject->setId($page_object_id);
615  $pageObject->createFromXML();
616  }
618  && !ilAssSpecFeedbackPage::_exists($page_object_type, $page_object_id, '', true)) {
619  $pageObject = new ilAssSpecFeedbackPage();
620  $pageObject->setParentId($this->questionOBJ->getId());
621  $pageObject->setId($page_object_id);
622  $pageObject->createFromXML();
623  }
624  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK
type for specific feedback page objects
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAllSpecificAnswerFeedbackContents()

ilAssQuestionFeedback::getAllSpecificAnswerFeedbackContents ( int  $question_id)
abstract

Referenced by getGenericFeedbackContent().

+ Here is the caller graph for this function:

◆ getClassNameByType()

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

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

References PAGE_OBJECT_TYPE_GENERIC_FEEDBACK.

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

554  : string
555  {
556  $gui = ($a_gui) ? "GUI" : "";
557 
559  return "ilAssGenFeedbackPage" . $gui;
560  }
561 
562  //if ($a_type == ilAssQuestionFeedback::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK) {
563  return "ilAssSpecFeedbackPage" . $gui;
564  }
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
+ Here is the caller graph for this function:

◆ getGenericFeedbackContent()

ilAssQuestionFeedback::getGenericFeedbackContent ( int  $question_id,
bool  $solution_completed 
)
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.

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

References $res, ilRTE\_replaceMediaObjectImageSrc(), getAllSpecificAnswerFeedbackContents(), and getSpecificAnswerFeedbackContent().

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

278  : string
279  {
280  $res = $this->db->queryF(
281  "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
282  ['integer', 'text'],
283  [$question_id, (int) $solution_completed]
284  );
285 
286  $feedback_content = '';
287 
288  if ($this->db->numRows($res) > 0) {
289  $row = $this->db->fetchAssoc($res);
290  $feedback_content = ilRTE::_replaceMediaObjectImageSrc(
291  $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($row['feedback'] ?? ''),
292  1
293  );
294  }
295  return $feedback_content;
296  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGenericFeedbackExportPresentation()

ilAssQuestionFeedback::getGenericFeedbackExportPresentation ( int  $question_id,
bool  $solution_completed 
)

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

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

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

709  : string
710  {
711  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
712  $genericFeedbackExportPresentation = $this->getPageObjectXML(
714  $this->getGenericFeedbackPageObjectId($question_id, $solution_completed)
715  );
716  } else {
717  $genericFeedbackExportPresentation = $this->getGenericFeedbackContent($question_id, $solution_completed);
718  }
719 
720  return $genericFeedbackExportPresentation;
721  }
getPageObjectXML(string $page_object_type, int $page_object_id)
getGenericFeedbackContent(int $question_id, bool $solution_completed)
returns the GENERIC feedback content for a given question state.
getGenericFeedbackPageObjectId(int $question_id, bool $solution_completed)
returns a useable page object id for generic feedback page objects for the given question id for eith...
+ Here is the call graph for this function:

◆ getGenericFeedbackId()

ilAssQuestionFeedback::getGenericFeedbackId ( int  $question_id,
bool  $solution_completed 
)
finalprotected

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

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

References $res, and ILIAS\Repository\int().

Referenced by getGenericFeedbackPageObjectId(), initGenericFormProperties(), and saveGenericFeedbackContent().

483  : int
484  {
485  $res = $this->db->queryF(
486  "SELECT feedback_id FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
487  ['integer','text'],
488  [$question_id, (int) $solution_completed]
489  );
490 
491  $feedbackId = -1;
492  if ($this->db->numRows($res)) {
493  $row = $this->db->fetchAssoc($res);
494  $feedbackId = (int) $row['feedback_id'];
495  }
496 
497  return $feedbackId;
498  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGenericFeedbackPageObjectId()

ilAssQuestionFeedback::getGenericFeedbackPageObjectId ( int  $question_id,
bool  $solution_completed 
)
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)

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

References getGenericFeedbackId().

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

699  : int
700  {
701  $page_object_id = $this->getGenericFeedbackId($question_id, $solution_completed);
702  return $page_object_id;
703  }
getGenericFeedbackId(int $question_id, bool $solution_completed)
returns the SPECIFIC answer feedback ID for a given question id and answer index. ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGenericFeedbackPageObjectType()

ilAssQuestionFeedback::getGenericFeedbackPageObjectType ( )
finalprotected

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

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

669  : string
670  {
671  return self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK;
672  }
+ Here is the caller graph for this function:

◆ getGenericFeedbackTableName()

ilAssQuestionFeedback::getGenericFeedbackTableName ( )
finalprotected

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

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

533  : string
534  {
535  return self::TABLE_NAME_GENERIC_FEEDBACK;
536  }
+ Here is the caller graph for this function:

◆ getGenericFeedbackTestPresentation()

ilAssQuestionFeedback::getGenericFeedbackTestPresentation ( int  $question_id,
bool  $solution_completed 
)

returns the html of GENERIC feedback for the given question id for test presentation (either for the complete solution or for the incomplete solution)

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

References cleanupPageContent(), getGenericFeedbackContent(), getGenericFeedbackPageObjectId(), getGenericFeedbackPageObjectType(), and getSpecificAnswerFeedbackTestPresentation().

88  : string
89  {
90  if ($this->page_obj_output_mode == "edit") {
91  return '';
92  }
93  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
94  return $this->cleanupPageContent(
95  $this->getPageObjectContent(
97  $this->getGenericFeedbackPageObjectId($question_id, $solution_completed)
98  )
99  );
100  }
101  return $this->getGenericFeedbackContent($question_id, $solution_completed);
102  }
getGenericFeedbackContent(int $question_id, bool $solution_completed)
returns the GENERIC feedback content for a given question state.
getGenericFeedbackPageObjectId(int $question_id, bool $solution_completed)
returns a useable page object id for generic feedback page objects for the given question id for eith...
+ Here is the call graph for this function:

◆ getPageObjectEditingLink()

ilAssQuestionFeedback::getPageObjectEditingLink ( string  $page_object_type,
int  $page_object_id 
)
private

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

References ILIAS\Repository\ctrl(), and getClassNameByType().

Referenced by createFeedbackPages(), and getPageObjectNonEditableValueHTML().

566  : string
567  {
568  $cl = $this->getClassNameByType($page_object_type, true);
569  $this->ctrl->setParameterByClass($cl, 'feedback_type', $page_object_type);
570  $this->ctrl->setParameterByClass($cl, 'feedback_id', $page_object_id);
571 
572  return $this->ctrl->getLinkTargetByClass($cl, 'edit');
573  }
getClassNameByType(string $a_type, bool $a_gui=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageObjectNonEditableValueHTML()

ilAssQuestionFeedback::getPageObjectNonEditableValueHTML ( string  $page_object_type,
int  $page_object_id 
)
finalprotected

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

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

References getPageObjectEditingLink(), and ILIAS\Repository\lng().

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

542  : string
543  {
544  $link = $this->getPageObjectEditingLink($page_object_type, $page_object_id);
545  $content = $this->getPageObjectContent($page_object_type, $page_object_id);
546  return sprintf(
547  '<a href="%s">%s</a><br /><br />%s',
548  $link,
549  $this->lng->txt('tst_question_feedback_edit_page'),
550  $content
551  );
552  }
getPageObjectEditingLink(string $page_object_type, int $page_object_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageObjectOutputMode()

ilAssQuestionFeedback::getPageObjectOutputMode ( )
final

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

References $page_obj_output_mode, ILIAS\Repository\ctrl(), ensurePageObjectExists(), and getClassNameByType().

580  : string
581  {
583  }
+ Here is the call graph for this function:

◆ getPageObjectXML()

ilAssQuestionFeedback::getPageObjectXML ( string  $page_object_type,
int  $page_object_id 
)
finalprotected

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

References ensurePageObjectExists(), and getClassNameByType().

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

598  : string
599  {
600  $cl = $this->getClassNameByType($page_object_type);
601 
602  $this->ensurePageObjectExists($page_object_type, $page_object_id);
603 
604  $pageObject = new $cl($page_object_id);
605  return $pageObject->getXMLContent();
606  }
ensurePageObjectExists(string $page_object_type, int $page_object_id)
getClassNameByType(string $a_type, bool $a_gui=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackContent()

ilAssQuestionFeedback::getSpecificAnswerFeedbackContent ( int  $question_id,
int  $question_index,
int  $answer_index 
)
abstract

Referenced by getGenericFeedbackContent().

+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackExportPresentation()

ilAssQuestionFeedback::getSpecificAnswerFeedbackExportPresentation ( int  $question_id,
int  $question_index,
int  $answer_index 
)
abstract

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

Referenced by getGenericFeedbackExportPresentation(), and isSpecificAnswerFeedbackAvailable().

+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackPageObjectType()

◆ getSpecificAnswerFeedbackTestPresentation()

ilAssQuestionFeedback::getSpecificAnswerFeedbackTestPresentation ( int  $question_id,
int  $question_index,
int  $answer_index 
)
abstract

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

public

Parameters
integer$question_id
integer$question_index
integer$answer_index
Returns
string $specificAnswerFeedbackTestPresentationHTML

Referenced by getGenericFeedbackTestPresentation().

+ Here is the caller graph for this function:

◆ importGenericFeedback()

ilAssQuestionFeedback::importGenericFeedback ( int  $question_id,
bool  $solution_completed,
string  $feedback_content 
)

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

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

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

733  : void
734  {
735  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
736  $page_object_id = $this->saveGenericFeedbackContent($question_id, $solution_completed, '');
737  $page_object_type = $this->getGenericFeedbackPageObjectType();
738 
739  $this->createPageObject($page_object_type, $page_object_id, $feedback_content);
740  } else {
741  $this->saveGenericFeedbackContent($question_id, $solution_completed, $feedback_content);
742  }
743  }
saveGenericFeedbackContent(int $question_id, bool $solution_completed, string $feedback_content)
saves GENERIC feedback content for the given question id to the database.
createPageObject(string $page_object_type, int $page_object_id, string $page_object_content)
+ Here is the call graph for this function:

◆ importSpecificAnswerFeedback()

ilAssQuestionFeedback::importSpecificAnswerFeedback ( int  $question_id,
int  $question_index,
int  $answer_index,
string  $feedback_content 
)
abstract

Referenced by importGenericFeedback().

+ Here is the caller graph for this function:

◆ initGenericFormProperties()

ilAssQuestionFeedback::initGenericFormProperties ( ilPropertyFormGUI  $form)
final

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

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

References ILIAS\Repository\ctrl(), ensurePageObjectExists(), getGenericFeedbackContent(), getGenericFeedbackId(), getGenericFeedbackPageObjectId(), getGenericFeedbackPageObjectType(), ilPropertyFormGUI\getItemByPostVar(), getPageObjectNonEditableValueHTML(), initSpecificFormProperties(), and ILIAS\Repository\lng().

150  : void
151  {
152  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
153  $page_object_type = $this->getGenericFeedbackPageObjectType();
154 
155  $page_object_id = $this->getGenericFeedbackId($this->questionOBJ->getId(), true);
156 
157  if ($page_object_id === -1) {
158  $this->ctrl->setParameterByClass(ilAssQuestionFeedbackEditingGUI::class, 'feedback_type', $page_object_type);
159  $this->ctrl->setParameterByClass(ilAssQuestionFeedbackEditingGUI::class, 'fb_mode', 'complete');
160  $link = $this->ctrl->getLinkTargetByClass(ilAssQuestionFeedbackEditingGUI::class, 'createFeedbackPage');
161  $value_feedback_solution_complete = sprintf(
162  '<a href="%s">%s</a>',
163  $link,
164  $this->lng->txt('tst_question_feedback_edit_page')
165  );
166  $this->ctrl->setParameterByClass(ilAssQuestionFeedbackEditingGUI::class, 'fb_mode', 'incomplete');
167  $link = $this->ctrl->getLinkTargetByClass(ilAssQuestionFeedbackEditingGUI::class, 'createFeedbackPage');
168  $value_feedback_solution_incomplete = sprintf(
169  '<a href="%s">%s</a>',
170  $link,
171  $this->lng->txt('tst_question_feedback_edit_page')
172  );
173  } else {
174  $this->ensurePageObjectExists($page_object_type, $page_object_id);
175 
176  $value_feedback_solution_complete = $this->getPageObjectNonEditableValueHTML(
177  $page_object_type,
178  $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), true)
179  );
180  $value_feedback_solution_incomplete = $this->getPageObjectNonEditableValueHTML(
181  $page_object_type,
182  $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), false)
183  );
184  }
185 
186  } else {
187  $value_feedback_solution_complete = $this->getGenericFeedbackContent(
188  $this->questionOBJ->getId(),
189  true
190  );
191 
192  $value_feedback_solution_incomplete = $this->getGenericFeedbackContent(
193  $this->questionOBJ->getId(),
194  false
195  );
196  }
197 
198  $form->getItemByPostVar('feedback_complete')->setValue($value_feedback_solution_complete);
199  $form->getItemByPostVar('feedback_incomplete')->setValue($value_feedback_solution_incomplete);
200  }
ensurePageObjectExists(string $page_object_type, int $page_object_id)
getItemByPostVar(string $a_post_var)
getGenericFeedbackContent(int $question_id, bool $solution_completed)
returns the GENERIC feedback content for a given question state.
getPageObjectNonEditableValueHTML(string $page_object_type, int $page_object_id)
returns html content to be used as value for non editable value form properties in feedback editing f...
getGenericFeedbackId(int $question_id, bool $solution_completed)
returns the SPECIFIC answer feedback ID for a given question id and answer index. ...
getGenericFeedbackPageObjectId(int $question_id, bool $solution_completed)
returns a useable page object id for generic feedback page objects for the given question id for eith...
+ 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

Referenced by initGenericFormProperties().

+ Here is the caller graph for this function:

◆ isGenericFeedbackId()

ilAssQuestionFeedback::isGenericFeedbackId ( int  $feedbackId)
protected

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

References isSpecificAnswerFeedbackId().

Referenced by checkFeedbackParent().

500  : bool
501  {
502  $row = $this->db->fetchAssoc($this->db->queryF(
503  "SELECT COUNT(feedback_id) cnt FROM {$this->getGenericFeedbackTableName()}
504  WHERE question_fi = %s AND feedback_id = %s",
505  ['integer','integer'],
506  [$this->questionOBJ->getId(), $feedbackId]
507  ));
508 
509 
510  return (bool) $row['cnt'];
511  }
+ Here is the call graph for this function:
+ 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)

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

231  : bool
232  {
233  return false;
234  }

◆ isSpecificAnswerFeedbackAvailable()

ilAssQuestionFeedback::isSpecificAnswerFeedbackAvailable ( int  $question_id)

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

References $res, and getSpecificAnswerFeedbackExportPresentation().

302  : bool
303  {
304  $res = $this->db->queryF(
305  "SELECT answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
306  ['integer'],
307  [$question_id]
308  );
309 
310  $all_feedback_contents = '';
311 
312  while ($row = $this->db->fetchAssoc($res)) {
313  $all_feedback_contents .= $this->getSpecificAnswerFeedbackExportPresentation(
314  $this->questionOBJ->getId(),
315  0,
316  $row['answer']
317  );
318  }
319 
320  return trim(strip_tags($all_feedback_contents)) !== '';
321  }
$res
Definition: ltiservices.php:69
getSpecificAnswerFeedbackExportPresentation(int $question_id, int $question_index, int $answer_index)
returns the generic feedback export presentation for given question id either for solution completed ...
+ Here is the call graph for this function:

◆ isSpecificAnswerFeedbackId()

ilAssQuestionFeedback::isSpecificAnswerFeedbackId ( int  $feedbackId)
abstractprotected

Referenced by checkFeedbackParent(), and isGenericFeedbackId().

+ Here is the caller graph for this function:

◆ isValidFeedbackPageObjectType()

static ilAssQuestionFeedback::isValidFeedbackPageObjectType ( string  $feedbackPageObjectType)
staticfinal

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

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

Referenced by ilAssQuestionFeedbackPageObjectCommandForwarder\__construct().

683  : bool
684  {
685  switch ($feedbackPageObjectType) {
686  case self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK:
687  case self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK:
688  return true;
689  }
690 
691  return false;
692  }
+ Here is the caller graph for this function:

◆ migrateContentForLearningModule()

ilAssQuestionFeedback::migrateContentForLearningModule ( ilAssSelfAssessmentMigrator  $migrator,
int  $question_id 
)

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

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

747  : void
748  {
749  $this->saveGenericFeedbackContent($question_id, true, $migrator->migrateToLmContent(
750  $this->getGenericFeedbackContent($question_id, true)
751  ));
752 
753  $this->saveGenericFeedbackContent($question_id, false, $migrator->migrateToLmContent(
754  $this->getGenericFeedbackContent($question_id, false)
755  ));
756  }
saveGenericFeedbackContent(int $question_id, bool $solution_completed, string $feedback_content)
saves GENERIC feedback content for the given question id to the database.
+ Here is the call graph for this function:

◆ saveGenericFeedbackContent()

ilAssQuestionFeedback::saveGenericFeedbackContent ( int  $question_id,
bool  $solution_completed,
string  $feedback_content 
)
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.

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

References ilRTE\_replaceMediaObjectImageSrc(), getGenericFeedbackId(), getGenericFeedbackTableName(), ILIAS\Repository\int(), and saveSpecificAnswerFeedbackContent().

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

328  : int
329  {
330  $feedbackId = $this->getGenericFeedbackId($question_id, $solution_completed);
331 
332  if ($feedback_content !== '') {
333  $feedback_content = $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedback_content);
334  $feedback_content = ilRTE::_replaceMediaObjectImageSrc($feedback_content, 0);
335  }
336 
337  if ($feedbackId !== -1) {
338  $this->db->update(
340  [
341  'feedback' => ['clob', $feedback_content],
342  'tstamp' => ['integer', time()]
343  ],
344  [
345  'feedback_id' => ['integer', $feedbackId]
346  ]
347  );
348  } else {
349  $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
350 
351  $this->db->insert($this->getGenericFeedbackTableName(), [
352  'feedback_id' => ['integer', $feedbackId],
353  'question_fi' => ['integer', $question_id],
354  'correctness' => ['text', (int) $solution_completed], // text ?
355  'feedback' => ['clob', $feedback_content],
356  'tstamp' => ['integer', time()]
357  ]);
358  }
359 
360  return $feedbackId;
361  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
getGenericFeedbackId(int $question_id, bool $solution_completed)
returns the SPECIFIC answer feedback ID for a given question id and answer index. ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveGenericFormProperties()

ilAssQuestionFeedback::saveGenericFormProperties ( ilPropertyFormGUI  $form)
final

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

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

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

212  : void
213  {
214  if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
215  $this->saveGenericFeedbackContent($this->questionOBJ->getId(), false, (string) $form->getInput('feedback_incomplete'));
216  $this->saveGenericFeedbackContent($this->questionOBJ->getId(), true, (string) $form->getInput('feedback_complete'));
217  }
218  }
saveGenericFeedbackContent(int $question_id, bool $solution_completed, string $feedback_content)
saves GENERIC feedback content for the given question id to the database.
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
+ Here is the call graph for this function:

◆ saveSpecificAnswerFeedbackContent()

ilAssQuestionFeedback::saveSpecificAnswerFeedbackContent ( int  $question_id,
int  $question_index,
int  $answer_index,
string  $feedback_content 
)
abstract

Referenced by saveGenericFeedbackContent().

+ Here is the caller graph for this function:

◆ saveSpecificFormProperties()

ilAssQuestionFeedback::saveSpecificFormProperties ( ilPropertyFormGUI  $form)
abstract

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

Referenced by saveGenericFormProperties().

+ Here is the caller graph for this function:

◆ setPageObjectOutputMode()

ilAssQuestionFeedback::setPageObjectOutputMode ( string  $page_obj_output_mode)
final

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

References $page_obj_output_mode.

575  : void
576  {
577  $this->page_obj_output_mode = $page_obj_output_mode;
578  }

◆ syncFeedback()

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

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

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

References syncGenericFeedback(), and syncSpecificFeedback().

441  : void
442  {
443  $this->syncGenericFeedback($originalQuestionId, $duplicateQuestionId);
444  $this->syncSpecificFeedback($originalQuestionId, $duplicateQuestionId);
445  }
syncGenericFeedback(int $originalQuestionId, int $duplicateQuestionId)
syncs the GENERIC feedback from a duplicated question back to the original question ...
syncSpecificFeedback(int $originalQuestionId, int $duplicateQuestionId)
syncs the SPECIFIC feedback from a duplicated question back to the original question ...
+ Here is the call graph for this function:

◆ syncGenericFeedback()

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

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

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

References getGenericFeedbackTableName().

Referenced by syncFeedback().

450  : void
451  {
452  // delete generic feedback of the original question
453  $this->db->manipulateF(
454  "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
455  ['integer'],
456  [$originalQuestionId]
457  );
458 
459  // get generic feedback of the actual (duplicated) question
460  $result = $this->db->queryF(
461  "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
462  ['integer'],
463  [$duplicateQuestionId]
464  );
465 
466  // save generic feedback to the original question
467  while ($row = $this->db->fetchAssoc($result)) {
468  $nextId = $this->db->nextId($this->getGenericFeedbackTableName());
469 
470  $this->db->insert($this->getGenericFeedbackTableName(), [
471  'feedback_id' => ['integer', $nextId],
472  'question_fi' => ['integer', $originalQuestionId],
473  'correctness' => ['text', $row['correctness']],
474  'feedback' => ['clob', $row['feedback']],
475  'tstamp' => ['integer', time()]
476  ]);
477  }
478  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncSpecificFeedback()

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

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

Referenced by checkFeedbackParent(), and syncFeedback().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilAssQuestionFeedback::$ctrl
protected

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

Referenced by __construct().

◆ $db

ilDBInterface ilAssQuestionFeedback::$db
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilAssQuestionFeedback::$lng
protected

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

Referenced by __construct().

◆ $page_obj_output_mode

string ilAssQuestionFeedback::$page_obj_output_mode = "presentation"
protected

◆ $questionOBJ

assQuestion ilAssQuestionFeedback::$questionOBJ
protected

Definition at line 56 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 52 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 47 of file class.ilAssQuestionFeedback.php.

◆ PAGE_OBJECT_TYPE_GENERIC_FEEDBACK

◆ PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK

const ilAssQuestionFeedback::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK = 'qfbs'

◆ TABLE_NAME_GENERIC_FEEDBACK

const ilAssQuestionFeedback::TABLE_NAME_GENERIC_FEEDBACK = 'qpl_fb_generic'

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


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