ILIAS  release_7 Revision v7.30-3-g800a261c036
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{
33 public function __construct($id = -1)
34 {
35 $this->tiny_mce_enabled = (new ilSetting('advanced_editing'))->get('advanced_editing_javascript_editor')
36 === 'tinymce' ? true : false;
38 include_once "./Modules/TestQuestionPool/classes/class.assTextQuestion.php";
39 $this->object = new assTextQuestion();
40 if ($id >= 0) {
41 $this->object->loadFromDb($id);
42 }
43 }
44
48 protected function writePostData($always = false)
49 {
50 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
51 if (!$hasErrors) {
52 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
57 return 0;
58 }
59 return 1;
60 }
61
67 public function editQuestion($checkonly = false)
68 {
69 $save = $this->isSaveCommand();
70 $this->getQuestionTemplate();
71
72 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
73 $form = new ilPropertyFormGUI();
74 $this->editForm = $form;
75
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
85
86
87 $this->populateTaxonomyFormSection($form);
88
90
91 $errors = false;
92
93 if ($save) {
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) {
98 $checkonly = false;
99 }
100 }
101
102 if (!$checkonly) {
103 $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
104 }
105 return $errors;
106 }
107
108 private static function buildAnswerTextOnlyArray($answers)
109 {
110 $answerTexts = array();
111
112 foreach ($answers as $answer) {
113 $answerTexts[] = $answer->getAnswertext();
114 }
115
116 return $answerTexts;
117 }
118
119 public function outAdditionalOutput()
120 {
121 }
122
123 public function magicAfterTestOutput()
124 {
125 // TODO - BEGIN: what exactly is done here? cant we use the parent method?
126
127 include_once "./Services/RTE/classes/class.ilRTE.php";
128 $rtestring = ilRTE::_getRTEClassname();
129 include_once "./Services/RTE/classes/class.$rtestring.php";
130 $rte = new $rtestring();
131 include_once "./Services/Object/classes/class.ilObject.php";
132 $obj_id = ilObject::_lookupObjectId($_GET["ref_id"]);
133 $obj_type = ilObject::_lookupType($_GET["ref_id"], true);
134 $rte->addUserTextEditor("textinput");
135 $this->outAdditionalOutput();
136
137 // TODO - END: what exactly is done here? cant we use the parent method?
138 }
139
146 {
147 return true;
148 }
149
163 public function getSolutionOutput(
164 $active_id,
165 $pass = null,
166 $graphicalOutput = false,
167 $result_output = false,
168 $show_question_only = true,
169 $show_feedback = false,
170 $show_correct_solution = false,
171 $show_manual_scoring = false,
172 $show_question_text = true
173 ) {
174 // get the solution of the user for the active pass or from the last pass if allowed
175
176 $user_solution = $this->getUserAnswer($active_id, $pass);
177
178 if (($active_id > 0) && (!$show_correct_solution)) {
179 $solution = $user_solution;
180 } else {
181 $solution = $this->getBestAnswer($this->renderPurposeSupportsFormHtml());
182 }
183
184 // generate the question output
185 include_once "./Services/UICore/classes/class.ilTemplate.php";
186 $template = new ilTemplate("tpl.il_as_qpl_text_question_output_solution.html", true, true, "Modules/TestQuestionPool");
187 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
188
189 $solution = $this->object->getHtmlUserSolutionPurifier()->purify($solution);
190 if ($this->renderPurposeSupportsFormHtml()) {
191 $template->setCurrentBlock('essay_div');
192 $template->setVariable("DIV_ESSAY", $this->object->prepareTextareaOutput($solution, true));
193 } else {
194 $template->setCurrentBlock('essay_textarea');
195 $template->setVariable("TA_ESSAY", $this->object->prepareTextareaOutput($solution, true, true));
196 }
197 $template->parseCurrentBlock();
198
199 if (!$show_correct_solution) {
200 $max_no_of_chars = $this->object->getMaxNumOfChars();
201
202 if ($max_no_of_chars == 0) {
203 $max_no_of_chars = ucfirst($this->lng->txt('unlimited'));
204 }
205
206 $act_no_of_chars = $this->object->countLetters($solution);
207 $template->setVariable("CHARACTER_INFO", '<b>' . $max_no_of_chars . '</b>' .
208 $this->lng->txt('answer_characters') . ' <b>' . $act_no_of_chars . '</b>');
209 }
210
211 if ($this->object->isWordCounterEnabled()) {
212 $template->setCurrentBlock('word_count');
213 $template->setVariable(
214 'WORD_COUNT',
215 $this->lng->txt('qst_essay_written_words') .
216 ' <b>' . $this->object->countWords($solution) . '</b>'
217 );
218 $template->parseCurrentBlock();
219 }
220
221 if (($active_id > 0) && (!$show_correct_solution)) {
222 if ($graphicalOutput) {
223 // output of ok/not ok icons for user entered solutions
224 $reached_points = $this->object->getReachedPoints($active_id, $pass);
225 if ($reached_points == $this->object->getMaximumPoints()) {
226 $template->setCurrentBlock("icon_ok");
227 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
228 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
229 $template->parseCurrentBlock();
230 } else {
231 $template->setCurrentBlock("icon_ok");
232 if ($reached_points > 0) {
233 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
234 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
235 } else {
236 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
237 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
238 }
239 $template->parseCurrentBlock();
240 }
241 }
242 }
243 if ($show_question_text == true) {
244 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
245 }
246 $questionoutput = $template->get();
247
248 $feedback = '';
249 if ($show_feedback) {
250 if (!$this->isTestPresentationContext()) {
251 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
252 $feedback .= strlen($fb) ? $fb : '';
253 }
254
255 $fb = $this->getSpecificFeedbackOutput(
256 array($user_solution => '')
257 );
258
259 $feedback .= strlen($fb) ? $fb : '';
260 }
261 if (strlen($feedback)) {
262 $cssClass = (
263 $this->hasCorrectSolution($active_id, $pass) ?
265 );
266
267 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
268 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
269 }
270
271 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
272
273 $solutionoutput = $solutiontemplate->get();
274 if (!$show_question_only) {
275 // get page object output
276 $solutionoutput = $this->getILIASPage($solutionoutput);
277 }
278 return $solutionoutput;
279 }
280
281 private function getBestAnswer($asHtml)
282 {
283 $answers = $this->object->getAnswers();
284 if (!count($answers)) {
285 return '';
286 }
287
288 if ($asHtml) {
289 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_html.html';
290 } else {
291 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_ta.html';
292 }
293
294 $tpl = new ilTemplate($tplFile, true, true, 'Modules/TestQuestionPool');
295
296 foreach ($answers as $answer) {
297 $keywordString = '';
298 if (in_array($this->object->getKeywordRelation(), assTextQuestion::getScoringModesWithPointsByKeyword())) {
299 $keywordString .= $answer->getPoints() . ' ';
300 if ($answer->getPoints() == '1' || $answer->getPoints() == '-1') {
301 $keywordString .= $this->lng->txt('point');
302 } else {
303 $keywordString .= $this->lng->txt('points');
304 }
305 $keywordString .= ' ' . $this->lng->txt('for') . ' ';
306 }
307 $keywordString .= $answer->getAnswertext();
308
309 $tpl->setCurrentBlock('keyword');
310 $tpl->setVariable('KEYWORD', $keywordString);
311 $tpl->parseCurrentBlock();
312 }
313
314 $tpl->setVariable('KEYWORD_HEADER', $this->lng->txt('solution_contain_keywords'));
315 $tpl->setVariable('SCORING_LABEL', $this->lng->txt('essay_scoring_mode') . ': ');
316
317 switch ($this->object->getKeywordRelation()) {
318 case 'any':
319 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_any'));
320 break;
321 case 'all':
322 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_all'));
323 break;
324 case 'one':
325 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_one'));
326 break;
327 }
328
329 return $tpl->get();
330 }
331
332 private function getUserAnswer($active_id, $pass)
333 {
334 $user_solution = "";
335 $solutions = $this->object->getSolutionValues($active_id, $pass, !$this->getUseIntermediateSolution());
336 foreach ($solutions as $idx => $solution_value) {
337 $user_solution = $solution_value["value1"];
338 }
339 return $user_solution;
340 }
341
342 public 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 $template->setCurrentBlock("maximum_char_hint");
349 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
350 $template->parseCurrentBlock();
351 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
352 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
353 $template->parseCurrentBlock();
354 $template->setCurrentBlock("maxchars_counter");
355 $template->setVariable("QID", $this->object->getId());
356 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
357 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
358 $template->setVariable("CHARACTERS", $this->lng->txt("qst_essay_chars_remaining"));
359 $template->parseCurrentBlock();
360 }
361
362 if ($this->object->isWordCounterEnabled()) {
363 $template->setCurrentBlock("word_counter");
364 $template->setVariable("QID", $this->object->getId());
365 $template->setVariable("WORDCOUNTER", $this->lng->txt("qst_essay_allready_written_words"));
366 $template->parseCurrentBlock();
367 }
368
369 if (is_object($this->getPreviewSession())) {
370 $template->setVariable("ESSAY", ilUtil::prepareFormOutput(
371 $this->getPreviewSession()->getParticipantsSolution()
372 ));
373 }
374
375 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
376 $template->setVariable("QID", $this->object->getId());
377
378 $questionoutput = $template->get();
379
380 $questionoutput .= $this->getJsCode();
381
382 if (!$show_question_only) {
383 // get page object output
384 $questionoutput = $this->getILIASPage($questionoutput);
385 }
386 return $questionoutput;
387 }
388
389 public function getTestOutput($active_id, $pass = null, $is_postponed = false, $use_post_solutions = false, $inlineFeedback = false)
390 {
391 // get the solution of the user for the active pass or from the last pass if allowed
392 $user_solution = "";
393 if ($active_id) {
394 $solutions = null;
395
396 $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
397 foreach ($solutions as $idx => $solution_value) {
398 $user_solution = $solution_value["value1"];
399 }
400
401 if ($this->tiny_mce_enabled) {
402 $user_solution = htmlentities($user_solution);
403 }
404
405 $user_solution = str_replace(['{', '}', '\\'], ['&#123', '&#125', '&#92'], $user_solution);
406 }
407
408 // generate the question output
409 include_once "./Services/UICore/classes/class.ilTemplate.php";
410 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", true, true, "Modules/TestQuestionPool");
411 if ($this->object->getMaxNumOfChars()) {
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("qst_essay_chars_remaining"));
423 $template->parseCurrentBlock();
424 }
425
426 if ($this->object->isWordCounterEnabled()) {
427 $template->setCurrentBlock("word_counter");
428 $template->setVariable("QID", $this->object->getId());
429 $template->setVariable("WORDCOUNTER", $this->lng->txt("qst_essay_allready_written_words"));
430 $template->parseCurrentBlock();
431 }
432
433 $template->setVariable("QID", $this->object->getId());
434 $template->setVariable("ESSAY", $user_solution);
435 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
436 $questionoutput = $template->get();
437
438 $questionoutput .= $this->getJsCode();
439
440 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
441 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
443 return $pageoutput;
444 }
445
446 protected function getJsCode()
447 {
448 $tpl = new ilTemplate('tpl.charcounter.html', true, true, 'Modules/TestQuestionPool');
449
450 $tpl->setCurrentBlock('tinymce_handler');
451 $tpl->touchBlock('tinymce_handler');
452 $tpl->parseCurrentBlock();
453
454 if ($this->object->getMaxNumOfChars() > 0) {
455 $tpl->setCurrentBlock('letter_counter_js');
456 $tpl->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
457 $tpl->parseCurrentBlock();
458 }
459
460 if ($this->object->isWordCounterEnabled()) {
461 $tpl->setCurrentBlock('word_counter_js');
462 $tpl->touchBlock('word_counter_js');
463 $tpl->parseCurrentBlock();
464 }
465
466 $tpl->setCurrentBlock('counter_js');
467 $tpl->setVariable("QID", $this->object->getId());
468 $tpl->parseCurrentBlock();
469
470 return $tpl->get();
471 }
472
473 public function addSuggestedSolution()
474 {
475 $_SESSION["subquestion_index"] = 0;
476 if ($_POST["cmd"]["addSuggestedSolution"]) {
477 if ($this->writePostData()) {
479 $this->editQuestion();
480 return;
481 }
482 if (!$this->checkInput()) {
483 ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
484 $this->editQuestion();
485 return;
486 }
487 }
488 $this->object->saveToDb();
489 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
490 $this->tpl->setVariable("HEADER", $this->object->getTitle());
491 $this->getQuestionTemplate();
492 parent::addSuggestedSolution();
493 }
494
495 public function getSpecificFeedbackOutput($userSolution)
496 {
497 $user_answer = key($userSolution);
498
499 $feedback = '';
500
501 foreach ($this->object->getAnswers() as $idx => $ans) {
502 if ($this->object->isKeywordMatching($user_answer, htmlspecialchars($ans->getAnswertext()))) {
503 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
504 $this->object->getId(),
505 0,
506 $idx
507 );
508 $feedback .= '<tr><td><b><i>' . $ans->getAnswertext() . '</i></b></td><td>';
509 $feedback .= $fb . '</td> </tr>';
510 }
511 }
512
513 if ($feedback === '') {
514 return '';
515 }
516
517 $feedback = '<table><tbody>' . $feedback . '</tbody></table>';
518 return $this->object->prepareTextareaOutput($feedback, true);
519 }
520
522 {
523 $this->object->setWordCounterEnabled(isset($_POST['wordcounter']) && $_POST['wordcounter']);
524 $this->object->setMaxNumOfChars($_POST["maxchars"]);
525 $this->object->setTextRating($_POST["text_rating"]);
526 $this->object->setKeywordRelation($_POST['scoring_mode']);
527 }
528
530 {
531 switch ($this->object->getKeywordRelation()) {
532 case 'non':
533 $this->object->setAnswers(array());
534 $this->object->setPoints($_POST['non_keyword_points']);
535 break;
536 case 'any':
537 $this->object->setAnswers($_POST['any_keyword']);
538 $this->object->setPoints($this->object->getMaximumPoints());
539 break;
540 case 'all':
541 $this->object->setAnswers($_POST['all_keyword']);
542 $this->object->setPoints($_POST['all_keyword_points']);
543 break;
544 case 'one':
545 $this->object->setAnswers($_POST['one_keyword']);
546 $this->object->setPoints($_POST['one_keyword_points']);
547 break;
548 }
549 }
550
552 {
553 // wordcounter
554 $wordcounter = new ilCheckboxInputGUI($this->lng->txt('qst_essay_wordcounter_enabled'), 'wordcounter');
555 $wordcounter->setInfo($this->lng->txt('qst_essay_wordcounter_enabled_info'));
556 $wordcounter->setChecked($this->object->isWordCounterEnabled());
557 $form->addItem($wordcounter);
558
559 // maxchars
560 $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
561 $maxchars->setSize(5);
562 $maxchars->setMinValue(1);
563 if ($this->object->getMaxNumOfChars() > 0) {
564 $maxchars->setValue($this->object->getMaxNumOfChars());
565 }
566 $maxchars->setInfo($this->lng->txt("description_maxchars"));
567 $form->addItem($maxchars);
568
569 // text rating
570 $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating");
571 $text_options = array(
572 "ci" => $this->lng->txt("cloze_textgap_case_insensitive"),
573 "cs" => $this->lng->txt("cloze_textgap_case_sensitive"),
574 "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"),
575 "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"),
576 "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"),
577 "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"),
578 "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5")
579 );
580 $textrating->setOptions($text_options);
581 $textrating->setValue($this->object->getTextRating());
582 $form->addItem($textrating);
583
584 return $form;
585 }
586
588 {
589 $scoringMode = new ilRadioGroupInputGUI(
590 $this->lng->txt('essay_scoring_mode'),
591 'scoring_mode'
592 );
593
594 $scoringOptionNone = new ilRadioOption(
595 $this->lng->txt('essay_scoring_mode_without_keywords'),
596 'non',
597 $this->lng->txt(
598 'essay_scoring_mode_without_keywords_desc'
599 )
600 );
601 $scoringOptionAnyKeyword = new ilRadioOption(
602 $this->lng->txt('essay_scoring_mode_keyword_relation_any'),
603 'any',
604 $this->lng->txt(
605 'essay_scoring_mode_keyword_relation_any_desc'
606 )
607 );
608 $scoringOptionAllKeyword = new ilRadioOption(
609 $this->lng->txt('essay_scoring_mode_keyword_relation_all'),
610 'all',
611 $this->lng->txt(
612 'essay_scoring_mode_keyword_relation_all_desc'
613 )
614 );
615 $scoringOptionOneKeyword = new ilRadioOption(
616 $this->lng->txt('essay_scoring_mode_keyword_relation_one'),
617 'one',
618 $this->lng->txt(
619 'essay_scoring_mode_keyword_relation_one_desc'
620 )
621 );
622
623 $scoringMode->addOption($scoringOptionNone);
624 $scoringMode->addOption($scoringOptionAnyKeyword);
625 $scoringMode->addOption($scoringOptionAllKeyword);
626 $scoringMode->addOption($scoringOptionOneKeyword);
627 $scoringMode->setRequired(true);
628 $scoringMode->setValue(
629 strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation(
630 ) : 'non'
631 );
632
633 if ($this->object->getAnswerCount() == 0) {
634 $this->object->addAnswer("", 1, 0, 0);
635 }
636 require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
637
638 // Without Keywords
639 $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points");
640 $nonKeywordPoints->allowDecimals(true);
641 $nonKeywordPoints->setValue($this->object->getPoints());
642 $nonKeywordPoints->setRequired(true);
643 $nonKeywordPoints->setSize(3);
644 $nonKeywordPoints->setMinValue(0.0);
645 $nonKeywordPoints->setMinvalueShouldBeGreater(true);
646 $scoringOptionNone->addSubItem($nonKeywordPoints);
647
648 // Any Keyword
649 $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword");
650 $anyKeyword->setRequired(true);
651 $anyKeyword->setQuestionObject($this->object);
652 $anyKeyword->setSingleline(true);
653 $anyKeyword->setValues($this->object->getAnswers());
654 $scoringOptionAnyKeyword->addSubItem($anyKeyword);
655
656 // All Keywords
657 $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword");
658 $allKeyword->setRequired(true);
659 //$allKeyword->setQuestionObject($this->object);
660 //$allKeyword->setSingleline(TRUE);
661 $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
662 $scoringOptionAllKeyword->addSubItem($allKeyword);
663 $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points");
664 $allKeywordPoints->allowDecimals(true);
665 $allKeywordPoints->setValue($this->object->getPoints());
666 $allKeywordPoints->setRequired(true);
667 $allKeywordPoints->setSize(3);
668 $allKeywordPoints->setMinValue(0.0);
669 $allKeywordPoints->setMinvalueShouldBeGreater(true);
670 $scoringOptionAllKeyword->addSubItem($allKeywordPoints);
671
672 // One Keywords
673 $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword");
674 $oneKeyword->setRequired(true);
675 //$oneKeyword->setQuestionObject($this->object);
676 //$oneKeyword->setSingleline(TRUE);
677 $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
678 $scoringOptionOneKeyword->addSubItem($oneKeyword);
679 $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points");
680 $oneKeywordPoints->allowDecimals(true);
681 $oneKeywordPoints->setValue($this->object->getPoints());
682 $oneKeywordPoints->setRequired(true);
683 $oneKeywordPoints->setSize(3);
684 $oneKeywordPoints->setMinValue(0.0);
685 $oneKeywordPoints->setMinvalueShouldBeGreater(true);
686 $scoringOptionOneKeyword->addSubItem($oneKeywordPoints);
687
688 $form->addItem($scoringMode);
689 }
690
701 {
702 return array();
703 }
704
715 {
716 return array();
717 }
718
727 public function getAggregatedAnswersView($relevant_answers)
728 {
729 return ''; //print_r($relevant_answers,true);
730 }
731
733 {
734 return false;
735 }
736
737 public function getAnswersFrequency($relevantAnswers, $questionIndex)
738 {
739 }
740
742 {
744 $this->populateAnswerSpecificFormPart($form);
745
746 $form->removeItemByPostVar('maxchars');
747 }
748
753 {
754 $this->writeQuestionSpecificPostData($form);
755 $this->writeAnswerSpecificPostData($form);
756 }
757}
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
Basic GUI class for assessment questions.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
getILIASPage($html="")
Returns the ILIAS Page around a question.
getQuestionTemplate()
get question template
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.
hasCorrectSolution($activeId, $passIndex)
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
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...
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getScoringModesWithPointsByKeyword()
This class represents a checkbox property in a property form.
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).
removeItemByPostVar($a_post_var, $a_remove_unused_headers=false)
Remove Item.
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.
ILIAS Setting Class.
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(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent.
$errors
Definition: imgupload.php:49
Interface ilGuiAnswerScoringAdjustable.
Interface ilGuiQuestionScoringAdjustable.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc