90 if ($this->page_obj_output_mode ==
"edit") {
93 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
124 $this->
lng->txt(
'feedback_complete_solution'),
126 $this->questionOBJ->isAdditionalContentEditingModePageObject()
130 $this->
lng->txt(
'feedback_incomplete_solution'),
131 'feedback_incomplete',
132 $this->questionOBJ->isAdditionalContentEditingModePageObject()
152 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
166 $this->questionOBJ->getId(),
171 $this->questionOBJ->getId(),
176 $form->
getItemByPostVar(
'feedback_complete')->setValue($valueFeedbackSolutionComplete);
177 $form->
getItemByPostVar(
'feedback_incomplete')->setValue($valueFeedbackSolutionIncomplete);
192 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
224 if ($asNonEditable) {
228 $property->setRequired(
false);
229 $property->setRows(10);
230 $property->setCols(80);
232 if (!$this->questionOBJ->getPreventRteUsage()) {
233 $property->setUseRte(
true);
234 $property->addPlugin(
"latex");
235 $property->addButton(
"latex");
236 $property->addButton(
"pastelatex");
239 $property->setRTESupport($this->questionOBJ->getId(),
"qpl",
"assessment");
242 $property->setUseTagsForRteOnly(
false);
245 $property->setRTESupport($this->questionOBJ->getId(),
"qpl",
"assessment");
258 $res = $this->db->queryF(
259 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
260 array(
'integer',
'text'),
261 array($questionId, (
int) $solutionCompleted)
264 $feedbackContent =
'';
266 if ($this->db->numRows(
$res) > 0) {
267 $row = $this->db->fetchAssoc(
$res);
269 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($row[
'feedback'] ??
''),
273 return $feedbackContent;
282 $res = $this->db->queryF(
283 "SELECT answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
288 $allFeedbackContents =
'';
290 while ($row = $this->db->fetchAssoc(
$res)) {
292 $this->questionOBJ->getId(),
298 return (
bool) strlen(trim(strip_tags($allFeedbackContents)));
308 require_once
'Services/RTE/classes/class.ilRTE.php';
312 if (strlen($feedbackContent)) {
313 $feedbackContent = $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedbackContent);
317 if ($feedbackId != -1) {
321 'feedback' => array(
'clob', $feedbackContent),
322 'tstamp' => array(
'integer', time())
325 'feedback_id' => array(
'integer', $feedbackId)
332 'feedback_id' => array(
'integer', $feedbackId),
333 'question_fi' => array(
'integer', $questionId),
334 'correctness' => array(
'text', (
int) $solutionCompleted),
335 'feedback' => array(
'clob', $feedbackContent),
336 'tstamp' => array(
'integer', time())
351 if ($isAdditionalContentEditingModePageObject) {
363 $this->db->manipulateF(
364 "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
376 final public function duplicateFeedback(
int $originalQuestionId,
int $duplicateQuestionId): void
388 $res = $this->db->queryF(
389 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
391 array($originalQuestionId)
394 while ($row = $this->db->fetchAssoc(
$res)) {
398 'feedback_id' => array(
'integer', $feedbackId),
399 'question_fi' => array(
'integer', $duplicateQuestionId),
400 'correctness' => array(
'text', $row[
'correctness']),
401 'feedback' => array(
'clob', $row[
'feedback']),
402 'tstamp' => array(
'integer', time())
405 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
407 $this->
duplicatePageObject($pageObjectType, $row[
'feedback_id'], $feedbackId, $duplicateQuestionId);
421 final public function syncFeedback(
int $originalQuestionId,
int $duplicateQuestionId): void
433 $this->db->manipulateF(
434 "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
436 array($originalQuestionId)
440 $result = $this->db->queryF(
441 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
443 array($duplicateQuestionId)
447 while ($row = $this->db->fetchAssoc($result)) {
451 'feedback_id' => array(
'integer', $nextId),
452 'question_fi' => array(
'integer', $originalQuestionId),
453 'correctness' => array(
'text', $row[
'correctness']),
454 'feedback' => array(
'clob', $row[
'feedback']),
455 'tstamp' => array(
'integer', time())
465 $res = $this->db->queryF(
466 "SELECT feedback_id FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
467 array(
'integer',
'text'),
468 array($questionId, (
int) $solutionCompleted)
472 if ($this->db->numRows(
$res)) {
473 $row = $this->db->fetchAssoc(
$res);
474 $feedbackId = (
int) $row[
'feedback_id'];
482 $row = $this->db->fetchAssoc($this->db->queryF(
483 "SELECT COUNT(feedback_id) cnt FROM {$this->getGenericFeedbackTableName()} 484 WHERE question_fi = %s AND feedback_id = %s",
485 array(
'integer',
'integer'),
486 array($this->questionOBJ->getId(), $feedbackId)
490 return (
bool) $row[
'cnt'];
511 abstract protected function syncSpecificFeedback(
int $originalQuestionId,
int $duplicateQuestionId): void;
515 return self::TABLE_NAME_GENERIC_FEEDBACK;
527 return "$link<br /><br />$content";
532 $gui = ($a_gui) ?
"GUI" :
"";
535 return "ilAssGenFeedbackPage" . $gui;
539 return "ilAssSpecFeedbackPage" . $gui;
545 $this->
ctrl->setParameterByClass($cl,
'feedback_type', $pageObjectType);
546 $this->
ctrl->setParameterByClass($cl,
'feedback_id', $pageObjectId);
548 $linkHREF = $this->
ctrl->getLinkTargetByClass($cl,
'edit');
549 $linkTEXT = $this->
lng->txt(
'tst_question_feedback_edit_page');
551 return "<a href='$linkHREF'>$linkTEXT</a>";
572 $pageObjectGUI =
new $cl($pageObjectId);
573 $pageObjectGUI->setOutputMode($mode);
575 return $pageObjectGUI->presentation($mode);
578 final protected function getPageObjectXML(
string $pageObjectType,
int $pageObjectId): string
584 $pageObject =
new $cl($pageObjectId);
585 return $pageObject->getXMLContent();
593 $pageObject->setParentId($this->questionOBJ->getId());
594 $pageObject->setId($pageObjectId);
595 $pageObject->createFromXML();
600 $pageObject->setParentId($this->questionOBJ->getId());
601 $pageObject->setId($pageObjectId);
602 $pageObject->createFromXML();
606 final protected function createPageObject(
string $pageObjectType,
int $pageObjectId,
string $pageObjectContent): void
610 $pageObject =
new $cl();
611 $pageObject->setParentId($this->questionOBJ->getId());
612 $pageObject->setId($pageObjectId);
613 $pageObject->setXMLContent($pageObjectContent);
614 $pageObject->createFromXML();
617 final protected function duplicatePageObject(
string $pageObjectType,
int $originalPageObjectId,
int $duplicatePageObjectId,
int $duplicatePageObjectParentId): void
623 $pageObject =
new $cl($originalPageObjectId);
624 $pageObject->setParentId($duplicatePageObjectParentId);
625 $pageObject->setId($duplicatePageObjectId);
626 $pageObject->createFromXML();
634 $pageObject->delete();
640 $pageObject->delete();
647 return self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK;
652 return self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK;
661 switch ($feedbackPageObjectType) {
662 case self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK:
663 case self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK:
679 if ($pageObjectId == -1) {
683 return $pageObjectId;
692 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
701 return $genericFeedbackExportPresentation;
716 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
726 abstract public function importSpecificAnswerFeedback(
int $questionId,
int $questionIndex,
int $answerIndex,
string $feedbackContent): void;
731 $this->getGenericFeedbackContent($questionId,
true)
735 $this->getGenericFeedbackContent($questionId,
false)
742 if (@$doc->loadHTML(
'<html><body>' . $content .
'</body></html>')) {
744 $nodes_after_comments = $xpath->query(
'//comment()/following-sibling::*[1]');
745 foreach ($nodes_after_comments as $node_after_comments) {
746 if (trim($node_after_comments->nodeValue) ===
'' 747 && $node_after_comments->childElementCount === 0) {
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
importGenericFeedback(int $questionId, bool $solutionCompleted, string $feedbackContent)
imports the given feedback content as generic feedback for the given question id for either the compl...
initSpecificFormProperties(ilPropertyFormGUI $form)
initialises a given form object's SPECIFIC form properties relating to this question type ...
duplicatePageObject(string $pageObjectType, int $originalPageObjectId, int $duplicatePageObjectId, int $duplicatePageObjectParentId)
syncGenericFeedback(int $originalQuestionId, int $duplicateQuestionId)
syncs the GENERIC feedback from a duplicated question back to the original question ...
deleteGenericFeedbacks(int $questionId, bool $isAdditionalContentEditingModePageObject)
deletes all GENERIC feedback contents (and page objects if required) for the given question id ...
importSpecificAnswerFeedback(int $questionId, int $questionIndex, int $answerIndex, string $feedbackContent)
ensurePageObjectDeleted(string $pageObjectType, int $pageObjectId)
getGenericFeedbackExportPresentation(int $questionId, bool $solutionCompleted)
returns the generic feedback export presentation for given question id either for solution completed ...
getPageObjectOutputMode()
duplicateSpecificFeedback(int $originalQuestionId, int $duplicateQuestionId)
duplicates the SPECIFIC feedback relating to the given original question id and saves it for the give...
getSpecificAnswerFeedbackPageObjectType()
Abstract basic class which is to be extended by the concrete assessment question type classes...
getGenericFeedbackTableName()
getPageObjectContent(string $pageObjectType, int $pageObjectId)
cleanupPageContent(string $content)
__construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilDBInterface $db, ilLanguage $lng)
constructor
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getClassNameByType(string $a_type, bool $a_gui=false)
migrateToLmContent($content)
getAllSpecificAnswerFeedbackContents(int $questionId)
syncSpecificFeedback(int $originalQuestionId, int $duplicateQuestionId)
syncs the SPECIFIC feedback from a duplicated question back to the original question ...
deleteSpecificAnswerFeedbacks(int $questionId, bool $isAdditionalContentEditingModePageObject)
saveSpecificFormProperties(ilPropertyFormGUI $form)
saves a given form object's SPECIFIC form properties relating to this question type ...
const CSS_CLASS_FEEDBACK_CORRECT
static isValidFeedbackPageObjectType(string $feedbackPageObjectType)
returns the fact whether the given page object type relates to generic or specific feedback page obje...
saveSpecificAnswerFeedbackContent(int $questionId, int $questionIndex, int $answerIndex, string $feedbackContent)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getSpecificAnswerFeedbackContent(int $questionId, int $questionIndex, int $answerIndex)
getGenericFeedbackPageObjectId(int $questionId, bool $solutionCompleted)
returns a useable page object id for generic feedback page objects for the given question id for eith...
isSpecificAnswerFeedbackId(int $feedbackId)
createPageObject(string $pageObjectType, int $pageObjectId, string $pageObjectContent)
getGenericFeedbackContent(int $questionId, bool $solutionCompleted)
returns the GENERIC feedback content for a given question state.
const TABLE_NAME_GENERIC_FEEDBACK
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
string $page_obj_output_mode
getPageObjectXML(string $pageObjectType, int $pageObjectId)
isSpecificAnswerFeedbackAvailable(int $questionId)
getSpecificAnswerFeedbackExportPresentation(int $questionId, int $questionIndex, int $answerIndex)
returns the generic feedback export presentation for given question id either for solution completed ...
buildFeedbackContentFormProperty(string $label, string $postVar, bool $asNonEditable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
duplicateFeedback(int $originalQuestionId, int $duplicateQuestionId)
duplicates the feedback relating to the given original question id and saves it for the given duplica...
getPageObjectNonEditableValueHTML(string $pageObjectType, int $pageObjectId)
returns html content to be used as value for non editable value form properties in feedback editing f...
const CSS_CLASS_FEEDBACK_WRONG
getGenericFeedbackTestPresentation(int $questionId, bool $solutionCompleted)
returns the html of GENERIC feedback for the given question id for test presentation (either for the ...
getGenericFeedbackId(int $questionId, bool $solutionCompleted)
returns the SPECIFIC answer feedback ID for a given question id and answer index. ...
const FEEDBACK_SOLUTION_INCOMPLETE_PAGE_OBJECT_ID
id for page object relating to generic incomplete solution feedback
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
syncFeedback(int $originalQuestionId, int $duplicateQuestionId)
syncs the feedback from a duplicated question back to the original question
isSaveableInPageObjectEditingMode()
returns the fact wether the feedback editing form is saveable in page object editing or not...
getSpecificAnswerFeedbackTestPresentation(int $questionId, int $questionIndex, int $answerIndex)
returns the html of SPECIFIC feedback for the given question id and answer index for test presentatio...
saveGenericFormProperties(ilPropertyFormGUI $form)
saves a given form object's GENERIC form properties relating to all question types ...
const FEEDBACK_SOLUTION_COMPLETE_PAGE_OBJECT_ID
id for page object relating to generic complete solution feedback
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ensurePageObjectExists(string $pageObjectType, int $pageObjectId)
This class represents a text area property in a property form.
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 ...
getGenericFeedbackPageObjectType()
duplicateGenericFeedback(int $originalQuestionId, int $duplicateQuestionId)
duplicates the GENERIC feedback relating to the given original question id and saves it for the given...
saveGenericFeedbackContent(int $questionId, bool $solutionCompleted, string $feedbackContent)
saves GENERIC feedback content for the given question id to the database.
migrateContentForLearningModule(ilAssSelfAssessmentMigrator $migrator, int $questionId)
setPageObjectOutputMode(string $page_obj_output_mode)
checkFeedbackParent(int $feedbackId)
isGenericFeedbackId(int $feedbackId)
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK
type for specific feedback page objects
getPageObjectEditingLink(string $pageObjectType, int $pageObjectId)