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';
37 parent::__construct();
38 include_once
"./Modules/TestQuestionPool/classes/class.assMatchingQuestion.php";
43 $this->
object->loadFromDb($id);
52 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
55 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
68 $this->
object->flushMatchingPairs();
69 $this->
object->flushTerms();
70 $this->
object->flushDefinitions();
73 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php';
74 foreach (
$_POST[
'terms'][
'answer'] as $index => $answer)
77 if (strlen( $_FILES[
'terms'][
'name'][
'image'][$index] ))
80 $name = $_FILES[
'terms'][
'name'][
'image'][$index];
81 if ($this->
object->setImageFile( $_FILES[
'terms'][
'tmp_name'][
'image'][$index],
82 $this->object->getEncryptedFilename( $name )
86 $filename = $this->
object->getEncryptedFilename( $name );
97 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php';
98 foreach (
$_POST[
'definitions'][
'answer'] as $index => $answer)
101 if (strlen( $_FILES[
'definitions'][
'name'][
'image'][$index] ))
104 $name = $_FILES[
'definitions'][
'name'][
'image'][$index];
105 if ($this->
object->setImageFile( $_FILES[
'definitions'][
'tmp_name'][
'image'][$index],
106 $this->object->getEncryptedFilename( $name )
110 $filename = $this->
object->getEncryptedFilename( $name );
117 $this->
object->addDefinition(
123 if (is_array(
$_POST[
'pairs'][
'points'] ))
125 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php';
126 foreach (
$_POST[
'pairs'][
'points'] as $index => $points)
128 $term_id =
$_POST[
'pairs'][
'term'][$index];
129 $definition_id =
$_POST[
'pairs'][
'definition'][$index];
130 $this->
object->addMatchingPair( $this->
object->getTermWithIdentifier( $term_id ),
131 $this->
object->getDefinitionWithIdentifier( $definition_id ),
140 if (!$this->
object->getSelfAssessmentEditingMode())
142 $this->
object->setShuffle(
$_POST[
"shuffle"] );
146 $this->
object->setShuffle( 1 );
148 $this->
object->setThumbGeometry(
$_POST[
"thumb_geometry"] );
149 $this->
object->setMatchingMode(
$_POST[
'matching_mode']);
161 $position = key(
$_POST[
'cmd'][
'removeimageterms']);
162 $this->
object->removeTermImage($position);
175 $position = key(
$_POST[
'cmd'][
'removeimagedefinitions']);
176 $this->
object->removeDefinitionImage($position);
183 $position = key(
$_POST[
"cmd"][
"addterms"]);
184 $this->
object->insertTerm($position+1);
191 $position = key(
$_POST[
"cmd"][
"removeterms"]);
192 $this->
object->deleteTerm($position);
199 $position = key(
$_POST[
"cmd"][
"adddefinitions"]);
200 $this->
object->insertDefinition($position+1);
207 $position = key(
$_POST[
"cmd"][
"removedefinitions"]);
208 $this->
object->deleteDefinition($position);
215 $position = key(
$_POST[
"cmd"][
"addpairs"]);
216 $this->
object->insertMatchingPair($position+1);
223 $position = key(
$_POST[
"cmd"][
"removepairs"]);
224 $this->
object->deleteMatchingPair($position);
233 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
235 $this->editForm = $form;
237 $form->setFormAction($this->ctrl->getFormAction($this));
239 $form->setMultipart(
true);
240 $form->setTableWidth(
"100%");
241 $form->setId(
"matching");
254 $form->setValuesByPost();
255 $errors = !$form->checkInput();
256 $form->setValuesByPost();
260 $terms = $form->getItemByPostVar(
'terms');
261 $terms->setAlert($this->lng->txt(
"msg_number_of_terms_too_low"));
264 if (
$errors) $checkonly =
false;
267 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
273 return $this->ctrl->getCmd() ==
'uploaddefinitions';
278 return $this->ctrl->getCmd() ==
'uploadterms';
298 $numDefinitions = count($form->
getItemByPostVar(
'definitions')->getValues());
300 if($numTerms >= $numDefinitions)
311 include_once
"./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
313 if ($this->
object->getSelfAssessmentEditingMode())
318 $definitions->setRequired(
true );
319 $definitions->setQuestionObject( $this->
object );
320 $definitions->setTextName( $this->lng->txt(
'definition_text' ) );
321 $definitions->setImageName( $this->lng->txt(
'definition_image' ) );
322 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
323 if (!count( $this->
object->getDefinitions() ))
327 $definitionvalues = $this->
object->getDefinitions();
328 $definitions->setValues( $definitionvalues );
331 $definitions->checkInput();
333 $form->
addItem( $definitions );
336 include_once
"./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
338 if ($this->
object->getSelfAssessmentEditingMode())
340 $terms->setRequired(
true );
341 $terms->setQuestionObject( $this->
object );
342 $terms->setTextName( $this->lng->txt(
'term_text' ) );
343 $terms->setImageName( $this->lng->txt(
'term_image' ) );
344 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
345 if (!count( $this->
object->getTerms() ))
347 $termvalues = $this->
object->getTerms();
348 $terms->setValues( $termvalues );
351 $terms->checkInput();
356 include_once
"./Modules/TestQuestionPool/classes/class.ilMatchingPairWizardInputGUI.php";
359 $pairs->setTerms( $this->
object->getTerms() );
360 $pairs->setDefinitions( $this->
object->getDefinitions() );
361 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
362 if (count( $this->
object->getMatchingPairs() ) == 0)
364 $this->
object->addMatchingPair(
new assAnswerMatchingPair($termvalues[0], $definitionvalues[0], 0) );
366 $pairs->setPairs( $this->
object->getMatchingPairs() );
376 $hidden->setValue($matchingtype);
379 if (!$this->
object->getSelfAssessmentEditingMode())
382 $shuffle =
new ilSelectInputGUI($this->lng->txt(
"shuffle_answers" ),
"shuffle");
383 $shuffle_options =
array(
384 0 => $this->lng->txt(
"no" ),
385 1 => $this->lng->txt(
"matching_shuffle_terms_definitions" ),
386 2 => $this->lng->txt(
"matching_shuffle_terms" ),
387 3 => $this->lng->txt(
"matching_shuffle_definitions" )
389 $shuffle->setOptions( $shuffle_options );
390 $shuffle->setValue($this->
object->getShuffle() != null ? $this->
object->getShuffle() : 1);
391 $shuffle->setRequired( FALSE );
394 $geometry =
new ilNumberInputGUI($this->lng->txt(
"thumb_geometry" ),
"thumb_geometry");
396 $geometry->setRequired(
true );
397 $geometry->setMaxLength( 6 );
398 $geometry->setMinValue( 20 );
399 $geometry->setSize( 6 );
400 $geometry->setInfo( $this->lng->txt(
"thumb_geometry_info" ) );
405 $mode =
new ilRadioGroupInputGUI($this->lng->txt(
'qpl_qst_inp_matching_mode'),
'matching_mode');
411 $mode->addOption($modeONEonONE);
416 $mode->addOption($modeALLonALL);
439 $graphicalOutput = FALSE,
440 $result_output = FALSE,
441 $show_question_only = TRUE,
442 $show_feedback = FALSE,
443 $show_correct_solution = FALSE,
444 $show_manual_scoring = FALSE,
445 $show_question_text = TRUE
449 include_once
"./Services/UICore/classes/class.ilTemplate.php";
450 $template =
new ilTemplate(
"tpl.il_as_qpl_matching_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
451 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
453 $solutions =
array();
454 if (($active_id > 0) && (!$show_correct_solution))
456 include_once
"./Modules/Test/classes/class.ilObjTest.php";
457 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
458 $solution_script .=
"";
462 foreach ($this->
object->getMaximumScoringMatchingPairs() as $pair)
464 $solutions[] =
array(
465 "value1" => $pair->term->identifier,
466 "value2" => $pair->definition->identifier,
467 'points' => $pair->points
474 foreach ($solutions as $solution)
476 $definition = $this->
object->getDefinitionWithIdentifier($solution[
'value2']);
477 $term = $this->
object->getTermWithIdentifier($solution[
'value1']);
478 $points = $solution[
'points'];
480 if (is_object($definition))
482 if (strlen($definition->picture))
484 if( strlen($definition->text) )
486 $template->setCurrentBlock(
'definition_image_text');
488 $template->parseCurrentBlock();
491 require_once
'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
493 $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->picture
496 $template->setCurrentBlock(
'definition_image');
497 $template->setVariable(
'ANSWER_IMAGE_URL', $answerImageSrc);
500 $template->setVariable(
'URL_PREVIEW', $this->
object->getImagePathWeb() . $definition->picture);
501 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
503 $template->parseCurrentBlock();
507 $template->setCurrentBlock(
'definition_text');
508 $template->setVariable(
"DEFINITION", $this->
object->prepareTextareaOutput($definition->text, TRUE));
509 $template->parseCurrentBlock();
512 if (is_object($term))
514 if (strlen($term->picture))
516 if( strlen($term->text) )
518 $template->setCurrentBlock(
'term_image_text');
520 $template->parseCurrentBlock();
523 require_once
'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
525 $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->picture
528 $template->setCurrentBlock(
'term_image');
529 $template->setVariable(
'ANSWER_IMAGE_URL', $answerImageSrc);
532 $template->setVariable(
'URL_PREVIEW', $this->
object->getImagePathWeb() . $term->picture);
533 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
535 $template->parseCurrentBlock();
539 $template->setCurrentBlock(
'term_text');
540 $template->setVariable(
"TERM", $this->
object->prepareTextareaOutput($term->text, TRUE));
541 $template->parseCurrentBlock();
545 if (($active_id > 0) && (!$show_correct_solution))
547 if ($graphicalOutput)
551 foreach ($this->
object->getMatchingPairs() as $pair)
561 $template->setCurrentBlock(
"icon_ok");
563 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
564 $template->parseCurrentBlock();
568 $template->setCurrentBlock(
"icon_ok");
570 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
571 $template->parseCurrentBlock();
578 $resulttext = ($points == 1) ?
"(%s " . $this->lng->txt(
"point") .
")" :
"(%s " . $this->lng->txt(
"points") .
")";
579 $template->setCurrentBlock(
"result_output");
580 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $points));
581 $template->parseCurrentBlock();
584 $template->setCurrentBlock(
"row");
585 $template->setVariable(
"TEXT_MATCHES", $this->lng->txt(
"matches"));
586 $template->parseCurrentBlock();
589 $questiontext = $this->
object->getQuestion();
590 if ($show_question_text==
true)
592 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($questiontext, TRUE));
595 $questionoutput = $template->get();
603 $feedback .= strlen($fb) ? $fb :
'';
607 $feedback .= strlen($fb) ? $fb :
'';
609 if (strlen($feedback))
615 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
616 $solutiontemplate->setVariable(
"FEEDBACK", $this->
object->prepareTextareaOutput( $feedback,
true ));
619 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
621 $solutionoutput = $solutiontemplate->get();
622 if (!$show_question_only)
627 return $solutionoutput;
630 public function getPreview($show_question_only = FALSE, $showInlineFeedback =
false)
636 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
639 $this->tpl->addJavaScript(
'./Services/jQuery/js/jquery.ui.touch-punch.min.js');
643 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/jquery-ui-1-10-3-fixed.js');
645 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilMatchingQuestion.js');
648 $template =
new ilTemplate(
"tpl.il_as_qpl_matching_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
650 foreach($solutions as $defId => $terms)
652 foreach($terms as $termId)
654 $template->setCurrentBlock(
"matching_data");
655 $template->setVariable(
"DEFINITION_ID", $defId);
656 $template->setVariable(
"TERM_ID", $termId);
657 $template->parseCurrentBlock();
662 $terms = $this->
object->getTerms();
663 $definitions = $this->
object->getDefinitions();
664 switch ($this->
object->getShuffle())
667 $seed = $this->
object->getShuffler()->getSeed();
668 $this->
object->getShuffler()->setSeed($seed.
'1');
669 $terms = $this->
object->getShuffler()->shuffle($terms);
670 $this->
object->getShuffler()->setSeed($seed.
'2');
671 $definitions = $this->
object->getShuffler()->shuffle($definitions);
672 $this->
object->getShuffler()->setSeed($seed);
675 $terms = $this->
object->getShuffler()->shuffle($terms);
678 $definitions = $this->
object->getShuffler()->shuffle($definitions);
684 foreach ($definitions as $definition)
686 if (strlen($definition->picture))
688 $template->setCurrentBlock(
"definition_picture");
689 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
690 $template->setVariable(
"IMAGE_HREF", $this->
object->getImagePathWeb() . $definition->picture);
691 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->picture;
692 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $definition->picture;
693 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
694 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
695 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
696 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
697 $template->setVariable(
"TEXT_DEFINITION", (strlen($definition->text)) ? $this->object->prepareTextareaOutput($definition->text, TRUE,
true) :
'');
698 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
700 $template->parseCurrentBlock();
704 $template->setCurrentBlock(
"definition_text");
705 $template->setVariable(
"DEFINITION", $this->
object->prepareTextareaOutput($definition->text, TRUE,
true));
706 $template->parseCurrentBlock();
709 $template->setCurrentBlock(
"droparea");
710 $template->setVariable(
"ID_DROPAREA", $definition->identifier);
711 $template->setVariable(
"QUESTION_ID", $this->
object->getId());
712 $template->parseCurrentBlock();
714 $template->setCurrentBlock(
"definition_data");
715 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
716 $template->parseCurrentBlock();
721 foreach ($terms as $term)
723 if (strlen($term->picture))
725 $template->setCurrentBlock(
"term_picture");
726 $template->setVariable(
"TERM_ID", $term->identifier);
727 $template->setVariable(
"IMAGE_HREF", $this->
object->getImagePathWeb() . $term->picture);
728 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->picture;
729 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $term->picture;
730 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
731 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
732 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
733 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
734 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
735 $template->setVariable(
"TEXT_TERM", (strlen($term->text)) ? $this->object->prepareTextareaOutput($term->text, TRUE,
true) :
'');
737 $template->parseCurrentBlock();
741 $template->setCurrentBlock(
"term_text");
742 $template->setVariable(
"TERM_TEXT", $this->
object->prepareTextareaOutput($term->text, TRUE,
true));
743 $template->parseCurrentBlock();
745 $template->setCurrentBlock(
"draggable");
746 $template->setVariable(
"ID_DRAGGABLE", $term->identifier);
747 $template->parseCurrentBlock();
749 $template->setCurrentBlock(
"term_data");
750 $template->setVariable(
"TERM_ID", $term->identifier);
751 $template->parseCurrentBlock();
754 $template->setVariable(
'MATCHING_MODE', $this->
object->getMatchingMode());
756 $template->setVariable(
"RESET_BUTTON", $this->lng->txt(
"reset_terms"));
758 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
760 $questionoutput = $template->get();
762 if (!$show_question_only)
768 return $questionoutput;
776 protected function sortDefinitionsBySolution(
array $solution,
array $definitions)
779 $handled_defintions =
array();
780 foreach($solution as $solution_values)
782 $id = $solution_values[
'value2'];
783 if(!isset($handled_defintions[$id]))
785 $neworder[] = $this->
object->getDefinitionWithIdentifier($id);
786 $handled_defintions[$id] = $id;
790 foreach($definitions as $definition)
795 if(!isset($handled_defintions[$definition->identifier]))
797 $neworder[] = $definition;
805 function getTestOutput($active_id,
$pass, $is_postponed = FALSE, $user_post_solution = FALSE, $inlineFeedback =
false)
810 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
813 $this->tpl->addJavaScript(
'./Services/jQuery/js/jquery.ui.touch-punch.min.js');
817 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/jquery-ui-1-10-3-fixed.js');
819 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilMatchingQuestion.js');
822 $template =
new ilTemplate(
"tpl.il_as_qpl_matching_output.html",
true,
true,
"Modules/TestQuestionPool");
828 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 829 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 831 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 834 if (is_array($user_post_solution))
836 $solutions =
array();
837 foreach ($user_post_solution[
'matching'][$this->
object->getId()] as $definition => $term)
839 array_push($solutions,
array(
"value1" => $term,
"value2" => $definition));
845 $solutions = $this->
object->getTestOutputSolutions($active_id,
$pass);
850 foreach ($solutions as $idx => $solution_value)
852 if (($solution_value[
"value2"] > -1) && ($solution_value[
"value1"] > -1))
854 $template->setCurrentBlock(
"matching_data");
855 $template->setVariable(
"TERM_ID", $solution_value[
"value1"]);
856 $template->setVariable(
"DEFINITION_ID", $solution_value[
"value2"]);
857 $template->parseCurrentBlock();
864 $terms = $this->
object->getTerms();
865 $definitions = $this->
object->getDefinitions();
866 switch ($this->
object->getShuffle())
869 $seed = $this->
object->getShuffler()->getSeed();
870 $this->
object->getShuffler()->setSeed($seed.
'1');
871 $terms = $this->
object->getShuffler()->shuffle($terms);
872 if (count($solutions))
874 $definitions = $this->sortDefinitionsBySolution($solutions, $definitions);
878 $this->
object->getShuffler()->setSeed($seed.
'2');
879 $definitions = $this->
object->getShuffler()->shuffle($definitions);
881 $this->
object->getShuffler()->setSeed($seed);
884 $terms = $this->
object->getShuffler()->shuffle($terms);
887 if (count($solutions))
889 $definitions = $this->sortDefinitionsBySolution($solutions, $definitions);
893 $definitions = $this->
object->getShuffler()->shuffle($definitions);
900 foreach ($definitions as $definition)
902 if (strlen($definition->picture))
904 $template->setCurrentBlock(
"definition_picture");
905 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
906 $template->setVariable(
"IMAGE_HREF", $this->
object->getImagePathWeb() . $definition->picture);
907 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->picture;
908 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $definition->picture;
909 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
910 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
911 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
912 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
913 $template->setVariable(
"TEXT_DEFINITION", (strlen($definition->text)) ? $this->object->prepareTextareaOutput($definition->text,
true,
true) :
'');
914 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
916 $template->parseCurrentBlock();
920 $template->setCurrentBlock(
"definition_text");
921 $template->setVariable(
"DEFINITION", $this->
object->prepareTextareaOutput($definition->text,
true,
true));
922 $template->parseCurrentBlock();
925 $template->setCurrentBlock(
"droparea");
926 $template->setVariable(
"ID_DROPAREA", $definition->identifier);
927 $template->setVariable(
"QUESTION_ID", $this->
object->getId());
928 $template->parseCurrentBlock();
930 $template->setCurrentBlock(
"definition_data");
931 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
932 $template->parseCurrentBlock();
937 foreach ($terms as $term)
939 if (strlen($term->picture))
941 $template->setCurrentBlock(
"term_picture");
942 $template->setVariable(
"TERM_ID", $term->identifier);
943 $template->setVariable(
"IMAGE_HREF", $this->
object->getImagePathWeb() . $term->picture);
944 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->picture;
945 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $term->picture;
946 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
947 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
948 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
949 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
950 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
951 $template->setVariable(
"TEXT_TERM", (strlen($term->text)) ? $this->object->prepareTextareaOutput($term->text,
true,
true) :
'');
953 $template->parseCurrentBlock();
957 $template->setCurrentBlock(
"term_text");
958 $template->setVariable(
"TERM_TEXT", $this->
object->prepareTextareaOutput($term->text,
true,
true));
959 $template->parseCurrentBlock();
961 $template->setCurrentBlock(
"draggable");
962 $template->setVariable(
"ID_DRAGGABLE", $term->identifier);
963 $template->parseCurrentBlock();
965 $template->setCurrentBlock(
'term_data');
966 $template->setVariable(
'TERM_ID', $term->identifier);
967 $template->parseCurrentBlock();
970 $template->setVariable(
'MATCHING_MODE', $this->
object->getMatchingMode());
972 $template->setVariable(
"RESET_BUTTON", $this->lng->txt(
"reset_terms"));
974 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
976 return $this->
outQuestionPage(
"", $is_postponed, $active_id, $template->get());
1000 global $rbacsystem, $ilTabs;
1002 $ilTabs->clearTargets();
1004 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
1005 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1006 $q_type = $this->
object->getQuestionType();
1008 if (strlen($q_type))
1010 $classname = $q_type .
"GUI";
1011 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
1012 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
1017 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
1020 $ilTabs->addTarget(
"edit_page",
1021 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
1022 array(
"edit",
"insert",
"exec_pg"),
1023 "",
"", $force_active);
1029 $force_active =
false;
1030 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
1033 if ($classname)
$url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
1035 $ilTabs->addTarget(
"edit_question",
1037 array(
"editQuestion",
"save",
"saveEdit",
"removeimageterms",
"uploadterms",
"removeimagedefinitions",
"uploaddefinitions",
1038 "addpairs",
"removepairs",
"addterms",
"removeterms",
"adddefinitions",
"removedefinitions",
"originalSyncForm"),
1039 $classname,
"", $force_active);
1054 $ilTabs->addTarget(
"statistics",
1055 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
1056 array(
"assessment"),
1065 $userSolution = $this->
object->fetchIndexedValuesFromValuePairs(
1066 $this->
object->getSolutionValues($active_id,
$pass)
1069 $matches = array_values($this->
object->matchingpairs);
1071 if( !$this->
object->feedbackOBJ->specificAnswerFeedbackExists($matches) )
1076 $feedback =
'<table class="test_specific_feedback"><tbody>';
1078 foreach ($matches as $idx => $ans)
1082 if( !isset($userSolution[$ans->definition->identifier]) )
1087 if( !is_array($userSolution[$ans->definition->identifier]) )
1092 if( !in_array($ans->term->identifier, $userSolution[$ans->definition->identifier]) )
1098 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
1099 $this->
object->getId(), $idx
1101 $feedback .=
'<tr><td>"' . $ans->definition->text .
'" ' . $this->lng->txt(
"matches") .
' "';
1102 $feedback .= $ans->term->text .
'"</td><td>';
1103 $feedback .= $fb .
'</td> </tr>';
1106 $feedback .=
'</tbody></table>';
1107 return $this->
object->prepareTextareaOutput($feedback, TRUE);
1153 if( !($pair->points > 0) )
1158 if( !is_object($term) )
1163 if( $pair->definition->identifier != $definition->identifier )
1168 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)
{}
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.
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
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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
static signFile($path_to_file)
Basic GUI class for assessment questions.
setErrorMessage($errormessage)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
setQuestionTabs()
Sets the ILIAS tabs for this question type.
saveTaxonomyAssignments()
Create new PHPExcel object
obj_idprivate
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...
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.