ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.assTextQuestionGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
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';
8 
22 class assTextQuestionGUI extends assQuestionGUI //implements ilGuiQuestionScoringAdjustable, ilGuiAnswerScoringAdjustable
23 {
31  public function __construct($id = -1)
32  {
34  include_once "./Modules/TestQuestionPool/classes/class.assTextQuestion.php";
35  $this->object = new assTextQuestion();
36  if ($id >= 0)
37  {
38  $this->object->loadFromDb($id);
39  }
40  }
41 
49  public function writePostData($always = false)
50  {
51  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
52  if (!$hasErrors)
53  {
57  $this->saveTaxonomyAssignments();
58  return 0;
59  }
60  return 1;
61  }
62 
68  public function editQuestion($checkonly = FALSE)
69  {
70  $save = $this->isSaveCommand();
71  $this->getQuestionTemplate();
72 
73  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
74  $form = new ilPropertyFormGUI();
75  $form->setFormAction($this->ctrl->getFormAction($this));
76  $form->setTitle($this->outQuestionType());
77  $form->setMultipart(TRUE);
78  $form->setTableWidth("100%");
79  $form->setId("asstextquestion");
80 
81  $this->addBasicQuestionFormProperties( $form );
82  $this->populateQuestionSpecificFormPart( $form );
83  $this->populateAnswerSpecificFormPart( $form );
84 
85 
86  $this->populateTaxonomyFormSection($form);
87 
88  $this->addQuestionFormCommandButtons($form);
89 
90  $errors = false;
91 
92  if ($save)
93  {
94  $form->setValuesByPost();
95  $errors = !$form->checkInput();
96  $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
97  if ($errors) $checkonly = false;
98  }
99 
100  if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
101  return $errors;
102  }
103 
104  private static function buildAnswerTextOnlyArray($answers)
105  {
106  $answerTexts = array();
107 
108  foreach($answers as $answer)
109  {
110  $answerTexts[] = $answer->getAnswertext();
111  }
112 
113  return $answerTexts;
114  }
115 
117  {
118  if ($this->object->getMaxNumOfChars() > 0)
119  {
120  $this->tpl->addBlockFile("CONTENT_BLOCK", "charcounter", "tpl.charcounter.html", "Modules/TestQuestionPool");
121  $this->tpl->setCurrentBlock("charcounter");
122  $this->tpl->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
123  $this->tpl->parseCurrentBlock();
124  }
125  }
126 
127  function outQuestionForTest($formaction, $active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
128  {
129  $test_output = $this->getTestOutput($active_id, $pass, $is_postponed, $use_post_solutions);
130  $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
131  $this->tpl->setVariable("FORMACTION", $formaction);
132  include_once "./Services/RTE/classes/class.ilRTE.php";
133  $rtestring = ilRTE::_getRTEClassname();
134  include_once "./Services/RTE/classes/class.$rtestring.php";
135  $rte = new $rtestring();
136  include_once "./Services/Object/classes/class.ilObject.php";
137  $obj_id = ilObject::_lookupObjectId($_GET["ref_id"]);
138  $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
139  $rte->addUserTextEditor("textinput");
140  $this->outAdditionalOutput();
141  }
142 
157  $active_id,
158  $pass = NULL,
159  $graphicalOutput = FALSE,
160  $result_output = FALSE,
161  $show_question_only = TRUE,
162  $show_feedback = FALSE,
163  $show_correct_solution = FALSE,
164  $show_manual_scoring = FALSE,
165  $show_question_text = TRUE
166  )
167  {
168  // get the solution of the user for the active pass or from the last pass if allowed
169 
170  $user_solution = $this->getUserAnswer( $active_id, $pass );
171 
172  if (($active_id > 0) && (!$show_correct_solution))
173  {
174  $solution = $user_solution;
175  }
176  else
177  {
178  $solution = $this->getBestAnswer();
179  }
180 
181  // generate the question output
182  include_once "./Services/UICore/classes/class.ilTemplate.php";
183  $template = new ilTemplate("tpl.il_as_qpl_text_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
184  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
185 
186  $solution = $this->object->getHtmlUserSolutionPurifier()->purify($solution);
187  $template->setVariable("ESSAY", $this->object->prepareTextareaOutput($solution, TRUE));
188 
189  $questiontext = $this->object->getQuestion();
190 
191  if (!$show_correct_solution)
192  {
193  $max_no_of_chars = $this->object->getMaxNumOfChars();
194 
195  if ($max_no_of_chars == 0)
196  {
197  $max_no_of_chars = ucfirst($this->lng->txt('unlimited'));
198  }
199 
200  $act_no_of_chars = strlen($user_solution);
201  $template->setVariable("CHARACTER_INFO", '<b>' . $max_no_of_chars . '</b>' .
202  $this->lng->txt('answer_characters') . ' <b>' . $act_no_of_chars . '</b>');
203  }
204  if (($active_id > 0) && (!$show_correct_solution))
205  {
206  if ($graphicalOutput)
207  {
208  // output of ok/not ok icons for user entered solutions
209  $reached_points = $this->object->getReachedPoints($active_id, $pass);
210  if ($reached_points == $this->object->getMaximumPoints())
211  {
212  $template->setCurrentBlock("icon_ok");
213  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.png"));
214  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
215  $template->parseCurrentBlock();
216  }
217  else
218  {
219  $template->setCurrentBlock("icon_ok");
220  if ($reached_points > 0)
221  {
222  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.png"));
223  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
224  }
225  else
226  {
227  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.png"));
228  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
229  }
230  $template->parseCurrentBlock();
231  }
232  }
233  }
234  if ($show_question_text==true)
235  {
236  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
237  }
238  $questionoutput = $template->get();
239 
240  $feedback = '';
241  if($show_feedback)
242  {
243  $fb = $this->getGenericFeedbackOutput($active_id, $pass);
244  $feedback .= strlen($fb) ? $fb : '';
245 
246  $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
247  $feedback .= strlen($fb) ? $fb : '';
248  }
249  if (strlen($feedback)) $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
250 
251  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
252 
253  $solutionoutput = $solutiontemplate->get();
254  if (!$show_question_only)
255  {
256  // get page object output
257  $solutionoutput = '<div class="ilc_question_Standard">'.$solutionoutput."</div>";
258  }
259  return $solutionoutput;
260  }
261 
262  private function getBestAnswer()
263  {
264  $answers = $this->object->getAnswers();
265  if (count( $answers ))
266  {
267  $user_solution = $this->lng->txt( "solution_contain_keywords" ) . "<ul>";
268 
269  foreach ($answers as $answer)
270  {
271  $user_solution .= '<li>'. $answer->getAnswertext();
272 
273  if( in_array($this->object->getKeywordRelation(), assTextQuestion::getScoringModesWithPointsByKeyword()) )
274  {
275  $user_solution .= ' ' . $this->lng->txt('for') . ' ';
276  $user_solution .= $answer->getPoints() . ' ' . $this->lng->txt('points') . '</li>';
277  }
278  }
279  $user_solution .= '</ul>';
280 
281  $user_solution .= $this->lng->txt('essay_scoring_mode') . ': ';
282 
283  switch( $this->object->getKeywordRelation() )
284  {
285  case 'any':
286  $user_solution .= $this->lng->txt('essay_scoring_mode_keyword_relation_any');
287  break;
288  case 'all':
289  $user_solution .= $this->lng->txt('essay_scoring_mode_keyword_relation_all');
290  break;
291  case 'one':
292  $user_solution .= $this->lng->txt('essay_scoring_mode_keyword_relation_one');
293  break;
294  }
295  }
296  return $user_solution;
297  }
298 
299  private function getUserAnswer($active_id, $pass)
300  {
301  $user_solution = "";
302  $solutions = $this->object->getSolutionValues( $active_id, $pass );
303  foreach ($solutions as $idx => $solution_value)
304  {
305  $user_solution = $solution_value["value1"];
306  }
307  return $user_solution;
308  }
309 
310  function getPreview($show_question_only = FALSE)
311  {
312  // generate the question output
313  include_once "./Services/UICore/classes/class.ilTemplate.php";
314  $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
315  if ($this->object->getMaxNumOfChars())
316  {
317  $template->setCurrentBlock("maximum_char_hint");
318  $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
319  $template->parseCurrentBlock();
320  #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
321  $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
322  $template->parseCurrentBlock();
323  $template->setCurrentBlock("maxchars_counter");
324  $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
325  $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
326  $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
327  $template->parseCurrentBlock();
328  }
329  $questiontext = $this->object->getQuestion();
330  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
331  $questionoutput = $template->get();
332  if (!$show_question_only)
333  {
334  // get page object output
335  $questionoutput = $this->getILIASPage($questionoutput);
336  }
337  return $questionoutput;
338  }
339 
340  function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
341  {
342  // get the solution of the user for the active pass or from the last pass if allowed
343  $user_solution = "";
344  if ($active_id)
345  {
346  $solutions = NULL;
347  include_once "./Modules/Test/classes/class.ilObjTest.php";
348  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
349  {
350  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
351  }
352  $solutions =& $this->object->getSolutionValues($active_id, $pass);
353  foreach ($solutions as $idx => $solution_value)
354  {
355  $user_solution = $solution_value["value1"];
356  }
357  }
358 
359  // generate the question output
360  include_once "./Services/UICore/classes/class.ilTemplate.php";
361  $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
362  if ($this->object->getMaxNumOfChars())
363  {
364  $template->setCurrentBlock("maximum_char_hint");
365  $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
366  $template->parseCurrentBlock();
367  #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
368  $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
369  $template->parseCurrentBlock();
370  $template->setCurrentBlock("maxchars_counter");
371  $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
372  $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
373  $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
374  $template->parseCurrentBlock();
375  }
376  $template->setVariable("ESSAY", ilUtil::prepareFormOutput($user_solution));
377  $questiontext = $this->object->getQuestion();
378  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
379  $questionoutput = $template->get();
380  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
381  include_once "./Services/YUI/classes/class.ilYuiUtil.php";
383  return $pageoutput;
384  }
385 
387  {
388  $_SESSION["subquestion_index"] = 0;
389  if ($_POST["cmd"]["addSuggestedSolution"])
390  {
391  if ($this->writePostData())
392  {
394  $this->editQuestion();
395  return;
396  }
397  if (!$this->checkInput())
398  {
399  ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
400  $this->editQuestion();
401  return;
402  }
403  }
404  $this->object->saveToDb();
405  $this->ctrl->setParameter($this, "q_id", $this->object->getId());
406  $this->tpl->setVariable("HEADER", $this->object->getTitle());
407  $this->getQuestionTemplate();
409  }
410 
418  function setQuestionTabs()
419  {
420  global $rbacsystem, $ilTabs;
421 
422  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
423  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
424  $q_type = $this->object->getQuestionType();
425 
426  if (strlen($q_type))
427  {
428  $classname = $q_type . "GUI";
429  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
430  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
431  }
432 
433  if ($_GET["q_id"])
434  {
435  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
436  {
437  // edit page
438  $ilTabs->addTarget("edit_page",
439  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
440  array("edit", "insert", "exec_pg"),
441  "", "", $force_active);
442  }
443 
444  // edit page
445  $ilTabs->addTarget("preview",
446  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "preview"),
447  array("preview"),
448  "ilAssQuestionPageGUI", "", $force_active);
449  }
450 
451  $force_active = false;
452  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
453  {
454  $url = "";
455  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
456  // edit question properties
457  $ilTabs->addTarget("edit_question",
458  $url,
459  array("editQuestion", "save", "saveEdit", "originalSyncForm"),
460  $classname, "", $force_active);
461  }
462 
463  // add tab for question feedback within common class assQuestionGUI
464  $this->addTab_QuestionFeedback($ilTabs);
465 
466  // add tab for question hint within common class assQuestionGUI
467  $this->addTab_QuestionHints($ilTabs);
468 
469  if ($_GET["q_id"])
470  {
471  $ilTabs->addTarget("solution_hint",
472  $this->ctrl->getLinkTargetByClass($classname, "suggestedsolution"),
473  array("suggestedsolution", "saveSuggestedSolution", "outSolutionExplorer", "cancel",
474  "addSuggestedSolution","cancelExplorer", "linkChilds", "removeSuggestedSolution"
475  ),
476  $classname,
477  ""
478  );
479  }
480 
481  // Assessment of questions sub menu entry
482  if ($_GET["q_id"])
483  {
484  $ilTabs->addTarget("statistics",
485  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
486  array("assessment"),
487  $classname, "");
488  }
489 
490  if (($_GET["calling_test"] > 0) || ($_GET["test_ref_id"] > 0))
491  {
492  $ref_id = $_GET["calling_test"];
493  if (strlen($ref_id) == 0) $ref_id = $_GET["test_ref_id"];
494 
495  global $___test_express_mode;
496 
497  if (!$_GET['test_express_mode'] && !$___test_express_mode) {
498  $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
499  }
500  else {
502  $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), $link);
503  }
504  }
505  else
506  {
507  $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions"));
508  }
509  }
510 
511  function getSpecificFeedbackOutput($active_id, $pass)
512  {
513  $feedback = '<table><tbody>';
514  $user_answers = $this->object->getSolutionValues($active_id);
515  $user_answer = ' '. $user_answers[0]['value1'];
516 
517  foreach ($this->object->getAnswers() as $idx => $ans)
518  {
519  if ($this->object->isKeywordMatching($user_answer, $ans->getAnswertext() ))
520  {
521  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
522  $this->object->getId(), $idx
523  );
524  $feedback .= '<tr><td><b><i>' . $ans->getAnswertext() . '</i></b></td><td>';
525  $feedback .= $fb . '</td> </tr>';
526  }
527  }
528 
529  $feedback .= '</tbody></table>';
530  return $this->object->prepareTextareaOutput($feedback, TRUE);
531  }
532 
533  public function writeQuestionSpecificPostData( $always = true)
534  {
535  $this->object->setMaxNumOfChars( $_POST["maxchars"] );
536  $this->object->setTextRating( $_POST["text_rating"] );
537  $this->object->setKeywordRelation( $_POST['scoring_mode'] );
538  }
539 
540  public function writeAnswerSpecificPostData( $always = true )
541  {
542  switch ($this->object->getKeywordRelation())
543  {
544  case 'non':
545  $this->object->setAnswers( array() );
546  $this->object->setPoints( $_POST['non_keyword_points'] );
547  break;
548  case 'any':
549  $this->object->setAnswers( $_POST['any_keyword'] );
550  $this->object->setPoints( $this->object->getMaximumPoints() );
551  break;
552  case 'all':
553  $this->object->setAnswers( $_POST['all_keyword'] );
554  $this->object->setPoints( $_POST['all_keyword_points'] );
555  break;
556  case 'one':
557  $this->object->setAnswers( $_POST['one_keyword'] );
558  $this->object->setPoints( $_POST['one_keyword_points'] );
559  break;
560  }
561  }
562 
564  {
565  // maxchars
566  $maxchars = new ilNumberInputGUI($this->lng->txt( "maxchars" ), "maxchars");
567  $maxchars->setSize( 5 );
568  if ($this->object->getMaxNumOfChars() > 0)
569  $maxchars->setValue( $this->object->getMaxNumOfChars() );
570  $maxchars->setInfo( $this->lng->txt( "description_maxchars" ) );
571  $form->addItem( $maxchars );
572 
573  // text rating
574  $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating");
575  $text_options = array(
576  "ci" => $this->lng->txt("cloze_textgap_case_insensitive"),
577  "cs" => $this->lng->txt("cloze_textgap_case_sensitive"),
578  "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"),
579  "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"),
580  "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"),
581  "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"),
582  "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5")
583  );
584  $textrating->setOptions($text_options);
585  $textrating->setValue($this->object->getTextRating());
586  $form->addItem($textrating);
587 
588  return $form;
589  }
590 
592  {
593  $scoringMode = new ilRadioGroupInputGUI(
594  $this->lng->txt( 'essay_scoring_mode' ), 'scoring_mode'
595  );
596 
597  $scoringOptionNone = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_without_keywords' ),
598  'non', $this->lng->txt( 'essay_scoring_mode_without_keywords_desc'
599  )
600  );
601  $scoringOptionAnyKeyword = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_keyword_relation_any' ),
602  'any', $this->lng->txt( 'essay_scoring_mode_keyword_relation_any_desc'
603  )
604  );
605  $scoringOptionAllKeyword = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_keyword_relation_all' ),
606  'all', $this->lng->txt( 'essay_scoring_mode_keyword_relation_all_desc'
607  )
608  );
609  $scoringOptionOneKeyword = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_keyword_relation_one' ),
610  'one', $this->lng->txt( 'essay_scoring_mode_keyword_relation_one_desc'
611  )
612  );
613 
614  $scoringMode->addOption( $scoringOptionNone );
615  $scoringMode->addOption( $scoringOptionAnyKeyword );
616  $scoringMode->addOption( $scoringOptionAllKeyword );
617  $scoringMode->addOption( $scoringOptionOneKeyword );
618  $scoringMode->setRequired( true );
619  $scoringMode->setValue( strlen( $this->object->getKeywordRelation() ) ? $this->object->getKeywordRelation(
620  ) : 'non'
621  );
622 
623  if ($this->object->getAnswerCount() == 0)
624  {
625  $this->object->addAnswer( "", 1, 0, 0 );
626  }
627  require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
628 
629  // Without Keywords
630  $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt( "points" ), "non_keyword_points");
631  $nonKeywordPoints->setValue( $this->object->getPoints() );
632  $nonKeywordPoints->setRequired( TRUE );
633  $nonKeywordPoints->setSize( 3 );
634  $nonKeywordPoints->setMinValue( 0.0 );
635  $nonKeywordPoints->setMinvalueShouldBeGreater( true );
636  $scoringOptionNone->addSubItem( $nonKeywordPoints );
637 
638  // Any Keyword
639  $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt( "answers" ), "any_keyword");
640  $anyKeyword->setRequired( TRUE );
641  $anyKeyword->setQuestionObject( $this->object );
642  $anyKeyword->setSingleline( TRUE );
643  $anyKeyword->setValues( $this->object->getAnswers() );
644  $scoringOptionAnyKeyword->addSubItem( $anyKeyword );
645 
646  // All Keywords
647  $allKeyword = new ilTextWizardInputGUI($this->lng->txt( "answers" ), "all_keyword");
648  $allKeyword->setRequired( TRUE );
649  //$allKeyword->setQuestionObject($this->object);
650  //$allKeyword->setSingleline(TRUE);
651  $allKeyword->setValues( self::buildAnswerTextOnlyArray( $this->object->getAnswers() ) );
652  $scoringOptionAllKeyword->addSubItem( $allKeyword );
653  $allKeywordPoints = new ilNumberInputGUI($this->lng->txt( "points" ), "all_keyword_points");
654  $allKeywordPoints->allowDecimals(TRUE);
655  $allKeywordPoints->setValue( $this->object->getPoints() );
656  $allKeywordPoints->setRequired( TRUE );
657  $allKeywordPoints->setSize( 3 );
658  $allKeywordPoints->setMinValue( 0.0 );
659  $allKeywordPoints->setMinvalueShouldBeGreater( true );
660  $scoringOptionAllKeyword->addSubItem( $allKeywordPoints );
661 
662  // One Keywords
663  $oneKeyword = new ilTextWizardInputGUI($this->lng->txt( "answers" ), "one_keyword");
664  $oneKeyword->setRequired( TRUE );
665  //$oneKeyword->setQuestionObject($this->object);
666  //$oneKeyword->setSingleline(TRUE);
667  $oneKeyword->setValues( self::buildAnswerTextOnlyArray( $this->object->getAnswers() ) );
668  $scoringOptionOneKeyword->addSubItem( $oneKeyword );
669  $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt( "points" ), "one_keyword_points");
670  $oneKeywordPoints->allowDecimals(TRUE);
671  $oneKeywordPoints->setValue( $this->object->getPoints() );
672  $oneKeywordPoints->setRequired( TRUE );
673  $oneKeywordPoints->setSize( 3 );
674  $oneKeywordPoints->setMinValue( 0.0 );
675  $oneKeywordPoints->setMinvalueShouldBeGreater( true );
676  $scoringOptionOneKeyword->addSubItem( $oneKeywordPoints );
677 
678  $form->addItem( $scoringMode );
679  }
680 
691  {
692  return array();
693  }
694 
705  {
706  return array();
707  }
708 
717  public function getAggregatedAnswersView($relevant_answers)
718  {
719  return ''; //print_r($relevant_answers,true);
720  }
721 }