19 declare(strict_types=1);
45 $this->
object->loadFromDb(
$id);
54 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
68 $this->
object->flushMatchingPairs();
69 $this->
object->flushTerms();
70 $this->
object->flushDefinitions();
72 $kindlyTo = $this->
refinery->kindlyTo();
74 $uploads = $this->request_data_collector->getProcessedUploads();
75 $allowed_mime_types = [
'image/jpeg',
'image/png',
'image/gif'];
77 if ($this->request_data_collector->isset(
'terms')) {
78 $terms = $this->request_data_collector->raw(
'terms');
79 $answers = $this->forms_helper->transformArray($terms,
'answer', $kindlyTo->string());
80 $terms_image_names = $this->forms_helper->transformArray($terms,
'imagename', $kindlyTo->string());
81 $terms_identifiers = $this->forms_helper->transformArray($terms,
'identifier', $kindlyTo->int());
83 foreach ($answers as $index => $answer) {
84 $filename = $terms_image_names[$index] ??
'';
86 $upload_tmp_name = $this->request_data_collector->getUploadFilename([
'terms',
'image'], $index);
88 if (isset($uploads[$upload_tmp_name]) && $uploads[$upload_tmp_name]->isOk() &&
89 in_array($uploads[$upload_tmp_name]->getMimeType(), $allowed_mime_types)) {
91 $name = $uploads[$upload_tmp_name]->getName();
92 if ($this->
object->setImageFile(
93 $uploads[$upload_tmp_name]->getPath(),
94 $this->
object->getEncryptedFilename($name)
96 $filename = $this->
object->getEncryptedFilename($name);
101 $this->
object->addTerm(
105 $terms_identifiers[$index] ?? 0
111 if ($this->request_data_collector->isset(
'definitions')) {
112 $definitions = $this->request_data_collector->raw(
'definitions');
113 $answers = $this->forms_helper->transformArray($definitions,
'answer', $kindlyTo->string());
114 $definitions_image_names = $this->forms_helper->transformArray($definitions,
'imagename', $kindlyTo->string());
115 $definitions_identifiers = $this->forms_helper->transformArray($definitions,
'identifier', $kindlyTo->int());
117 foreach ($answers as $index => $answer) {
118 $filename = $definitions_image_names[$index] ??
'';
120 $upload_tmp_name = $this->request_data_collector->getUploadFilename([
'definitions',
'image'], $index);
122 if (isset($uploads[$upload_tmp_name]) && $uploads[$upload_tmp_name]->isOk() &&
123 in_array($uploads[$upload_tmp_name]->getMimeType(), $allowed_mime_types)) {
125 $name = $uploads[$upload_tmp_name]->getName();
126 if ($this->
object->setImageFile(
127 $uploads[$upload_tmp_name]->getPath(),
128 $this->
object->getEncryptedFilename($name)
130 $filename = $this->
object->getEncryptedFilename($name);
134 $this->
object->addDefinition(
138 $definitions_identifiers[$index] ?? 0
144 if ($this->request_data_collector->isset(
'pairs')) {
145 $pairs = $this->request_data_collector->raw(
'pairs');
146 $points_of_pairs = $this->forms_helper->transformArray($pairs,
'points', $kindlyTo->float());
147 $pair_terms = $this->forms_helper->transformArray($pairs,
'term', $kindlyTo->int());
148 $pair_definitions = $this->forms_helper->transformArray($pairs,
'definition', $kindlyTo->int());
150 foreach ($points_of_pairs as $index => $points) {
151 $term_id = $pair_terms[$index] ?? 0;
152 $definition_id = $pair_definitions[$index] ?? 0;
153 $this->
object->addMatchingPair(
154 $this->
object->getTermWithIdentifier($term_id),
155 $this->
object->getDefinitionWithIdentifier($definition_id),
164 if (!$this->
object->getSelfAssessmentEditingMode()) {
165 $this->
object->setShuffle($this->request_data_collector->int(
'shuffle'));
166 $this->
object->setShuffleMode($this->request_data_collector->int(
'shuffle'));
168 $this->
object->setShuffle(1);
169 $this->
object->setShuffleMode(1);
171 $this->
object->setThumbGeometry($this->request_data_collector->int(
'thumb_geometry'));
172 $this->
object->setMatchingMode($this->request_data_collector->string(
'matching_mode'));
186 $this->
object->removeTermImage($this->request_data_collector->getCmdIndex(
'removeimageterms'));
201 $this->
object->removeDefinitionImage($this->request_data_collector->getCmdIndex(
'removeimagedefinitions'));
209 $add_terms = $this->request_data_collector->getCmdIndex(
'addterms');
210 $this->
object->insertTerm($add_terms + 1);
218 $this->
object->deleteTerm($this->request_data_collector->getCmdIndex(
'removeterms'));
226 $this->
object->insertDefinition($this->request_data_collector->getCmdIndex(
'adddefinitions') + 1);
234 $this->
object->deleteDefinition($this->request_data_collector->getCmdIndex(
'removedefinitions'));
242 $this->
object->insertMatchingPair($this->request_data_collector->getCmdIndex(
'addpairs') + 1);
250 $this->
object->deleteMatchingPair($this->request_data_collector->getCmdIndex(
'removepairs'));
255 bool $checkonly =
false,
256 ?
bool $is_save_cmd =
null 261 $this->editForm = $form;
263 $form->setFormAction($this->
ctrl->getFormAction($this));
265 $form->setMultipart(
true);
266 $form->setTableWidth(
"100%");
267 $form->setId(
"matching");
277 $form->setValuesByPost();
278 $errors = !$form->checkInput();
279 $form->setValuesByPost();
282 $terms = $form->getItemByPostVar(
'terms');
283 $terms->setAlert($this->
lng->txt(
"msg_number_of_terms_too_low"));
284 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'form_input_not_valid'));
299 return $this->
ctrl->getCmd() ==
'uploaddefinitions';
304 return $this->
ctrl->getCmd() ==
'uploadterms';
323 $numDefinitions = count($form->
getItemByPostVar(
'definitions')->getValues());
325 if ($numTerms >= $numDefinitions) {
335 if ($this->
object->getSelfAssessmentEditingMode()) {
340 return $value->withText(html_entity_decode($value->getText()));
343 $definitions->setRequired(
true);
344 $definitions->setQuestionObject($this->
object);
345 $definitions->setTextName($this->
lng->txt(
'definition_text'));
346 $definitions->setImageName($this->
lng->txt(
'definition_image'));
347 if (!count($this->
object->getDefinitions())) {
350 $definitionvalues =
array_map($stripHtmlEntitesFromValues, $this->
object->getDefinitions());
351 $definitions->setValues($definitionvalues);
353 $definitions->checkInput();
355 $definitions->setInfo($this->
lng->txt(
'latex_edit_info'));
359 if ($this->
object->getSelfAssessmentEditingMode()) {
362 $terms->setRequired(
true);
363 $terms->setQuestionObject($this->
object);
364 $terms->setTextName($this->
lng->txt(
'term_text'));
365 $terms->setImageName($this->
lng->txt(
'term_image'));
367 if (0 === count($this->
object->getTerms())) {
373 $termvalues =
array_map($stripHtmlEntitesFromValues, $this->
object->getTerms());
374 $terms->setValues($termvalues);
376 $terms->checkInput();
378 $terms->setInfo($this->
lng->txt(
'latex_edit_info'));
383 $pairs->setTerms($this->
object->getTerms());
384 $pairs->setDefinitions($this->
object->getDefinitions());
385 if (count($this->
object->getMatchingPairs()) == 0) {
386 $this->
object->addMatchingPair($termvalues[0], $definitionvalues[0], 0);
389 $pairs->setPairs($this->
object->getMatchingPairs());
399 $hidden->setValue(
'');
402 if (!$this->
object->getSelfAssessmentEditingMode()) {
406 0 => $this->
lng->txt(
"no"),
407 1 => $this->
lng->txt(
"matching_shuffle_terms_definitions"),
408 2 => $this->
lng->txt(
"matching_shuffle_terms"),
409 3 => $this->
lng->txt(
"matching_shuffle_definitions")
412 $shuffle->setValue($this->
object->getShuffleMode());
413 $shuffle->setRequired(
false);
418 $geometry->setRequired(
true);
419 $geometry->setMaxLength(6);
420 $geometry->setMinValue($this->
object->getMinimumThumbSize());
421 $geometry->setMaxValue($this->
object->getMaximumThumbSize());
422 $geometry->setSize(6);
423 $geometry->setInfo($this->
lng->txt(
'thumb_size_info'));
432 $this->
lng->txt(
'qpl_qst_inp_matching_mode_one_on_one'),
435 $mode->addOption($modeONEonONE);
438 $this->
lng->txt(
'qpl_qst_inp_matching_mode_all_on_all'),
441 $mode->addOption($modeALLonALL);
452 bool $graphical_output =
false,
453 bool $result_output =
false,
454 bool $show_question_only =
true,
455 bool $show_feedback =
false,
456 bool $show_correct_solution =
false,
457 bool $show_manual_scoring =
false,
458 bool $show_question_text =
true,
459 bool $show_inline_feedback =
true 462 if (($active_id > 0) && (!$show_correct_solution)) {
463 $solutions = $this->
object->getSolutionValues($active_id, $pass);
465 foreach ($this->
object->getMaximumScoringMatchingPairs() as $pair) {
467 'value1' => $pair->getTerm()->getIdentifier(),
468 'value2' => $pair->getDefinition()->getIdentifier(),
469 'points' => $pair->getPoints()
482 $show_correct_solution,
483 $show_manual_scoring,
486 $show_inline_feedback,
491 mixed $user_solutions,
494 bool $graphical_output =
false,
495 bool $result_output =
false,
496 bool $show_question_only =
true,
497 bool $show_feedback =
false,
498 bool $show_correct_solution =
false,
499 bool $show_manual_scoring =
false,
500 bool $show_question_text =
true,
501 bool $show_autosave_title =
false,
502 bool $show_inline_feedback =
false,
504 $template =
new ilTemplate(
'tpl.il_as_qpl_matching_output_solution.html',
true,
true,
'components/ILIAS/TestQuestionPool');
505 $solutiontemplate =
new ilTemplate(
'tpl.il_as_tst_solution_output.html',
true,
true,
'components/ILIAS/TestQuestionPool');
508 foreach ($user_solutions as $solution) {
509 $definition = $this->
object->getDefinitionWithIdentifier($solution[
'value2']);
510 $term = $this->
object->getTermWithIdentifier($solution[
'value1']);
511 $points = $solution[
'points'];
513 if (is_object($definition)) {
514 if ($definition->getPicture() !==
'') {
515 if ($definition->getText() !==
'') {
516 $template->setCurrentBlock(
'definition_image_text');
517 $template->setVariable(
521 $template->parseCurrentBlock();
525 $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->getPicture()
528 $template->setCurrentBlock(
'definition_image');
529 $template->setVariable(
'ANSWER_IMAGE_URL', $answerImageSrc);
530 $template->setVariable(
533 $definition->getText()
536 $template->setVariable(
537 'ANSWER_IMAGE_TITLE',
539 $definition->getText()
542 $template->setVariable(
'URL_PREVIEW', $this->
object->getImagePathWeb() . $definition->getPicture());
543 $template->setVariable(
"TEXT_PREVIEW", $this->
lng->txt(
'preview'));
545 $template->parseCurrentBlock();
547 $template->setCurrentBlock(
'definition_text');
549 $template->parseCurrentBlock();
552 if ($term !==
null) {
553 if (strlen($term->getPicture())) {
554 if (strlen($term->getText())) {
555 $template->setCurrentBlock(
'term_image_text');
557 $template->parseCurrentBlock();
561 $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->getPicture()
564 $template->setCurrentBlock(
'term_image');
565 $template->setVariable(
'ANSWER_IMAGE_URL', $answerImageSrc);
566 $template->setVariable(
572 $template->setVariable(
573 'ANSWER_IMAGE_TITLE',
578 $template->setVariable(
'URL_PREVIEW', $this->
object->getImagePathWeb() . $term->getPicture());
579 $template->setVariable(
"TEXT_PREVIEW", $this->
lng->txt(
'preview'));
581 $template->parseCurrentBlock();
583 $template->setCurrentBlock(
'term_text');
585 $template->parseCurrentBlock();
589 if (($active_id > 0) && (!$show_correct_solution)) {
590 if ($graphical_output) {
593 foreach ($this->
object->getMatchingPairs() as $pair) {
603 $template->setCurrentBlock(
'icon_ok');
604 $template->setVariable(
'ICON_OK', $correctness_icon);
605 $template->parseCurrentBlock();
609 if ($result_output) {
610 $resulttext = ($points == 1) ?
'(%s ' . $this->
lng->txt(
'point') .
')' :
'(%s ' . $this->
lng->txt(
'points') .
')';
611 $template->setCurrentBlock(
'result_output');
612 $template->setVariable(
'RESULT_OUTPUT', sprintf($resulttext, $points));
613 $template->parseCurrentBlock();
616 $template->setCurrentBlock(
'row');
617 $template->setVariable(
'TEXT_MATCHES', $this->
lng->txt(
'matches'));
618 $template->parseCurrentBlock();
621 if ($show_question_text ==
true) {
622 $template->setVariable(
'QUESTIONTEXT', $this->
object->getQuestionForHTMLOutput());
625 $questionoutput = $template->get();
628 if ($show_feedback) {
631 $feedback .= strlen($fb) ? $fb :
'';
635 $feedback .= strlen($fb) ? $fb :
'';
637 if (strlen($feedback)) {
643 $solutiontemplate->setVariable(
'ILC_FB_CSS_CLASS', $cssClass);
647 $solutiontemplate->setVariable(
'SOLUTION_OUTPUT', $questionoutput);
649 $solutionoutput = $solutiontemplate->get();
650 if (!$show_question_only) {
654 return $solutionoutput;
658 bool $show_question_only =
false,
659 bool $show_inline_feedback =
false 661 $template =
new ilTemplate(
'tpl.il_as_qpl_matching_output.html',
true,
true,
'components/ILIAS/TestQuestionPool');
667 $terms = $this->
object->getTerms();
668 $definitions = $this->
object->getDefinitions();
669 switch ($this->
object->getShuffleMode()) {
671 $terms = $this->
object->getShuffler()->transform($terms);
672 $definitions = $this->
object->getShuffler()->transform(
673 $this->
object->getShuffler()->transform($definitions)
677 $terms = $this->
object->getShuffler()->transform($terms);
680 $definitions = $this->
object->getShuffler()->transform($definitions);
684 foreach ($definitions as $definition) {
686 $template->setCurrentBlock(
'droparea');
687 $template->setVariable(
'ID_DROPAREA', $definition->getIdentifier());
688 $template->setVariable(
'QUESTION_ID', $this->
object->getId());
689 $template->parseCurrentBlock();
692 $template->setVariable(
693 'TERMS_PRESENTATION_SOURCE',
701 $template->setVariable(
'QUESTIONTEXT', $this->
renderLatex($this->
object->getQuestionForHTMLOutput()));
703 $questionoutput = $template->get();
705 if (!$show_question_only) {
710 return $questionoutput;
723 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->
getPicture();
724 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $definition->
getPicture();
725 if (!file_exists($thumb)) {
726 $this->
object->rebuildThumbnails();
728 $template->
setVariable(
'THUMBNAIL_HREF', $thumbweb);
734 $template->
setVariable(
'TEXT_PREVIEW', $this->
lng->txt(
'preview'));
745 if ($solutions === []
746 || !array_key_exists($definition->
getIdentifier(), $solutions)) {
747 $template->
setVariable(
'ASSIGNED_TERMS', json_encode([]));
760 array $assigned_term_ids,
761 array $available_terms
763 $definition_template->
setVariable(
'ASSIGNED_TERMS', json_encode($assigned_term_ids));
765 'TERMS_PRESENTATION_ASSIGNED',
768 function (
string $c,
int $v) use ($definition_id, &$available_terms) {
773 $c .= $this->
buildTermHtml($available_terms[$key], $definition_id);
775 unset($available_terms[$key]);
783 return $available_terms;
788 foreach ($terms as $key => $term) {
789 if ($term->getIdentifier() === $term_id) {
798 $template =
new ilTemplate(
'tpl.il_as_qpl_matching_term_output.html',
true,
true,
'components/ILIAS/TestQuestionPool');
800 $template->setVariable(
'ID_DRAGGABLE', $term->
getIdentifier());
802 if ($definition_id !==
null) {
803 $template->setCurrentBlock(
'definition_id');
804 $template->setVariable(
'IID_DROPAREA', $definition_id);
805 $template->parseCurrentBlock();
809 $template->setCurrentBlock(
'term_text');
810 $template->setVariable(
'TERM_TEXT', $this->
renderLatex(
813 $template->parseCurrentBlock();
814 return $template->get();
817 $template->setCurrentBlock(
'term_picture');
819 $template->setVariable(
'IMAGE_HREF', $this->
object->getImagePathWeb() . $term->
getPicture());
820 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->
getPicture();
821 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $term->
getPicture();
822 if (!file_exists($thumb)) {
823 $this->
object->rebuildThumbnails();
825 $template->setVariable(
'THUMBNAIL_HREF', $thumbweb);
826 $template->setVariable(
'THUMB_ALT', $this->
lng->txt(
'image'));
827 $template->setVariable(
'THUMB_TITLE', $this->
lng->txt(
'image'));
828 $template->setVariable(
'TEXT_PREVIEW', $this->
lng->txt(
'preview'));
829 $template->setVariable(
'TEXT_TERM', $term->
getText() !==
'' 835 $template->parseCurrentBlock();
836 return $template->get();
839 private function buildSolutionsArray(
int $active_id,
int $attempt, array|
bool $user_post_solutions): array
841 if ($active_id === 0) {
844 if ($user_post_solutions !==
false) {
845 return $user_post_solutions[
'matching'];
849 $this->
object->getTestOutputSolutions($active_id, $attempt),
850 static function (array
$c, array $v): array {
851 if (!array_key_exists($v[
'value2'], $c)) {
852 $c[$v[
'value2']] = [$v[
'value1']];
855 $c[$v[
'value2']][] = $v[
'value1'];
870 $handled_definitions = [];
871 foreach (array_keys($solutions) as $definition_id) {
872 $neworder[] = $this->
object->getDefinitionWithIdentifier($definition_id);
873 $handled_definitions[$definition_id] = $definition_id;
876 foreach ($definitions as $definition) {
877 if (!isset($handled_definitions[$definition->getIdentifier()])) {
878 $neworder[] = $definition;
888 bool $is_question_postponed =
false,
889 array|
bool $user_post_solutions =
false,
890 bool $show_specific_inline_feedback =
false 892 $template =
new ilTemplate(
'tpl.il_as_qpl_matching_output.html',
true,
true,
'components/ILIAS/TestQuestionPool');
896 $terms = $this->
object->getTerms();
897 $definitions = $this->
object->getDefinitions();
898 switch ($this->
object->getShuffleMode()) {
900 $terms = $this->
object->getShuffler()->transform($terms);
901 if ($solutions !== []) {
904 $definitions = $this->
object->getShuffler()->transform(
905 $this->
object->getShuffler()->transform($definitions)
910 $terms = $this->
object->getShuffler()->transform($terms);
913 if ($solutions !== []) {
916 $definitions = $this->
object->getShuffler()->transform($definitions);
921 foreach ($definitions as $definition) {
923 $template->setCurrentBlock(
'droparea');
924 $template->setVariable(
'ID_DROPAREA', $definition->getIdentifier());
925 $template->setVariable(
'QUESTION_ID', $this->
object->getId());
926 $template->parseCurrentBlock();
929 $template->setVariable(
930 'TERMS_PRESENTATION_SOURCE',
938 $template->setVariable(
'QUESTIONTEXT', $this->
renderLatex($this->
object->getQuestionForHTMLOutput()));
940 return $this->
outQuestionPage(
'', $is_question_postponed, $active_id, $template->get());
948 $title = $this->request_data_collector->string(
'title');
949 $author = $this->request_data_collector->string(
'author');
950 $question = $this->request_data_collector->string(
'question');
952 return !empty($title) && !empty($author) && !empty($question);
957 $matches = array_values($this->
object->matchingpairs);
959 if (!$this->
object->feedbackOBJ->specificAnswerFeedbackExists()) {
963 $feedback =
'<table class="test_specific_feedback"><tbody>';
965 foreach ($matches as $idx => $ans) {
966 if (!isset($userSolution[$ans->getDefinition()->getIdentifier()])) {
970 if (!is_array($userSolution[$ans->getDefinition()->getIdentifier()])) {
974 if (!in_array($ans->getTerm()->getIdentifier(), $userSolution[$ans->getDefinition()->getIdentifier()])) {
978 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
983 $feedback .=
"<tr><td>\"{$ans->getDefinition()->getText()}\" {$this->lng->txt('matches')} ";
984 $feedback .=
"\"{$ans->getTerm()->getText()}\"</td><td>{$fb}</td></tr>";
987 $feedback .=
'</tbody></table>';
1021 if (!($pair->getPoints() > 0)) {
1025 if (!is_object($term)) {
1029 if ($pair->getDefinition()->getIdentifier() != $definition->getIdentifier()) {
1033 if ($pair->getTerm()->getIdentifier() != $term->getIdentifier()) {
1042 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $picture;
1043 return '<img src="' . $thumbweb .
'" alt="' . $picture .
'" title="' . $picture .
'"/>';
1050 if (strlen($elem->getText())) {
1051 $html .= $elem->getText();
1054 if (strlen($elem->getPicture())) {
1063 $answersByActiveAndPass = [];
1065 foreach ($relevantAnswers as $row) {
1066 $key = $row[
'active_fi'] .
':' . $row[
'pass'];
1068 if (!isset($answersByActiveAndPass[$key])) {
1069 $answersByActiveAndPass[$key] = [];
1072 $answersByActiveAndPass[$key][$row[
'value1']] = $row[
'value2'];
1077 foreach ($answersByActiveAndPass as $key => $matchingPairs) {
1078 foreach ($matchingPairs as $termId => $defId) {
1079 $hash = md5($termId .
':' . $defId);
1081 if (!isset($answers[$hash])) {
1083 $this->
object->getTermWithIdentifier($termId)
1087 $this->
object->getDefinitionWithIdentifier($defId)
1091 'answer' => $termHtml . $defHtml,
1092 'term' => $termHtml,
1093 'definition' => $defHtml,
1098 $answers[$hash][
'frequency']++;
1115 $table->setQuestionIndex($questionIndex);
1117 $table->initColumns();
1126 $pairs->setTerms($this->
object->getTerms());
1127 $pairs->setDefinitions($this->
object->getDefinitions());
1128 $pairs->setPairs($this->
object->getMatchingPairs());
1129 $pairs->setThumbsWebPathWithPrefix($this->
object->getImagePathWeb() . $this->
object->getThumbPrefix());
1138 $pairs = $this->
object->getMatchingPairs();
1141 if ($this->request_data_collector->isset(
'pairs')) {
1142 $points_of_pairs = $this->request_data_collector->raw(
'pairs')[
'points'];
1143 $pair_terms = explode(
',', $this->request_data_collector->raw(
'pairs')[
'term_id']);
1144 $pair_definitions = explode(
',', $this->request_data_collector->raw(
'pairs')[
'definition_id']);
1146 foreach ($points_of_pairs as $idx => $points) {
1147 $k = implode(
'.', [$pair_terms[$idx], $pair_definitions[$idx]]);
1148 $values[$k] = (float) str_replace(
',',
'.', $points);
1151 foreach ($pairs as $idx => $pair) {
1152 $id = implode(
'.', [
1153 $pair->getTerm()->getIdentifier(),
1154 $pair->getDefinition()->getIdentifier()
1156 $nu_pairs[
$id] = $pair->withPoints($values[
$id]);
1159 $this->
object = $this->
object->withMatchingPairs($nu_pairs);
1165 $this->tpl->addJavaScript(
'assets/js/matching.js');
1166 $this->tpl->addOnLoadCode(
1167 'il.test.matching.init(' 1168 .
"document.querySelector('#ilMatchingQuestionContainer_{$this->object->getId()}')," 1169 .
"'{$this->object->getMatchingMode()}');"
isTestPresentationContext()
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
Class for matching question terms.
setAdditionalContentEditingModeFromPost()
hasCorrectSolution($activeId, $passIndex)
This class represents an option in a radio group.
getArrayKeyForTermId(int $term_id, array $terms)
generateCorrectnessIconsForCorrectness(int $correctness)
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
const MATCHING_MODE_N_ON_N
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAnswerStatisticImageHtml($picture)
renderLatex($content)
Wrap content with latex in a LatexContent UI component and render it to be processed by MathJax in th...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
const MATCHING_MODE_1_ON_1
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
isValidTermAndDefinitionAmount(ilPropertyFormGUI $form)
for mode 1:1 terms count must not be less than definitions count for mode n:n this limitation is canc...
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
const CSS_CLASS_FEEDBACK_CORRECT
populateDefinition(ilTemplate $template, assAnswerMatchingDefinition $definition, array $solutions, array $terms)
Matching question GUI representation.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
Class for matching questions.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from the request and applies them to the data object...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
checkInput()
check input fields
buildTermHtml(assAnswerMatchingTerm $term, ?int $definition_id=null)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
setVariable($variable, $value='')
Sets a variable value.
setErrorMessage(string $errormessage)
writeQuestionGenericPostData()
getAnswerStatisticMatchingElemHtml($elem)
writePostData(bool $always=false)
{}
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from the request and applies them to the data object...
setValue(string $a_value)
editQuestion(bool $checkonly=false, ?bool $is_save_cmd=null)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
isCorrectMatching($pair, $definition, $term)
getAnswerFrequencyTableGUI($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
const CSS_CLASS_FEEDBACK_WRONG
sortDefinitionsBySolution(array $solutions, array $definitions)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
getTestOutput(int $active_id, int $attempt, bool $is_question_postponed=false, array|bool $user_post_solutions=false, bool $show_specific_inline_feedback=false)
buildSolutionsArray(int $active_id, int $attempt, array|bool $user_post_solutions)
getPreview(bool $show_question_only=false, bool $show_inline_feedback=false)
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
saveTaxonomyAssignments()
getSpecificFeedbackOutput(array $userSolution)
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
renderSolutionOutput(mixed $user_solutions, int $active_id, ?int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
populateAssignedTerms(ilTemplate $definition_template, int $definition_id, array $assigned_term_ids, array $available_terms)
__construct(Container $dic, ilPlugin $plugin)
getAnswersFrequency($relevantAnswers, $questionIndex)
static signFile(string $path_to_file)
Class for matching question definitions.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
getSolutionOutput(int $active_id, ?int $pass=null, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_inline_feedback=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
renderEditForm(ilPropertyFormGUI $form)
getGenericFeedbackOutput(int $active_id, ?int $pass)