90 if ($this->page_obj_output_mode ==
"edit") {
93 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
95 $this->getPageObjectContent(
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()) {
157 if ($page_object_id === -1) {
158 $this->
ctrl->setParameterByClass(ilAssQuestionFeedbackEditingGUI::class,
'feedback_type', $page_object_type);
159 $this->
ctrl->setParameterByClass(ilAssQuestionFeedbackEditingGUI::class,
'fb_mode',
'complete');
160 $link = $this->
ctrl->getLinkTargetByClass(ilAssQuestionFeedbackEditingGUI::class,
'createFeedbackPage');
161 $value_feedback_solution_complete = sprintf(
162 '<a href="%s">%s</a>',
164 $this->
lng->txt(
'tst_question_feedback_edit_page')
166 $this->
ctrl->setParameterByClass(ilAssQuestionFeedbackEditingGUI::class,
'fb_mode',
'incomplete');
167 $link = $this->
ctrl->getLinkTargetByClass(ilAssQuestionFeedbackEditingGUI::class,
'createFeedbackPage');
168 $value_feedback_solution_incomplete = sprintf(
169 '<a href="%s">%s</a>',
171 $this->
lng->txt(
'tst_question_feedback_edit_page')
188 $this->questionOBJ->getId(),
193 $this->questionOBJ->getId(),
198 $form->
getItemByPostVar(
'feedback_complete')->setValue($value_feedback_solution_complete);
199 $form->
getItemByPostVar(
'feedback_incomplete')->setValue($value_feedback_solution_incomplete);
214 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
246 if ($as_non_editable) {
250 $property->setRequired(
false);
251 $property->setRows(10);
252 $property->setCols(80);
254 if (!$this->questionOBJ->getPreventRteUsage()) {
255 $property->setUseRte(
true);
256 $property->addPlugin(
"latex");
257 $property->addButton(
"latex");
258 $property->addButton(
"pastelatex");
261 $property->setRTESupport($this->questionOBJ->getId(),
"qpl",
"assessment");
264 $property->setUseTagsForRteOnly(
false);
267 $property->setRTESupport($this->questionOBJ->getId(),
"qpl",
"assessment");
280 $res = $this->db->queryF(
281 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
283 [$question_id, (
int) $solution_completed]
286 $feedback_content =
'';
288 if ($this->db->numRows(
$res) > 0) {
289 $row = $this->db->fetchAssoc(
$res);
291 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($row[
'feedback'] ??
''),
295 return $feedback_content;
304 $res = $this->db->queryF(
305 "SELECT answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
310 $all_feedback_contents =
'';
312 while ($row = $this->db->fetchAssoc(
$res)) {
314 $this->questionOBJ->getId(),
320 return trim(strip_tags($all_feedback_contents)) !==
'';
332 if ($feedback_content !==
'') {
333 $feedback_content = $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedback_content);
337 if ($feedbackId !== -1) {
341 'feedback' => [
'clob', $feedback_content],
342 'tstamp' => [
'integer', time()]
345 'feedback_id' => [
'integer', $feedbackId]
352 'feedback_id' => [
'integer', $feedbackId],
353 'question_fi' => [
'integer', $question_id],
354 'correctness' => [
'text', (
int) $solution_completed],
355 'feedback' => [
'clob', $feedback_content],
356 'tstamp' => [
'integer', time()]
371 if ($isAdditionalContentEditingModePageObject) {
383 $this->db->manipulateF(
384 "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
396 final public function duplicateFeedback(
int $originalQuestionId,
int $duplicateQuestionId): void
408 $res = $this->db->queryF(
409 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
411 [$originalQuestionId]
414 while ($row = $this->db->fetchAssoc(
$res)) {
418 'feedback_id' => [
'integer', $feedbackId],
419 'question_fi' => [
'integer', $duplicateQuestionId],
420 'correctness' => [
'text', $row[
'correctness']],
421 'feedback' => [
'clob', $row[
'feedback']],
422 'tstamp' => [
'integer', time()]
425 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
427 $this->
duplicatePageObject($page_object_type, $row[
'feedback_id'], $feedbackId, $duplicateQuestionId);
441 final public function syncFeedback(
int $originalQuestionId,
int $duplicateQuestionId): void
453 $this->db->manipulateF(
454 "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
456 [$originalQuestionId]
460 $result = $this->db->queryF(
461 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
463 [$duplicateQuestionId]
467 while ($row = $this->db->fetchAssoc($result)) {
471 'feedback_id' => [
'integer', $nextId],
472 'question_fi' => [
'integer', $originalQuestionId],
473 'correctness' => [
'text', $row[
'correctness']],
474 'feedback' => [
'clob', $row[
'feedback']],
475 'tstamp' => [
'integer', time()]
485 $res = $this->db->queryF(
486 "SELECT feedback_id FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
488 [$question_id, (
int) $solution_completed]
492 if ($this->db->numRows(
$res)) {
493 $row = $this->db->fetchAssoc(
$res);
494 $feedbackId = (
int) $row[
'feedback_id'];
502 $row = $this->db->fetchAssoc($this->db->queryF(
503 "SELECT COUNT(feedback_id) cnt FROM {$this->getGenericFeedbackTableName()} 504 WHERE question_fi = %s AND feedback_id = %s",
505 [
'integer',
'integer'],
506 [$this->questionOBJ->getId(), $feedbackId]
510 return (
bool) $row[
'cnt'];
531 abstract protected function syncSpecificFeedback(
int $originalQuestionId,
int $duplicateQuestionId): void;
535 return self::TABLE_NAME_GENERIC_FEEDBACK;
545 $content = $this->getPageObjectContent($page_object_type, $page_object_id);
547 '<a href="%s">%s</a><br /><br />%s',
549 $this->
lng->txt(
'tst_question_feedback_edit_page'),
556 $gui = ($a_gui) ?
"GUI" :
"";
559 return "ilAssGenFeedbackPage" . $gui;
563 return "ilAssSpecFeedbackPage" . $gui;
569 $this->
ctrl->setParameterByClass($cl,
'feedback_type', $page_object_type);
570 $this->
ctrl->setParameterByClass($cl,
'feedback_id', $page_object_id);
572 return $this->
ctrl->getLinkTargetByClass($cl,
'edit');
585 final protected function getPageObjectContent(
string $page_object_type,
int $page_object_id):
string 594 $pageObjectGUI =
new $cl($page_object_id);
595 return $pageObjectGUI->presentation($mode);
598 final protected function getPageObjectXML(
string $page_object_type,
int $page_object_id): string
604 $pageObject =
new $cl($page_object_id);
605 return $pageObject->getXMLContent();
613 $pageObject->setParentId($this->questionOBJ->getId());
614 $pageObject->setId($page_object_id);
615 $pageObject->createFromXML();
620 $pageObject->setParentId($this->questionOBJ->getId());
621 $pageObject->setId($page_object_id);
622 $pageObject->createFromXML();
626 final protected function createPageObject(
string $page_object_type,
int $page_object_id,
string $page_object_content): void
630 $pageObject =
new $cl();
631 $pageObject->setParentId($this->questionOBJ->getId());
632 $pageObject->setId($page_object_id);
633 $pageObject->setXMLContent($page_object_content);
634 $pageObject->createFromXML();
637 final protected function duplicatePageObject(
string $page_object_type,
int $original_page_object_id,
int $duplicate_page_object_id,
int $duplicate_page_object_parent_id): void
643 $pageObject =
new $cl($original_page_object_id);
644 $pageObject->setParentId($duplicate_page_object_parent_id);
645 $pageObject->setId($duplicate_page_object_id);
646 $pageObject->createFromXML();
651 if ($page_object_id === -1) {
658 $pageObject->delete();
664 $pageObject->delete();
671 return self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK;
676 return self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK;
685 switch ($feedbackPageObjectType) {
686 case self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK:
687 case self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK:
702 return $page_object_id;
711 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
720 return $genericFeedbackExportPresentation;
735 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
739 $this->
createPageObject($page_object_type, $page_object_id, $feedback_content);
745 abstract public function importSpecificAnswerFeedback(
int $question_id,
int $question_index,
int $answer_index,
string $feedback_content): void;
750 $this->getGenericFeedbackContent($question_id,
true)
754 $this->getGenericFeedbackContent($question_id,
false)
761 if (@$doc->loadHTML(
'<html><body>' . $content .
'</body></html>')) {
763 $nodes_after_comments = $xpath->query(
'//comment()/following-sibling::*[1]');
764 foreach ($nodes_after_comments as $node_after_comments) {
765 if (trim($node_after_comments->nodeValue) ===
'' 766 && $node_after_comments->childElementCount === 0) {
778 $this->questionOBJ->getId(),
785 $this->questionOBJ->getId(),
791 $page_object_id = ($mode ===
'complete') ? $page_object_id_complete : $page_object_id_incomplete;
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...
initSpecificFormProperties(ilPropertyFormGUI $form)
initialises a given form object's SPECIFIC form properties relating to this question type ...
syncGenericFeedback(int $originalQuestionId, int $duplicateQuestionId)
syncs the GENERIC feedback from a duplicated question back to the original question ...
saveGenericFeedbackContent(int $question_id, bool $solution_completed, string $feedback_content)
saves GENERIC feedback content for the given question id to the database.
ensurePageObjectExists(string $page_object_type, int $page_object_id)
getPageObjectOutputMode()
duplicateSpecificFeedback(int $originalQuestionId, int $duplicateQuestionId)
duplicates the SPECIFIC feedback relating to the given original question id and saves it for the give...
importSpecificAnswerFeedback(int $question_id, int $question_index, int $answer_index, string $feedback_content)
getSpecificAnswerFeedbackPageObjectType()
Abstract basic class which is to be extended by the concrete assessment question type classes...
getGenericFeedbackTableName()
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...
getPageObjectEditingLink(string $page_object_type, int $page_object_id)
deleteGenericFeedbacks(int $question_id, bool $isAdditionalContentEditingModePageObject)
deletes all GENERIC feedback contents (and page objects if required) for the given question id ...
getClassNameByType(string $a_type, bool $a_gui=false)
migrateToLmContent($content)
syncSpecificFeedback(int $originalQuestionId, int $duplicateQuestionId)
syncs the SPECIFIC feedback from a duplicated question back to the original question ...
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...
deleteSpecificAnswerFeedbacks(int $question_id, bool $isAdditionalContentEditingModePageObject)
saveSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index, string $feedback_content)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
migrateContentForLearningModule(ilAssSelfAssessmentMigrator $migrator, int $question_id)
getPageObjectXML(string $page_object_type, int $page_object_id)
getGenericFeedbackContent(int $question_id, bool $solution_completed)
returns the GENERIC feedback content for a given question state.
isSpecificAnswerFeedbackId(int $feedbackId)
isSpecificAnswerFeedbackAvailable(int $question_id)
getSpecificAnswerFeedbackExportPresentation(int $question_id, int $question_index, int $answer_index)
returns the generic feedback export presentation for given question id either for solution completed ...
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.
createPageObject(string $page_object_type, int $page_object_id, string $page_object_content)
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
string $page_obj_output_mode
duplicateFeedback(int $originalQuestionId, int $duplicateQuestionId)
duplicates the feedback relating to the given original question id and saves it for the given duplica...
const CSS_CLASS_FEEDBACK_WRONG
getAllSpecificAnswerFeedbackContents(int $question_id)
duplicatePageObject(string $page_object_type, int $original_page_object_id, int $duplicate_page_object_id, int $duplicate_page_object_parent_id)
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...
getPageObjectNonEditableValueHTML(string $page_object_type, int $page_object_id)
returns html content to be used as value for non editable value form properties in feedback editing f...
getSpecificAnswerFeedbackTestPresentation(int $question_id, int $question_index, int $answer_index)
returns the html of SPECIFIC feedback for the given question id and answer index for test presentatio...
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...
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
getGenericFeedbackId(int $question_id, bool $solution_completed)
returns the SPECIFIC answer feedback ID for a given question id and answer index. ...
getGenericFeedbackTestPresentation(int $question_id, bool $solution_completed)
returns the html of GENERIC feedback for the given question id for test presentation (either for the ...
getSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index)
createFeedbackPages(string $mode)
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...
setPageObjectOutputMode(string $page_obj_output_mode)
getGenericFeedbackExportPresentation(int $question_id, bool $solution_completed)
returns the generic feedback export presentation for given question id either for solution completed ...
checkFeedbackParent(int $feedbackId)
ensurePageObjectDeleted(string $page_object_type, int $page_object_id)
buildFeedbackContentFormProperty(string $label, string $post_var, bool $as_non_editable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
isGenericFeedbackId(int $feedbackId)
getGenericFeedbackPageObjectId(int $question_id, bool $solution_completed)
returns a useable page object id for generic feedback page objects for the given question id for eith...
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
importGenericFeedback(int $question_id, bool $solution_completed, string $feedback_content)
imports the given feedback content as generic feedback for the given question id for either the compl...