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();
358 if ($this->
object->getSelfAssessmentEditingMode()) {
361 $terms->setRequired(
true);
362 $terms->setQuestionObject($this->
object);
363 $terms->setTextName($this->
lng->txt(
'term_text'));
364 $terms->setImageName($this->
lng->txt(
'term_image'));
366 if (0 === count($this->
object->getTerms())) {
372 $termvalues =
array_map($stripHtmlEntitesFromValues, $this->
object->getTerms());
373 $terms->setValues($termvalues);
375 $terms->checkInput();
381 $pairs->setTerms($this->
object->getTerms());
382 $pairs->setDefinitions($this->
object->getDefinitions());
383 if (count($this->
object->getMatchingPairs()) == 0) {
384 $this->
object->addMatchingPair($termvalues[0], $definitionvalues[0], 0);
387 $pairs->setPairs($this->
object->getMatchingPairs());
397 $hidden->setValue(
'');
400 if (!$this->
object->getSelfAssessmentEditingMode()) {
404 0 => $this->
lng->txt(
"no"),
405 1 => $this->
lng->txt(
"matching_shuffle_terms_definitions"),
406 2 => $this->
lng->txt(
"matching_shuffle_terms"),
407 3 => $this->
lng->txt(
"matching_shuffle_definitions")
410 $shuffle->setValue($this->
object->getShuffleMode());
411 $shuffle->setRequired(
false);
416 $geometry->setRequired(
true);
417 $geometry->setMaxLength(6);
418 $geometry->setMinValue($this->
object->getMinimumThumbSize());
419 $geometry->setMaxValue($this->
object->getMaximumThumbSize());
420 $geometry->setSize(6);
421 $geometry->setInfo($this->
lng->txt(
'thumb_size_info'));
430 $this->
lng->txt(
'qpl_qst_inp_matching_mode_one_on_one'),
433 $mode->addOption($modeONEonONE);
436 $this->
lng->txt(
'qpl_qst_inp_matching_mode_all_on_all'),
439 $mode->addOption($modeALLonALL);
450 bool $graphical_output =
false,
451 bool $result_output =
false,
452 bool $show_question_only =
true,
453 bool $show_feedback =
false,
454 bool $show_correct_solution =
false,
455 bool $show_manual_scoring =
false,
456 bool $show_question_text =
true,
457 bool $show_inline_feedback =
true 460 if (($active_id > 0) && (!$show_correct_solution)) {
461 $solutions = $this->
object->getSolutionValues($active_id, $pass);
463 foreach ($this->
object->getMaximumScoringMatchingPairs() as $pair) {
465 'value1' => $pair->getTerm()->getIdentifier(),
466 'value2' => $pair->getDefinition()->getIdentifier(),
467 'points' => $pair->getPoints()
480 $show_correct_solution,
481 $show_manual_scoring,
484 $show_inline_feedback,
489 mixed $user_solutions,
492 bool $graphical_output =
false,
493 bool $result_output =
false,
494 bool $show_question_only =
true,
495 bool $show_feedback =
false,
496 bool $show_correct_solution =
false,
497 bool $show_manual_scoring =
false,
498 bool $show_question_text =
true,
499 bool $show_autosave_title =
false,
500 bool $show_inline_feedback =
false,
502 $template =
new ilTemplate(
'tpl.il_as_qpl_matching_output_solution.html',
true,
true,
'components/ILIAS/TestQuestionPool');
503 $solutiontemplate =
new ilTemplate(
'tpl.il_as_tst_solution_output.html',
true,
true,
'components/ILIAS/TestQuestionPool');
506 foreach ($user_solutions as $solution) {
507 $definition = $this->
object->getDefinitionWithIdentifier($solution[
'value2']);
508 $term = $this->
object->getTermWithIdentifier($solution[
'value1']);
509 $points = $solution[
'points'];
511 if (is_object($definition)) {
512 if ($definition->getPicture() !==
'') {
513 if ($definition->getText() !==
'') {
514 $template->setCurrentBlock(
'definition_image_text');
515 $template->setVariable(
519 $template->parseCurrentBlock();
523 $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->getPicture()
526 $template->setCurrentBlock(
'definition_image');
527 $template->setVariable(
'ANSWER_IMAGE_URL', $answerImageSrc);
528 $template->setVariable(
531 $definition->getText()
534 $template->setVariable(
535 'ANSWER_IMAGE_TITLE',
537 $definition->getText()
540 $template->setVariable(
'URL_PREVIEW', $this->
object->getImagePathWeb() . $definition->getPicture());
541 $template->setVariable(
"TEXT_PREVIEW", $this->
lng->txt(
'preview'));
543 $template->parseCurrentBlock();
545 $template->setCurrentBlock(
'definition_text');
547 $template->parseCurrentBlock();
550 if ($term !==
null) {
551 if (strlen($term->getPicture())) {
552 if (strlen($term->getText())) {
553 $template->setCurrentBlock(
'term_image_text');
555 $template->parseCurrentBlock();
559 $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->getPicture()
562 $template->setCurrentBlock(
'term_image');
563 $template->setVariable(
'ANSWER_IMAGE_URL', $answerImageSrc);
564 $template->setVariable(
570 $template->setVariable(
571 'ANSWER_IMAGE_TITLE',
576 $template->setVariable(
'URL_PREVIEW', $this->
object->getImagePathWeb() . $term->getPicture());
577 $template->setVariable(
"TEXT_PREVIEW", $this->
lng->txt(
'preview'));
579 $template->parseCurrentBlock();
581 $template->setCurrentBlock(
'term_text');
583 $template->parseCurrentBlock();
587 if (($active_id > 0) && (!$show_correct_solution)) {
588 if ($graphical_output) {
591 foreach ($this->
object->getMatchingPairs() as $pair) {
601 $template->setCurrentBlock(
'icon_ok');
602 $template->setVariable(
'ICON_OK', $correctness_icon);
603 $template->parseCurrentBlock();
607 if ($result_output) {
608 $resulttext = ($points == 1) ?
'(%s ' . $this->
lng->txt(
'point') .
')' :
'(%s ' . $this->
lng->txt(
'points') .
')';
609 $template->setCurrentBlock(
'result_output');
610 $template->setVariable(
'RESULT_OUTPUT', sprintf($resulttext, $points));
611 $template->parseCurrentBlock();
614 $template->setCurrentBlock(
'row');
615 $template->setVariable(
'TEXT_MATCHES', $this->
lng->txt(
'matches'));
616 $template->parseCurrentBlock();
619 if ($show_question_text ==
true) {
620 $template->setVariable(
'QUESTIONTEXT', $this->
object->getQuestionForHTMLOutput());
623 $questionoutput = $template->get();
626 if ($show_feedback) {
629 $feedback .= strlen($fb) ? $fb :
'';
633 $feedback .= strlen($fb) ? $fb :
'';
635 if (strlen($feedback)) {
641 $solutiontemplate->setVariable(
'ILC_FB_CSS_CLASS', $cssClass);
645 $solutiontemplate->setVariable(
'SOLUTION_OUTPUT', $questionoutput);
647 $solutionoutput = $solutiontemplate->get();
648 if (!$show_question_only) {
652 return $solutionoutput;
656 bool $show_question_only =
false,
657 bool $show_inline_feedback =
false 659 $template =
new ilTemplate(
'tpl.il_as_qpl_matching_output.html',
true,
true,
'components/ILIAS/TestQuestionPool');
665 $terms = $this->
object->getTerms();
666 $definitions = $this->
object->getDefinitions();
667 switch ($this->
object->getShuffleMode()) {
669 $terms = $this->
object->getShuffler()->transform($terms);
670 $definitions = $this->
object->getShuffler()->transform(
671 $this->
object->getShuffler()->transform($definitions)
675 $terms = $this->
object->getShuffler()->transform($terms);
678 $definitions = $this->
object->getShuffler()->transform($definitions);
682 foreach ($definitions as $definition) {
684 $template->setCurrentBlock(
'droparea');
685 $template->setVariable(
'ID_DROPAREA', $definition->getIdentifier());
686 $template->setVariable(
'QUESTION_ID', $this->
object->getId());
687 $template->parseCurrentBlock();
690 $template->setVariable(
691 'TERMS_PRESENTATION_SOURCE',
699 $template->setVariable(
'QUESTIONTEXT', $this->
object->getQuestionForHTMLOutput());
701 $questionoutput = $template->get();
703 if (!$show_question_only) {
708 return $questionoutput;
721 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->
getPicture();
722 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $definition->
getPicture();
723 if (!file_exists($thumb)) {
724 $this->
object->rebuildThumbnails();
726 $template->
setVariable(
'THUMBNAIL_HREF', $thumbweb);
730 $template->
setVariable(
'TEXT_PREVIEW', $this->
lng->txt(
'preview'));
739 if ($solutions === []
740 || !array_key_exists($definition->
getIdentifier(), $solutions)) {
741 $template->
setVariable(
'ASSIGNED_TERMS', json_encode([]));
754 array $assigned_term_ids,
755 array $available_terms
757 $definition_template->
setVariable(
'ASSIGNED_TERMS', json_encode($assigned_term_ids));
759 'TERMS_PRESENTATION_ASSIGNED',
762 function (
string $c,
int $v) use ($definition_id, &$available_terms) {
767 $c .= $this->
buildTermHtml($available_terms[$key], $definition_id);
769 unset($available_terms[$key]);
777 return $available_terms;
782 foreach ($terms as $key => $term) {
783 if ($term->getIdentifier() === $term_id) {
792 $template =
new ilTemplate(
'tpl.il_as_qpl_matching_term_output.html',
true,
true,
'components/ILIAS/TestQuestionPool');
794 $template->setVariable(
'ID_DRAGGABLE', $term->
getIdentifier());
796 if ($definition_id !==
null) {
797 $template->setCurrentBlock(
'definition_id');
798 $template->setVariable(
'IID_DROPAREA', $definition_id);
799 $template->parseCurrentBlock();
803 $template->setCurrentBlock(
'term_text');
805 $template->parseCurrentBlock();
806 return $template->get();
809 $template->setCurrentBlock(
'term_picture');
811 $template->setVariable(
'IMAGE_HREF', $this->
object->getImagePathWeb() . $term->
getPicture());
812 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->
getPicture();
813 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $term->
getPicture();
814 if (!file_exists($thumb)) {
815 $this->
object->rebuildThumbnails();
817 $template->setVariable(
'THUMBNAIL_HREF', $thumbweb);
818 $template->setVariable(
'THUMB_ALT', $this->
lng->txt(
'image'));
819 $template->setVariable(
'THUMB_TITLE', $this->
lng->txt(
'image'));
820 $template->setVariable(
'TEXT_PREVIEW', $this->
lng->txt(
'preview'));
821 $template->setVariable(
'TEXT_TERM', $term->
getText() !==
'' 825 $template->parseCurrentBlock();
826 return $template->get();
829 private function buildSolutionsArray(
int $active_id,
int $attempt, array|
bool $user_post_solutions): array
831 if ($active_id === 0) {
834 if ($user_post_solutions !==
false) {
835 return $user_post_solutions[
'matching'];
839 $this->
object->getTestOutputSolutions($active_id, $attempt),
840 static function (array
$c, array $v): array {
841 if (!array_key_exists($v[
'value2'], $c)) {
842 $c[$v[
'value2']] = [$v[
'value1']];
845 $c[$v[
'value2']][] = $v[
'value1'];
860 $handled_definitions = [];
861 foreach (array_keys($solutions) as $definition_id) {
862 $neworder[] = $this->
object->getDefinitionWithIdentifier($definition_id);
863 $handled_definitions[$definition_id] = $definition_id;
866 foreach ($definitions as $definition) {
867 if (!isset($handled_definitions[$definition->getIdentifier()])) {
868 $neworder[] = $definition;
878 bool $is_question_postponed =
false,
879 array|
bool $user_post_solutions =
false,
880 bool $show_specific_inline_feedback =
false 882 $template =
new ilTemplate(
'tpl.il_as_qpl_matching_output.html',
true,
true,
'components/ILIAS/TestQuestionPool');
886 $terms = $this->
object->getTerms();
887 $definitions = $this->
object->getDefinitions();
888 switch ($this->
object->getShuffleMode()) {
890 $terms = $this->
object->getShuffler()->transform($terms);
891 if ($solutions !== []) {
894 $definitions = $this->
object->getShuffler()->transform(
895 $this->
object->getShuffler()->transform($definitions)
900 $terms = $this->
object->getShuffler()->transform($terms);
903 if ($solutions !== []) {
906 $definitions = $this->
object->getShuffler()->transform($definitions);
911 foreach ($definitions as $definition) {
913 $template->setCurrentBlock(
'droparea');
914 $template->setVariable(
'ID_DROPAREA', $definition->getIdentifier());
915 $template->setVariable(
'QUESTION_ID', $this->
object->getId());
916 $template->parseCurrentBlock();
919 $template->setVariable(
920 'TERMS_PRESENTATION_SOURCE',
928 $template->setVariable(
'QUESTIONTEXT', $this->
object->getQuestionForHTMLOutput());
930 return $this->
outQuestionPage(
'', $is_question_postponed, $active_id, $template->get());
938 $title = $this->request_data_collector->string(
'title');
939 $author = $this->request_data_collector->string(
'author');
940 $question = $this->request_data_collector->string(
'question');
942 return !empty($title) && !empty($author) && !empty($question);
947 $matches = array_values($this->
object->matchingpairs);
949 if (!$this->
object->feedbackOBJ->specificAnswerFeedbackExists()) {
953 $feedback =
'<table class="test_specific_feedback"><tbody>';
955 foreach ($matches as $idx => $ans) {
956 if (!isset($userSolution[$ans->getDefinition()->getIdentifier()])) {
960 if (!is_array($userSolution[$ans->getDefinition()->getIdentifier()])) {
964 if (!in_array($ans->getTerm()->getIdentifier(), $userSolution[$ans->getDefinition()->getIdentifier()])) {
968 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
973 $feedback .=
"<tr><td>\"{$ans->getDefinition()->getText()}\" {$this->lng->txt('matches')} ";
974 $feedback .=
"\"{$ans->getTerm()->getText()}\"</td><td>{$fb}</td></tr>";
977 $feedback .=
'</tbody></table>';
1011 if (!($pair->getPoints() > 0)) {
1015 if (!is_object($term)) {
1019 if ($pair->getDefinition()->getIdentifier() != $definition->getIdentifier()) {
1023 if ($pair->getTerm()->getIdentifier() != $term->getIdentifier()) {
1032 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $picture;
1033 return '<img src="' . $thumbweb .
'" alt="' . $picture .
'" title="' . $picture .
'"/>';
1040 if (strlen($elem->getText())) {
1041 $html .= $elem->getText();
1044 if (strlen($elem->getPicture())) {
1053 $answersByActiveAndPass = [];
1055 foreach ($relevantAnswers as $row) {
1056 $key = $row[
'active_fi'] .
':' . $row[
'pass'];
1058 if (!isset($answersByActiveAndPass[$key])) {
1059 $answersByActiveAndPass[$key] = [];
1062 $answersByActiveAndPass[$key][$row[
'value1']] = $row[
'value2'];
1067 foreach ($answersByActiveAndPass as $key => $matchingPairs) {
1068 foreach ($matchingPairs as $termId => $defId) {
1069 $hash = md5($termId .
':' . $defId);
1071 if (!isset($answers[$hash])) {
1073 $this->
object->getTermWithIdentifier($termId)
1077 $this->
object->getDefinitionWithIdentifier($defId)
1081 'answer' => $termHtml . $defHtml,
1082 'term' => $termHtml,
1083 'definition' => $defHtml,
1088 $answers[$hash][
'frequency']++;
1105 $table->setQuestionIndex($questionIndex);
1107 $table->initColumns();
1116 $pairs->setTerms($this->
object->getTerms());
1117 $pairs->setDefinitions($this->
object->getDefinitions());
1118 $pairs->setPairs($this->
object->getMatchingPairs());
1119 $pairs->setThumbsWebPathWithPrefix($this->
object->getImagePathWeb() . $this->
object->getThumbPrefix());
1128 $pairs = $this->
object->getMatchingPairs();
1131 if ($this->request_data_collector->isset(
'pairs')) {
1132 $points_of_pairs = $this->request_data_collector->raw(
'pairs')[
'points'];
1133 $pair_terms = explode(
',', $this->request_data_collector->raw(
'pairs')[
'term_id']);
1134 $pair_definitions = explode(
',', $this->request_data_collector->raw(
'pairs')[
'definition_id']);
1136 foreach ($points_of_pairs as $idx => $points) {
1137 $k = implode(
'.', [$pair_terms[$idx], $pair_definitions[$idx]]);
1138 $values[$k] = (float) str_replace(
',',
'.', $points);
1141 foreach ($pairs as $idx => $pair) {
1142 $id = implode(
'.', [
1143 $pair->getTerm()->getIdentifier(),
1144 $pair->getDefinition()->getIdentifier()
1146 $nu_pairs[
$id] = $pair->withPoints($values[
$id]);
1149 $this->
object = $this->
object->withMatchingPairs($nu_pairs);
1155 $this->tpl->addJavaScript(
'assets/js/matching.js');
1156 $this->tpl->addOnLoadCode(
1157 'il.test.matching.init(' 1158 .
"document.querySelector('#ilMatchingQuestionContainer_{$this->object->getId()}')," 1159 .
"'{$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)
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)