ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAssQuestionFeedback Class Reference
+ Inheritance diagram for ilAssQuestionFeedback:
+ Collaboration diagram for ilAssQuestionFeedback:

Public Member Functions

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

Static Public Member Functions

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

Data Fields

const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK = 'qfbg'
 type for generic feedback page objects
const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK = 'qfbs'
 type for specific feedback page objects
const FEEDBACK_SOLUTION_INCOMPLETE_PAGE_OBJECT_ID = 1
 id for page object relating to generic incomplete solution feedback
const FEEDBACK_SOLUTION_COMPLETE_PAGE_OBJECT_ID = 2
 id for page object relating to generic complete solution feedback
const TABLE_NAME_GENERIC_FEEDBACK = 'qpl_fb_generic'
 table name for specific feedback

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 ...
 duplicateSpecificFeedback ($originalQuestionId, $duplicateQuestionId)
 duplicates the SPECIFIC feedback relating to the given original question id and saves it for the given duplicate question id
 getGenericFeedbackId ($questionId, $solutionCompleted)
 returns the SPECIFIC answer feedback ID for a given question id and answer index.
 syncSpecificFeedback ($originalQuestionId, $duplicateQuestionId)
 syncs the SPECIFIC feedback from a duplicated question back to the original question
 getGenericFeedbackTableName ()
 returns the table name for specific feedback
 getPageObjectNonEditableValueHTML ($pageObjectType, $pageObjectId)
 returns html content to be used as value for non editable value form properties in feedback editing form
 getPageObjectContent ($pageObjectType, $pageObjectId)
 returns the content of page object with given type and id
 getPageObjectXML ($pageObjectType, $pageObjectId)
 returns the xml of page object with given type and id
 createPageObject ($pageObjectType, $pageObjectId, $pageObjectContent)
 creates a new page object with given page object id and page object type and passed page object content
 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
 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
 getSpecificAnswerFeedbackPageObjectType ()
 returns the type for specific feedback page objects defined in local constant
 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)

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
 syncGenericFeedback ($originalQuestionId, $duplicateQuestionId)
 syncs the GENERIC feedback from a duplicated question back to the original question
 getPageObjectEditingLink ($pageObjectType, $pageObjectId)
 returns a link to page object editor for page object with given type and id
 ensurePageObjectExists ($pageObjectType, $pageObjectId)
 ensures an existing page object with given type and id

Detailed Description

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

Constructor & Destructor Documentation

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

constructor

public

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

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

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

{
$this->questionOBJ = $questionOBJ;
$this->ctrl = $ctrl;
$this->lng = $lng;
$this->db = $db;
}

Member Function Documentation

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

References ilObjAdvancedEditing\_getUsedHTMLTags().

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

{
if($asNonEditable)
{
require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
$property = new ilNonEditableValueGUI($label, $postVar, true);
}
else
{
require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
require_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
$property = new ilTextAreaInputGUI($label, $postVar);
$property->setRequired(false);
$property->setRows(10);
$property->setCols(80);
if( !$this->questionOBJ->getPreventRteUsage() )
{
$property->setUseRte(true);
$property->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
$property->addPlugin("latex");
$property->addButton("latex");
$property->addButton("pastelatex");
}
$property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
}
return $property;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 ilPropertyFormGUI\addItem(), and buildFeedbackContentFormProperty().

{
$this->lng->txt('feedback_complete_solution'), 'feedback_complete',
$this->questionOBJ->isAdditionalContentEditingModePageObject()
));
$this->lng->txt('feedback_incomplete_solution'), 'feedback_incomplete',
$this->questionOBJ->isAdditionalContentEditingModePageObject()
));
}

+ Here is the call graph for this function:

ilAssQuestionFeedback::completeSpecificFormProperties ( ilPropertyFormGUI  $form)
abstract

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

public

Parameters
ilPropertyFormGUI$form

Reimplemented in ilAssMultiOptionQuestionFeedback, ilAssSingleOptionQuestionFeedback, and ilAssConfigurableMultiOptionQuestionFeedback.

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

References getClassNameByType().

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

{
$cl = $this->getClassNameByType($pageObjectType);
require_once 'Modules/TestQuestionPool/classes/feedback/class.'.$cl.'.php';
$pageObject = new $cl();
$pageObject->setParentId($this->questionOBJ->getId());
$pageObject->setId($pageObjectId);
$pageObject->setXMLContent($pageObjectContent);
$pageObject->createFromXML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

{
if( $isAdditionalContentEditingModePageObject )
{
$this->getGenericFeedbackPageObjectId($questionId, true)
);
$this->getGenericFeedbackPageObjectId($questionId, false)
);
}
$this->db->manipulateF(
"DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s", array('integer'), array($questionId)
);
}

+ Here is the call graph for this function:

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

deletes all SPECIFIC feedback contents for the given question id

public

Parameters
integer$questionId
boolean$isAdditionalContentEditingModePageObject

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

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

References duplicateGenericFeedback(), and duplicateSpecificFeedback().

{
$this->duplicateGenericFeedback($originalQuestionId, $duplicateQuestionId);
$this->duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId);
}

+ Here is the call graph for this function:

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

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

Referenced by duplicateFeedback().

{
$res = $this->db->queryF(
"SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
array('integer'), array($originalQuestionId)
);
while( $row = $this->db->fetchAssoc($res) )
{
$feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
$this->db->insert($this->getGenericFeedbackTableName(), array(
'feedback_id' => array('integer', $feedbackId),
'question_fi' => array('integer', $duplicateQuestionId),
'correctness' => array('text', $row['correctness']),
'feedback' => array('clob', $row['feedback']),
'tstamp' => array('integer', time())
));
if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
$pageObjectType = $this->getGenericFeedbackPageObjectType();
$this->duplicatePageObject($pageObjectType, $row['feedback_id'], $feedbackId, $duplicateQuestionId);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References getClassNameByType().

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

{
$cl = $this->getClassNameByType($pageObjectType);
require_once 'Modules/TestQuestionPool/classes/feedback/class.'.$cl.'.php';
$pageObject = new $cl($originalPageObjectId);
$pageObject->setParentId($duplicatePageObjectParentId);
$pageObject->setId($duplicatePageObjectId);
$pageObject->createFromXML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented in ilAssMultiOptionQuestionFeedback, ilAssConfigurableMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

Referenced by duplicateFeedback().

+ Here is the caller graph for this function:

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 821 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().

{
{
include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPage.php");
if( ilAssGenFeedbackPage::_exists($pageObjectType, $pageObjectId) )
{
$pageObject = new ilAssGenFeedbackPage($pageObjectId);
$pageObject->delete();
}
}
{
include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPage.php");
if( ilAssSpecFeedbackPage::_exists($pageObjectType, $pageObjectId) )
{
$pageObject = new ilAssSpecFeedbackPage($pageObjectId);
$pageObject->delete();
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

ensures an existing page object with given type and id

private

Parameters
type$pageObjectType
type$pageObjectId

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

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

Referenced by getPageObjectContent(), and getPageObjectXML().

{
{
include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPage.php");
if( !ilAssGenFeedbackPage::_exists($pageObjectType, $pageObjectId) )
{
$pageObject = new ilAssGenFeedbackPage();
$pageObject->setParentId($this->questionOBJ->getId());
$pageObject->setId($pageObjectId);
$pageObject->createFromXML();
}
}
{
include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPage.php");
if( !ilAssSpecFeedbackPage::_exists($pageObjectType, $pageObjectId) )
{
$pageObject = new ilAssSpecFeedbackPage();
$pageObject->setParentId($this->questionOBJ->getId());
$pageObject->setId($pageObjectId);
$pageObject->createFromXML();
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Get class name by type.

Parameters
@return

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

References PAGE_OBJECT_TYPE_GENERIC_FEEDBACK, and PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK.

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

{
$gui = ($a_gui)
? "GUI"
: "";
include_once("./Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php");
{
return "ilAssGenFeedbackPage".$gui;
}
{
return "ilAssSpecFeedbackPage".$gui;
}
}

+ Here is the caller graph for this function:

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

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

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

{
require_once 'Services/RTE/classes/class.ilRTE.php';
$correctness = $solutionCompleted ? 1 : 0;
$res = $this->db->queryF(
"SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
array('integer', 'text'), array($questionId, $correctness)
);
$feedbackContent = null;
while( $row = $this->db->fetchAssoc($res) )
{
$feedbackContent = ilRTE::_replaceMediaObjectImageSrc($row['feedback'], 1);
break;
}
return $feedbackContent;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

{
if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
$genericFeedbackExportPresentation = $this->getPageObjectXML(
$this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
);
}
else
{
$genericFeedbackExportPresentation = $this->getGenericFeedbackContent($questionId, $solutionCompleted);
}
return $genericFeedbackExportPresentation;
}

+ Here is the call graph for this function:

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

References $res, and $row.

Referenced by getGenericFeedbackPageObjectId(), and saveGenericFeedbackContent().

{
$res = $this->db->queryF(
"SELECT feedback_id FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
array('integer','text'), array($questionId, (int)$solutionCompleted)
);
$feedbackId = null;
while( $row = $this->db->fetchAssoc($res) )
{
$feedbackId = $row['feedback_id'];
break;
}
return $feedbackId;
}

+ Here is the caller graph for this function:

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

References getGenericFeedbackId(), and saveGenericFeedbackContent().

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

{
$pageObjectId = $this->getGenericFeedbackId($questionId, $solutionCompleted);
if( !$pageObjectId )
{
$pageObjectId = $this->saveGenericFeedbackContent($questionId, $solutionCompleted, null);
}
return $pageObjectId;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionFeedback::getGenericFeedbackPageObjectType ( )
finalprotected

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

protected

Returns
string $genericFeedbackPageObjectType

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

References PAGE_OBJECT_TYPE_GENERIC_FEEDBACK.

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

+ Here is the caller graph for this function:

ilAssQuestionFeedback::getGenericFeedbackTableName ( )
finalprotected

returns the table name for specific feedback

Returns
string $specificFeedbackTableName

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

References TABLE_NAME_GENERIC_FEEDBACK.

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

+ Here is the caller graph for this function:

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

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

{
if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
$genericFeedbackTestPresentationHTML = $this->getPageObjectContent(
$this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted)
);
}
else
{
$genericFeedbackTestPresentationHTML = $this->getGenericFeedbackContent($questionId, $solutionCompleted);
}
return $genericFeedbackTestPresentationHTML;
}

+ Here is the call graph for this function:

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

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

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

{
$cl = $this->getClassNameByType($pageObjectType, true);
require_once 'Modules/TestQuestionPool/classes/feedback/class.'.$cl.'.php';
$this->ensurePageObjectExists($pageObjectType, $pageObjectId);
$pageObjectGUI = new $cl($pageObjectId);
$pageObjectGUI->setOutputMode($this->getPageObjectOutputMode());
return $pageObjectGUI->presentation($this->getPageObjectOutputMode());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References getClassNameByType().

Referenced by getPageObjectNonEditableValueHTML().

{
$cl = $this->getClassNameByType($pageObjectType, true);
$this->ctrl->setParameterByClass($cl, 'feedback_type', $pageObjectType);
$this->ctrl->setParameterByClass($cl, 'feedback_id', $pageObjectId);
$linkHREF = $this->ctrl->getLinkTargetByClass($cl, 'edit');
$linkTEXT = $this->lng->txt('tst_question_feedback_edit_page');
return "<a href='$linkHREF'>$linkTEXT</a>";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References getPageObjectContent(), and getPageObjectEditingLink().

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

{
$link = $this->getPageObjectEditingLink($pageObjectType, $pageObjectId);
$content = $this->getPageObjectContent($pageObjectType, $pageObjectId);
return "$link<br /><br />$content";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionFeedback::getPageObjectOutputMode ( )
final

Get page object output mode.

Returns
string page output mode

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

References $page_obj_output_mode.

Referenced by getPageObjectContent().

+ Here is the caller graph for this function:

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

References ensurePageObjectExists(), and getClassNameByType().

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

{
$cl = $this->getClassNameByType($pageObjectType);
require_once 'Modules/TestQuestionPool/classes/feedback/class.'.$cl.'.php';
$this->ensurePageObjectExists($pageObjectType, $pageObjectId);
$pageObject = new $cl($pageObjectId);
return $pageObject->getXMLContent();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

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

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

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

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

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

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

{
if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
$pageObjectId = $this->getGenericFeedbackPageObjectId($questionId, $solutionCompleted);
$pageObjectType = $this->getGenericFeedbackPageObjectType();
$this->createPageObject($pageObjectType, $pageObjectId, $feedbackContent);
}
else
{
$this->saveGenericFeedbackContent($questionId, $solutionCompleted, $feedbackContent);
}
}

+ Here is the call graph for this function:

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

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

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

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

{
if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
$pageObjectType = $this->getGenericFeedbackPageObjectType();
$valueFeedbackSolutionComplete = $this->getPageObjectNonEditableValueHTML(
$pageObjectType, $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), true)
);
$valueFeedbackSolutionIncomplete = $this->getPageObjectNonEditableValueHTML(
$pageObjectType, $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), false)
);
}
else
{
$valueFeedbackSolutionComplete = $this->questionOBJ->prepareTextareaOutput(
$this->getGenericFeedbackContent($this->questionOBJ->getId(), true)
);
$valueFeedbackSolutionIncomplete = $this->questionOBJ->prepareTextareaOutput(
$this->getGenericFeedbackContent($this->questionOBJ->getId(), false)
);
}
$form->getItemByPostVar('feedback_complete')->setValue($valueFeedbackSolutionComplete);
$form->getItemByPostVar('feedback_incomplete')->setValue($valueFeedbackSolutionIncomplete);
}

+ Here is the call graph for this function:

ilAssQuestionFeedback::initSpecificFormProperties ( ilPropertyFormGUI  $form)
abstract

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

public

Parameters
ilPropertyFormGUI$form

Reimplemented in ilAssMultiOptionQuestionFeedback, ilAssConfigurableMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

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

Reimplemented in ilAssConfigurableMultiOptionQuestionFeedback.

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

{
return false;
}
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 879 of file class.ilAssQuestionFeedback.php.

Referenced by ilAssQuestionFeedbackPageObjectCommandForwarder\__construct().

{
switch( $feedbackPageObjectType )
{
case self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK:
case self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK:
return true;
}
return false;
}

+ Here is the caller graph for this function:

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

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

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

{
require_once 'Services/RTE/classes/class.ilRTE.php';
$correctness = $solutionCompleted ? 1 : 0;
$feedbackId = $this->getGenericFeedbackId($questionId, $solutionCompleted);
if( strlen($feedbackContent) )
{
$feedbackContent = ilRTE::_replaceMediaObjectImageSrc($feedbackContent, 0);
}
if( $feedbackId )
{
$this->db->update(
array(
'feedback' => array('clob', $feedbackContent),
'tstamp' => array('integer', time())
),
array(
'feedback_id' => array('integer', $feedbackId)
)
);
}
else
{
$feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
$this->db->insert($this->getGenericFeedbackTableName(), array(
'feedback_id' => array('integer', $feedbackId),
'question_fi' => array('integer', $questionId),
'correctness' => array('text', $correctness), // text ?
'feedback' => array('clob', $feedbackContent),
'tstamp' => array('integer', time())
));
}
return $feedbackId;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

{
if( !$this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
$this->saveGenericFeedbackContent($this->questionOBJ->getId(), false, $form->getInput('feedback_incomplete'));
$this->saveGenericFeedbackContent($this->questionOBJ->getId(), true, $form->getInput('feedback_complete'));
}
}

+ Here is the call graph for this function:

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

Reimplemented in ilAssMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

ilAssQuestionFeedback::saveSpecificFormProperties ( ilPropertyFormGUI  $form)
abstract

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

public

Parameters
ilPropertyFormGUI$form

Reimplemented in ilAssMultiOptionQuestionFeedback, ilAssConfigurableMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

ilAssQuestionFeedback::setPageObjectOutputMode (   $a_val)
final

Set page object output mode.

Parameters
string$a_valpage output mode

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

{
$this->page_obj_output_mode = $a_val;
}
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 522 of file class.ilAssQuestionFeedback.php.

References syncGenericFeedback(), and syncSpecificFeedback().

{
$this->syncGenericFeedback($originalQuestionId, $duplicateQuestionId);
$this->syncSpecificFeedback($originalQuestionId, $duplicateQuestionId);
}

+ Here is the call graph for this function:

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

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

Referenced by syncFeedback().

{
// delete generic feedback of the original question
$this->db->manipulateF(
"DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s", array('integer'), array($originalQuestionId)
);
// get generic feedback of the actual (duplicated) question
$result = $this->db->queryF(
"SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s", array('integer'), array($duplicateQuestionId)
);
// save generic feedback to the original question
while( $row = $this->db->fetchAssoc($result) )
{
$nextId = $this->db->nextId($this->getGenericFeedbackTableName());
$this->db->insert($this->getGenericFeedbackTableName(), array(
'feedback_id' => array('integer', $nextId),
'question_fi' => array('integer', $originalQuestionId),
'correctness' => array('text', $row['correctness']),
'feedback' => array('clob', $row['feedback']),
'tstamp' => array('integer', time())
));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

protected

Parameters
integer$originalQuestionId
integer$duplicateQuestionId

Reimplemented in ilAssMultiOptionQuestionFeedback, ilAssConfigurableMultiOptionQuestionFeedback, and ilAssSingleOptionQuestionFeedback.

Referenced by syncFeedback().

+ Here is the caller graph for this function:

Field Documentation

ilAssQuestionFeedback::$ctrl = null
protected

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

Referenced by __construct().

ilAssQuestionFeedback::$db = null
protected

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

Referenced by __construct().

ilAssQuestionFeedback::$lng = null
protected

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

Referenced by __construct().

ilAssQuestionFeedback::$page_obj_output_mode = "presentation"
protected

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

Referenced by getPageObjectOutputMode().

ilAssQuestionFeedback::$questionOBJ = null
protected

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

Referenced by __construct().

const ilAssQuestionFeedback::FEEDBACK_SOLUTION_COMPLETE_PAGE_OBJECT_ID = 2

id for page object relating to generic complete solution feedback

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

const ilAssQuestionFeedback::FEEDBACK_SOLUTION_INCOMPLETE_PAGE_OBJECT_ID = 1

id for page object relating to generic incomplete solution feedback

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

const ilAssQuestionFeedback::TABLE_NAME_GENERIC_FEEDBACK = 'qpl_fb_generic'

table name for specific feedback

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

Referenced by getGenericFeedbackTableName().


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