ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4require_once './Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5require_once './Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6require_once './Modules/TestQuestionPool/interfaces/interface.ilGuiAnswerScoringAdjustable.php';
7require_once './Modules/Test/classes/inc.AssessmentConstants.php';
8
23{
31 public function __construct($id = -1)
32 {
33 parent::__construct();
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 {
54 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
59 return 0;
60 }
61 return 1;
62 }
63
69 public function editQuestion($checkonly = FALSE)
70 {
71 $save = $this->isSaveCommand();
72 $this->getQuestionTemplate();
73
74 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
75 $form = new ilPropertyFormGUI();
76 $form->setFormAction($this->ctrl->getFormAction($this));
77 $form->setTitle($this->outQuestionType());
78 $form->setMultipart(TRUE);
79 $form->setTableWidth("100%");
80 $form->setId("asstextquestion");
81
82 $this->addBasicQuestionFormProperties( $form );
84 $this->populateAnswerSpecificFormPart( $form );
85
86
87 $this->populateTaxonomyFormSection($form);
88
90
91 $errors = false;
92
93 if ($save)
94 {
95 $form->setValuesByPost();
96 $errors = !$form->checkInput();
97 $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
98 if ($errors) $checkonly = false;
99 }
100
101 if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
102 return $errors;
103 }
104
105 private static function buildAnswerTextOnlyArray($answers)
106 {
107 $answerTexts = array();
108
109 foreach($answers as $answer)
110 {
111 $answerTexts[] = $answer->getAnswertext();
112 }
113
114 return $answerTexts;
115 }
116
118 {
119 }
120
121 public function magicAfterTestOutput()
122 {
123 // TODO - BEGIN: what exactly is done here? cant we use the parent method?
124
125 include_once "./Services/RTE/classes/class.ilRTE.php";
126 $rtestring = ilRTE::_getRTEClassname();
127 include_once "./Services/RTE/classes/class.$rtestring.php";
128 $rte = new $rtestring();
129 include_once "./Services/Object/classes/class.ilObject.php";
130 $obj_id = ilObject::_lookupObjectId($_GET["ref_id"]);
131 $obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
132 $rte->addUserTextEditor("textinput");
133 $this->outAdditionalOutput();
134
135 // TODO - END: what exactly is done here? cant we use the parent method?
136 }
137
152 $active_id,
153 $pass = NULL,
154 $graphicalOutput = FALSE,
155 $result_output = FALSE,
156 $show_question_only = TRUE,
157 $show_feedback = FALSE,
158 $show_correct_solution = FALSE,
159 $show_manual_scoring = FALSE,
160 $show_question_text = TRUE
161 )
162 {
163 // get the solution of the user for the active pass or from the last pass if allowed
164
165 $user_solution = $this->getUserAnswer( $active_id, $pass );
166
167 if (($active_id > 0) && (!$show_correct_solution))
168 {
169 $solution = $user_solution;
170 }
171 else
172 {
173 $solution = $this->getBestAnswer($_GET['pdf']);
174 }
175
176 // generate the question output
177 include_once "./Services/UICore/classes/class.ilTemplate.php";
178 $template = new ilTemplate("tpl.il_as_qpl_text_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
179 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
180
181 $solution = $this->object->getHtmlUserSolutionPurifier()->purify($solution);
182 if( $_GET['pdf'] )
183 {
184 $template->setCurrentBlock('essay_div');
185 $template->setVariable("DIV_ESSAY", $this->object->prepareTextareaOutput($solution, TRUE));
186 }
187 else
188 {
189 $template->setCurrentBlock('essay_textarea');
190 $template->setVariable("TA_ESSAY", $this->object->prepareTextareaOutput($solution, TRUE, true));
191 }
192 $template->parseCurrentBlock();
193
194 $questiontext = $this->object->getQuestion();
195
196 if (!$show_correct_solution)
197 {
198 $max_no_of_chars = $this->object->getMaxNumOfChars();
199
200 if ($max_no_of_chars == 0)
201 {
202 $max_no_of_chars = ucfirst($this->lng->txt('unlimited'));
203 }
204
205 $act_no_of_chars = $this->object->countLetters($user_solution);
206 $template->setVariable("CHARACTER_INFO", '<b>' . $max_no_of_chars . '</b>' .
207 $this->lng->txt('answer_characters') . ' <b>' . $act_no_of_chars . '</b>');
208 }
209 if (($active_id > 0) && (!$show_correct_solution))
210 {
211 if ($graphicalOutput)
212 {
213 // output of ok/not ok icons for user entered solutions
214 $reached_points = $this->object->getReachedPoints($active_id, $pass);
215 if ($reached_points == $this->object->getMaximumPoints())
216 {
217 $template->setCurrentBlock("icon_ok");
218 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
219 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
220 $template->parseCurrentBlock();
221 }
222 else
223 {
224 $template->setCurrentBlock("icon_ok");
225 if ($reached_points > 0)
226 {
227 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
228 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
229 }
230 else
231 {
232 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
233 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
234 }
235 $template->parseCurrentBlock();
236 }
237 }
238 }
239 if ($show_question_text==true)
240 {
241 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
242 }
243 $questionoutput = $template->get();
244
245 $feedback = '';
246 if($show_feedback)
247 {
248 if( !$this->isTestPresentationContext() )
249 {
250 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
251 $feedback .= strlen($fb) ? $fb : '';
252 }
253
254 $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
255 $feedback .= strlen($fb) ? $fb : '';
256 }
257 if (strlen($feedback))
258 {
259 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
261 );
262
263 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
264 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
265 }
266
267 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
268
269 $solutionoutput = $solutiontemplate->get();
270 if (!$show_question_only)
271 {
272 // get page object output
273 $solutionoutput = $this->getILIASPage($solutionoutput);
274 }
275 return $solutionoutput;
276 }
277
278 private function getBestAnswer($asHtml)
279 {
280 $answers = $this->object->getAnswers();
281 if( !count($answers) )
282 {
283 return '';
284 }
285
286 if($asHtml)
287 {
288 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_html.html';
289 }
290 else
291 {
292 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_ta.html';
293 }
294
295 $tpl = new ilTemplate($tplFile, true, true, 'Modules/TestQuestionPool');
296
297 foreach ($answers as $answer)
298 {
299 $keywordString = $answer->getAnswertext();
300
301 if( in_array($this->object->getKeywordRelation(), assTextQuestion::getScoringModesWithPointsByKeyword()) )
302 {
303 $keywordString .= ' ' . $this->lng->txt('for') . ' ';
304 $keywordString .= $answer->getPoints() . ' ' . $this->lng->txt('points');
305 }
306
307 $tpl->setCurrentBlock('keyword');
308 $tpl->setVariable('KEYWORD', $keywordString);
309 $tpl->parseCurrentBlock();
310 }
311
312 $tpl->setVariable('KEYWORD_HEADER', $this->lng->txt('solution_contain_keywords'));
313 $tpl->setVariable('SCORING_LABEL', $this->lng->txt('essay_scoring_mode').': ');
314
315 switch( $this->object->getKeywordRelation() )
316 {
317 case 'any':
318 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_any'));
319 break;
320 case 'all':
321 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_all'));
322 break;
323 case 'one':
324 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_one'));
325 break;
326 }
327
328 return $tpl->get();
329 }
330
331 private function getUserAnswer($active_id, $pass)
332 {
333 $user_solution = "";
334 $solutions = $this->object->getSolutionValues( $active_id, $pass );
335 foreach ($solutions as $idx => $solution_value)
336 {
337 $user_solution = $solution_value["value1"];
338 }
339 return $user_solution;
340 }
341
342 function getPreview($show_question_only = FALSE, $showInlineFeedback = false)
343 {
344 // generate the question output
345 include_once "./Services/UICore/classes/class.ilTemplate.php";
346 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
347 if ($this->object->getMaxNumOfChars())
348 {
349 $template->setCurrentBlock("maximum_char_hint");
350 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
351 $template->parseCurrentBlock();
352 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
353 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
354 $template->parseCurrentBlock();
355 $template->setCurrentBlock("maxchars_counter");
356 $template->setVariable("QID", $this->object->getId());
357 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
358 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
359 $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
360 $template->parseCurrentBlock();
361 }
362
363 if( is_object($this->getPreviewSession()) )
364 {
365 $template->setVariable("ESSAY", ilUtil::prepareFormOutput(
366 $this->getPreviewSession()->getParticipantsSolution()
367 ));
368 }
369
370 $questiontext = $this->object->getQuestion();
371 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
372 $template->setVariable("QID", $this->object->getId());
373
374 $questionoutput = $template->get();
375
376 $questionoutput .= $this->getJsCode();
377
378 if (!$show_question_only)
379 {
380 // get page object output
381 $questionoutput = $this->getILIASPage($questionoutput);
382 }
383 return $questionoutput;
384 }
385
386 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $inlineFeedback = false)
387 {
388 // get the solution of the user for the active pass or from the last pass if allowed
389 $user_solution = "";
390 if ($active_id)
391 {
392 $solutions = NULL;
393 // hey: prevPassSolutions - obsolete due to central check
394 #include_once "./Modules/Test/classes/class.ilObjTest.php";
395 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
396 #{
397 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
398 #}
399 // hey.
400 $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
401 foreach ($solutions as $idx => $solution_value)
402 {
403 $user_solution = $solution_value["value1"];
404 }
405 }
406
407 // generate the question output
408 include_once "./Services/UICore/classes/class.ilTemplate.php";
409 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
410 if ($this->object->getMaxNumOfChars())
411 {
412 $template->setCurrentBlock("maximum_char_hint");
413 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
414 $template->parseCurrentBlock();
415 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
416 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
417 $template->parseCurrentBlock();
418 $template->setCurrentBlock("maxchars_counter");
419 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
420 $template->setVariable("QID", $this->object->getId());
421 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
422 $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
423 $template->parseCurrentBlock();
424 }
425 $template->setVariable("QID", $this->object->getId());
426 $template->setVariable("ESSAY", ilUtil::prepareFormOutput($user_solution));
427 $questiontext = $this->object->getQuestion();
428 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
429 $questionoutput = $template->get();
430
431 $questionoutput .= $this->getJsCode();
432
433 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
434 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
436 return $pageoutput;
437 }
438
439 protected function getJsCode()
440 {
441 $tpl = new ilTemplate('tpl.charcounter.html', true, true, 'Modules/TestQuestionPool');
442
443 $tpl->setCurrentBlock('tinymce_handler');
444 $tpl->touchBlock('tinymce_handler');
445 $tpl->parseCurrentBlock();
446
447 if ($this->object->getMaxNumOfChars() > 0)
448 {
449 $tpl->setCurrentBlock('letter_counter_js');
450 $tpl->setVariable("QID", $this->object->getId());
451 $tpl->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
452 $tpl->parseCurrentBlock();
453 }
454
455 return $tpl->get();
456 }
457
459 {
460 $_SESSION["subquestion_index"] = 0;
461 if ($_POST["cmd"]["addSuggestedSolution"])
462 {
463 if ($this->writePostData())
464 {
466 $this->editQuestion();
467 return;
468 }
469 if (!$this->checkInput())
470 {
471 ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
472 $this->editQuestion();
473 return;
474 }
475 }
476 $this->object->saveToDb();
477 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
478 $this->tpl->setVariable("HEADER", $this->object->getTitle());
479 $this->getQuestionTemplate();
480 parent::addSuggestedSolution();
481 }
482
491 {
492 global $rbacsystem, $ilTabs;
493
494 $ilTabs->clearTargets();
495
496 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
497 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
498 $q_type = $this->object->getQuestionType();
499
500 if (strlen($q_type))
501 {
502 $classname = $q_type . "GUI";
503 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
504 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
505 }
506
507 if ($_GET["q_id"])
508 {
509 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
510 {
511 // edit page
512 $ilTabs->addTarget("edit_page",
513 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
514 array("edit", "insert", "exec_pg"),
515 "", "", $force_active);
516 }
517
518 $this->addTab_QuestionPreview($ilTabs);
519 }
520
521 $force_active = false;
522 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
523 {
524 $url = "";
525 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
526 // edit question properties
527 $ilTabs->addTarget("edit_question",
528 $url,
529 array("editQuestion", "save", "saveEdit", "originalSyncForm"),
530 $classname, "", $force_active);
531 }
532
533 // add tab for question feedback within common class assQuestionGUI
534 $this->addTab_QuestionFeedback($ilTabs);
535
536 // add tab for question hint within common class assQuestionGUI
537 $this->addTab_QuestionHints($ilTabs);
538
539 // add tab for question's suggested solution within common class assQuestionGUI
540 $this->addTab_SuggestedSolution($ilTabs, $classname);
541
542 // Assessment of questions sub menu entry
543 if ($_GET["q_id"])
544 {
545 $ilTabs->addTarget("statistics",
546 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
547 array("assessment"),
548 $classname, "");
549 }
550
551 $this->addBackTab($ilTabs);
552 }
553
554 function getSpecificFeedbackOutput($active_id, $pass)
555 {
556 $feedback = '<table><tbody>';
557 $user_answers = $this->object->getSolutionValues($active_id);
558 $user_answer = ' '. $user_answers[0]['value1'];
559
560 foreach ($this->object->getAnswers() as $idx => $ans)
561 {
562 if ($this->object->isKeywordMatching($user_answer, $ans->getAnswertext() ))
563 {
564 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
565 $this->object->getId(), $idx
566 );
567 $feedback .= '<tr><td><b><i>' . $ans->getAnswertext() . '</i></b></td><td>';
568 $feedback .= $fb . '</td> </tr>';
569 }
570 }
571
572 $feedback .= '</tbody></table>';
573 return $this->object->prepareTextareaOutput($feedback, TRUE);
574 }
575
577 {
578 $this->object->setMaxNumOfChars( $_POST["maxchars"] );
579 $this->object->setTextRating( $_POST["text_rating"] );
580 $this->object->setKeywordRelation( $_POST['scoring_mode'] );
581 }
582
584 {
585 switch ($this->object->getKeywordRelation())
586 {
587 case 'non':
588 $this->object->setAnswers( array() );
589 $this->object->setPoints( $_POST['non_keyword_points'] );
590 break;
591 case 'any':
592 $this->object->setAnswers( $_POST['any_keyword'] );
593 $this->object->setPoints( $this->object->getMaximumPoints() );
594 break;
595 case 'all':
596 $this->object->setAnswers( $_POST['all_keyword'] );
597 $this->object->setPoints( $_POST['all_keyword_points'] );
598 break;
599 case 'one':
600 $this->object->setAnswers( $_POST['one_keyword'] );
601 $this->object->setPoints( $_POST['one_keyword_points'] );
602 break;
603 }
604 }
605
607 {
608 // maxchars
609 $maxchars = new ilNumberInputGUI($this->lng->txt( "maxchars" ), "maxchars");
610 $maxchars->setSize( 5 );
611 if ($this->object->getMaxNumOfChars() > 0)
612 $maxchars->setValue( $this->object->getMaxNumOfChars() );
613 $maxchars->setInfo( $this->lng->txt( "description_maxchars" ) );
614 $form->addItem( $maxchars );
615
616 // text rating
617 $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating");
618 $text_options = array(
619 "ci" => $this->lng->txt("cloze_textgap_case_insensitive"),
620 "cs" => $this->lng->txt("cloze_textgap_case_sensitive"),
621 "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"),
622 "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"),
623 "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"),
624 "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"),
625 "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5")
626 );
627 $textrating->setOptions($text_options);
628 $textrating->setValue($this->object->getTextRating());
629 $form->addItem($textrating);
630
631 return $form;
632 }
633
635 {
636 $scoringMode = new ilRadioGroupInputGUI(
637 $this->lng->txt( 'essay_scoring_mode' ), 'scoring_mode'
638 );
639
640 $scoringOptionNone = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_without_keywords' ),
641 'non', $this->lng->txt( 'essay_scoring_mode_without_keywords_desc'
642 )
643 );
644 $scoringOptionAnyKeyword = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_keyword_relation_any' ),
645 'any', $this->lng->txt( 'essay_scoring_mode_keyword_relation_any_desc'
646 )
647 );
648 $scoringOptionAllKeyword = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_keyword_relation_all' ),
649 'all', $this->lng->txt( 'essay_scoring_mode_keyword_relation_all_desc'
650 )
651 );
652 $scoringOptionOneKeyword = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_keyword_relation_one' ),
653 'one', $this->lng->txt( 'essay_scoring_mode_keyword_relation_one_desc'
654 )
655 );
656
657 $scoringMode->addOption( $scoringOptionNone );
658 $scoringMode->addOption( $scoringOptionAnyKeyword );
659 $scoringMode->addOption( $scoringOptionAllKeyword );
660 $scoringMode->addOption( $scoringOptionOneKeyword );
661 $scoringMode->setRequired( true );
662 $scoringMode->setValue( strlen( $this->object->getKeywordRelation() ) ? $this->object->getKeywordRelation(
663 ) : 'non'
664 );
665
666 if ($this->object->getAnswerCount() == 0)
667 {
668 $this->object->addAnswer( "", 1, 0, 0 );
669 }
670 require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
671
672 // Without Keywords
673 $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt( "points" ), "non_keyword_points");
674 $nonKeywordPoints->allowDecimals(true);
675 $nonKeywordPoints->setValue( $this->object->getPoints() );
676 $nonKeywordPoints->setRequired( TRUE );
677 $nonKeywordPoints->setSize( 3 );
678 $nonKeywordPoints->setMinValue( 0.0 );
679 $nonKeywordPoints->setMinvalueShouldBeGreater( true );
680 $scoringOptionNone->addSubItem( $nonKeywordPoints );
681
682 // Any Keyword
683 $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt( "answers" ), "any_keyword");
684 $anyKeyword->setRequired( TRUE );
685 $anyKeyword->setQuestionObject( $this->object );
686 $anyKeyword->setSingleline( TRUE );
687 $anyKeyword->setValues( $this->object->getAnswers() );
688 $scoringOptionAnyKeyword->addSubItem( $anyKeyword );
689
690 // All Keywords
691 $allKeyword = new ilTextWizardInputGUI($this->lng->txt( "answers" ), "all_keyword");
692 $allKeyword->setRequired( TRUE );
693 //$allKeyword->setQuestionObject($this->object);
694 //$allKeyword->setSingleline(TRUE);
695 $allKeyword->setValues( self::buildAnswerTextOnlyArray( $this->object->getAnswers() ) );
696 $scoringOptionAllKeyword->addSubItem( $allKeyword );
697 $allKeywordPoints = new ilNumberInputGUI($this->lng->txt( "points" ), "all_keyword_points");
698 $allKeywordPoints->allowDecimals(true);
699 $allKeywordPoints->setValue( $this->object->getPoints() );
700 $allKeywordPoints->setRequired( TRUE );
701 $allKeywordPoints->setSize( 3 );
702 $allKeywordPoints->setMinValue( 0.0 );
703 $allKeywordPoints->setMinvalueShouldBeGreater( true );
704 $scoringOptionAllKeyword->addSubItem( $allKeywordPoints );
705
706 // One Keywords
707 $oneKeyword = new ilTextWizardInputGUI($this->lng->txt( "answers" ), "one_keyword");
708 $oneKeyword->setRequired( TRUE );
709 //$oneKeyword->setQuestionObject($this->object);
710 //$oneKeyword->setSingleline(TRUE);
711 $oneKeyword->setValues( self::buildAnswerTextOnlyArray( $this->object->getAnswers() ) );
712 $scoringOptionOneKeyword->addSubItem( $oneKeyword );
713 $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt( "points" ), "one_keyword_points");
714 $oneKeywordPoints->allowDecimals(true);
715 $oneKeywordPoints->setValue( $this->object->getPoints() );
716 $oneKeywordPoints->setRequired( TRUE );
717 $oneKeywordPoints->setSize( 3 );
718 $oneKeywordPoints->setMinValue( 0.0 );
719 $oneKeywordPoints->setMinvalueShouldBeGreater( true );
720 $scoringOptionOneKeyword->addSubItem( $oneKeywordPoints );
721
722 $form->addItem( $scoringMode );
723 }
724
735 {
736 return array();
737 }
738
749 {
750 return array();
751 }
752
761 public function getAggregatedAnswersView($relevant_answers)
762 {
763 return ''; //print_r($relevant_answers,true);
764 }
765}
$_GET["client_id"]
$_SESSION["AccountId"]
Basic GUI class for assessment questions.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
getILIASPage($html="")
Returns the ILIAS Page around a question.
getQuestionTemplate()
get question template
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
addBackTab(ilTabsGUI $ilTabs)
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
Text question GUI representation.
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
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.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
getTestOutput($active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE, $inlineFeedback=false)
writePostData($always=false)
Evaluates a posted edit form and writes the form data in the question object.
__construct($id=-1)
assTextQuestionGUI constructor
getSpecificFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
setQuestionTabs()
Sets the ILIAS tabs for this question type.
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
getUserAnswer($active_id, $pass)
static buildAnswerTextOnlyArray($answers)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
Class for text questions.
static getScoringModesWithPointsByKeyword()
This class represents a number property in a property form.
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
static _getRTEClassname()
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
special template class to simplify handling of ITX/PEAR
This class represents a text wizard property in a property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static initDomEvent()
Init YUI DomEvent.
$_POST['username']
Definition: cron.php:12
Interface ilGuiAnswerScoringAdjustable.
Interface ilGuiQuestionScoringAdjustable.
$url
Definition: shib_logout.php:72
$errors