ILIAS  trunk Revision v12.0_alpha-424-g0abf7026fd4
class.ilAssQuestionFeedback.php
Go to the documentation of this file.
1<?php
2
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
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
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->setRteTags(ilRTESettings::_getUsedHTMLTags("assessment"));
257 $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
258 } else {
260 $property->setUseTagsForRteOnly(false);
261 }
262 $property->setInfo($this->lng->txt('latex_edit_info'));
263
264 $property->setRTESupport($this->questionOBJ->getId(), "qpl", "assessment");
265 }
266
267 return $property;
268 }
269
275 final public function getGenericFeedbackContent(int $question_id, bool $solution_completed): string
276 {
277 $res = $this->db->queryF(
278 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
279 ['integer', 'text'],
280 [$question_id, (int) $solution_completed]
281 );
282
283 $feedback_content = '';
284
285 if ($this->db->numRows($res) > 0) {
286 $row = $this->db->fetchAssoc($res);
287 $feedback_content = ilRTE::_replaceMediaObjectImageSrc(
288 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($row['feedback'] ?? ''),
289 1
290 );
291 }
292 return $feedback_content;
293 }
294
295 abstract public function getSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index): string;
296
297 abstract public function getAllSpecificAnswerFeedbackContents(int $question_id): string;
298
299 public function isSpecificAnswerFeedbackAvailable(int $question_id): bool
300 {
301 $res = $this->db->queryF(
302 "SELECT answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
303 ['integer'],
304 [$question_id]
305 );
306
307 $all_feedback_contents = '';
308
309 while ($row = $this->db->fetchAssoc($res)) {
310 $all_feedback_contents .= $this->getSpecificAnswerFeedbackExportPresentation(
311 $this->questionOBJ->getId(),
312 0,
313 $row['answer']
314 );
315 }
316
317 return trim(strip_tags($all_feedback_contents)) !== '';
318 }
319
325 final public function saveGenericFeedbackContent(int $question_id, bool $solution_completed, string $feedback_content): int
326 {
327 $feedbackId = $this->getGenericFeedbackId($question_id, $solution_completed);
328
329 if ($feedback_content !== '') {
330 $feedback_content = $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedback_content);
331 $feedback_content = ilRTE::_replaceMediaObjectImageSrc($feedback_content, 0);
332 }
333
334 if ($feedbackId !== -1) {
335 $this->db->update(
337 [
338 'feedback' => ['clob', $feedback_content],
339 'tstamp' => ['integer', time()]
340 ],
341 [
342 'feedback_id' => ['integer', $feedbackId]
343 ]
344 );
345 } else {
346 $feedbackId = $this->db->nextId($this->getGenericFeedbackTableName());
347
348 $this->db->insert($this->getGenericFeedbackTableName(), [
349 'feedback_id' => ['integer', $feedbackId],
350 'question_fi' => ['integer', $question_id],
351 'correctness' => ['text', (int) $solution_completed], // text ?
352 'feedback' => ['clob', $feedback_content],
353 'tstamp' => ['integer', time()]
354 ]);
355 }
356
357 return $feedbackId;
358 }
359
360 abstract public function saveSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index, string $feedback_content): int;
361
366 final public function deleteGenericFeedbacks(int $question_id, bool $isAdditionalContentEditingModePageObject): void
367 {
368 if ($page_object_id === -1) {
369 return;
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->cloneSpecificFeedback($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->clonePageObject($page_object_type, $row['feedback_id'], $feedbackId, $duplicateQuestionId);
428 }
429 }
430 }
431
436 abstract protected function cloneSpecificFeedback(int $source_question_id, int $target_question_id): void;
437
441 final public function cloneFeedback(int $original_question_id, int $duplicate_question_id): void
442 {
443 $this->cloneGenericFeedback($original_question_id, $duplicate_question_id);
444 $this->cloneSpecificFeedback($duplicate_question_id, $original_question_id);
445 }
446
450 private function cloneGenericFeedback(int $original_question_id, int $duplicate_question_id): void
451 {
454 $original_question_id,
456 );
457
458 // get generic feedback of the actual (duplicated) question
459 $result = $this->db->queryF(
460 "SELECT * FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s",
462 [$duplicate_question_id]
463 );
464
465 // save generic feedback to the original question
466 while ($row = $this->db->fetchAssoc($result)) {
467 $next_id = $this->db->nextId($this->getGenericFeedbackTableName());
468
469 $this->db->insert($this->getGenericFeedbackTableName(), [
470 'feedback_id' => [ilDBConstants::T_INTEGER, $next_id],
471 'question_fi' => [ilDBConstants::T_INTEGER, $original_question_id],
472 'correctness' => [ilDBConstants::T_TEXT, $row['correctness']],
473 'feedback' => [ilDBConstants::T_CLOB, $row['feedback']],
474 'tstamp' => [ilDBConstants::T_INTEGER, time()]
475 ]);
476
477 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
478 $page_object_type = $this->getGenericFeedbackPageObjectType();
479 $this->clonePageObject($page_object_type, $row['feedback_id'], $next_id, $original_question_id);
480 }
481 }
482 }
483
485 string $table_name,
486 int $original_question_id,
487 string $page_object_type
488 ): void {
489 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
490 $original_result = $this->db->queryF(
491 "SELECT feedback_id FROM {$table_name} WHERE question_fi = %s",
493 [$original_question_id]
494 );
495 while ($original_row = $this->db->fetchAssoc($original_result)) {
497 $page_object_type,
498 (int) $original_row['feedback_id']
499 );
500 }
501 }
502
503 $this->db->manipulateF(
504 "DELETE FROM {$table_name} WHERE question_fi = %s",
506 [$original_question_id]
507 );
508 }
509
513 final protected function getGenericFeedbackId(int $question_id, bool $solution_completed): int
514 {
515 $res = $this->db->queryF(
516 "SELECT feedback_id FROM {$this->getGenericFeedbackTableName()} WHERE question_fi = %s AND correctness = %s",
517 ['integer','text'],
518 [$question_id, (int) $solution_completed]
519 );
520
521 $feedbackId = -1;
522 if ($this->db->numRows($res)) {
523 $row = $this->db->fetchAssoc($res);
524 $feedbackId = (int) $row['feedback_id'];
525 }
526
527 return $feedbackId;
528 }
529
530 protected function isGenericFeedbackId(int $feedbackId): bool
531 {
532 $row = $this->db->fetchAssoc($this->db->queryF(
533 "SELECT COUNT(feedback_id) cnt FROM {$this->getGenericFeedbackTableName()}
534 WHERE question_fi = %s AND feedback_id = %s",
535 ['integer','integer'],
536 [$this->questionOBJ->getId(), $feedbackId]
537 ));
538
539
540 return (bool) $row['cnt'];
541 }
542
543 abstract protected function isSpecificAnswerFeedbackId(int $feedbackId): bool;
544
545 final public function checkFeedbackParent(int $feedbackId): bool
546 {
547 if ($this->isGenericFeedbackId($feedbackId)) {
548 return true;
549 }
550
551 if ($this->isSpecificAnswerFeedbackId($feedbackId)) {
552 return true;
553 }
554
555 return false;
556 }
557
558 final protected function getGenericFeedbackTableName(): string
559 {
560 return self::TABLE_NAME_GENERIC_FEEDBACK;
561 }
562
567 final protected function getPageObjectNonEditableValueHTML(string $page_object_type, int $page_object_id): string
568 {
569 $link = $this->getPageObjectEditingLink($page_object_type, $page_object_id);
570 $content = $this->getPageObjectContent($page_object_type, $page_object_id);
571 return sprintf(
572 '<a href="%s">%s</a><br /><br />%s',
573 $link,
574 $this->lng->txt('tst_question_feedback_edit_page'),
575 $content
576 );
577 }
578
579 public function getClassNameByType(string $a_type, bool $a_gui = false): string
580 {
581 $gui = ($a_gui) ? "GUI" : "";
582
584 return "ilAssGenFeedbackPage" . $gui;
585 }
586
587 //if ($a_type == ilAssQuestionFeedback::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK) {
588 return "ilAssSpecFeedbackPage" . $gui;
589 }
590
591 private function getPageObjectEditingLink(string $page_object_type, int $page_object_id): string
592 {
593 $cl = $this->getClassNameByType($page_object_type, true);
594 $this->ctrl->setParameterByClass($cl, 'feedback_type', $page_object_type);
595 $this->ctrl->setParameterByClass($cl, 'feedback_id', $page_object_id);
596
597 return $this->ctrl->getLinkTargetByClass($cl, 'edit');
598 }
599
600 final public function setPageObjectOutputMode(string $page_obj_output_mode): void
601 {
602 $this->page_obj_output_mode = $page_obj_output_mode;
603 }
604
605 final public function getPageObjectOutputMode(): string
606 {
607 return $this->page_obj_output_mode;
608 }
609
610 final protected function getPageObjectContent(string $page_object_type, int $page_object_id): string
611 {
612 $cl = $this->getClassNameByType($page_object_type, true);
613
614 $this->ensurePageObjectExists($page_object_type, $page_object_id);
615
616 $mode = ($this->ctrl->isAsynch()) ? "presentation" : $this->getPageObjectOutputMode();
617
619 $pageObjectGUI = new $cl($page_object_id);
620 return $pageObjectGUI->presentation($mode);
621 }
622
623 final protected function getPageObjectXML(string $page_object_type, int $page_object_id): string
624 {
625 $cl = $this->getClassNameByType($page_object_type);
626
627 $this->ensurePageObjectExists($page_object_type, $page_object_id);
628
629 $pageObject = new $cl($page_object_id);
630 return $pageObject->getXMLContent();
631 }
632
633 private function ensurePageObjectExists(string $page_object_type, int $page_object_id): void
634 {
636 && !ilAssGenFeedbackPage::_exists($page_object_type, $page_object_id, '', true)) {
637 $pageObject = new ilAssGenFeedbackPage();
638 $pageObject->setParentId($this->questionOBJ->getId());
639 $pageObject->setId($page_object_id);
640 $pageObject->createFromXML();
641 }
643 && !ilAssSpecFeedbackPage::_exists($page_object_type, $page_object_id, '', true)) {
644 $pageObject = new ilAssSpecFeedbackPage();
645 $pageObject->setParentId($this->questionOBJ->getId());
646 $pageObject->setId($page_object_id);
647 $pageObject->createFromXML();
648 }
649 }
650
651 final protected function createPageObject(string $page_object_type, int $page_object_id, string $page_object_content): void
652 {
653 $cl = $this->getClassNameByType($page_object_type);
654
655 $pageObject = new $cl();
656 $pageObject->setParentId($this->questionOBJ->getId());
657 $pageObject->setId($page_object_id);
658 $pageObject->setXMLContent($page_object_content);
659 $pageObject->createFromXML();
660 }
661
662 final protected function clonePageObject(
663 string $page_object_type,
664 int $source_page_object_id,
665 int $target_page_object_id,
666 int $target_page_object_parent_id
667 ): void {
668 $this->ensurePageObjectExists($page_object_type, $source_page_object_id);
669 $this->ensurePageObjectExists($page_object_type, $target_page_object_id);
670
671 $cl = $this->getClassNameByType($page_object_type);
672
673 $pageObject = new $cl($source_page_object_id);
674 $pageObject->setParentId($target_page_object_parent_id);
675 $pageObject->setId($target_page_object_id);
676 $pageObject->updateFromXML();
677 }
678
679 final protected function ensurePageObjectDeleted(string $page_object_type, int $page_object_id): void
680 {
682 if (ilAssGenFeedbackPage::_exists($page_object_type, $page_object_id)) {
683 $pageObject = new ilAssGenFeedbackPage($page_object_id);
684 $pageObject->delete();
685 }
686 }
688 if (ilAssSpecFeedbackPage::_exists($page_object_type, $page_object_id)) {
689 $pageObject = new ilAssSpecFeedbackPage($page_object_id);
690 $pageObject->delete();
691 }
692 }
693 }
694
695 final protected function getGenericFeedbackPageObjectType(): string
696 {
697 return self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK;
698 }
699
700 final protected function getSpecificAnswerFeedbackPageObjectType(): string
701 {
702 return self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK;
703 }
704
709 final public static function isValidFeedbackPageObjectType(string $feedbackPageObjectType): bool
710 {
711 switch ($feedbackPageObjectType) {
712 case self::PAGE_OBJECT_TYPE_GENERIC_FEEDBACK:
713 case self::PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK:
714 return true;
715 }
716
717 return false;
718 }
719
725 final protected function getGenericFeedbackPageObjectId(int $question_id, bool $solution_completed): int
726 {
727 $page_object_id = $this->getGenericFeedbackId($question_id, $solution_completed);
728 return $page_object_id;
729 }
730
735 public function getGenericFeedbackExportPresentation(int $question_id, bool $solution_completed): string
736 {
737 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
738 $genericFeedbackExportPresentation = $this->getPageObjectXML(
739 $this->getGenericFeedbackPageObjectType(),
740 $this->getGenericFeedbackPageObjectId($question_id, $solution_completed)
741 );
742 } else {
743 $genericFeedbackExportPresentation = $this->getGenericFeedbackContent($question_id, $solution_completed);
744 }
745
746 return $genericFeedbackExportPresentation;
747 }
748
753 abstract public function getSpecificAnswerFeedbackExportPresentation(int $question_id, int $question_index, int $answer_index): string;
754
759 public function importGenericFeedback(int $question_id, bool $solution_completed, string $feedback_content): void
760 {
761 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
762 $page_object_id = $this->saveGenericFeedbackContent($question_id, $solution_completed, '');
763 $page_object_type = $this->getGenericFeedbackPageObjectType();
764
765 $this->createPageObject($page_object_type, $page_object_id, $feedback_content);
766 } else {
767 $this->saveGenericFeedbackContent($question_id, $solution_completed, $feedback_content);
768 }
769 }
770
771 abstract public function importSpecificAnswerFeedback(int $question_id, int $question_index, int $answer_index, string $feedback_content): void;
772
773 public function migrateContentForLearningModule(ilAssSelfAssessmentMigrator $migrator, int $question_id): void
774 {
775 $this->saveGenericFeedbackContent($question_id, true, $migrator->migrateToLmContent(
776 $this->getGenericFeedbackContent($question_id, true)
777 ));
778
779 $this->saveGenericFeedbackContent($question_id, false, $migrator->migrateToLmContent(
780 $this->getGenericFeedbackContent($question_id, false)
781 ));
782 }
783
784 protected function cleanupPageContent(string $content): string
785 {
786 $doc = new DOMDocument('1.0', 'UTF-8');
787 if (@$doc->loadHTML('<html><body>' . $content . '</body></html>')) {
788 $xpath = new DOMXPath($doc);
789 $nodes_after_comments = $xpath->query('//comment()/following-sibling::*[1]');
790 foreach ($nodes_after_comments as $node_after_comments) {
791 if (trim($node_after_comments->nodeValue) === ''
792 && $node_after_comments->childElementCount === 0) {
793 return '';
794 }
795 }
796 }
797 return $content;
798 }
799
800 public function createFeedbackPages(string $mode): string
801 {
803 $page_object_id_complete = $this->saveGenericFeedbackContent(
804 $this->questionOBJ->getId(),
805 true,
806 ''
807 );
808 $this->ensurePageObjectExists($page_object_type, $page_object_id_complete);
809
810 $page_object_id_incomplete = $this->saveGenericFeedbackContent(
811 $this->questionOBJ->getId(),
812 false,
813 ''
814 );
815 $this->ensurePageObjectExists($page_object_type, $page_object_id_incomplete);
816
817 $page_object_id = ($mode === 'complete') ? $page_object_id_complete : $page_object_id_incomplete;
818 return $this->getPageObjectEditingLink(
819 $page_object_type,
820 $page_object_id
821 );
822 }
823
824}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const FEEDBACK_SOLUTION_COMPLETE_PAGE_OBJECT_ID
id for page object relating to generic complete solution feedback
saveGenericFormProperties(ilPropertyFormGUI $form)
saves a given form object's GENERIC form properties relating to all question types
getGenericFeedbackTestPresentation(int $question_id, bool $solution_completed)
returns the html of GENERIC feedback for the given question id for test presentation (either for the ...
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...
const PAGE_OBJECT_TYPE_GENERIC_FEEDBACK
type for generic feedback page objects
cloneGenericFeedback(int $original_question_id, int $duplicate_question_id)
syncs the GENERIC feedback from a duplicated question back to the original question
completeGenericFormProperties(ilPropertyFormGUI $form)
completes a given form object with the GENERIC form properties required by all question types
initGenericFormProperties(ilPropertyFormGUI $form)
initialises a given form object's GENERIC form properties relating to all question types
getPageObjectXML(string $page_object_type, int $page_object_id)
__construct(assQuestion $questionOBJ, ilCtrl $ctrl, ilDBInterface $db, ilLanguage $lng)
constructor
getClassNameByType(string $a_type, bool $a_gui=false)
getPageObjectEditingLink(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...
getGenericFeedbackContent(int $question_id, bool $solution_completed)
returns the GENERIC feedback content for a given question state.
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...
ensurePageObjectExists(string $page_object_type, int $page_object_id)
clonePageObject(string $page_object_type, int $source_page_object_id, int $target_page_object_id, int $target_page_object_parent_id)
const PAGE_OBJECT_TYPE_SPECIFIC_FEEDBACK
type for specific 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...
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...
completeSpecificFormProperties(ilPropertyFormGUI $form)
completes a given form object with the SPECIFIC form properties required by this question type
getGenericFeedbackExportPresentation(int $question_id, bool $solution_completed)
returns the generic feedback export presentation for given question id either for solution completed ...
const FEEDBACK_SOLUTION_INCOMPLETE_PAGE_OBJECT_ID
id for page object relating to generic incomplete solution feedback
saveGenericFeedbackContent(int $question_id, bool $solution_completed, string $feedback_content)
saves GENERIC feedback content for the given question id to the database.
migrateContentForLearningModule(ilAssSelfAssessmentMigrator $migrator, int $question_id)
isSaveableInPageObjectEditingMode()
returns the fact wether the feedback editing form is saveable in page object editing or not.
isSpecificAnswerFeedbackAvailable(int $question_id)
createPageObject(string $page_object_type, int $page_object_id, string $page_object_content)
cloneFeedback(int $original_question_id, int $duplicate_question_id)
syncs the feedback from a duplicated question back to the original question
cloneSpecificFeedback(int $source_question_id, int $target_question_id)
duplicates the SPECIFIC feedback relating to the given original question id and saves it for the give...
static isValidFeedbackPageObjectType(string $feedbackPageObjectType)
returns the fact whether the given page object type relates to generic or specific feedback page obje...
importSpecificAnswerFeedback(int $question_id, int $question_index, int $answer_index, string $feedback_content)
isSpecificAnswerFeedbackId(int $feedbackId)
deleteGenericFeedbacks(int $question_id, bool $isAdditionalContentEditingModePageObject)
deletes all GENERIC feedback contents (and page objects if required) for the given question id
deleteSpecificAnswerFeedbacks(int $question_id, bool $isAdditionalContentEditingModePageObject)
getSpecificAnswerFeedbackExportPresentation(int $question_id, int $question_index, int $answer_index)
returns the generic feedback export presentation for given question id either for solution completed ...
getGenericFeedbackId(int $question_id, bool $solution_completed)
returns the SPECIFIC answer feedback ID for a given question id and answer index.
setPageObjectOutputMode(string $page_obj_output_mode)
getAllSpecificAnswerFeedbackContents(int $question_id)
deleteFeedbackOfOriginalQuestion(string $table_name, int $original_question_id, string $page_object_type)
initSpecificFormProperties(ilPropertyFormGUI $form)
initialises a given form object's SPECIFIC form properties relating to this question type
saveSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index, string $feedback_content)
duplicateGenericFeedback(int $originalQuestionId, int $duplicateQuestionId)
duplicates the GENERIC feedback relating to the given original question id and saves it for the given...
getSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index)
saveSpecificFormProperties(ilPropertyFormGUI $form)
saves a given form object's SPECIFIC form properties relating to this question type
ensurePageObjectDeleted(string $page_object_type, int $page_object_id)
static getSelfAssessmentTags()
Get tags allowed in question tags in self assessment mode.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
language handling
This class represents a non editable value in a property form.
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
This class represents a property form user interface.
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-...
getItemByPostVar(string $a_post_var)
static _getUsedHTMLTags(string $module='')
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...
This class represents a property that may include a sub form.
This class represents a text area property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilDBInterface.
$res
Definition: ltiservices.php:69
if(!file_exists('../ilias.ini.php'))