4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiAnswerScoringAdjustable.php';
7 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
36 parent::__construct();
37 include_once
"./Modules/TestQuestionPool/classes/class.assMatchingQuestion.php";
42 $this->
object->loadFromDb($id);
55 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
58 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
71 $this->
object->flushMatchingPairs();
72 $this->
object->flushTerms();
73 $this->
object->flushDefinitions();
76 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php';
77 foreach (
$_POST[
'terms'][
'answer'] as $index => $answer)
80 if (strlen( $_FILES[
'terms'][
'name'][
'image'][$index] ))
83 $name = $_FILES[
'terms'][
'name'][
'image'][$index];
84 if ($this->object->setImageFile( $_FILES[
'terms'][
'tmp_name'][
'image'][$index],
85 $this->object->getEncryptedFilename( $name )
89 $filename = $this->
object->getEncryptedFilename( $name );
100 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php';
101 foreach (
$_POST[
'definitions'][
'answer'] as $index => $answer)
104 if (strlen( $_FILES[
'definitions'][
'name'][
'image'][$index] ))
107 $name = $_FILES[
'definitions'][
'name'][
'image'][$index];
108 if ($this->object->setImageFile( $_FILES[
'definitions'][
'tmp_name'][
'image'][$index],
109 $this->object->getEncryptedFilename( $name )
113 $filename = $this->
object->getEncryptedFilename( $name );
120 $this->
object->addDefinition(
126 if (is_array(
$_POST[
'pairs'][
'points'] ))
128 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php';
129 foreach (
$_POST[
'pairs'][
'points'] as $index => $points)
131 $term_id =
$_POST[
'pairs'][
'term'][$index];
132 $definition_id =
$_POST[
'pairs'][
'definition'][$index];
133 $this->
object->addMatchingPair( $this->object->getTermWithIdentifier( $term_id ),
134 $this->
object->getDefinitionWithIdentifier( $definition_id ),
143 if (!$this->object->getSelfAssessmentEditingMode())
145 $this->
object->setShuffle(
$_POST[
"shuffle"] );
149 $this->
object->setShuffle( 1 );
151 $this->
object->setThumbGeometry(
$_POST[
"thumb_geometry"] );
152 $this->
object->setMatchingMode(
$_POST[
'matching_mode']);
164 $position = key(
$_POST[
'cmd'][
'removeimageterms']);
165 $this->
object->removeTermImage($position);
178 $position = key(
$_POST[
'cmd'][
'removeimagedefinitions']);
179 $this->
object->removeDefinitionImage($position);
186 $position = key(
$_POST[
"cmd"][
"addterms"]);
187 $this->
object->insertTerm($position+1);
194 $position = key(
$_POST[
"cmd"][
"removeterms"]);
195 $this->
object->deleteTerm($position);
202 $position = key(
$_POST[
"cmd"][
"adddefinitions"]);
203 $this->
object->insertDefinition($position+1);
210 $position = key(
$_POST[
"cmd"][
"removedefinitions"]);
211 $this->
object->deleteDefinition($position);
218 $position = key(
$_POST[
"cmd"][
"addpairs"]);
219 $this->
object->insertMatchingPair($position+1);
226 $position = key(
$_POST[
"cmd"][
"removepairs"]);
227 $this->
object->deleteMatchingPair($position);
236 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
238 $form->setFormAction($this->ctrl->getFormAction($this));
240 $form->setMultipart(
true);
241 $form->setTableWidth(
"100%");
242 $form->setId(
"matching");
255 $form->setValuesByPost();
256 $errors = !$form->checkInput();
257 $form->setValuesByPost();
261 $terms = $form->getItemByPostVar(
'terms');
262 $terms->setAlert($this->lng->txt(
"msg_number_of_terms_too_low"));
265 if (
$errors) $checkonly =
false;
268 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
274 return $this->ctrl->getCmd() ==
'uploaddefinitions';
279 return $this->ctrl->getCmd() ==
'uploadterms';
299 $numDefinitions = count($form->
getItemByPostVar(
'definitions')->getValues());
301 if($numTerms >= $numDefinitions)
312 include_once
"./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
314 if ($this->object->getSelfAssessmentEditingMode())
319 $definitions->setRequired(
true );
320 $definitions->setQuestionObject( $this->
object );
321 $definitions->setTextName( $this->lng->txt(
'definition_text' ) );
322 $definitions->setImageName( $this->lng->txt(
'definition_image' ) );
323 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
324 if (!count( $this->object->getDefinitions() ))
328 $definitionvalues = $this->
object->getDefinitions();
329 $definitions->setValues( $definitionvalues );
332 $definitions->checkInput();
334 $form->
addItem( $definitions );
337 include_once
"./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
339 if ($this->object->getSelfAssessmentEditingMode())
341 $terms->setRequired(
true );
342 $terms->setQuestionObject( $this->
object );
343 $terms->setTextName( $this->lng->txt(
'term_text' ) );
344 $terms->setImageName( $this->lng->txt(
'term_image' ) );
345 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
346 if (!count( $this->object->getTerms() ))
348 $termvalues = $this->
object->getTerms();
349 $terms->setValues( $termvalues );
352 $terms->checkInput();
357 include_once
"./Modules/TestQuestionPool/classes/class.ilMatchingPairWizardInputGUI.php";
360 $pairs->setTerms( $this->object->getTerms() );
361 $pairs->setDefinitions( $this->object->getDefinitions() );
362 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
363 if (count( $this->object->getMatchingPairs() ) == 0)
365 $this->
object->addMatchingPair(
new assAnswerMatchingPair($termvalues[0], $definitionvalues[0], 0) );
367 $pairs->setPairs( $this->object->getMatchingPairs() );
377 $hidden->setValue($matchingtype);
380 if (!$this->object->getSelfAssessmentEditingMode())
383 $shuffle =
new ilSelectInputGUI($this->lng->txt(
"shuffle_answers" ),
"shuffle");
384 $shuffle_options = array(
385 0 => $this->lng->txt(
"no" ),
386 1 => $this->lng->txt(
"matching_shuffle_terms_definitions" ),
387 2 => $this->lng->txt(
"matching_shuffle_terms" ),
388 3 => $this->lng->txt(
"matching_shuffle_definitions" )
391 $shuffle->setValue($this->object->getShuffle() != null ? $this->
object->getShuffle() : 1);
392 $shuffle->setRequired( FALSE );
395 $geometry =
new ilNumberInputGUI($this->lng->txt(
"thumb_geometry" ),
"thumb_geometry");
396 $geometry->
setValue( $this->object->getThumbGeometry() );
397 $geometry->setRequired(
true );
398 $geometry->setMaxLength( 6 );
399 $geometry->setMinValue( 20 );
400 $geometry->setSize( 6 );
401 $geometry->setInfo( $this->lng->txt(
"thumb_geometry_info" ) );
406 $mode =
new ilRadioGroupInputGUI($this->lng->txt(
'qpl_qst_inp_matching_mode'),
'matching_mode');
412 $mode->addOption($modeONEonONE);
417 $mode->addOption($modeALLonALL);
419 $mode->
setValue($this->object->getMatchingMode());
440 $graphicalOutput = FALSE,
441 $result_output = FALSE,
442 $show_question_only = TRUE,
443 $show_feedback = FALSE,
444 $show_correct_solution = FALSE,
445 $show_manual_scoring = FALSE,
446 $show_question_text = TRUE
450 include_once
"./Services/UICore/classes/class.ilTemplate.php";
451 $template =
new ilTemplate(
"tpl.il_as_qpl_matching_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
452 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
454 $solutions = array();
455 if (($active_id > 0) && (!$show_correct_solution))
457 include_once
"./Modules/Test/classes/class.ilObjTest.php";
458 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
459 $solution_script .=
"";
463 foreach ($this->object->getMaximumScoringMatchingPairs() as $pair)
465 $solutions[] = array(
466 "value1" => $pair->term->identifier,
467 "value2" => $pair->definition->identifier,
468 'points' => $pair->points
475 foreach ($solutions as $solution)
477 $definition = $this->
object->getDefinitionWithIdentifier($solution[
'value2']);
478 $term = $this->
object->getTermWithIdentifier($solution[
'value1']);
479 $points = $solution[
'points'];
481 if (is_object($definition))
483 if (strlen($definition->picture))
485 if( strlen($definition->text) )
487 $template->setCurrentBlock(
'definition_image_text');
489 $template->parseCurrentBlock();
492 $template->setCurrentBlock(
'definition_image');
493 $template->setVariable(
'ANSWER_IMAGE_URL', $this->object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->picture);
496 $template->setVariable(
'URL_PREVIEW', $this->object->getImagePathWeb() . $definition->picture);
497 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
499 $template->parseCurrentBlock();
503 $template->setCurrentBlock(
'definition_text');
504 $template->setVariable(
"DEFINITION", $this->object->prepareTextareaOutput($definition->text, TRUE));
505 $template->parseCurrentBlock();
508 if (is_object($term))
510 if (strlen($term->picture))
512 if( strlen($term->text) )
514 $template->setCurrentBlock(
'term_image_text');
516 $template->parseCurrentBlock();
519 $template->setCurrentBlock(
'term_image');
520 $template->setVariable(
'ANSWER_IMAGE_URL', $this->object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->picture);
523 $template->setVariable(
'URL_PREVIEW', $this->object->getImagePathWeb() . $term->picture);
524 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
526 $template->parseCurrentBlock();
530 $template->setCurrentBlock(
'term_text');
531 $template->setVariable(
"TERM", $this->object->prepareTextareaOutput($term->text, TRUE));
532 $template->parseCurrentBlock();
536 if (($active_id > 0) && (!$show_correct_solution))
538 if ($graphicalOutput)
542 foreach ($this->object->getMatchingPairs() as $pair)
552 $template->setCurrentBlock(
"icon_ok");
554 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
555 $template->parseCurrentBlock();
559 $template->setCurrentBlock(
"icon_ok");
561 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
562 $template->parseCurrentBlock();
569 $resulttext = ($points == 1) ?
"(%s " . $this->lng->txt(
"point") .
")" :
"(%s " . $this->lng->txt(
"points") .
")";
570 $template->setCurrentBlock(
"result_output");
571 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $points));
572 $template->parseCurrentBlock();
575 $template->setCurrentBlock(
"row");
576 $template->setVariable(
"TEXT_MATCHES", $this->lng->txt(
"matches"));
577 $template->parseCurrentBlock();
580 $questiontext = $this->
object->getQuestion();
581 if ($show_question_text==
true)
583 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
586 $questionoutput = $template->get();
594 $feedback .= strlen($fb) ? $fb :
'';
598 $feedback .= strlen($fb) ? $fb :
'';
600 if (strlen($feedback))
606 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
607 $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $feedback,
true ));
610 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
612 $solutionoutput = $solutiontemplate->get();
613 if (!$show_question_only)
618 return $solutionoutput;
621 public function getPreview($show_question_only = FALSE, $showInlineFeedback =
false)
627 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
631 $this->tpl->addJavaScript(
'./Services/jQuery/js/jquery.ui.touch-punch.min.js');
635 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/jquery-ui-1-10-3-fixed.js');
638 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilMatchingQuestion.js');
641 $template =
new ilTemplate(
"tpl.il_as_qpl_matching_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
643 foreach($solutions as $defId => $terms)
645 foreach($terms as $termId)
647 $template->setCurrentBlock(
"matching_data");
648 $template->setVariable(
"DEFINITION_ID", $defId);
649 $template->setVariable(
"TERM_ID", $termId);
650 $template->parseCurrentBlock();
655 $terms = $this->
object->getTerms();
656 $definitions = $this->
object->getDefinitions();
657 switch ($this->object->getShuffle())
660 $seed = $this->
object->getShuffler()->getSeed();
661 $this->
object->getShuffler()->setSeed($seed.
'1');
662 $terms = $this->
object->getShuffler()->shuffle($terms);
663 $this->
object->getShuffler()->setSeed($seed.
'2');
664 $definitions = $this->
object->getShuffler()->shuffle($definitions);
665 $this->
object->getShuffler()->setSeed($seed);
668 $terms = $this->
object->getShuffler()->shuffle($terms);
671 $definitions = $this->
object->getShuffler()->shuffle($definitions);
677 foreach ($definitions as $definition)
679 if (strlen($definition->picture))
681 $template->setCurrentBlock(
"definition_picture");
682 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
683 $template->setVariable(
"IMAGE_HREF", $this->object->getImagePathWeb() . $definition->picture);
684 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->picture;
685 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $definition->picture;
686 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
687 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
688 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
689 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
690 $template->setVariable(
"TEXT_DEFINITION", (strlen($definition->text)) ? $this->object->prepareTextareaOutput($definition->text, TRUE) :
'');
691 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
693 $template->parseCurrentBlock();
697 $template->setCurrentBlock(
"definition_text");
698 $template->setVariable(
"DEFINITION", $this->object->prepareTextareaOutput($definition->text, TRUE));
699 $template->parseCurrentBlock();
702 $template->setCurrentBlock(
"droparea");
703 $template->setVariable(
"ID_DROPAREA", $definition->identifier);
704 $template->setVariable(
"QUESTION_ID", $this->object->getId());
705 $template->parseCurrentBlock();
707 $template->setCurrentBlock(
"definition_data");
708 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
709 $template->parseCurrentBlock();
714 foreach ($terms as $term)
716 if (strlen($term->picture))
718 $template->setCurrentBlock(
"term_picture");
719 $template->setVariable(
"TERM_ID", $term->identifier);
720 $template->setVariable(
"IMAGE_HREF", $this->object->getImagePathWeb() . $term->picture);
721 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->picture;
722 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $term->picture;
723 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
724 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
725 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
726 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
727 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
728 $template->setVariable(
"TEXT_TERM", (strlen($term->text)) ? $this->object->prepareTextareaOutput($term->text, TRUE) :
'');
730 $template->parseCurrentBlock();
734 $template->setCurrentBlock(
"term_text");
735 $template->setVariable(
"TERM_TEXT", $this->object->prepareTextareaOutput($term->text, TRUE));
736 $template->parseCurrentBlock();
738 $template->setCurrentBlock(
"draggable");
739 $template->setVariable(
"ID_DRAGGABLE", $term->identifier);
740 $template->parseCurrentBlock();
742 $template->setCurrentBlock(
"term_data");
743 $template->setVariable(
"TERM_ID", $term->identifier);
744 $template->parseCurrentBlock();
747 $template->setVariable(
'MATCHING_MODE', $this->object->getMatchingMode());
749 $template->setVariable(
"RESET_BUTTON", $this->lng->txt(
"reset_terms"));
751 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
753 $questionoutput = $template->get();
755 if (!$show_question_only)
761 return $questionoutput;
769 protected function sortDefinitionsBySolution(array $solution, array $definitions)
772 $handled_defintions = array();
773 foreach($solution as $solution_values)
775 $id = $solution_values[
'value2'];
776 if(!isset($handled_defintions[$id]))
778 $neworder[] = $this->
object->getDefinitionWithIdentifier($id);
779 $handled_defintions[$id] = $id;
783 foreach($definitions as $definition)
788 if(!isset($handled_defintions[$definition->identifier]))
790 $neworder[] = $definition;
798 function getTestOutput($active_id,
$pass, $is_postponed = FALSE, $user_post_solution = FALSE, $inlineFeedback =
false)
803 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
807 $this->tpl->addJavaScript(
'./Services/jQuery/js/jquery.ui.touch-punch.min.js');
811 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/jquery-ui-1-10-3-fixed.js');
814 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilMatchingQuestion.js');
817 $template =
new ilTemplate(
"tpl.il_as_qpl_matching_output.html",
true,
true,
"Modules/TestQuestionPool");
823 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 824 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 826 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 829 if (is_array($user_post_solution))
831 $solutions = array();
832 foreach ($user_post_solution[
'matching'][$this->object->getId()] as $definition => $term)
834 array_push($solutions, array(
"value1" => $term,
"value2" => $definition));
845 foreach ($solutions as $idx => $solution_value)
847 if (($solution_value[
"value2"] > -1) && ($solution_value[
"value1"] > -1))
849 $template->setCurrentBlock(
"matching_data");
850 $template->setVariable(
"TERM_ID", $solution_value[
"value1"]);
851 $template->setVariable(
"DEFINITION_ID", $solution_value[
"value2"]);
852 $template->parseCurrentBlock();
859 $terms = $this->
object->getTerms();
860 $definitions = $this->
object->getDefinitions();
861 switch ($this->object->getShuffle())
864 $seed = $this->
object->getShuffler()->getSeed();
865 $this->
object->getShuffler()->setSeed($seed.
'1');
866 $terms = $this->
object->getShuffler()->shuffle($terms);
867 if (count($solutions))
869 $definitions = $this->sortDefinitionsBySolution($solutions, $definitions);
873 $this->
object->getShuffler()->setSeed($seed.
'2');
874 $definitions = $this->
object->getShuffler()->shuffle($definitions);
876 $this->
object->getShuffler()->setSeed($seed);
879 $terms = $this->
object->getShuffler()->shuffle($terms);
882 if (count($solutions))
884 $definitions = $this->sortDefinitionsBySolution($solutions, $definitions);
888 $definitions = $this->
object->getShuffler()->shuffle($definitions);
895 foreach ($definitions as $definition)
897 if (strlen($definition->picture))
899 $template->setCurrentBlock(
"definition_picture");
900 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
901 $template->setVariable(
"IMAGE_HREF", $this->object->getImagePathWeb() . $definition->picture);
902 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->picture;
903 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $definition->picture;
904 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
905 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
906 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
907 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
908 $template->setVariable(
"TEXT_DEFINITION", (strlen($definition->text)) ?
ilUtil::prepareFormOutput($definition->text) :
'');
909 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
911 $template->parseCurrentBlock();
915 $template->setCurrentBlock(
"definition_text");
916 $template->setVariable(
"DEFINITION", $this->object->prepareTextareaOutput($definition->text,
true));
917 $template->parseCurrentBlock();
920 $template->setCurrentBlock(
"droparea");
921 $template->setVariable(
"ID_DROPAREA", $definition->identifier);
922 $template->setVariable(
"QUESTION_ID", $this->object->getId());
923 $template->parseCurrentBlock();
925 $template->setCurrentBlock(
"definition_data");
926 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
927 $template->parseCurrentBlock();
932 foreach ($terms as $term)
934 if (strlen($term->picture))
936 $template->setCurrentBlock(
"term_picture");
937 $template->setVariable(
"TERM_ID", $term->identifier);
938 $template->setVariable(
"IMAGE_HREF", $this->object->getImagePathWeb() . $term->picture);
939 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->picture;
940 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $term->picture;
941 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
942 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
943 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
944 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
945 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
948 $template->parseCurrentBlock();
952 $template->setCurrentBlock(
"term_text");
953 $template->setVariable(
"TERM_TEXT", $this->object->prepareTextareaOutput($term->text,
true));
954 $template->parseCurrentBlock();
956 $template->setCurrentBlock(
"draggable");
957 $template->setVariable(
"ID_DRAGGABLE", $term->identifier);
958 $template->parseCurrentBlock();
960 $template->setCurrentBlock(
'term_data');
961 $template->setVariable(
'TERM_ID', $term->identifier);
962 $template->parseCurrentBlock();
965 $template->setVariable(
'MATCHING_MODE', $this->object->getMatchingMode());
967 $template->setVariable(
"RESET_BUTTON", $this->lng->txt(
"reset_terms"));
969 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
971 return $this->
outQuestionPage(
"", $is_postponed, $active_id, $template->get());
995 global $rbacsystem, $ilTabs;
997 $ilTabs->clearTargets();
999 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
1000 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1001 $q_type = $this->
object->getQuestionType();
1003 if (strlen($q_type))
1005 $classname = $q_type .
"GUI";
1006 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
1007 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
1012 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
1015 $ilTabs->addTarget(
"edit_page",
1016 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
1017 array(
"edit",
"insert",
"exec_pg"),
1018 "",
"", $force_active);
1024 $force_active =
false;
1025 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
1028 if ($classname)
$url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
1030 $ilTabs->addTarget(
"edit_question",
1032 array(
"editQuestion",
"save",
"saveEdit",
"removeimageterms",
"uploadterms",
"removeimagedefinitions",
"uploaddefinitions",
1033 "addpairs",
"removepairs",
"addterms",
"removeterms",
"adddefinitions",
"removedefinitions",
"originalSyncForm"),
1034 $classname,
"", $force_active);
1049 $ilTabs->addTarget(
"statistics",
1050 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
1051 array(
"assessment"),
1060 $matches = array_values($this->object->getMaximumScoringMatchingPairs());
1062 if( !$this->object->feedbackOBJ->specificAnswerFeedbackExists($matches) )
1067 $feedback =
'<table class="test_specific_feedback"><tbody>';
1069 foreach ($matches as $idx => $ans)
1071 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
1072 $this->object->getId(), $idx
1074 $feedback .=
'<tr><td>"' . $ans->definition->text .
'" ' . $this->lng->txt(
"matches") .
' "';
1075 $feedback .= $ans->term->text .
'"</td><td>';
1076 $feedback .= $fb .
'</td> </tr>';
1079 $feedback .=
'</tbody></table>';
1080 return $this->
object->prepareTextareaOutput($feedback, TRUE);
1126 if( !($pair->points > 0) )
1131 if( !is_object($term) )
1136 if( $pair->definition->identifier != $definition->identifier )
1141 if( $pair->term->identifier != $term->identifier )
isTestPresentationContext()
Class for matching question terms.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
writePostData($always=false)
Evaluates a posted edit form and writes the form data in the question object.
This class represents an option in a radio group.
static initjQueryUI()
Init jQuery UI (see included_components.txt for included components)
Class for matching question pairs.
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
editQuestion($checkonly=FALSE)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
const MATCHING_MODE_N_ON_N
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
const MATCHING_MODE_1_ON_1
getTestOutputSolutions($activeId, $pass)
isValidTermAndDefinitionAmount(ilPropertyFormGUI $form)
for mode 1:1 terms count must not be less than definitions count for mode n:n this limitation is canc...
getQuestionTemplate()
get question template
const CSS_CLASS_FEEDBACK_CORRECT
Matching question GUI representation.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
Class for matching questions.
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
checkInput()
check input fields
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
setValue($a_value)
Set Value.
writeQuestionGenericPostData()
__construct($id=-1)
assMatchingQuestionGUI constructor
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
getILIASPage($html="")
Returns the ILIAS Page around a question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getSpecificFeedbackOutput($active_id, $pass)
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
special template class to simplify handling of ITX/PEAR
isCorrectMatching($pair, $definition, $term)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
const CSS_CLASS_FEEDBACK_WRONG
Basic GUI class for assessment questions.
setErrorMessage($errormessage)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
setQuestionTabs()
Sets the ILIAS tabs for this question type.
saveTaxonomyAssignments()
addBackTab(ilTabsGUI $ilTabs)
getSolutionOutput( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
Get the question solution output.
Class for matching question definitions.
static initjQuery($a_tpl=null)
Init jQuery.
Interface ilGuiAnswerScoringAdjustable.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
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...
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
Interface ilGuiQuestionScoringAdjustable.
getTestOutput($active_id, $pass, $is_postponed=FALSE, $user_post_solution=FALSE, $inlineFeedback=false)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.