114 if ($this->page_obj_output_mode ==
"edit") {
117 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
126 return $genericFeedbackTestPresentationHTML;
153 $this->lng->txt(
'feedback_complete_solution'),
155 $this->questionOBJ->isAdditionalContentEditingModePageObject()
159 $this->lng->txt(
'feedback_incomplete_solution'),
160 'feedback_incomplete',
161 $this->questionOBJ->isAdditionalContentEditingModePageObject()
185 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
199 $this->questionOBJ->getId(),
204 $this->questionOBJ->getId(),
209 $form->
getItemByPostVar(
'feedback_complete')->setValue($valueFeedbackSolutionComplete);
210 $form->
getItemByPostVar(
'feedback_incomplete')->setValue($valueFeedbackSolutionIncomplete);
233 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
278 if ($asNonEditable) {
279 require_once
'Services/Form/classes/class.ilNonEditableValueGUI.php';
283 require_once
'Services/Form/classes/class.ilTextAreaInputGUI.php';
284 require_once
'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
287 $property->setRequired(
false);
288 $property->setRows(10);
289 $property->setCols(80);
291 if (!$this->questionOBJ->getPreventRteUsage()) {
292 $property->setUseRte(
true);
293 $property->addPlugin(
"latex");
294 $property->addButton(
"latex");
295 $property->addButton(
"pastelatex");
297 require_once
'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
299 $property->setRTESupport($this->questionOBJ->getId(),
"qpl",
"assessment");
301 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
303 $property->setUseTagsForRteOnly(
false);
306 $property->setRTESupport($this->questionOBJ->getId(),
"qpl",
"assessment");
325 require_once
'Services/RTE/classes/class.ilRTE.php';
327 $correctness = $solutionCompleted ? 1 : 0;
329 $res = $this->db->queryF(
330 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
331 array(
'integer',
'text'),
332 array($questionId, $correctness)
335 $feedbackContent = null;
337 while ($row = $this->db->fetchAssoc(
$res)) {
342 return is_null($feedbackContent) ?
'' : $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedbackContent);
375 $res = $this->db->queryF(
376 "SELECT answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
381 $allFeedbackContents =
'';
383 while ($row = $this->db->fetchAssoc(
$res)) {
385 $this->questionOBJ->getId(),
391 return (
bool) strlen(trim(strip_tags($allFeedbackContents)));
408 require_once
'Services/RTE/classes/class.ilRTE.php';
410 $correctness = $solutionCompleted ? 1 : 0;
414 if (strlen($feedbackContent)) {
415 $feedbackContent = $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedbackContent);
423 'feedback' => array(
'clob', $feedbackContent),
424 'tstamp' => array(
'integer', time())
427 'feedback_id' => array(
'integer', $feedbackId)
434 'feedback_id' => array(
'integer', $feedbackId),
435 'question_fi' => array(
'integer', $questionId),
436 'correctness' => array(
'text', $correctness),
437 'feedback' => array(
'clob', $feedbackContent),
438 'tstamp' => array(
'integer', time())
469 if ($isAdditionalContentEditingModePageObject) {
481 $this->db->manipulateF(
482 "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
524 $res = $this->db->queryF(
525 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
527 array($originalQuestionId)
530 while ($row = $this->db->fetchAssoc(
$res)) {
534 'feedback_id' => array(
'integer', $feedbackId),
535 'question_fi' => array(
'integer', $duplicateQuestionId),
536 'correctness' => array(
'text', $row[
'correctness']),
537 'feedback' => array(
'clob', $row[
'feedback']),
538 'tstamp' => array(
'integer', time())
541 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
543 $this->
duplicatePageObject($pageObjectType, $row[
'feedback_id'], $feedbackId, $duplicateQuestionId);
567 final public function syncFeedback($originalQuestionId, $duplicateQuestionId)
584 $this->db->manipulateF(
585 "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
587 array($originalQuestionId)
592 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
594 array($duplicateQuestionId)
598 while ($row = $this->db->fetchAssoc(
$result)) {
602 'feedback_id' => array(
'integer', $nextId),
603 'question_fi' => array(
'integer', $originalQuestionId),
604 'correctness' => array(
'text', $row[
'correctness']),
605 'feedback' => array(
'clob', $row[
'feedback']),
606 'tstamp' => array(
'integer', time())
622 $res = $this->db->queryF(
623 "SELECT feedback_id FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
624 array(
'integer',
'text'),
625 array($questionId, (
int) $solutionCompleted)
630 while ($row = $this->db->fetchAssoc(
$res)) {
631 $feedbackId = $row[
'feedback_id'];
644 $row = $this->db->fetchAssoc($this->db->queryF(
645 "SELECT COUNT(feedback_id) cnt FROM {$this->getGenericFeedbackTableName()} 646 WHERE question_fi = %s AND feedback_id = %s",
647 array(
'integer',
'integer'),
648 array($this->questionOBJ->getId(), $feedbackId)
696 return self::TABLE_NAME_GENERIC_FEEDBACK;
714 return "$link<br /><br />$content";
728 include_once(
"./Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php");
730 return "ilAssGenFeedbackPage" . $gui;
733 return "ilAssSpecFeedbackPage" . $gui;
751 $this->ctrl->setParameterByClass($cl,
'feedback_type', $pageObjectType);
752 $this->ctrl->setParameterByClass($cl,
'feedback_id', $pageObjectId);
754 $linkHREF = $this->ctrl->getLinkTargetByClass($cl,
'edit');
755 $linkTEXT = $this->lng->txt(
'tst_question_feedback_edit_page');
757 return "<a href='$linkHREF'>$linkTEXT</a>";
767 $this->page_obj_output_mode = $a_val;
792 $ilCtrl = $DIC[
'ilCtrl'];
795 require_once
'Modules/TestQuestionPool/classes/feedback/class.' . $cl .
'.php';
799 $mode = ($ilCtrl->isAsynch())
803 $pageObjectGUI =
new $cl($pageObjectId);
804 $pageObjectGUI->setOutputMode($mode);
806 return $pageObjectGUI->presentation($mode);
821 require_once
'Modules/TestQuestionPool/classes/feedback/class.' . $cl .
'.php';
825 $pageObject =
new $cl($pageObjectId);
826 return $pageObject->getXMLContent();
842 $pageObject->setParentId($this->questionOBJ->getId());
843 $pageObject->setId($pageObjectId);
844 $pageObject->createFromXML();
849 $pageObject->setParentId($this->questionOBJ->getId());
850 $pageObject->setId($pageObjectId);
851 $pageObject->createFromXML();
865 final protected function createPageObject($pageObjectType, $pageObjectId, $pageObjectContent)
868 require_once
'Modules/TestQuestionPool/classes/feedback/class.' . $cl .
'.php';
870 $pageObject =
new $cl();
871 $pageObject->setParentId($this->questionOBJ->getId());
872 $pageObject->setId($pageObjectId);
873 $pageObject->setXMLContent($pageObjectContent);
874 $pageObject->createFromXML();
888 final protected function duplicatePageObject($pageObjectType, $originalPageObjectId, $duplicatePageObjectId, $duplicatePageObjectParentId)
893 require_once
'Modules/TestQuestionPool/classes/feedback/class.' . $cl .
'.php';
895 $pageObject =
new $cl($originalPageObjectId);
896 $pageObject->setParentId($duplicatePageObjectParentId);
897 $pageObject->setId($duplicatePageObjectId);
898 $pageObject->createFromXML();
912 include_once(
"./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPage.php");
915 $pageObject->delete();
919 include_once(
"./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPage.php");
922 $pageObject->delete();
937 return self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK;
950 return self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK;
965 switch ($feedbackPageObjectType) {
966 case self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK:
967 case self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK:
990 if (!$pageObjectId) {
994 return $pageObjectId;
1008 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
1017 return $genericFeedbackExportPresentation;
1044 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
1074 $this->getGenericFeedbackContent($questionId,
true)
1078 $this->getGenericFeedbackContent($questionId,
false)
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
getSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex)
returns the SPECIFIC feedback content for a given question id and answer index.
initSpecificFormProperties(ilPropertyFormGUI $form)
initialises a given form object's SPECIFIC form properties relating to this question type ...
checkFeedbackParent($feedbackId)
This class provides processing control methods.
createPageObject($pageObjectType, $pageObjectId, $pageObjectContent)
creates a new page object with given page object id and page object type and passed page object conte...
importSpecificAnswerFeedback($questionId, $questionIndex, $answerIndex, $feedbackContent)
imports the given feedback content as specific feedback for the given question id and answer index ...
getPageObjectNonEditableValueHTML($pageObjectType, $pageObjectId)
returns html content to be used as value for non editable value form properties in feedback editing f...
ensurePageObjectExists($pageObjectType, $pageObjectId)
ensures an existing page object with given type and id
getPageObjectOutputMode()
Get page object output mode.
getGenericFeedbackTestPresentation($questionId, $solutionCompleted)
returns the html of GENERIC feedback for the given question id for test presentation (either for the ...
getSpecificAnswerFeedbackPageObjectType()
returns the type for specific feedback page objects defined in local constant
Abstract basic class which is to be extended by the concrete assessment question type classes...
getGenericFeedbackTableName()
returns the table name for specific feedback
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
__construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilDBInterface $db, ilLanguage $lng)
constructor
static isValidFeedbackPageObjectType($feedbackPageObjectType)
returns the fact wether the given page object type relates to generic or specific feedback page objec...
migrateToLmContent($content)
migrateContentForLearningModule(ilAssSelfAssessmentMigrator $migrator, $questionId)
saveSpecificFormProperties(ilPropertyFormGUI $form)
saves a given form object's SPECIFIC form properties relating to this question type ...
const CSS_CLASS_FEEDBACK_CORRECT
saveSpecificAnswerFeedbackContent($questionId, $questionIndex, $answerIndex, $feedbackContent)
saves SPECIFIC feedback content for the given question id and answer index to the database...
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...
deleteGenericFeedbacks($questionId, $isAdditionalContentEditingModePageObject)
deletes all GENERIC feedback contents (and page objects if required) for the given question id ...
getGenericFeedbackContent($questionId, $solutionCompleted)
returns the GENERIC feedback content for a given question state.
getClassNameByType($a_type, $a_gui=false)
Get class name by type.
Generic feedback page object.
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
foreach($_POST as $key=> $value) $res
syncSpecificFeedback($originalQuestionId, $duplicateQuestionId)
syncs the SPECIFIC feedback from a duplicated question back to the original question ...
const TABLE_NAME_GENERIC_FEEDBACK
table name for specific feedback
duplicateGenericFeedback($originalQuestionId, $duplicateQuestionId)
duplicates the GENERIC feedback relating to the given original question id and saves it for the given...
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
duplicatePageObject($pageObjectType, $originalPageObjectId, $duplicatePageObjectId, $duplicatePageObjectParentId)
duplicates the page object with given type and original id to new page object with same type and give...
isGenericFeedbackId($feedbackId)
duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId)
duplicates the SPECIFIC feedback relating to the given original question id and saves it for the give...
const CSS_CLASS_FEEDBACK_WRONG
syncFeedback($originalQuestionId, $duplicateQuestionId)
syncs the feedback from a duplicated question back to the original question
importGenericFeedback($questionId, $solutionCompleted, $feedbackContent)
imports the given feedback content as generic feedback for the given question id for either the compl...
const FEEDBACK_SOLUTION_INCOMPLETE_PAGE_OBJECT_ID
id for page object relating to generic incomplete solution feedback
deleteSpecificAnswerFeedbacks($questionId, $isAdditionalContentEditingModePageObject)
deletes all SPECIFIC feedback contents for the given question id
Specific feedback page object.
isSaveableInPageObjectEditingMode()
returns the fact wether the feedback editing form is saveable in page object editing or not...
getGenericFeedbackExportPresentation($questionId, $solutionCompleted)
returns the generic feedback export presentation for given question id either for solution completed ...
saveGenericFormProperties(ilPropertyFormGUI $form)
saves a given form object's GENERIC form properties relating to all question types ...
isSpecificAnswerFeedbackId($feedbackId)
getPageObjectXML($pageObjectType, $pageObjectId)
returns the xml of page object with given type and id
const FEEDBACK_SOLUTION_COMPLETE_PAGE_OBJECT_ID
id for page object relating to generic complete solution feedback
getGenericFeedbackId($questionId, $solutionCompleted)
returns the SPECIFIC answer feedback ID for a given question id and answer index. ...
ensurePageObjectDeleted($pageObjectType, $pageObjectId)
ensures a no more existing page object for given type and id
This class represents a non editable value in a property form.
getSpecificAnswerFeedbackExportPresentation($questionId, $questionIndex, $answerIndex)
returns the generic feedback export presentation for given question id either for solution completed ...
This class represents a text area property in a property form.
duplicateFeedback($originalQuestionId, $duplicateQuestionId)
duplicates the feedback relating to the given original question id and saves it for the given duplica...
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 ...
getSpecificAnswerFeedbackTestPresentation($questionId, $questionIndex, $answerIndex)
returns the html of SPECIFIC feedback for the given question id and answer index for test presentatio...
initGenericFormProperties(ilPropertyFormGUI $form)
initialises a given form object's GENERIC form properties relating to all question types ...
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.
buildFeedbackContentFormProperty($label, $postVar, $asNonEditable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
setPageObjectOutputMode($a_val)
Set page object output mode.
isSpecificAnswerFeedbackAvailable($questionId)
returns the fact wether any specific feedback content is available or not
getAllSpecificAnswerFeedbackContents($questionId)
returns the SPECIFIC feedback content for a given question id and answer index.
getPageObjectEditingLink($pageObjectType, $pageObjectId)
returns a link to page object editor for page object with given type and id
const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK
type for specific feedback page objects
syncGenericFeedback($originalQuestionId, $duplicateQuestionId)
syncs the GENERIC feedback from a duplicated question back to the original question ...