ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilAssQuestionFeedback.php
Go to the documentation of this file.
1 <?php
2 
29 abstract class ilAssQuestionFeedback
30 {
31  public const CSS_CLASS_FEEDBACK_CORRECT = 'ilc_qfeedr_FeedbackRight';
32  public const CSS_CLASS_FEEDBACK_WRONG = 'ilc_qfeedw_FeedbackWrong';
33 
37  public const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK = 'qfbg';
38 
42  public const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK = 'qfbs';
43 
48 
53 
54  public const TABLE_NAME_GENERIC_FEEDBACK = 'qpl_fb_generic';
55 
57 
58  protected ilCtrl $ctrl;
59 
60  protected ilDBInterface $db;
61 
62  protected ilLanguage $lng;
63 
64  protected string $page_obj_output_mode = "presentation";
65 
76  final public function __construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilDBInterface $db, ilLanguage $lng)
77  {
78  $this->questionOBJ = $questionOBJ;
79  $this->ctrl = $ctrl;
80  $this->lng = $lng;
81  $this->db = $db;
82  }
83 
88  public function getGenericFeedbackTestPresentation(int $question_id, bool $solution_completed): string
89  {
90  if ($this->page_obj_output_mode == "edit") {
91  return '';
92  }
93  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
94  return $this->cleanupPageContent(
95  $this->getPageObjectContent(
97  $this->getGenericFeedbackPageObjectId($question_id, $solution_completed)
98  )
99  );
100  }
101  return $this->getGenericFeedbackContent($question_id, $solution_completed);
102  }
103 
115  abstract public function getSpecificAnswerFeedbackTestPresentation(int $question_id, int $question_index, int $answer_index): string;
116 
121  final public function completeGenericFormProperties(ilPropertyFormGUI $form): void
122  {
124  $this->lng->txt('feedback_complete_solution'),
125  'feedback_complete',
126  $this->questionOBJ->isAdditionalContentEditingModePageObject()
127  ));
128 
130  $this->lng->txt('feedback_incomplete_solution'),
131  'feedback_incomplete',
132  $this->questionOBJ->isAdditionalContentEditingModePageObject()
133  ));
134  }
135 
144  abstract public function completeSpecificFormProperties(ilPropertyFormGUI $form): void;
145 
150  final public function initGenericFormProperties(ilPropertyFormGUI $form): void
151  {
152  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
153  $page_object_type = $this->getGenericFeedbackPageObjectType();
154 
155  $page_object_id = $this->getGenericFeedbackId($this->questionOBJ->getId(), true);
156 
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>',
163  $link,
164  $this->lng->txt('tst_question_feedback_edit_page')
165  );
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>',
170  $link,
171  $this->lng->txt('tst_question_feedback_edit_page')
172  );
173  } else {
174  $this->ensurePageObjectExists($page_object_type, $page_object_id);
175 
176  $value_feedback_solution_complete = $this->getPageObjectNonEditableValueHTML(
177  $page_object_type,
178  $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), true)
179  );
180  $value_feedback_solution_incomplete = $this->getPageObjectNonEditableValueHTML(
181  $page_object_type,
182  $this->getGenericFeedbackPageObjectId($this->questionOBJ->getId(), false)
183  );
184  }
185 
186  } else {
187  $value_feedback_solution_complete = $this->getGenericFeedbackContent(
188  $this->questionOBJ->getId(),
189  true
190  );
191 
192  $value_feedback_solution_incomplete = $this->getGenericFeedbackContent(
193  $this->questionOBJ->getId(),
194  false
195  );
196  }
197 
198  $form->getItemByPostVar('feedback_complete')->setValue($value_feedback_solution_complete);
199  $form->getItemByPostVar('feedback_incomplete')->setValue($value_feedback_solution_incomplete);
200  }
201 
206  abstract public function initSpecificFormProperties(ilPropertyFormGUI $form): void;
207 
212  final public function saveGenericFormProperties(ilPropertyFormGUI $form): void
213  {
214  if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
215  $this->saveGenericFeedbackContent($this->questionOBJ->getId(), false, (string) $form->getInput('feedback_incomplete'));
216  $this->saveGenericFeedbackContent($this->questionOBJ->getId(), true, (string) $form->getInput('feedback_complete'));
217  }
218  }
219 
224  abstract public function saveSpecificFormProperties(ilPropertyFormGUI $form): void;
225 
231  public function isSaveableInPageObjectEditingMode(): bool
232  {
233  return false;
234  }
235 
244  final protected function buildFeedbackContentFormProperty(string $label, string $post_var, bool $as_non_editable): ilSubEnabledFormPropertyGUI
245  {
246  if ($as_non_editable) {
247  $property = new ilNonEditableValueGUI($label, $post_var, true);
248  } else {
249  $property = new ilTextAreaInputGUI($label, $post_var);
250  $property->setRequired(false);
251  $property->setRows(10);
252  $property->setCols(80);
253 
254  if (!$this->questionOBJ->getPreventRteUsage()) {
255  $property->setUseRte(true);
256  $property->addPlugin("latex");
257  $property->addButton("latex");
258  $property->addButton("pastelatex");
259 
260  $property->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
261  $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
262  } else {
264  $property->setUseTagsForRteOnly(false);
265  }
266 
267  $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
268  }
269 
270  return $property;
271  }
272 
278  final public function getGenericFeedbackContent(int $question_id, bool $solution_completed): string
279  {
280  $res = $this->db->queryF(
281  "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
282  ['integer', 'text'],
283  [$question_id, (int) $solution_completed]
284  );
285 
286  $feedback_content = '';
287 
288  if ($this->db->numRows($res) > 0) {
289  $row = $this->db->fetchAssoc($res);
290  $feedback_content = ilRTE::_replaceMediaObjectImageSrc(
291  $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($row['feedback'] ?? ''),
292  1
293  );
294  }
295  return $feedback_content;
296  }
297 
298  abstract public function getSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index): string;
299 
300  abstract public function getAllSpecificAnswerFeedbackContents(int $question_id): string;
301 
302  public function isSpecificAnswerFeedbackAvailable(int $question_id): bool
303  {
304  $res = $this->db->queryF(
305  "SELECT answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
306  ['integer'],
307  [$question_id]
308  );
309 
310  $all_feedback_contents = '';
311 
312  while ($row = $this->db->fetchAssoc($res)) {
313  $all_feedback_contents .= $this->getSpecificAnswerFeedbackExportPresentation(
314  $this->questionOBJ->getId(),
315  0,
316  $row['answer']
317  );
318  }
319 
320  return trim(strip_tags($all_feedback_contents)) !== '';
321  }
322 
328  final public function saveGenericFeedbackContent(int $question_id, bool $solution_completed, string $feedback_content): int
329  {
330  $feedbackId = $this->getGenericFeedbackId($question_id, $solution_completed);
331 
332  if ($feedback_content !== '') {
333  $feedback_content = $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedback_content);
334  $feedback_content = ilRTE::_replaceMediaObjectImageSrc($feedback_content, 0);
335  }
336 
337  if ($feedbackId !== -1) {
338  $this->db->update(
340  [
341  'feedback' => ['clob', $feedback_content],
342  'tstamp' => ['integer', time()]
343  ],
344  [
345  'feedback_id' => ['integer', $feedbackId]
346  ]
347  );
348  } else {
349  $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
350 
351  $this->db->insert($this->getGenericFeedbackTableName(), [
352  'feedback_id' => ['integer', $feedbackId],
353  'question_fi' => ['integer', $question_id],
354  'correctness' => ['text', (int) $solution_completed], // text ?
355  'feedback' => ['clob', $feedback_content],
356  'tstamp' => ['integer', time()]
357  ]);
358  }
359 
360  return $feedbackId;
361  }
362 
363  abstract public function saveSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index, string $feedback_content): int;
364 
369  final public function deleteGenericFeedbacks(int $question_id, bool $isAdditionalContentEditingModePageObject): void
370  {
371  if ($isAdditionalContentEditingModePageObject) {
374  $this->getGenericFeedbackPageObjectId($question_id, true)
375  );
376 
379  $this->getGenericFeedbackPageObjectId($question_id, false)
380  );
381  }
382 
383  $this->db->manipulateF(
384  "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
385  ['integer'],
386  [$question_id]
387  );
388  }
389 
390  abstract public function deleteSpecificAnswerFeedbacks(int $question_id, bool $isAdditionalContentEditingModePageObject): void;
391 
396  final public function duplicateFeedback(int $originalQuestionId, int $duplicateQuestionId): void
397  {
398  $this->duplicateGenericFeedback($originalQuestionId, $duplicateQuestionId);
399  $this->duplicateSpecificFeedback($originalQuestionId, $duplicateQuestionId);
400  }
401 
406  private function duplicateGenericFeedback(int $originalQuestionId, int $duplicateQuestionId): void
407  {
408  $res = $this->db->queryF(
409  "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
410  ['integer'],
411  [$originalQuestionId]
412  );
413 
414  while ($row = $this->db->fetchAssoc($res)) {
415  $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
416 
417  $this->db->insert($this->getGenericFeedbackTableName(), [
418  'feedback_id' => ['integer', $feedbackId],
419  'question_fi' => ['integer', $duplicateQuestionId],
420  'correctness' => ['text', $row['correctness']],
421  'feedback' => ['clob', $row['feedback']],
422  'tstamp' => ['integer', time()]
423  ]);
424 
425  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
426  $page_object_type = $this->getGenericFeedbackPageObjectType();
427  $this->duplicatePageObject($page_object_type, $row['feedback_id'], $feedbackId, $duplicateQuestionId);
428  }
429  }
430  }
431 
436  abstract protected function duplicateSpecificFeedback(int $originalQuestionId, int $duplicateQuestionId): void;
437 
441  final public function syncFeedback(int $originalQuestionId, int $duplicateQuestionId): void
442  {
443  $this->syncGenericFeedback($originalQuestionId, $duplicateQuestionId);
444  $this->syncSpecificFeedback($originalQuestionId, $duplicateQuestionId);
445  }
446 
450  private function syncGenericFeedback(int $originalQuestionId, int $duplicateQuestionId): void
451  {
452  // delete generic feedback of the original question
453  $this->db->manipulateF(
454  "DELETE FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
455  ['integer'],
456  [$originalQuestionId]
457  );
458 
459  // get generic feedback of the actual (duplicated) question
460  $result = $this->db->queryF(
461  "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
462  ['integer'],
463  [$duplicateQuestionId]
464  );
465 
466  // save generic feedback to the original question
467  while ($row = $this->db->fetchAssoc($result)) {
468  $nextId = $this->db->nextId($this->getGenericFeedbackTableName());
469 
470  $this->db->insert($this->getGenericFeedbackTableName(), [
471  'feedback_id' => ['integer', $nextId],
472  'question_fi' => ['integer', $originalQuestionId],
473  'correctness' => ['text', $row['correctness']],
474  'feedback' => ['clob', $row['feedback']],
475  'tstamp' => ['integer', time()]
476  ]);
477  }
478  }
479 
483  final protected function getGenericFeedbackId(int $question_id, bool $solution_completed): int
484  {
485  $res = $this->db->queryF(
486  "SELECT feedback_id FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
487  ['integer','text'],
488  [$question_id, (int) $solution_completed]
489  );
490 
491  $feedbackId = -1;
492  if ($this->db->numRows($res)) {
493  $row = $this->db->fetchAssoc($res);
494  $feedbackId = (int) $row['feedback_id'];
495  }
496 
497  return $feedbackId;
498  }
499 
500  protected function isGenericFeedbackId(int $feedbackId): bool
501  {
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]
507  ));
508 
509 
510  return (bool) $row['cnt'];
511  }
512 
513  abstract protected function isSpecificAnswerFeedbackId(int $feedbackId): bool;
514 
515  final public function checkFeedbackParent(int $feedbackId): bool
516  {
517  if ($this->isGenericFeedbackId($feedbackId)) {
518  return true;
519  }
520 
521  if ($this->isSpecificAnswerFeedbackId($feedbackId)) {
522  return true;
523  }
524 
525  return false;
526  }
527 
531  abstract protected function syncSpecificFeedback(int $originalQuestionId, int $duplicateQuestionId): void;
532 
533  final protected function getGenericFeedbackTableName(): string
534  {
535  return self::TABLE_NAME_GENERIC_FEEDBACK;
536  }
537 
542  final protected function getPageObjectNonEditableValueHTML(string $page_object_type, int $page_object_id): string
543  {
544  $link = $this->getPageObjectEditingLink($page_object_type, $page_object_id);
545  $content = $this->getPageObjectContent($page_object_type, $page_object_id);
546  return sprintf(
547  '<a href="%s">%s</a><br /><br />%s',
548  $link,
549  $this->lng->txt('tst_question_feedback_edit_page'),
550  $content
551  );
552  }
553 
554  public function getClassNameByType(string $a_type, bool $a_gui = false): string
555  {
556  $gui = ($a_gui) ? "GUI" : "";
557 
559  return "ilAssGenFeedbackPage" . $gui;
560  }
561 
562  //if ($a_type == ilAssQuestionFeedback::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK) {
563  return "ilAssSpecFeedbackPage" . $gui;
564  }
565 
566  private function getPageObjectEditingLink(string $page_object_type, int $page_object_id): string
567  {
568  $cl = $this->getClassNameByType($page_object_type, true);
569  $this->ctrl->setParameterByClass($cl, 'feedback_type', $page_object_type);
570  $this->ctrl->setParameterByClass($cl, 'feedback_id', $page_object_id);
571 
572  return $this->ctrl->getLinkTargetByClass($cl, 'edit');
573  }
574 
575  final public function setPageObjectOutputMode(string $page_obj_output_mode): void
576  {
577  $this->page_obj_output_mode = $page_obj_output_mode;
578  }
579 
580  final public function getPageObjectOutputMode(): string
581  {
583  }
584 
585  final protected function getPageObjectContent(string $page_object_type, int $page_object_id): string
586  {
587  $cl = $this->getClassNameByType($page_object_type, true);
588 
589  $this->ensurePageObjectExists($page_object_type, $page_object_id);
590 
591  $mode = ($this->ctrl->isAsynch()) ? "presentation" : $this->getPageObjectOutputMode();
592 
594  $pageObjectGUI = new $cl($page_object_id);
595  return $pageObjectGUI->presentation($mode);
596  }
597 
598  final protected function getPageObjectXML(string $page_object_type, int $page_object_id): string
599  {
600  $cl = $this->getClassNameByType($page_object_type);
601 
602  $this->ensurePageObjectExists($page_object_type, $page_object_id);
603 
604  $pageObject = new $cl($page_object_id);
605  return $pageObject->getXMLContent();
606  }
607 
608  private function ensurePageObjectExists(string $page_object_type, int $page_object_id): void
609  {
611  && !ilAssGenFeedbackPage::_exists($page_object_type, $page_object_id, '', true)) {
612  $pageObject = new ilAssGenFeedbackPage();
613  $pageObject->setParentId($this->questionOBJ->getId());
614  $pageObject->setId($page_object_id);
615  $pageObject->createFromXML();
616  }
618  && !ilAssSpecFeedbackPage::_exists($page_object_type, $page_object_id, '', true)) {
619  $pageObject = new ilAssSpecFeedbackPage();
620  $pageObject->setParentId($this->questionOBJ->getId());
621  $pageObject->setId($page_object_id);
622  $pageObject->createFromXML();
623  }
624  }
625 
626  final protected function createPageObject(string $page_object_type, int $page_object_id, string $page_object_content): void
627  {
628  $cl = $this->getClassNameByType($page_object_type);
629 
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();
635  }
636 
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
638  {
639  $this->ensurePageObjectExists($page_object_type, $original_page_object_id);
640 
641  $cl = $this->getClassNameByType($page_object_type);
642 
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();
647  }
648 
649  final protected function ensurePageObjectDeleted(string $page_object_type, int $page_object_id): void
650  {
651  if ($page_object_id === -1) {
652  return;
653  }
654 
656  if (ilAssGenFeedbackPage::_exists($page_object_type, $page_object_id)) {
657  $pageObject = new ilAssGenFeedbackPage($page_object_id);
658  $pageObject->delete();
659  }
660  }
662  if (ilAssSpecFeedbackPage::_exists($page_object_type, $page_object_id)) {
663  $pageObject = new ilAssSpecFeedbackPage($page_object_id);
664  $pageObject->delete();
665  }
666  }
667  }
668 
669  final protected function getGenericFeedbackPageObjectType(): string
670  {
671  return self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK;
672  }
673 
674  final protected function getSpecificAnswerFeedbackPageObjectType(): string
675  {
676  return self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK;
677  }
678 
683  final public static function isValidFeedbackPageObjectType(string $feedbackPageObjectType): bool
684  {
685  switch ($feedbackPageObjectType) {
686  case self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK:
687  case self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK:
688  return true;
689  }
690 
691  return false;
692  }
693 
699  final protected function getGenericFeedbackPageObjectId(int $question_id, bool $solution_completed): int
700  {
701  $page_object_id = $this->getGenericFeedbackId($question_id, $solution_completed);
702  return $page_object_id;
703  }
704 
709  public function getGenericFeedbackExportPresentation(int $question_id, bool $solution_completed): string
710  {
711  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
712  $genericFeedbackExportPresentation = $this->getPageObjectXML(
714  $this->getGenericFeedbackPageObjectId($question_id, $solution_completed)
715  );
716  } else {
717  $genericFeedbackExportPresentation = $this->getGenericFeedbackContent($question_id, $solution_completed);
718  }
719 
720  return $genericFeedbackExportPresentation;
721  }
722 
727  abstract public function getSpecificAnswerFeedbackExportPresentation(int $question_id, int $question_index, int $answer_index): string;
728 
733  public function importGenericFeedback(int $question_id, bool $solution_completed, string $feedback_content): void
734  {
735  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
736  $page_object_id = $this->saveGenericFeedbackContent($question_id, $solution_completed, '');
737  $page_object_type = $this->getGenericFeedbackPageObjectType();
738 
739  $this->createPageObject($page_object_type, $page_object_id, $feedback_content);
740  } else {
741  $this->saveGenericFeedbackContent($question_id, $solution_completed, $feedback_content);
742  }
743  }
744 
745  abstract public function importSpecificAnswerFeedback(int $question_id, int $question_index, int $answer_index, string $feedback_content): void;
746 
747  public function migrateContentForLearningModule(ilAssSelfAssessmentMigrator $migrator, int $question_id): void
748  {
749  $this->saveGenericFeedbackContent($question_id, true, $migrator->migrateToLmContent(
750  $this->getGenericFeedbackContent($question_id, true)
751  ));
752 
753  $this->saveGenericFeedbackContent($question_id, false, $migrator->migrateToLmContent(
754  $this->getGenericFeedbackContent($question_id, false)
755  ));
756  }
757 
758  protected function cleanupPageContent(string $content): string
759  {
760  $doc = new DOMDocument('1.0', 'UTF-8');
761  if (@$doc->loadHTML('<html><body>' . $content . '</body></html>')) {
762  $xpath = new DOMXPath($doc);
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) {
767  return '';
768  }
769  }
770  }
771  return $content;
772  }
773 
774  public function createFeedbackPages(string $mode): string
775  {
777  $page_object_id_complete = $this->saveGenericFeedbackContent(
778  $this->questionOBJ->getId(),
779  true,
780  ''
781  );
782  $this->ensurePageObjectExists($page_object_type, $page_object_id_complete);
783 
784  $page_object_id_incomplete = $this->saveGenericFeedbackContent(
785  $this->questionOBJ->getId(),
786  false,
787  ''
788  );
789  $this->ensurePageObjectExists($page_object_type, $page_object_id_incomplete);
790 
791  $page_object_id = ($mode === 'complete') ? $page_object_id_complete : $page_object_id_incomplete;
792  return $this->getPageObjectEditingLink(
793  $page_object_type,
794  $page_object_id
795  );
796  }
797 
798 }
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...
static getSelfAssessmentTags()
Get tags allowed in question tags in self assessment mode.
initSpecificFormProperties(ilPropertyFormGUI $form)
initialises a given form object&#39;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 ...
$res
Definition: ltiservices.php:69
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)
getItemByPostVar(string $a_post_var)
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)
Abstract basic class which is to be extended by the concrete assessment question type classes...
__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)
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&#39;s SPECIFIC form properties relating to this question type ...
static isValidFeedbackPageObjectType(string $feedbackPageObjectType)
returns the fact whether the given page object type relates to generic or specific feedback page obje...
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
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 ...
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
duplicateFeedback(int $originalQuestionId, int $duplicateQuestionId)
duplicates the feedback relating to the given original question id and saves it for the given duplica...
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&#39;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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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&#39;s GENERIC form properties relating to all question types ...
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 ...
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...
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...