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());
289 $numDefinitions = count($form->
getItemByPostVar(
'definitions')->getValues());
291 if($numTerms >= $numDefinitions)
302 include_once
"./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
304 if ($this->object->getSelfAssessmentEditingMode())
309 $definitions->setRequired(
true );
310 $definitions->setQuestionObject( $this->
object );
311 $definitions->setTextName( $this->lng->txt(
'definition_text' ) );
312 $definitions->setImageName( $this->lng->txt(
'definition_image' ) );
313 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
314 if (!count( $this->object->getDefinitions() ))
318 $definitionvalues = $this->
object->getDefinitions();
319 $definitions->setValues( $definitionvalues );
320 $definitions->checkInput();
321 $form->
addItem( $definitions );
324 include_once
"./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
326 if ($this->object->getSelfAssessmentEditingMode())
328 $terms->setRequired(
true );
329 $terms->setQuestionObject( $this->
object );
330 $terms->setTextName( $this->lng->txt(
'term_text' ) );
331 $terms->setImageName( $this->lng->txt(
'term_image' ) );
332 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
333 if (!count( $this->object->getTerms() ))
335 $termvalues = $this->
object->getTerms();
336 $terms->setValues( $termvalues );
337 $terms->checkInput();
341 include_once
"./Modules/TestQuestionPool/classes/class.ilMatchingPairWizardInputGUI.php";
344 $pairs->setTerms( $this->object->getTerms() );
345 $pairs->setDefinitions( $this->object->getDefinitions() );
346 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
347 if (count( $this->object->getMatchingPairs() ) == 0)
349 $this->
object->addMatchingPair(
new assAnswerMatchingPair($termvalues[0], $definitionvalues[0], 0) );
351 $pairs->setPairs( $this->object->getMatchingPairs() );
361 $hidden->setValue($matchingtype);
364 if (!$this->object->getSelfAssessmentEditingMode())
367 $shuffle =
new ilSelectInputGUI($this->lng->txt(
"shuffle_answers" ),
"shuffle");
368 $shuffle_options = array(
369 0 => $this->lng->txt(
"no" ),
370 1 => $this->lng->txt(
"matching_shuffle_terms_definitions" ),
371 2 => $this->lng->txt(
"matching_shuffle_terms" ),
372 3 => $this->lng->txt(
"matching_shuffle_definitions" )
375 $shuffle->setValue($this->object->getShuffle() != null ? $this->
object->getShuffle() : 1);
376 $shuffle->setRequired( FALSE );
379 $geometry =
new ilNumberInputGUI($this->lng->txt(
"thumb_geometry" ),
"thumb_geometry");
380 $geometry->
setValue( $this->object->getThumbGeometry() );
381 $geometry->setRequired(
true );
382 $geometry->setMaxLength( 6 );
383 $geometry->setMinValue( 20 );
384 $geometry->setSize( 6 );
385 $geometry->setInfo( $this->lng->txt(
"thumb_geometry_info" ) );
390 $mode =
new ilRadioGroupInputGUI($this->lng->txt(
'qpl_qst_inp_matching_mode'),
'matching_mode');
396 $mode->addOption($modeONEonONE);
401 $mode->addOption($modeALLonALL);
403 $mode->
setValue($this->object->getMatchingMode());
424 $graphicalOutput = FALSE,
425 $result_output = FALSE,
426 $show_question_only = TRUE,
427 $show_feedback = FALSE,
428 $show_correct_solution = FALSE,
429 $show_manual_scoring = FALSE,
430 $show_question_text = TRUE
434 include_once
"./Services/UICore/classes/class.ilTemplate.php";
435 $template =
new ilTemplate(
"tpl.il_as_qpl_matching_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
436 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
438 $solutions = array();
439 if (($active_id > 0) && (!$show_correct_solution))
441 include_once
"./Modules/Test/classes/class.ilObjTest.php";
442 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
443 $solution_script .=
"";
447 foreach ($this->object->getMaximumScoringMatchingPairs() as $pair)
449 $solutions[] = array(
450 "value1" => $pair->term->identifier,
451 "value2" => $pair->definition->identifier,
452 'points' => $pair->points
459 foreach ($solutions as $solution)
461 $definition = $this->
object->getDefinitionWithIdentifier($solution[
'value2']);
462 $term = $this->
object->getTermWithIdentifier($solution[
'value1']);
463 $points = $solution[
'points'];
465 if (is_object($definition))
467 if (strlen($definition->picture))
469 if( strlen($definition->text) )
471 $template->setCurrentBlock(
'definition_image_text');
473 $template->parseCurrentBlock();
476 $template->setCurrentBlock(
'definition_image');
477 $template->setVariable(
'ANSWER_IMAGE_URL', $this->object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->picture);
480 $template->setVariable(
'URL_PREVIEW', $this->object->getImagePathWeb() . $definition->picture);
481 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
483 $template->parseCurrentBlock();
487 $template->setCurrentBlock(
'definition_text');
488 $template->setVariable(
"DEFINITION", $this->object->prepareTextareaOutput($definition->text, TRUE));
489 $template->parseCurrentBlock();
492 if (is_object($term))
494 if (strlen($term->picture))
496 if( strlen($term->text) )
498 $template->setCurrentBlock(
'term_image_text');
500 $template->parseCurrentBlock();
503 $template->setCurrentBlock(
'term_image');
504 $template->setVariable(
'ANSWER_IMAGE_URL', $this->object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->picture);
507 $template->setVariable(
'URL_PREVIEW', $this->object->getImagePathWeb() . $term->picture);
508 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
510 $template->parseCurrentBlock();
514 $template->setCurrentBlock(
'term_text');
515 $template->setVariable(
"TERM", $this->object->prepareTextareaOutput($term->text, TRUE));
516 $template->parseCurrentBlock();
520 if (($active_id > 0) && (!$show_correct_solution))
522 if ($graphicalOutput)
526 foreach ($this->object->getMatchingPairs() as $pair)
536 $template->setCurrentBlock(
"icon_ok");
538 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
539 $template->parseCurrentBlock();
543 $template->setCurrentBlock(
"icon_ok");
545 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
546 $template->parseCurrentBlock();
553 $resulttext = ($points == 1) ?
"(%s " . $this->lng->txt(
"point") .
")" :
"(%s " . $this->lng->txt(
"points") .
")";
554 $template->setCurrentBlock(
"result_output");
555 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $points));
556 $template->parseCurrentBlock();
559 $template->setCurrentBlock(
"row");
560 $template->setVariable(
"TEXT_MATCHES", $this->lng->txt(
"matches"));
561 $template->parseCurrentBlock();
564 $questiontext = $this->
object->getQuestion();
565 if ($show_question_text==
true)
567 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
570 $questionoutput = $template->get();
576 $feedback .= strlen($fb) ? $fb :
'';
579 $feedback .= strlen($fb) ? $fb :
'';
581 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback,
true));
583 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
585 $solutionoutput = $solutiontemplate->get();
586 if (!$show_question_only)
591 return $solutionoutput;
594 public function getPreview($show_question_only = FALSE, $showInlineFeedback =
false)
600 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
604 $this->tpl->addJavaScript(
'./Services/jQuery/js/jquery.ui.touch-punch.min.js');
608 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/jquery-ui-1-10-3-fixed.js');
611 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilMatchingQuestion.js');
614 $template =
new ilTemplate(
"tpl.il_as_qpl_matching_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
616 foreach($solutions as $defId => $terms)
618 foreach($terms as $termId)
620 $template->setCurrentBlock(
"matching_data");
621 $template->setVariable(
"DEFINITION_ID", $defId);
622 $template->setVariable(
"TERM_ID", $termId);
623 $template->parseCurrentBlock();
628 $terms = $this->
object->getTerms();
629 $definitions = $this->
object->getDefinitions();
630 switch ($this->object->getShuffle())
633 $terms = $this->
object->pcArrayShuffle($terms);
634 $definitions = $this->
object->pcArrayShuffle($definitions);
637 $terms = $this->
object->pcArrayShuffle($terms);
640 $definitions = $this->
object->pcArrayShuffle($definitions);
646 foreach ($definitions as $definition)
648 if (strlen($definition->picture))
650 $template->setCurrentBlock(
"definition_picture");
651 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
652 $template->setVariable(
"IMAGE_HREF", $this->object->getImagePathWeb() . $definition->picture);
653 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->picture;
654 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $definition->picture;
655 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
656 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
657 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
658 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
659 $template->setVariable(
"TEXT_DEFINITION", (strlen($definition->text)) ? $this->object->prepareTextareaOutput($definition->text, TRUE) :
'');
660 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
662 $template->parseCurrentBlock();
666 $template->setCurrentBlock(
"definition_text");
667 $template->setVariable(
"DEFINITION", $this->object->prepareTextareaOutput($definition->text, TRUE));
668 $template->parseCurrentBlock();
671 $template->setCurrentBlock(
"droparea");
672 $template->setVariable(
"ID_DROPAREA", $definition->identifier);
673 $template->setVariable(
"QUESTION_ID", $this->object->getId());
674 $template->parseCurrentBlock();
676 $template->setCurrentBlock(
"definition_data");
677 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
678 $template->parseCurrentBlock();
683 foreach ($terms as $term)
685 if (strlen($term->picture))
687 $template->setCurrentBlock(
"term_picture");
688 $template->setVariable(
"TERM_ID", $term->identifier);
689 $template->setVariable(
"IMAGE_HREF", $this->object->getImagePathWeb() . $term->picture);
690 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->picture;
691 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $term->picture;
692 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
693 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
694 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
695 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
696 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
697 $template->setVariable(
"TEXT_TERM", (strlen($term->text)) ? $this->object->prepareTextareaOutput($term->text, TRUE) :
'');
699 $template->parseCurrentBlock();
703 $template->setCurrentBlock(
"term_text");
704 $template->setVariable(
"TERM_TEXT", $this->object->prepareTextareaOutput($term->text, TRUE));
705 $template->parseCurrentBlock();
707 $template->setCurrentBlock(
"draggable");
708 $template->setVariable(
"ID_DRAGGABLE", $term->identifier);
709 $template->parseCurrentBlock();
711 $template->setCurrentBlock(
"term_data");
712 $template->setVariable(
"TERM_ID", $term->identifier);
713 $template->parseCurrentBlock();
716 $template->setVariable(
'MATCHING_MODE', $this->object->getMatchingMode());
718 $template->setVariable(
"RESET_BUTTON", $this->lng->txt(
"reset_terms"));
720 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
722 $questionoutput = $template->get();
724 if (!$show_question_only)
730 return $questionoutput;
738 protected function sortDefinitionsBySolution(array $solution, array $definitions)
741 $handled_defintions = array();
742 foreach($solution as $solution_values)
744 $id = $solution_values[
'value2'];
745 if(!isset($handled_defintions[$id]))
747 $neworder[] = $this->
object->getDefinitionWithIdentifier($id);
748 $handled_defintions[$id] = $id;
752 foreach($definitions as $definition)
757 if(!isset($handled_defintions[$definition->identifier]))
759 $neworder[] = $definition;
770 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
774 $this->tpl->addJavaScript(
'./Services/jQuery/js/jquery.ui.touch-punch.min.js');
778 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/jquery-ui-1-10-3-fixed.js');
781 $this->tpl->addJavaScript(
'Modules/TestQuestionPool/js/ilMatchingQuestion.js');
784 $template =
new ilTemplate(
"tpl.il_as_qpl_matching_output.html",
true,
true,
"Modules/TestQuestionPool");
789 include_once
"./Modules/Test/classes/class.ilObjTest.php";
794 if (is_array($user_post_solution))
796 $solutions = array();
797 foreach ($user_post_solution[
'matching'][$this->object->getId()] as $definition => $term)
799 array_push($solutions, array(
"value1" => $term,
"value2" => $definition));
804 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
808 foreach ($solutions as $idx => $solution_value)
810 if (($solution_value[
"value2"] > -1) && ($solution_value[
"value1"] > -1))
812 $template->setCurrentBlock(
"matching_data");
813 $template->setVariable(
"TERM_ID", $solution_value[
"value1"]);
814 $template->setVariable(
"DEFINITION_ID", $solution_value[
"value2"]);
815 $template->parseCurrentBlock();
822 $terms = $this->
object->getTerms();
823 $definitions = $this->
object->getDefinitions();
824 switch ($this->object->getShuffle())
827 $terms = $this->
object->pcArrayShuffle($terms);
828 if (count($solutions))
830 $definitions = $this->sortDefinitionsBySolution($solutions, $definitions);
834 $definitions = $this->
object->pcArrayShuffle($definitions);
838 $terms = $this->
object->pcArrayShuffle($terms);
841 if (count($solutions))
843 $definitions = $this->sortDefinitionsBySolution($solutions, $definitions);
847 $definitions = $this->
object->pcArrayShuffle($definitions);
854 foreach ($definitions as $definition)
856 if (strlen($definition->picture))
858 $template->setCurrentBlock(
"definition_picture");
859 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
860 $template->setVariable(
"IMAGE_HREF", $this->object->getImagePathWeb() . $definition->picture);
861 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $definition->picture;
862 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $definition->picture;
863 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
864 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
865 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
866 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
867 $template->setVariable(
"TEXT_DEFINITION", (strlen($definition->text)) ?
ilUtil::prepareFormOutput($definition->text) :
'');
868 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
870 $template->parseCurrentBlock();
874 $template->setCurrentBlock(
"definition_text");
875 $template->setVariable(
"DEFINITION", $this->object->prepareTextareaOutput($definition->text,
true));
876 $template->parseCurrentBlock();
879 $template->setCurrentBlock(
"droparea");
880 $template->setVariable(
"ID_DROPAREA", $definition->identifier);
881 $template->setVariable(
"QUESTION_ID", $this->object->getId());
882 $template->parseCurrentBlock();
884 $template->setCurrentBlock(
"definition_data");
885 $template->setVariable(
"DEFINITION_ID", $definition->identifier);
886 $template->parseCurrentBlock();
891 foreach ($terms as $term)
893 if (strlen($term->picture))
895 $template->setCurrentBlock(
"term_picture");
896 $template->setVariable(
"TERM_ID", $term->identifier);
897 $template->setVariable(
"IMAGE_HREF", $this->object->getImagePathWeb() . $term->picture);
898 $thumbweb = $this->
object->getImagePathWeb() . $this->
object->getThumbPrefix() . $term->picture;
899 $thumb = $this->
object->getImagePath() . $this->
object->getThumbPrefix() . $term->picture;
900 if (!@file_exists($thumb)) $this->
object->rebuildThumbnails();
901 $template->setVariable(
"THUMBNAIL_HREF", $thumbweb);
902 $template->setVariable(
"THUMB_ALT", $this->lng->txt(
"image"));
903 $template->setVariable(
"THUMB_TITLE", $this->lng->txt(
"image"));
904 $template->setVariable(
"TEXT_PREVIEW", $this->lng->txt(
'preview'));
907 $template->parseCurrentBlock();
911 $template->setCurrentBlock(
"term_text");
912 $template->setVariable(
"TERM_TEXT", $this->object->prepareTextareaOutput($term->text,
true));
913 $template->parseCurrentBlock();
915 $template->setCurrentBlock(
"draggable");
916 $template->setVariable(
"ID_DRAGGABLE", $term->identifier);
917 $template->parseCurrentBlock();
919 $template->setCurrentBlock(
'term_data');
920 $template->setVariable(
'TERM_ID', $term->identifier);
921 $template->parseCurrentBlock();
924 $template->setVariable(
'MATCHING_MODE', $this->object->getMatchingMode());
926 $template->setVariable(
"RESET_BUTTON", $this->lng->txt(
"reset_terms"));
928 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
930 return $this->
outQuestionPage(
"", $is_postponed, $active_id, $template->get());
954 global $rbacsystem, $ilTabs;
956 $ilTabs->clearTargets();
958 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
959 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
960 $q_type = $this->
object->getQuestionType();
964 $classname = $q_type .
"GUI";
965 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
966 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
971 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
974 $ilTabs->addTarget(
"edit_page",
975 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
976 array(
"edit",
"insert",
"exec_pg"),
977 "",
"", $force_active);
983 $force_active =
false;
984 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
987 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
989 $ilTabs->addTarget(
"edit_question",
991 array(
"editQuestion",
"save",
"saveEdit",
"removeimageterms",
"uploadterms",
"removeimagedefinitions",
"uploaddefinitions",
992 "addpairs",
"removepairs",
"addterms",
"removeterms",
"adddefinitions",
"removedefinitions",
"originalSyncForm"),
993 $classname,
"", $force_active);
1008 $ilTabs->addTarget(
"statistics",
1009 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
1010 array(
"assessment"),
1019 $matches = array_values($this->object->getMaximumScoringMatchingPairs());
1021 if( !$this->object->feedbackOBJ->specificAnswerFeedbackExists($matches) )
1026 $feedback =
'<table class="test_specific_feedback"><tbody>';
1028 foreach ($matches as $idx => $ans)
1030 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
1031 $this->object->getId(), $idx
1033 $feedback .=
'<tr><td>"' . $ans->definition->text .
'" ' . $this->lng->txt(
"matches") .
' "';
1034 $feedback .= $ans->term->text .
'"</td><td>';
1035 $feedback .= $fb .
'</td> </tr>';
1038 $feedback .=
'</tbody></table>';
1039 return $this->
object->prepareTextareaOutput($feedback, TRUE);
1085 if( !($pair->points > 0) )
1090 if( !is_object($term) )
1095 if( $pair->definition->identifier != $definition->identifier )
1100 if( $pair->term->identifier != $term->identifier )
Class for matching question terms.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
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
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
const MATCHING_MODE_1_ON_1
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
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
Basic GUI class for assessment questions.
setErrorMessage($errormessage)
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
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()
getTestOutput($active_id, $pass=NULL, $is_postponed=FALSE, $user_post_solution=FALSE)
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.
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.