ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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, $answerIndex)
 returns the html of SPECIFIC feedback for the given question id and answer index for test presentation More...
 
 completeGenericFormProperties (ilPropertyFormGUI $form)
 completes a given form object with the GENERIC form properties required by all question types More...
 
 completeSpecificFormProperties (ilPropertyFormGUI $form)
 completes a given form object with the SPECIFIC form properties required by this question type More...
 
 initGenericFormProperties (ilPropertyFormGUI $form)
 initialises a given form object's GENERIC form properties relating to all question types More...
 
 initSpecificFormProperties (ilPropertyFormGUI $form)
 initialises a given form object's SPECIFIC form properties relating to this question type More...
 
 saveGenericFormProperties (ilPropertyFormGUI $form)
 saves a given form object's GENERIC form properties relating to all question types More...
 
 saveSpecificFormProperties (ilPropertyFormGUI $form)
 saves a given form object's SPECIFIC form properties relating to this question type More...
 
 isSaveableInPageObjectEditingMode ()
 returns the fact wether the feedback editing form is saveable in page object editing or not. More...
 
 getGenericFeedbackContent ($questionId, $solutionCompleted)
 returns the GENERIC feedback content for a given question state. More...
 
 getSpecificAnswerFeedbackContent ($questionId, $answerIndex)
 returns the SPECIFIC feedback content for a given question id and answer index. More...
 
 getAllSpecificAnswerFeedbackContents ($questionId)
 returns the SPECIFIC feedback content for a given question id and answer index. More...
 
 saveGenericFeedbackContent ($questionId, $solutionCompleted, $feedbackContent)
 saves GENERIC feedback content for the given question id to the database. More...
 
 saveSpecificAnswerFeedbackContent ($questionId, $answerIndex, $feedbackContent)
 saves SPECIFIC feedback content for the given question id and answer index to the database. More...
 
 deleteGenericFeedbacks ($questionId, $isAdditionalContentEditingModePageObject)
 deletes all GENERIC feedback contents (and page objects if required) for the given question id More...
 
 deleteSpecificAnswerFeedbacks ($questionId, $isAdditionalContentEditingModePageObject)
 deletes all SPECIFIC feedback contents for the given question id More...
 
 duplicateFeedback ($originalQuestionId, $duplicateQuestionId)
 duplicates the feedback relating to the given original question id and saves it for the given duplicate question id More...
 
 syncFeedback ($originalQuestionId, $duplicateQuestionId)
 syncs the feedback from a duplicated question back to the original question More...
 
 checkFeedbackParent ($feedbackId)
 
 getClassNameByType ($a_type, $a_gui=false)
 Get class name by type. More...
 
 setPageObjectOutputMode ($a_val)
 Set page object output mode. More...
 
 getPageObjectOutputMode ()
 Get page object output mode. More...
 
 getGenericFeedbackExportPresentation ($questionId, $solutionCompleted)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 getSpecificAnswerFeedbackExportPresentation ($questionId, $answerIndex)
 returns the generic feedback export presentation for given question id either for solution completed or incompleted More...
 
 importGenericFeedback ($questionId, $solutionCompleted, $feedbackContent)
 imports the given feedback content as generic feedback for the given question id for either the complete or incomplete solution More...
 
 importSpecificAnswerFeedback ($questionId, $answerIndex, $feedbackContent)
 imports the given feedback content as specific feedback for the given question id and answer index More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator, $questionId)
 

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

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.

95  {
96  $this->questionOBJ = $questionOBJ;
97 
98  $this->ctrl = $ctrl;
99  $this->lng = $lng;
100  $this->db = $db;
101  }

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

protected

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

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

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

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

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

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

632  {
633  if ($this->isGenericFeedbackId($feedbackId)) {
634  return true;
635  }
636 
637  if ($this->isSpecificAnswerFeedbackId($feedbackId)) {
638  return true;
639  }
640 
641  return false;
642  }
isSpecificAnswerFeedbackId($feedbackId)
+ 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

public

Parameters
ilPropertyFormGUI$form

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

References $form, ilPropertyFormGUI\addItem(), buildFeedbackContentFormProperty(), and completeSpecificFormProperties().

147  {
149  $this->lng->txt('feedback_complete_solution'),
150  'feedback_complete',
151  $this->questionOBJ->isAdditionalContentEditingModePageObject()
152  ));
153 
155  $this->lng->txt('feedback_incomplete_solution'),
156  'feedback_incomplete',
157  $this->questionOBJ->isAdditionalContentEditingModePageObject()
158  ));
159  }
addItem($a_item)
Add Item (Property, SectionHeader).
buildFeedbackContentFormProperty($label, $postVar, $asNonEditable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
+ Here is the call graph for this function:

◆ 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:

◆ 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

protected

Parameters
string$pageObjectType
integer$pageObjectId
string$pageObjectContent

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

References getClassNameByType().

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

835  {
836  $cl = $this->getClassNameByType($pageObjectType);
837  require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
838 
839  $pageObject = new $cl();
840  $pageObject->setParentId($this->questionOBJ->getId());
841  $pageObject->setId($pageObjectId);
842  $pageObject->setXMLContent($pageObjectContent);
843  $pageObject->createFromXML();
844  }
getClassNameByType($a_type, $a_gui=false)
Get class name by type.
+ 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

public

Parameters
integer$questionId
boolean$isAdditionalContentEditingModePageObject

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

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

434  {
435  if ($isAdditionalContentEditingModePageObject) {
438  $this->getGenericFeedbackPageObjectId($questionId, true)
439  );
440 
443  $this->getGenericFeedbackPageObjectId($questionId, false)
444  );
445  }
446 
447  $this->db->manipulateF(
448  "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
449  array('integer'),
450  array($questionId)
451  );
452  }
getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
returns a useable page object id for generic feedback page objects for the given question id for eith...
Create styles array
The data for the language used.
ensurePageObjectDeleted($pageObjectType, $pageObjectId)
ensures a no more existing page object for given type and id
getGenericFeedbackPageObjectType()
returns the type for generic feedback page objects defined in local constant
+ Here is the call graph for this function:

◆ deleteSpecificAnswerFeedbacks()

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

deletes all SPECIFIC feedback contents for the given question id

public

Parameters
integer$questionId
boolean$isAdditionalContentEditingModePageObject

Referenced by deleteGenericFeedbacks().

+ Here is the caller graph for this function:

◆ 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

public

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

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

References duplicateGenericFeedback(), and duplicateSpecificFeedback().

474  {
475  $this->duplicateGenericFeedback($originalQuestionId, $duplicateQuestionId);
476  $this->duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId);
477  }
duplicateGenericFeedback($originalQuestionId, $duplicateQuestionId)
duplicates the GENERIC feedback relating to the given original question id and saves it for the given...
duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId)
duplicates the SPECIFIC feedback relating to the given original question id and saves it for the give...
+ 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

private

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

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

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

Referenced by duplicateFeedback().

489  {
490  $res = $this->db->queryF(
491  "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
492  array('integer'),
493  array($originalQuestionId)
494  );
495 
496  while ($row = $this->db->fetchAssoc($res)) {
497  $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
498 
499  $this->db->insert($this->getGenericFeedbackTableName(), array(
500  'feedback_id' => array('integer', $feedbackId),
501  'question_fi' => array('integer', $duplicateQuestionId),
502  'correctness' => array('text', $row['correctness']),
503  'feedback' => array('clob', $row['feedback']),
504  'tstamp' => array('integer', time())
505  ));
506 
507  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
508  $pageObjectType = $this->getGenericFeedbackPageObjectType();
509  $this->duplicatePageObject($pageObjectType, $row['feedback_id'], $feedbackId, $duplicateQuestionId);
510  }
511  }
512  }
getGenericFeedbackTableName()
returns the table name for specific feedback
foreach($_POST as $key=> $value) $res
duplicatePageObject($pageObjectType, $originalPageObjectId, $duplicatePageObjectId, $duplicatePageObjectParentId)
duplicates the page object with given type and original id to new page object with same type and give...
Create styles array
The data for the language used.
getGenericFeedbackPageObjectType()
returns the type for generic feedback page objects defined in local constant
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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

protected

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

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

References getClassNameByType().

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

858  {
859  $cl = $this->getClassNameByType($pageObjectType);
860  require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
861 
862  $pageObject = new $cl($originalPageObjectId);
863  $pageObject->setParentId($duplicatePageObjectParentId);
864  $pageObject->setId($duplicatePageObjectId);
865  $pageObject->createFromXML();
866  }
getClassNameByType($a_type, $a_gui=false)
Get class name by type.
+ 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

protected

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Referenced by duplicateFeedback(), and duplicateGenericFeedback().

+ 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

protected

Parameters
type$pageObjectType
type$pageObjectId

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

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

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

877  {
879  include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPage.php");
880  if (ilAssGenFeedbackPage::_exists($pageObjectType, $pageObjectId)) {
881  $pageObject = new ilAssGenFeedbackPage($pageObjectId);
882  $pageObject->delete();
883  }
884  }
886  include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPage.php");
887  if (ilAssSpecFeedbackPage::_exists($pageObjectType, $pageObjectId)) {
888  $pageObject = new ilAssSpecFeedbackPage($pageObjectId);
889  $pageObject->delete();
890  }
891  }
892  }
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
Generic feedback page object.
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
Specific feedback page object.
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 (   $pageObjectType,
  $pageObjectId 
)
finalprivate

ensures an existing page object with given type and id

private

Parameters
type$pageObjectType
type$pageObjectId

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

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

Referenced by getPageObjectContent(), and getPageObjectXML().

803  {
805  include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPage.php");
806  if (!ilAssGenFeedbackPage::_exists($pageObjectType, $pageObjectId)) {
807  $pageObject = new ilAssGenFeedbackPage();
808  $pageObject->setParentId($this->questionOBJ->getId());
809  $pageObject->setId($pageObjectId);
810  $pageObject->createFromXML();
811  }
812  }
814  include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPage.php");
815  if (!ilAssSpecFeedbackPage::_exists($pageObjectType, $pageObjectId)) {
816  $pageObject = new ilAssSpecFeedbackPage();
817  $pageObject->setParentId($this->questionOBJ->getId());
818  $pageObject->setId($pageObjectId);
819  $pageObject->createFromXML();
820  }
821  }
822  }
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
Generic feedback page object.
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
Specific feedback page object.
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 (   $questionId)
abstract

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

public

Parameters
integer$questionId
Returns
string $feedbackContent

Referenced by getGenericFeedbackContent().

+ Here is the caller graph for this function:

◆ getClassNameByType()

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

Get class name by type.

Parameters

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

References $a_type, PAGE_OBJECT_TYPE_GENERIC_FEEDBACK, and PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK.

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

690  {
691  $gui = ($a_gui)
692  ? "GUI"
693  : "";
694  include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php");
696  return "ilAssGenFeedbackPage" . $gui;
697  }
699  return "ilAssSpecFeedbackPage" . $gui;
700  }
701  }
$a_type
Definition: workflow.php:92
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK
type for specific feedback page objects
+ 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.

public

Parameters
integer$questionId
boolean$solutionCompleted
Returns
string $feedbackContent

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

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

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

320  {
321  require_once 'Services/RTE/classes/class.ilRTE.php';
322 
323  $correctness = $solutionCompleted ? 1 : 0;
324 
325  $res = $this->db->queryF(
326  "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
327  array('integer', 'text'),
328  array($questionId, $correctness)
329  );
330 
331  $feedbackContent = null;
332 
333  while ($row = $this->db->fetchAssoc($res)) {
334  $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($row['feedback'], 1);
335  break;
336  }
337 
338  return $feedbackContent;
339  }
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGenericFeedbackExportPresentation()

ilAssQuestionFeedback::getGenericFeedbackExportPresentation (   $questionId,
  $solutionCompleted 
)

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

public

Parameters
integer$questionId
boolean$solutionCompleted
Returns
string $genericFeedbackExportPresentation

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

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

974  {
975  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
976  $genericFeedbackExportPresentation = $this->getPageObjectXML(
978  $this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
979  );
980  } else {
981  $genericFeedbackExportPresentation = $this->getGenericFeedbackContent($questionId, $solutionCompleted);
982  }
983 
984  return $genericFeedbackExportPresentation;
985  }
getGenericFeedbackContent($questionId, $solutionCompleted)
returns the GENERIC feedback content for a given question state.
getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
returns a useable page object id for generic feedback page objects for the given question id for eith...
getPageObjectXML($pageObjectType, $pageObjectId)
returns the xml of page object with given type and id
getGenericFeedbackPageObjectType()
returns the type for generic feedback page objects defined in local constant
+ 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.

protected

Parameters
integer$questionId
boolean$answerIndex
Returns
string $feedbackId

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

References $res, $row, and array.

Referenced by getGenericFeedbackPageObjectId(), and saveGenericFeedbackContent().

587  {
588  $res = $this->db->queryF(
589  "SELECT feedback_id FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
590  array('integer','text'),
591  array($questionId, (int) $solutionCompleted)
592  );
593 
594  $feedbackId = null;
595 
596  while ($row = $this->db->fetchAssoc($res)) {
597  $feedbackId = $row['feedback_id'];
598  break;
599  }
600 
601  return $feedbackId;
602  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ 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)

protected

Parameters
integer$questionId
boolean$solutionCompleted
Returns
integer $pageObjectId

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

References getGenericFeedbackId(), and saveGenericFeedbackContent().

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

954  {
955  $pageObjectId = $this->getGenericFeedbackId($questionId, $solutionCompleted);
956 
957  if (!$pageObjectId) {
958  $pageObjectId = $this->saveGenericFeedbackContent($questionId, $solutionCompleted, null);
959  }
960 
961  return $pageObjectId;
962  }
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.
+ 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

protected

Returns
string $genericFeedbackPageObjectType

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

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

903  {
904  return self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK;
905  }
+ Here is the caller graph for this function:

◆ getGenericFeedbackTableName()

ilAssQuestionFeedback::getGenericFeedbackTableName ( )
finalprotected

returns the table name for specific feedback

Returns
string $specificFeedbackTableName

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

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

661  {
662  return self::TABLE_NAME_GENERIC_FEEDBACK;
663  }
+ 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)

public

Parameters
integer$questionId
boolean$solutionCompleted
Returns
string $genericFeedbackTestPresentationHTML

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

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

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  }
getGenericFeedbackContent($questionId, $solutionCompleted)
returns the GENERIC feedback content for a given question state.
getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
returns a useable page object id for generic feedback page objects for the given question id for eith...
getPageObjectContent($pageObjectType, $pageObjectId)
returns the content of page object with given type and id
getGenericFeedbackPageObjectType()
returns the type for generic feedback page objects defined in local constant
+ 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

protected

Parameters
type$pageObjectType
type$pageObjectId
Returns
string $pageObjectContent

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

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

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

756  {
757  global $ilCtrl;
758 
759  $cl = $this->getClassNameByType($pageObjectType, true);
760  require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
761 
762  $this->ensurePageObjectExists($pageObjectType, $pageObjectId);
763 
764  $mode = ($ilCtrl->isAsynch())
765  ? "presentation"
766  : $this->getPageObjectOutputMode();
767 
768  $pageObjectGUI = new $cl($pageObjectId);
769  $pageObjectGUI->setOutputMode($mode);
770 
771  return $pageObjectGUI->presentation($mode);
772  }
ensurePageObjectExists($pageObjectType, $pageObjectId)
ensures an existing page object with given type and id
getPageObjectOutputMode()
Get page object output mode.
getClassNameByType($a_type, $a_gui=false)
Get class name by type.
global $ilCtrl
Definition: ilias.php:18
+ 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

private

Parameters
type$pageObjectType
type$pageObjectId
Returns
string $pageObjectEditingLink

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

References getClassNameByType().

Referenced by getPageObjectNonEditableValueHTML().

715  {
716  $cl = $this->getClassNameByType($pageObjectType, true);
717  $this->ctrl->setParameterByClass($cl, 'feedback_type', $pageObjectType);
718  $this->ctrl->setParameterByClass($cl, 'feedback_id', $pageObjectId);
719 
720  $linkHREF = $this->ctrl->getLinkTargetByClass($cl, 'edit');
721  $linkTEXT = $this->lng->txt('tst_question_feedback_edit_page');
722 
723  return "<a href='$linkHREF'>$linkTEXT</a>";
724  }
getClassNameByType($a_type, $a_gui=false)
Get class name by type.
+ 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

protected

Parameters
string$pageObjectType
integer$pageObjectId
Returns
string $nonEditableValueHTML

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

References getPageObjectContent(), and getPageObjectEditingLink().

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

676  {
677  $link = $this->getPageObjectEditingLink($pageObjectType, $pageObjectId);
678  $content = $this->getPageObjectContent($pageObjectType, $pageObjectId);
679 
680  return "$link<br /><br />$content";
681  }
getPageObjectContent($pageObjectType, $pageObjectId)
returns the content of page object with given type and id
getPageObjectEditingLink($pageObjectType, $pageObjectId)
returns a link to page object editor for page object with given type and id
+ 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 741 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

protected

Parameters
type$pageObjectType
type$pageObjectId
Returns
string $pageObjectXML

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

References ensurePageObjectExists(), and getClassNameByType().

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

784  {
785  $cl = $this->getClassNameByType($pageObjectType);
786  require_once 'Modules/TestQuestionPool/classes/feedback/class.' . $cl . '.php';
787 
788  $this->ensurePageObjectExists($pageObjectType, $pageObjectId);
789 
790  $pageObject = new $cl($pageObjectId);
791  return $pageObject->getXMLContent();
792  }
ensurePageObjectExists($pageObjectType, $pageObjectId)
ensures an existing page object with given type and id
getClassNameByType($a_type, $a_gui=false)
Get class name by type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackContent()

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

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

public

Parameters
integer$questionId
integer$answerIndex
Returns
string $feedbackContent

Referenced by getGenericFeedbackContent().

+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackExportPresentation()

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

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

public

Parameters
integer$questionId
integer$answerIndex
Returns
string $specificFeedbackExportPresentation

Referenced by getGenericFeedbackExportPresentation().

+ Here is the caller graph for this function:

◆ getSpecificAnswerFeedbackPageObjectType()

ilAssQuestionFeedback::getSpecificAnswerFeedbackPageObjectType ( )
finalprotected

◆ getSpecificAnswerFeedbackTestPresentation()

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

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

public

Parameters
integer$questionId
integer$answerIndex
Returns
string $specificAnswerFeedbackTestPresentationHTML

Referenced by getGenericFeedbackTestPresentation().

+ Here is the caller graph for this function:

◆ 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

public

Parameters
integer$questionId
boolean$solutionCompleted
string$feedbackContent

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

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

1009  {
1010  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
1011  $pageObjectId = $this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted);
1012  $pageObjectType = $this->getGenericFeedbackPageObjectType();
1013 
1014  $this->createPageObject($pageObjectType, $pageObjectId, $feedbackContent);
1015  } else {
1016  $this->saveGenericFeedbackContent($questionId, $solutionCompleted, $feedbackContent);
1017  }
1018  }
createPageObject($pageObjectType, $pageObjectId, $pageObjectContent)
creates a new page object with given page object id and page object type and passed page object conte...
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
saveGenericFeedbackContent($questionId, $solutionCompleted, $feedbackContent)
saves GENERIC feedback content for the given question id to the database.
+ Here is the call graph for this function:

◆ importSpecificAnswerFeedback()

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

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

public

Parameters
integer$questionId
integer$answerIndex
string$feedbackContent

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

public

Parameters
ilPropertyFormGUI$form

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

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

180  {
181  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
182  $pageObjectType = $this->getGenericFeedbackPageObjectType();
183 
184  $valueFeedbackSolutionComplete = $this->getPageObjectNonEditableValueHTML(
185  $pageObjectType,
186  $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), true)
187  );
188 
189  $valueFeedbackSolutionIncomplete = $this->getPageObjectNonEditableValueHTML(
190  $pageObjectType,
191  $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), false)
192  );
193  } else {
194  $valueFeedbackSolutionComplete = $this->getGenericFeedbackContent(
195  $this->questionOBJ->getId(),
196  true
197  );
198 
199  $valueFeedbackSolutionIncomplete = $this->getGenericFeedbackContent(
200  $this->questionOBJ->getId(),
201  false
202  );
203  }
204 
205  $form->getItemByPostVar('feedback_complete')->setValue($valueFeedbackSolutionComplete);
206  $form->getItemByPostVar('feedback_incomplete')->setValue($valueFeedbackSolutionIncomplete);
207  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
getPageObjectNonEditableValueHTML($pageObjectType, $pageObjectId)
returns html content to be used as value for non editable value form properties in feedback editing f...
getGenericFeedbackContent($questionId, $solutionCompleted)
returns the GENERIC feedback content for a given question state.
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
+ 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

public

Parameters
ilPropertyFormGUI$form

Referenced by initGenericFormProperties().

+ Here is the caller graph for this function:

◆ isGenericFeedbackId()

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

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

References $row, array, and isSpecificAnswerFeedbackId().

Referenced by checkFeedbackParent().

609  {
610  $row = $this->db->fetchAssoc($this->db->queryF(
611  "SELECT COUNT(feedback_id) cnt FROM {$this->getGenericFeedbackTableName()}
612  WHERE question_fi = %s AND feedback_id = %s",
613  array('integer','integer'),
614  array($this->questionOBJ->getId(), $feedbackId)
615  ));
616 
617 
618  return $row['cnt'];
619  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

public

Returns
boolean $isSaveableInPageObjectEditingMode

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

254  {
255  return false;
256  }

◆ isSpecificAnswerFeedbackId()

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

Referenced by checkFeedbackParent(), and isGenericFeedbackId().

+ 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

public

Parameters
string$feedbackPageObjectType
Returns
array $validFeedbackPageObjectTypes

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

Referenced by ilAssQuestionFeedbackPageObjectCommandForwarder\__construct().

931  {
932  switch ($feedbackPageObjectType) {
933  case self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK:
934  case self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK:
935 
936  return true;
937  }
938 
939  return false;
940  }
+ Here is the caller graph for this function:

◆ migrateContentForLearningModule()

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

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

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

1037  {
1038  $this->saveGenericFeedbackContent($questionId, true, $migrator->migrateToLmContent(
1039  $this->getGenericFeedbackContent($questionId, true)
1040  ));
1041 
1042  $this->saveGenericFeedbackContent($questionId, false, $migrator->migrateToLmContent(
1043  $this->getGenericFeedbackContent($questionId, false)
1044  ));
1045  }
saveGenericFeedbackContent($questionId, $solutionCompleted, $feedbackContent)
saves GENERIC feedback content for the given question id to the database.
+ 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.

public

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

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

References ilRTE\_replaceMediaObjectImageSrc(), array, getGenericFeedbackId(), getGenericFeedbackTableName(), saveSpecificAnswerFeedbackContent(), and time.

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

375  {
376  require_once 'Services/RTE/classes/class.ilRTE.php';
377 
378  $correctness = $solutionCompleted ? 1 : 0;
379 
380  $feedbackId = $this->getGenericFeedbackId($questionId, $solutionCompleted);
381 
382  if (strlen($feedbackContent)) {
383  $feedbackContent = ilRTE::_replaceMediaObjectImageSrc($feedbackContent, 0);
384  }
385 
386  if ($feedbackId) {
387  $this->db->update(
389  array(
390  'feedback' => array('clob', $feedbackContent),
391  'tstamp' => array('integer', time())
392  ),
393  array(
394  'feedback_id' => array('integer', $feedbackId)
395  )
396  );
397  } else {
398  $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
399 
400  $this->db->insert($this->getGenericFeedbackTableName(), array(
401  'feedback_id' => array('integer', $feedbackId),
402  'question_fi' => array('integer', $questionId),
403  'correctness' => array('text', $correctness), // text ?
404  'feedback' => array('clob', $feedbackContent),
405  'tstamp' => array('integer', time())
406  ));
407  }
408 
409  return $feedbackId;
410  }
getGenericFeedbackTableName()
returns the table name for specific feedback
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
Create styles array
The data for the language used.
getGenericFeedbackId($questionId, $solutionCompleted)
returns the SPECIFIC answer feedback ID for a given question id and answer index. ...
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveGenericFormProperties()

ilAssQuestionFeedback::saveGenericFormProperties ( ilPropertyFormGUI  $form)
final

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

public

Parameters
ilPropertyFormGUI$form

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

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

228  {
229  if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
230  $this->saveGenericFeedbackContent($this->questionOBJ->getId(), false, $form->getInput('feedback_incomplete'));
231  $this->saveGenericFeedbackContent($this->questionOBJ->getId(), true, $form->getInput('feedback_complete'));
232  }
233  }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
saveGenericFeedbackContent($questionId, $solutionCompleted, $feedbackContent)
saves GENERIC feedback content for the given question id to the database.
+ Here is the call graph for this function:

◆ saveSpecificAnswerFeedbackContent()

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

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

public

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

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

public

Parameters
ilPropertyFormGUI$form

Referenced by saveGenericFormProperties().

+ Here is the caller graph for this function:

◆ setPageObjectOutputMode()

ilAssQuestionFeedback::setPageObjectOutputMode (   $a_val)
final

Set page object output mode.

Parameters
string$a_valpage output mode

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

732  {
733  $this->page_obj_output_mode = $a_val;
734  }

◆ syncFeedback()

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

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

public

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

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

References syncGenericFeedback(), and syncSpecificFeedback().

534  {
535  $this->syncGenericFeedback($originalQuestionId, $duplicateQuestionId);
536  $this->syncSpecificFeedback($originalQuestionId, $duplicateQuestionId);
537  }
syncSpecificFeedback($originalQuestionId, $duplicateQuestionId)
syncs the SPECIFIC feedback from a duplicated question back to the original question ...
syncGenericFeedback($originalQuestionId, $duplicateQuestionId)
syncs the GENERIC feedback from a duplicated question back to the original question ...
+ 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

private

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

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

References $result, $row, array, getGenericFeedbackTableName(), and time.

Referenced by syncFeedback().

548  {
549  // delete generic feedback of the original question
550  $this->db->manipulateF(
551  "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
552  array('integer'),
553  array($originalQuestionId)
554  );
555 
556  // get generic feedback of the actual (duplicated) question
557  $result = $this->db->queryF(
558  "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
559  array('integer'),
560  array($duplicateQuestionId)
561  );
562 
563  // save generic feedback to the original question
564  while ($row = $this->db->fetchAssoc($result)) {
565  $nextId = $this->db->nextId($this->getGenericFeedbackTableName());
566 
567  $this->db->insert($this->getGenericFeedbackTableName(), array(
568  'feedback_id' => array('integer', $nextId),
569  'question_fi' => array('integer', $originalQuestionId),
570  'correctness' => array('text', $row['correctness']),
571  'feedback' => array('clob', $row['feedback']),
572  'tstamp' => array('integer', time())
573  ));
574  }
575  }
$result
getGenericFeedbackTableName()
returns the table name for specific feedback
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncSpecificFeedback()

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

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

protected

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Referenced by checkFeedbackParent(), and 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

const ilAssQuestionFeedback::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK = 'qfbg'

◆ 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'

table name for specific feedback

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


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