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